microboard-temp 0.4.59 → 0.4.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -635,8 +635,8 @@ class BoardCommand {
635
635
  switch (operation.method) {
636
636
  case "bringToFront": {
637
637
  for (const id in operation.prevZIndex) {
638
- const item2 = this.board.items.getById(id);
639
- if (!item2) {
638
+ const item = this.board.items.getById(id);
639
+ if (!item) {
640
640
  delete operation.prevZIndex.id;
641
641
  }
642
642
  }
@@ -648,8 +648,8 @@ class BoardCommand {
648
648
  }
649
649
  case "sendToBack": {
650
650
  for (const id in operation.prevZIndex) {
651
- const item2 = this.board.items.getById(id);
652
- if (!item2) {
651
+ const item = this.board.items.getById(id);
652
+ if (!item) {
653
653
  delete operation.prevZIndex.id;
654
654
  }
655
655
  }
@@ -663,11 +663,11 @@ class BoardCommand {
663
663
  case "moveSecondBeforeFirst":
664
664
  case "moveToZIndex": {
665
665
  const items = this.board.items;
666
- const item2 = items.getById(operation.item);
667
- if (!item2) {
666
+ const item = items.getById(operation.item);
667
+ if (!item) {
668
668
  throw new Error("Get reverse board operation. Item not found");
669
669
  }
670
- const zIndex = this.board.getZIndex(item2);
670
+ const zIndex = this.board.getZIndex(item);
671
671
  return {
672
672
  class: "Board",
673
673
  method: "moveToZIndex",
@@ -677,8 +677,8 @@ class BoardCommand {
677
677
  }
678
678
  case "moveManyToZIndex": {
679
679
  for (const id in operation.item) {
680
- const item2 = this.board.items.getById(id);
681
- if (!item2) {
680
+ const item = this.board.items.getById(id);
681
+ if (!item) {
682
682
  delete operation.item.id;
683
683
  }
684
684
  }
@@ -695,15 +695,15 @@ class BoardCommand {
695
695
  const items = this.board.items;
696
696
  const reverse = [];
697
697
  for (const itemId of operation.item) {
698
- const item2 = items.getById(itemId);
699
- if (!item2) {
698
+ const item = items.getById(itemId);
699
+ if (!item) {
700
700
  throw new Error("Get reverse board operation. Item not found");
701
701
  }
702
702
  reverse.push({
703
703
  class: "Board",
704
704
  method: "add",
705
705
  item: itemId,
706
- data: item2.serialize()
706
+ data: item.serialize()
707
707
  });
708
708
  }
709
709
  return reverse;
@@ -726,32 +726,32 @@ class BoardCommand {
726
726
  const items = this.board.items;
727
727
  const reverse = [];
728
728
  for (const itemId of operation.item) {
729
- const item2 = items.getById(itemId);
730
- if (!item2 || item2.itemType !== "Group") {
729
+ const item = items.getById(itemId);
730
+ if (!item || item.itemType !== "Group") {
731
731
  throw new Error("Get reverse board operation. Item not found");
732
732
  }
733
733
  reverse.push({
734
734
  class: "Board",
735
735
  method: "addLockedGroup",
736
736
  item: itemId,
737
- data: item2.serialize()
737
+ data: item.serialize()
738
738
  });
739
739
  }
740
740
  return reverse;
741
741
  }
742
742
  case "duplicate":
743
743
  case "paste": {
744
- const item2 = [];
744
+ const item = [];
745
745
  const map = operation.itemsMap;
746
746
  for (const key in map) {
747
747
  if (map.hasOwnProperty(key)) {
748
- item2.push(key);
748
+ item.push(key);
749
749
  }
750
750
  }
751
751
  return {
752
752
  class: "Board",
753
753
  method: "remove",
754
- item: item2
754
+ item
755
755
  };
756
756
  }
757
757
  }
@@ -7069,11 +7069,11 @@ class SubjectOperation {
7069
7069
  }
7070
7070
 
7071
7071
  // src/Items/ItemsCommandUtils.ts
7072
- function mapItemsByOperation(item2, getCallback) {
7073
- const items = Array.isArray(item2) ? item2 : [item2];
7074
- return items.map((item3) => {
7075
- const operation = getCallback(item3);
7076
- return { item: item3, operation };
7072
+ function mapItemsByOperation(item, getCallback) {
7073
+ const items = Array.isArray(item) ? item : [item];
7074
+ return items.map((item2) => {
7075
+ const operation = getCallback(item2);
7076
+ return { item: item2, operation };
7077
7077
  });
7078
7078
  }
7079
7079
 
@@ -7098,8 +7098,8 @@ class TransformationCommand {
7098
7098
  }
7099
7099
  }
7100
7100
  revert() {
7101
- this.reverse.forEach(({ item: item2, operation }) => {
7102
- item2.apply(operation);
7101
+ this.reverse.forEach(({ item, operation }) => {
7102
+ item.apply(operation);
7103
7103
  });
7104
7104
  }
7105
7105
  getReverse() {
@@ -7841,8 +7841,8 @@ class Path {
7841
7841
  }
7842
7842
  getIntersectionPoints(segment) {
7843
7843
  let intersections = [];
7844
- for (const item2 of this.segments) {
7845
- intersections = intersections.concat(item2.getIntersectionPoints(segment));
7844
+ for (const item of this.segments) {
7845
+ intersections = intersections.concat(item.getIntersectionPoints(segment));
7846
7846
  }
7847
7847
  return intersections;
7848
7848
  }
@@ -7907,8 +7907,8 @@ class Path {
7907
7907
  }
7908
7908
  isOpenEnclosedOrCrossedBy(rectangle) {
7909
7909
  let is = false;
7910
- for (const item2 of this.segments) {
7911
- is = is || item2.isEnclosedOrCrossedBy(rectangle);
7910
+ for (const item of this.segments) {
7911
+ is = is || item.isEnclosedOrCrossedBy(rectangle);
7912
7912
  }
7913
7913
  return is;
7914
7914
  }
@@ -8321,8 +8321,8 @@ class ConnectorCommand {
8321
8321
  }
8322
8322
  }
8323
8323
  revert() {
8324
- for (const { item: item2, operation } of this.reverse) {
8325
- item2.apply(operation);
8324
+ for (const { item, operation } of this.reverse) {
8325
+ item.apply(operation);
8326
8326
  }
8327
8327
  }
8328
8328
  getReverse() {
@@ -8479,11 +8479,11 @@ class SessionStorage {
8479
8479
  }
8480
8480
  get(key) {
8481
8481
  const boardId = this.getBoardId() || "";
8482
- const item2 = _sessionStorage.getItem(boardId + "_" + key);
8483
- if (!item2) {
8482
+ const item = _sessionStorage.getItem(boardId + "_" + key);
8483
+ if (!item) {
8484
8484
  return;
8485
8485
  }
8486
- return JSON.parse(item2);
8486
+ return JSON.parse(item);
8487
8487
  }
8488
8488
  remove(key) {
8489
8489
  const boardId = this.getBoardId() || "";
@@ -9268,8 +9268,8 @@ class LinkToCommand {
9268
9268
  }
9269
9269
  }
9270
9270
  revert() {
9271
- this.reverse.forEach(({ item: item2, operation }) => {
9272
- item2.apply(operation);
9271
+ this.reverse.forEach(({ item, operation }) => {
9272
+ item.apply(operation);
9273
9273
  });
9274
9274
  }
9275
9275
  getReverse() {
@@ -10570,9 +10570,9 @@ function handleSplitListItem(editor) {
10570
10570
  Transforms3.insertNodes(editor, {
10571
10571
  type: listType,
10572
10572
  listLevel: listNode.listLevel || 0,
10573
- children: itemsAfter.map((item2) => ({
10573
+ children: itemsAfter.map((item) => ({
10574
10574
  type: "list_item",
10575
- children: item2.children
10575
+ children: item.children
10576
10576
  }))
10577
10577
  }, { at: newListPath });
10578
10578
  }
@@ -12549,10 +12549,10 @@ function initializeDocument(effects) {
12549
12549
  return start;
12550
12550
  function start(code) {
12551
12551
  if (continued < stack.length) {
12552
- const item2 = stack[continued];
12553
- self2.containerState = item2[1];
12554
- ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
12555
- return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
12552
+ const item = stack[continued];
12553
+ self2.containerState = item[1];
12554
+ ok(item[0].continuation, "expected `continuation` to be defined on container construct");
12555
+ return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
12556
12556
  }
12557
12557
  return checkNewContainers(code);
12558
12558
  }
@@ -13528,17 +13528,17 @@ class SpliceBuffer {
13528
13528
  this.setCursor(Number.POSITIVE_INFINITY);
13529
13529
  return this.left.pop();
13530
13530
  }
13531
- push(item2) {
13531
+ push(item) {
13532
13532
  this.setCursor(Number.POSITIVE_INFINITY);
13533
- this.left.push(item2);
13533
+ this.left.push(item);
13534
13534
  }
13535
13535
  pushMany(items) {
13536
13536
  this.setCursor(Number.POSITIVE_INFINITY);
13537
13537
  chunkedPush(this.left, items);
13538
13538
  }
13539
- unshift(item2) {
13539
+ unshift(item) {
13540
13540
  this.setCursor(0);
13541
- this.right.push(item2);
13541
+ this.right.push(item);
13542
13542
  }
13543
13543
  unshiftMany(items) {
13544
13544
  this.setCursor(0);
@@ -15569,8 +15569,8 @@ function initializeFactory(field) {
15569
15569
  if (list2) {
15570
15570
  ok(Array.isArray(list2), "expected `disable.null` to be populated");
15571
15571
  while (++index2 < list2.length) {
15572
- const item2 = list2[index2];
15573
- if (!item2.previous || item2.previous.call(self2, self2.previous)) {
15572
+ const item = list2[index2];
15573
+ if (!item.previous || item.previous.call(self2, self2.previous)) {
15574
15574
  return true;
15575
15575
  }
15576
15576
  }
@@ -16401,14 +16401,14 @@ function compiler(options) {
16401
16401
  length++;
16402
16402
  }
16403
16403
  if (event[1].type === types.listItemPrefix) {
16404
- const item2 = {
16404
+ const item = {
16405
16405
  type: "listItem",
16406
16406
  _spread: false,
16407
16407
  start: Object.assign({}, event[1].start),
16408
16408
  end: undefined
16409
16409
  };
16410
- listItem2 = item2;
16411
- events.splice(index2, 0, ["enter", item2, event[2]]);
16410
+ listItem2 = item;
16411
+ events.splice(index2, 0, ["enter", item, event[2]]);
16412
16412
  index2++;
16413
16413
  length++;
16414
16414
  firstBlankLineIndex = undefined;
@@ -17206,14 +17206,14 @@ class MarkdownProcessor {
17206
17206
  if (err || !file) {
17207
17207
  throw err;
17208
17208
  }
17209
- const nodes = file.result.map((item2) => {
17209
+ const nodes = file.result.map((item) => {
17210
17210
  setNodeStyles({
17211
- node: item2,
17211
+ node: item,
17212
17212
  editor: this.editor,
17213
17213
  horisontalAlignment: "left",
17214
- isPaddingTopNeeded: item2.type !== "code_block"
17214
+ isPaddingTopNeeded: item.type !== "code_block"
17215
17215
  });
17216
- return item2;
17216
+ return item;
17217
17217
  });
17218
17218
  if (isNewParagraphNeeded) {
17219
17219
  nodes.push(createParagraphNode("", this.editor));
@@ -18191,8 +18191,8 @@ class ShapeCommand {
18191
18191
  }
18192
18192
  }
18193
18193
  revert() {
18194
- for (const { item: item2, operation } of this.reverse) {
18195
- item2.apply(operation);
18194
+ for (const { item, operation } of this.reverse) {
18195
+ item.apply(operation);
18196
18196
  }
18197
18197
  }
18198
18198
  getReverse() {
@@ -18274,8 +18274,8 @@ class RichTextCommand {
18274
18274
  }
18275
18275
  }
18276
18276
  revert() {
18277
- for (const { item: item2, operation } of this.reverse) {
18278
- const richText = this.board.items.getById(item2);
18277
+ for (const { item, operation } of this.reverse) {
18278
+ const richText = this.board.items.getById(item);
18279
18279
  if (!richText) {
18280
18280
  continue;
18281
18281
  }
@@ -18294,12 +18294,12 @@ class RichTextCommand {
18294
18294
  case "setSelectionFontColor":
18295
18295
  case "setSelectionBlockType":
18296
18296
  const inverseOps = this.operation.ops.map((op) => Operation3.inverse(op)).reverse();
18297
- return items.map((item2) => {
18297
+ return items.map((item) => {
18298
18298
  const operation = {
18299
18299
  ...this.operation,
18300
18300
  ops: inverseOps
18301
18301
  };
18302
- return { item: item2, operation };
18302
+ return { item, operation };
18303
18303
  });
18304
18304
  case "setFontColor":
18305
18305
  return items.map((id) => ({
@@ -18391,13 +18391,13 @@ class RichTextGroupCommand {
18391
18391
  this.reverseOps = this.getReverse();
18392
18392
  }
18393
18393
  apply() {
18394
- for (const { item: item2, operation } of this.forwardOps) {
18395
- item2.applyCommand(operation);
18394
+ for (const { item, operation } of this.forwardOps) {
18395
+ item.applyCommand(operation);
18396
18396
  }
18397
18397
  }
18398
18398
  revert() {
18399
- for (const { item: item2, operation } of this.reverseOps) {
18400
- item2.applyCommand(operation);
18399
+ for (const { item, operation } of this.reverseOps) {
18400
+ item.applyCommand(operation);
18401
18401
  }
18402
18402
  }
18403
18403
  getForward() {
@@ -18512,8 +18512,8 @@ class DrawingCommand {
18512
18512
  item;
18513
18513
  operation;
18514
18514
  reverse;
18515
- constructor(item2, operation) {
18516
- this.item = item2;
18515
+ constructor(item, operation) {
18516
+ this.item = item;
18517
18517
  this.operation = operation;
18518
18518
  this.reverse = this.getReverse();
18519
18519
  }
@@ -18522,52 +18522,52 @@ class DrawingCommand {
18522
18522
  return this;
18523
18523
  }
18524
18524
  apply() {
18525
- for (const item2 of this.item) {
18526
- item2.apply(this.operation);
18525
+ for (const item of this.item) {
18526
+ item.apply(this.operation);
18527
18527
  }
18528
18528
  }
18529
18529
  revert() {
18530
- for (const { item: item2, operation } of this.reverse) {
18531
- item2.apply(operation);
18530
+ for (const { item, operation } of this.reverse) {
18531
+ item.apply(operation);
18532
18532
  }
18533
18533
  }
18534
18534
  getReverse() {
18535
18535
  const reverse = [];
18536
- for (const item2 of this.item) {
18537
- reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
18536
+ for (const item of this.item) {
18537
+ reverse.push({ item, operation: this.getReverseOperation(item) });
18538
18538
  }
18539
18539
  return reverse;
18540
18540
  }
18541
- getReverseOperation(item2) {
18541
+ getReverseOperation(item) {
18542
18542
  switch (this.operation.method) {
18543
18543
  case "setStrokeColor":
18544
18544
  return {
18545
18545
  class: "Drawing",
18546
18546
  method: "setStrokeColor",
18547
- item: [item2.getId()],
18548
- color: item2.getStrokeColor()
18547
+ item: [item.getId()],
18548
+ color: item.getStrokeColor()
18549
18549
  };
18550
18550
  case "setStrokeWidth":
18551
18551
  return {
18552
18552
  class: "Drawing",
18553
18553
  method: "setStrokeWidth",
18554
- item: [item2.getId()],
18554
+ item: [item.getId()],
18555
18555
  width: this.operation.prevWidth,
18556
- prevWidth: item2.getStrokeWidth()
18556
+ prevWidth: item.getStrokeWidth()
18557
18557
  };
18558
18558
  case "setStrokeOpacity":
18559
18559
  return {
18560
18560
  class: "Drawing",
18561
18561
  method: "setStrokeOpacity",
18562
- item: [item2.getId()],
18563
- opacity: item2.getStrokeOpacity()
18562
+ item: [item.getId()],
18563
+ opacity: item.getStrokeOpacity()
18564
18564
  };
18565
18565
  case "setStrokeStyle":
18566
18566
  return {
18567
18567
  class: "Drawing",
18568
18568
  method: "setStrokeStyle",
18569
- item: [item2.getId()],
18570
- style: item2.getBorderStyle()
18569
+ item: [item.getId()],
18570
+ style: item.getBorderStyle()
18571
18571
  };
18572
18572
  }
18573
18573
  }
@@ -18589,8 +18589,8 @@ class StickerCommand {
18589
18589
  }
18590
18590
  }
18591
18591
  revert() {
18592
- for (const { item: item2, operation } of this.reverse) {
18593
- item2.apply(operation);
18592
+ for (const { item, operation } of this.reverse) {
18593
+ item.apply(operation);
18594
18594
  }
18595
18595
  }
18596
18596
  getReverse() {
@@ -18622,8 +18622,8 @@ class FrameCommand {
18622
18622
  }
18623
18623
  }
18624
18624
  revert() {
18625
- for (const { item: item2, operation } of this.reverse) {
18626
- item2.apply(operation);
18625
+ for (const { item, operation } of this.reverse) {
18626
+ item.apply(operation);
18627
18627
  }
18628
18628
  }
18629
18629
  getReverse() {
@@ -18665,21 +18665,23 @@ class FrameCommand {
18665
18665
  };
18666
18666
  });
18667
18667
  default:
18668
- const op = this.operation;
18669
- let newData = {};
18670
- if (op.prevData) {
18671
- newData = { ...op.prevData };
18672
- } else {
18673
- Object.keys(op.newData).forEach((key) => {
18674
- if (item[key]) {
18675
- newData[key] = item[key];
18676
- }
18677
- });
18678
- }
18679
- return {
18680
- ...op,
18681
- newData
18682
- };
18668
+ return mapItemsByOperation(frame, (item) => {
18669
+ const op = this.operation;
18670
+ let newData = {};
18671
+ if (op.prevData) {
18672
+ newData = { ...op.prevData };
18673
+ } else {
18674
+ Object.keys(op.newData).forEach((key) => {
18675
+ if (item[key]) {
18676
+ newData[key] = item[key];
18677
+ }
18678
+ });
18679
+ }
18680
+ return {
18681
+ ...op,
18682
+ newData
18683
+ };
18684
+ });
18683
18685
  }
18684
18686
  }
18685
18687
  }
@@ -18700,8 +18702,8 @@ class CommentCommand {
18700
18702
  }
18701
18703
  }
18702
18704
  revert() {
18703
- this.reverse.forEach(({ item: item2, operation }) => {
18704
- item2.apply(operation);
18705
+ this.reverse.forEach(({ item, operation }) => {
18706
+ item.apply(operation);
18705
18707
  });
18706
18708
  }
18707
18709
  getReverse() {
@@ -19163,8 +19165,8 @@ class GroupCommand {
19163
19165
  }
19164
19166
  }
19165
19167
  revert() {
19166
- for (const { item: item2, operation } of this.reverse) {
19167
- item2.apply(operation);
19168
+ for (const { item, operation } of this.reverse) {
19169
+ item.apply(operation);
19168
19170
  }
19169
19171
  }
19170
19172
  getReverse() {
@@ -19217,8 +19219,8 @@ class PlaceholderCommand {
19217
19219
  }
19218
19220
  }
19219
19221
  revert() {
19220
- for (const { item: item2, operation } of this.reverse) {
19221
- item2.apply(operation);
19222
+ for (const { item, operation } of this.reverse) {
19223
+ item.apply(operation);
19222
19224
  }
19223
19225
  }
19224
19226
  getReverse() {
@@ -19312,34 +19314,51 @@ class BaseCommand {
19312
19314
  return this;
19313
19315
  }
19314
19316
  apply() {
19315
- for (const item2 of this.items) {
19316
- item2.apply(this.operation);
19317
+ for (const item of this.items) {
19318
+ item.apply(this.operation);
19317
19319
  }
19318
19320
  }
19319
19321
  revert() {
19320
- for (const { item: item2, operation } of this.reverse) {
19321
- item2.apply(operation);
19322
+ for (const { item, operation } of this.reverse) {
19323
+ item.apply(operation);
19322
19324
  }
19323
19325
  }
19324
19326
  getReverse() {
19325
19327
  const items = this.items;
19326
- return mapItemsByOperation(items, (item2) => {
19327
- const op = this.operation;
19328
- let newData = {};
19329
- if (op.prevData) {
19330
- newData = { ...op.prevData };
19331
- } else {
19332
- Object.keys(op.newData).forEach((key) => {
19333
- if (item2[key]) {
19334
- newData[key] = item2[key];
19328
+ switch (this.operation.method) {
19329
+ case "addChildren":
19330
+ return mapItemsByOperation(items, (item) => {
19331
+ return {
19332
+ ...this.operation,
19333
+ newData: { childIds: item.getChildrenIds() }
19334
+ };
19335
+ });
19336
+ case "removeChildren":
19337
+ return mapItemsByOperation(items, (item) => {
19338
+ return {
19339
+ ...this.operation,
19340
+ newData: { childIds: item.getChildrenIds() }
19341
+ };
19342
+ });
19343
+ default:
19344
+ return mapItemsByOperation(items, (item) => {
19345
+ const op = this.operation;
19346
+ let newData = {};
19347
+ if (op.prevData) {
19348
+ newData = { ...op.prevData };
19349
+ } else {
19350
+ Object.keys(op.newData).forEach((key) => {
19351
+ if (item[key]) {
19352
+ newData[key] = item[key];
19353
+ }
19354
+ });
19335
19355
  }
19356
+ return {
19357
+ ...op,
19358
+ newData
19359
+ };
19336
19360
  });
19337
- }
19338
- return {
19339
- ...op,
19340
- newData
19341
- };
19342
- });
19361
+ }
19343
19362
  }
19344
19363
  }
19345
19364
  var itemCommandFactories = {
@@ -19359,37 +19378,37 @@ var itemCommandFactories = {
19359
19378
  LinkTo: createLinkToCommand
19360
19379
  };
19361
19380
  function createConnectorCommand(items, operation) {
19362
- return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
19381
+ return new ConnectorCommand(items.filter((item) => item.itemType === "Connector"), operation);
19363
19382
  }
19364
19383
  function createShapeCommand(items, operation) {
19365
- return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
19384
+ return new ShapeCommand(items.filter((item) => item.itemType === "Shape"), operation);
19366
19385
  }
19367
19386
  function createDrawingCommand(items, operation) {
19368
- return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
19387
+ return new DrawingCommand(items.filter((item) => item.itemType === "Drawing"), operation);
19369
19388
  }
19370
19389
  function createCommentCommand(items, operation) {
19371
- return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
19390
+ return new CommentCommand(items.filter((item) => item.itemType === "Comment"), operation);
19372
19391
  }
19373
19392
  function createStickerCommand(items, operation) {
19374
- return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
19393
+ return new StickerCommand(items.filter((item) => item.itemType === "Sticker"), operation);
19375
19394
  }
19376
19395
  function createFrameCommand(items, operation) {
19377
- return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
19396
+ return new FrameCommand(items.filter((item) => item.itemType === "Frame"), operation);
19378
19397
  }
19379
19398
  function createPlaceholderCommand(items, operation) {
19380
- return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
19399
+ return new PlaceholderCommand(items.filter((item) => item.itemType === "Placeholder"), operation);
19381
19400
  }
19382
19401
  function createGroupCommand(items, operation) {
19383
- return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
19402
+ return new GroupCommand(items.filter((item) => item.itemType === "Group"), operation);
19384
19403
  }
19385
19404
  function createImageCommand(items, operation) {
19386
- return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
19405
+ return new ImageCommand(items.filter((item) => item.itemType === "Image"), operation);
19387
19406
  }
19388
19407
  function createVideoCommand(items, operation) {
19389
- return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
19408
+ return new VideoCommand(items.filter((item) => item.itemType === "Video"), operation);
19390
19409
  }
19391
19410
  function createAudioCommand(items, operation) {
19392
- return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
19411
+ return new AudioCommand(items.filter((item) => item.itemType === "Audio"), operation);
19393
19412
  }
19394
19413
  function createRichTextCommand(items, operation, board) {
19395
19414
  if (!board) {
@@ -19397,8 +19416,8 @@ function createRichTextCommand(items, operation, board) {
19397
19416
  }
19398
19417
  if (operation.method === "groupEdit") {
19399
19418
  const texts = [];
19400
- for (const { item: item2 } of operation.itemsOps) {
19401
- const found = board.items.findById(item2);
19419
+ for (const { item } of operation.itemsOps) {
19420
+ const found = board.items.findById(item);
19402
19421
  const text3 = found?.getRichText();
19403
19422
  if (text3) {
19404
19423
  texts.push(text3);
@@ -19406,14 +19425,14 @@ function createRichTextCommand(items, operation, board) {
19406
19425
  }
19407
19426
  return new RichTextGroupCommand(texts, operation);
19408
19427
  } else {
19409
- return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
19428
+ return new RichTextCommand(board, items.map((item) => item.getId()), operation);
19410
19429
  }
19411
19430
  }
19412
19431
  function createTransformationCommand(items, operation) {
19413
- return new TransformationCommand(items.map((item2) => item2.transformation), operation);
19432
+ return new TransformationCommand(items.map((item) => item.transformation), operation);
19414
19433
  }
19415
19434
  function createLinkToCommand(items, operation) {
19416
- return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
19435
+ return new LinkToCommand(items.map((item) => item.linkTo), operation);
19417
19436
  }
19418
19437
  function createCommand(board, operation) {
19419
19438
  try {
@@ -19431,13 +19450,13 @@ function createCommand(board, operation) {
19431
19450
  default: {
19432
19451
  const itemType = operation.class;
19433
19452
  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);
19434
- const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
19435
- if (typeof item2 === "string") {
19436
- console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
19453
+ const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item) => {
19454
+ if (typeof item === "string") {
19455
+ console.warn(`Item with ID ${item} not found for operation ${operation.class}.${operation.method}`);
19437
19456
  return false;
19438
19457
  }
19439
- if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
19440
- console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
19458
+ if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item.itemType !== operation.class) {
19459
+ console.warn(`Item with ID ${item} is not of operation type: ${itemType}.`);
19441
19460
  return false;
19442
19461
  }
19443
19462
  return true;
@@ -19738,20 +19757,20 @@ class RBush {
19738
19757
  }
19739
19758
  return this;
19740
19759
  }
19741
- insert(item2) {
19742
- if (item2)
19743
- this._insert(item2, this.data.height - 1);
19760
+ insert(item) {
19761
+ if (item)
19762
+ this._insert(item, this.data.height - 1);
19744
19763
  return this;
19745
19764
  }
19746
19765
  clear() {
19747
19766
  this.data = createNode([]);
19748
19767
  return this;
19749
19768
  }
19750
- remove(item2, equalsFn) {
19751
- if (!item2)
19769
+ remove(item, equalsFn) {
19770
+ if (!item)
19752
19771
  return this;
19753
19772
  let node2 = this.data;
19754
- const bbox = this.toBBox(item2);
19773
+ const bbox = this.toBBox(item);
19755
19774
  const path2 = [];
19756
19775
  const indexes = [];
19757
19776
  let i, parent, goingUp;
@@ -19763,7 +19782,7 @@ class RBush {
19763
19782
  goingUp = true;
19764
19783
  }
19765
19784
  if (node2.leaf) {
19766
- const index2 = findItem(item2, node2.children, equalsFn);
19785
+ const index2 = findItem(item, node2.children, equalsFn);
19767
19786
  if (index2 !== -1) {
19768
19787
  node2.children.splice(index2, 1);
19769
19788
  path2.push(node2);
@@ -19786,8 +19805,8 @@ class RBush {
19786
19805
  }
19787
19806
  return this;
19788
19807
  }
19789
- toBBox(item2) {
19790
- return item2;
19808
+ toBBox(item) {
19809
+ return item;
19791
19810
  }
19792
19811
  compareMinX(a, b) {
19793
19812
  return a.minX - b.minX;
@@ -19870,11 +19889,11 @@ class RBush {
19870
19889
  }
19871
19890
  return node2;
19872
19891
  }
19873
- _insert(item2, level, isNode) {
19874
- const bbox = isNode ? item2 : this.toBBox(item2);
19892
+ _insert(item, level, isNode) {
19893
+ const bbox = isNode ? item : this.toBBox(item);
19875
19894
  const insertPath = [];
19876
19895
  const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
19877
- node2.children.push(item2);
19896
+ node2.children.push(item);
19878
19897
  extend2(node2, bbox);
19879
19898
  while (level >= 0) {
19880
19899
  if (insertPath[level].children.length > this._maxEntries) {
@@ -19973,11 +19992,11 @@ class RBush {
19973
19992
  }
19974
19993
  }
19975
19994
  }
19976
- function findItem(item2, items, equalsFn) {
19995
+ function findItem(item, items, equalsFn) {
19977
19996
  if (!equalsFn)
19978
- return items.indexOf(item2);
19997
+ return items.indexOf(item);
19979
19998
  for (let i = 0;i < items.length; i++) {
19980
- if (equalsFn(item2, items[i]))
19999
+ if (equalsFn(item, items[i]))
19981
20000
  return i;
19982
20001
  }
19983
20002
  return -1;
@@ -20068,8 +20087,8 @@ class TinyQueue {
20068
20087
  this._down(i);
20069
20088
  }
20070
20089
  }
20071
- push(item2) {
20072
- this.data.push(item2);
20090
+ push(item) {
20091
+ this.data.push(item);
20073
20092
  this.length++;
20074
20093
  this._up(this.length - 1);
20075
20094
  }
@@ -20090,21 +20109,21 @@ class TinyQueue {
20090
20109
  }
20091
20110
  _up(pos) {
20092
20111
  const { data, compare } = this;
20093
- const item2 = data[pos];
20112
+ const item = data[pos];
20094
20113
  while (pos > 0) {
20095
20114
  const parent = pos - 1 >> 1;
20096
20115
  const current = data[parent];
20097
- if (compare(item2, current) >= 0)
20116
+ if (compare(item, current) >= 0)
20098
20117
  break;
20099
20118
  data[pos] = current;
20100
20119
  pos = parent;
20101
20120
  }
20102
- data[pos] = item2;
20121
+ data[pos] = item;
20103
20122
  }
20104
20123
  _down(pos) {
20105
20124
  const { data, compare } = this;
20106
20125
  const halfLength = this.length >> 1;
20107
- const item2 = data[pos];
20126
+ const item = data[pos];
20108
20127
  while (pos < halfLength) {
20109
20128
  let left = (pos << 1) + 1;
20110
20129
  let best = data[left];
@@ -20113,12 +20132,12 @@ class TinyQueue {
20113
20132
  left = right;
20114
20133
  best = data[right];
20115
20134
  }
20116
- if (compare(best, item2) >= 0)
20135
+ if (compare(best, item) >= 0)
20117
20136
  break;
20118
20137
  data[pos] = best;
20119
20138
  pos = left;
20120
20139
  }
20121
- data[pos] = item2;
20140
+ data[pos] = item;
20122
20141
  }
20123
20142
  }
20124
20143
  function defaultCompare2(a, b) {
@@ -20206,10 +20225,10 @@ class RTreeIndex {
20206
20225
  return container ? container.item : undefined;
20207
20226
  }
20208
20227
  remove(id) {
20209
- const item2 = this.map.get(id);
20210
- if (item2) {
20228
+ const item = this.map.get(id);
20229
+ if (item) {
20211
20230
  this.map.delete(id);
20212
- this.tree.remove(item2);
20231
+ this.tree.remove(item);
20213
20232
  }
20214
20233
  }
20215
20234
  list() {
@@ -20281,11 +20300,11 @@ class Container extends Mbr {
20281
20300
  item;
20282
20301
  layer;
20283
20302
  zIndex;
20284
- constructor(id, item2, layer, zIndex) {
20285
- const rect = item2.getMbrWithChildren();
20303
+ constructor(id, item, layer, zIndex) {
20304
+ const rect = item.getMbrWithChildren();
20286
20305
  super(rect.left, rect.top, rect.right, rect.bottom);
20287
20306
  this.id = id;
20288
- this.item = item2;
20307
+ this.item = item;
20289
20308
  this.layer = layer;
20290
20309
  this.zIndex = zIndex;
20291
20310
  }
@@ -20302,7 +20321,7 @@ class LayeredIndex {
20302
20321
  this.getZIndex = this.getZIndex.bind(this);
20303
20322
  this.layers.newOnTop();
20304
20323
  }
20305
- isT(item2) {
20324
+ isT(item) {
20306
20325
  return true;
20307
20326
  }
20308
20327
  findById(id) {
@@ -20366,8 +20385,8 @@ class LayeredIndex {
20366
20385
  }
20367
20386
  getContainersFromItems(items) {
20368
20387
  const containers = [];
20369
- for (const item2 of items) {
20370
- const container = this.map.get(item2.getId());
20388
+ for (const item of items) {
20389
+ const container = this.map.get(item.getId());
20371
20390
  if (container) {
20372
20391
  containers.push(container);
20373
20392
  }
@@ -20444,9 +20463,9 @@ class LayeredIndex {
20444
20463
  }
20445
20464
  }
20446
20465
  }
20447
- insert(item2) {
20448
- const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
20449
- const bounds = item2.getMbrWithChildren();
20466
+ insert(item) {
20467
+ const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
20468
+ const bounds = item.getMbrWithChildren();
20450
20469
  const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
20451
20470
  if (inBounds.length === 0) {
20452
20471
  return this.insertContainer(toInsert);
@@ -20513,20 +20532,20 @@ class LayeredIndex {
20513
20532
  }
20514
20533
  }
20515
20534
  }
20516
- change(item2) {
20517
- const id = item2.getId();
20535
+ change(item) {
20536
+ const id = item.getId();
20518
20537
  const container = this.map.get(id);
20519
20538
  if (container) {
20520
20539
  const layer = this.layers.get(container.layer);
20521
20540
  if (layer) {
20522
20541
  layer.remove(id);
20523
20542
  this.map.delete(id);
20524
- this.insert(item2);
20543
+ this.insert(item);
20525
20544
  }
20526
20545
  }
20527
20546
  }
20528
- remove(item2) {
20529
- const id = item2.getId();
20547
+ remove(item) {
20548
+ const id = item.getId();
20530
20549
  const container = this.map.get(id);
20531
20550
  if (container) {
20532
20551
  const layer = this.layers.get(container.layer);
@@ -20552,13 +20571,13 @@ class LayeredIndex {
20552
20571
  return items;
20553
20572
  }
20554
20573
  batchInsert(items) {
20555
- for (const item2 of items) {
20556
- this.insert(item2);
20574
+ for (const item of items) {
20575
+ this.insert(item);
20557
20576
  }
20558
20577
  }
20559
20578
  batchChange(items) {
20560
- for (const item2 of items) {
20561
- this.change(item2);
20579
+ for (const item of items) {
20580
+ this.change(item);
20562
20581
  }
20563
20582
  }
20564
20583
  }
@@ -20567,8 +20586,8 @@ class LayeredIndex {
20567
20586
  class SpatialIndex {
20568
20587
  subject = new Subject;
20569
20588
  itemsArray = [];
20570
- itemsIndex = new LayeredIndex((item2) => {
20571
- return this.itemsArray.indexOf(item2);
20589
+ itemsIndex = new LayeredIndex((item) => {
20590
+ return this.itemsArray.indexOf(item);
20572
20591
  });
20573
20592
  Mbr = new Mbr;
20574
20593
  items;
@@ -20577,79 +20596,79 @@ class SpatialIndex {
20577
20596
  }
20578
20597
  clear() {
20579
20598
  this.itemsArray = [];
20580
- this.itemsIndex = new LayeredIndex((item2) => {
20581
- return this.itemsArray.indexOf(item2);
20599
+ this.itemsIndex = new LayeredIndex((item) => {
20600
+ return this.itemsArray.indexOf(item);
20582
20601
  });
20583
20602
  this.Mbr = new Mbr;
20584
20603
  }
20585
- insert(item2) {
20586
- this.itemsArray.push(item2);
20587
- this.itemsIndex.insert(item2);
20604
+ insert(item) {
20605
+ this.itemsArray.push(item);
20606
+ this.itemsIndex.insert(item);
20588
20607
  if (conf.isNode()) {
20589
20608
  return;
20590
20609
  }
20591
20610
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20592
- this.Mbr = item2.getMbr().copy();
20611
+ this.Mbr = item.getMbr().copy();
20593
20612
  } else {
20594
- this.Mbr.combine([item2.getMbr()]);
20613
+ this.Mbr.combine([item.getMbr()]);
20595
20614
  }
20596
- item2.subject.subscribe(this.change);
20615
+ item.subject.subscribe(this.change);
20597
20616
  this.subject.publish(this.items);
20598
20617
  }
20599
- change = (item2) => {
20600
- this.itemsIndex.change(item2);
20618
+ change = (item) => {
20619
+ this.itemsIndex.change(item);
20601
20620
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
20602
- this.Mbr = item2.getMbrWithChildren().copy();
20621
+ this.Mbr = item.getMbrWithChildren().copy();
20603
20622
  } else {
20604
- this.Mbr.combine([item2.getMbrWithChildren()]);
20623
+ this.Mbr.combine([item.getMbrWithChildren()]);
20605
20624
  }
20606
20625
  this.subject.publish(this.items);
20607
20626
  };
20608
- remove(item2) {
20609
- if ("index" in item2 && item2.index) {
20610
- item2.removeChildItems(item2.index.list());
20627
+ remove(item) {
20628
+ if ("index" in item && item.index) {
20629
+ item.removeChildItems(item.index.list());
20611
20630
  }
20612
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
20613
- this.itemsIndex.remove(item2);
20631
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
20632
+ this.itemsIndex.remove(item);
20614
20633
  this.Mbr = new Mbr;
20615
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
20634
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbrWithChildren()]));
20616
20635
  this.subject.publish(this.items);
20617
20636
  }
20618
20637
  copy() {
20619
- return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
20620
- ...item2.serialize(true),
20621
- id: item2.getId()
20638
+ return this.getItemsWithIncludedChildren(this.itemsArray).map((item) => ({
20639
+ ...item.serialize(true),
20640
+ id: item.getId()
20622
20641
  }));
20623
20642
  }
20624
20643
  getItemsWithIncludedChildren(items) {
20625
- return items.flatMap((item2) => {
20626
- if ("index" in item2 && item2.index) {
20627
- return [item2, ...item2.index.list()];
20644
+ return items.flatMap((item) => {
20645
+ if ("index" in item && item.index) {
20646
+ return [item, ...item.index.list()];
20628
20647
  }
20629
- return item2;
20648
+ return item;
20630
20649
  });
20631
20650
  }
20632
- getItemChildren(item2) {
20633
- if ("index" in item2 && item2.index) {
20634
- return item2.index.list();
20651
+ getItemChildren(item) {
20652
+ if ("index" in item && item.index) {
20653
+ return item.index.list();
20635
20654
  }
20636
20655
  return [];
20637
20656
  }
20638
- getItemParent(item2) {
20639
- if (item2.parent === "Board") {
20657
+ getItemParent(item) {
20658
+ if (item.parent === "Board") {
20640
20659
  return;
20641
20660
  }
20642
- return this.getById(item2.parent);
20661
+ return this.getById(item.parent);
20643
20662
  }
20644
- moveToZIndex(item2, zIndex) {
20645
- const index2 = this.itemsArray.indexOf(item2);
20663
+ moveToZIndex(item, zIndex) {
20664
+ const index2 = this.itemsArray.indexOf(item);
20646
20665
  this.itemsArray.splice(index2, 1);
20647
- this.itemsArray.splice(zIndex, 0, item2);
20648
- this.change(item2);
20666
+ this.itemsArray.splice(zIndex, 0, item);
20667
+ this.change(item);
20649
20668
  this.subject.publish(this.items);
20650
20669
  }
20651
20670
  moveManyToZIndex(itemsRecord) {
20652
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
20671
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
20653
20672
  const zIndex = Object.values(itemsRecord);
20654
20673
  for (let i = 0;i < zIndex.length; i++) {
20655
20674
  const index2 = zIndex[i];
@@ -20657,39 +20676,39 @@ class SpatialIndex {
20657
20676
  }
20658
20677
  this.itemsArray.forEach(this.change.bind(this));
20659
20678
  }
20660
- sendToBack(item2, shouldPublish = true) {
20661
- const index2 = this.itemsArray.indexOf(item2);
20679
+ sendToBack(item, shouldPublish = true) {
20680
+ const index2 = this.itemsArray.indexOf(item);
20662
20681
  this.itemsArray.splice(index2, 1);
20663
- this.itemsArray.unshift(item2);
20664
- this.itemsIndex.change(item2);
20682
+ this.itemsArray.unshift(item);
20683
+ this.itemsIndex.change(item);
20665
20684
  if (shouldPublish) {
20666
20685
  this.subject.publish(this.items);
20667
20686
  }
20668
20687
  }
20669
20688
  sendManyToBack(items) {
20670
20689
  const newItems = [...items];
20671
- this.itemsArray.forEach((item2) => {
20672
- if (!items.includes(item2)) {
20673
- newItems.push(item2);
20690
+ this.itemsArray.forEach((item) => {
20691
+ if (!items.includes(item)) {
20692
+ newItems.push(item);
20674
20693
  }
20675
20694
  });
20676
20695
  this.itemsArray = newItems;
20677
20696
  this.itemsArray.forEach(this.change.bind(this));
20678
20697
  }
20679
- bringToFront(item2, shouldPublish = true) {
20680
- const index2 = this.itemsArray.indexOf(item2);
20698
+ bringToFront(item, shouldPublish = true) {
20699
+ const index2 = this.itemsArray.indexOf(item);
20681
20700
  this.itemsArray.splice(index2, 1);
20682
- this.itemsArray.push(item2);
20683
- this.itemsIndex.change(item2);
20701
+ this.itemsArray.push(item);
20702
+ this.itemsIndex.change(item);
20684
20703
  if (shouldPublish) {
20685
20704
  this.subject.publish(this.items);
20686
20705
  }
20687
20706
  }
20688
20707
  bringManyToFront(items) {
20689
20708
  const newItems = [];
20690
- this.itemsArray.forEach((item2) => {
20691
- if (!items.includes(item2)) {
20692
- newItems.push(item2);
20709
+ this.itemsArray.forEach((item) => {
20710
+ if (!items.includes(item)) {
20711
+ newItems.push(item);
20693
20712
  }
20694
20713
  });
20695
20714
  newItems.push(...items);
@@ -20715,9 +20734,9 @@ class SpatialIndex {
20715
20734
  this.subject.publish(this.items);
20716
20735
  }
20717
20736
  getById(id) {
20718
- const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
20719
- if (item2) {
20720
- return item2;
20737
+ const item = this.getItemsWithIncludedChildren(this.itemsArray).find((item2) => item2.getId() === id);
20738
+ if (item) {
20739
+ return item;
20721
20740
  }
20722
20741
  }
20723
20742
  findById(id) {
@@ -20727,10 +20746,10 @@ class SpatialIndex {
20727
20746
  const mbr = new Mbr(left, top, right, bottom);
20728
20747
  const items = this.itemsIndex.getEnclosed(mbr);
20729
20748
  const children = [];
20730
- const clearItems = items.filter((item2) => {
20731
- if ("index" in item2 && item2.index) {
20732
- children.push(...item2.index.getEnclosed(left, top, right, bottom));
20733
- if (!item2.getMbr().isEnclosedBy(mbr)) {
20749
+ const clearItems = items.filter((item) => {
20750
+ if ("index" in item && item.index) {
20751
+ children.push(...item.index.getEnclosed(left, top, right, bottom));
20752
+ if (!item.getMbr().isEnclosedBy(mbr)) {
20734
20753
  return false;
20735
20754
  }
20736
20755
  }
@@ -20742,10 +20761,10 @@ class SpatialIndex {
20742
20761
  const mbr = new Mbr(left, top, right, bottom);
20743
20762
  const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
20744
20763
  const children = [];
20745
- const clearItems = items.filter((item2) => {
20746
- if ("index" in item2 && item2.index) {
20747
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20748
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20764
+ const clearItems = items.filter((item) => {
20765
+ if ("index" in item && item.index) {
20766
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20767
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20749
20768
  return false;
20750
20769
  }
20751
20770
  }
@@ -20756,10 +20775,10 @@ class SpatialIndex {
20756
20775
  getUnderPoint(point3, tolerance = 5) {
20757
20776
  const items = this.itemsIndex.getUnderPoint(point3, tolerance);
20758
20777
  const children = [];
20759
- const clearItems = items.filter((item2) => {
20760
- if ("index" in item2 && item2.index) {
20761
- children.push(...item2.index.getUnderPoint(point3, tolerance));
20762
- if (!item2.getMbr().isUnderPoint(point3)) {
20778
+ const clearItems = items.filter((item) => {
20779
+ if ("index" in item && item.index) {
20780
+ children.push(...item.index.getUnderPoint(point3, tolerance));
20781
+ if (!item.getMbr().isUnderPoint(point3)) {
20763
20782
  return false;
20764
20783
  }
20765
20784
  }
@@ -20771,10 +20790,10 @@ class SpatialIndex {
20771
20790
  const mbr = new Mbr(left, top, right, bottom);
20772
20791
  const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
20773
20792
  const children = [];
20774
- const clearItems = items.filter((item2) => {
20775
- if ("index" in item2 && item2.index) {
20776
- children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
20777
- if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
20793
+ const clearItems = items.filter((item) => {
20794
+ if ("index" in item && item.index) {
20795
+ children.push(...item.index.getEnclosedOrCrossed(left, top, right, bottom));
20796
+ if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
20778
20797
  return false;
20779
20798
  }
20780
20799
  }
@@ -20786,26 +20805,26 @@ class SpatialIndex {
20786
20805
  return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
20787
20806
  }
20788
20807
  getComments() {
20789
- return this.itemsArray.filter((item2) => item2 instanceof Comment);
20808
+ return this.itemsArray.filter((item) => item instanceof Comment);
20790
20809
  }
20791
20810
  getMbr() {
20792
20811
  return this.Mbr;
20793
20812
  }
20794
20813
  getNearestTo(point3, maxItems, filter, maxDistance) {
20795
20814
  const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
20796
- const filtered = allItems.filter((item2) => filter(item2));
20797
- const withDistance = filtered.map((item2) => ({
20798
- item: item2,
20799
- distance: point3.getDistance(item2.getMbr().getCenter())
20815
+ const filtered = allItems.filter((item) => filter(item));
20816
+ const withDistance = filtered.map((item) => ({
20817
+ item,
20818
+ distance: point3.getDistance(item.getMbr().getCenter())
20800
20819
  })).filter(({ distance }) => distance <= maxDistance);
20801
20820
  withDistance.sort((a, b) => a.distance - b.distance);
20802
- return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
20821
+ return withDistance.slice(0, maxItems).map(({ item }) => item);
20803
20822
  }
20804
20823
  list() {
20805
20824
  return this.getItemsWithIncludedChildren(this.itemsArray).concat();
20806
20825
  }
20807
- getZIndex(item2) {
20808
- const index2 = this.itemsArray.indexOf(item2);
20826
+ getZIndex(item) {
20827
+ const index2 = this.itemsArray.indexOf(item);
20809
20828
  if (index2 === -1) {
20810
20829
  return this.getLastZIndex();
20811
20830
  }
@@ -20835,14 +20854,14 @@ class Items {
20835
20854
  this.pointer = pointer;
20836
20855
  this.subject = subject;
20837
20856
  }
20838
- update(item2) {
20839
- this.index.change(item2);
20857
+ update(item) {
20858
+ this.index.change(item);
20840
20859
  }
20841
20860
  listAll() {
20842
20861
  return this.index.list();
20843
20862
  }
20844
20863
  listGroupItems() {
20845
- return this.index.list().filter((item2) => ("index" in item2) && item2.index);
20864
+ return this.index.list().filter((item) => ("index" in item) && item.index);
20846
20865
  }
20847
20866
  getById(id) {
20848
20867
  return this.index.getById(id);
@@ -20857,7 +20876,7 @@ class Items {
20857
20876
  return this.index.getEnclosedOrCrossed(left, top, right, bottom);
20858
20877
  }
20859
20878
  getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
20860
- return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
20879
+ return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => item instanceof BaseItem && item.index);
20861
20880
  }
20862
20881
  getUnderPoint(point3, tolerance = 5) {
20863
20882
  return this.index.getUnderPoint(point3, tolerance);
@@ -20885,28 +20904,28 @@ class Items {
20885
20904
  const unmodifiedSize = size;
20886
20905
  size = 16;
20887
20906
  const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
20888
- const groups = tolerated.filter((item2) => item2.itemType === "Group");
20907
+ const groups = tolerated.filter((item) => item.itemType === "Group");
20889
20908
  if (groups.length > 0) {
20890
20909
  return groups;
20891
20910
  }
20892
- let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20911
+ let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
20893
20912
  const underPointer = this.getUnderPoint(new Point(x, y), size);
20894
20913
  if (enclosed.length === 0) {
20895
20914
  enclosed = underPointer;
20896
20915
  }
20897
- if (underPointer.some((item2) => item2.itemType === "Drawing")) {
20916
+ if (underPointer.some((item) => item.itemType === "Drawing")) {
20898
20917
  enclosed = [...underPointer, ...enclosed];
20899
20918
  }
20900
- const { nearest } = enclosed.reduce((acc, item2) => {
20901
- const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
20902
- if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
20919
+ const { nearest } = enclosed.reduce((acc, item) => {
20920
+ const area = item.getMbr().getHeight() * item.getMbr().getWidth();
20921
+ if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
20903
20922
  return acc;
20904
20923
  }
20905
- const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
20906
- const itemZIndex = this.getZIndex(item2);
20924
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
20925
+ const itemZIndex = this.getZIndex(item);
20907
20926
  const accZIndex = this.getZIndex(acc.nearest);
20908
20927
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
20909
- return { nearest: item2, area };
20928
+ return { nearest: item, area };
20910
20929
  }
20911
20930
  return acc;
20912
20931
  }, { nearest: undefined, area: Infinity });
@@ -20918,8 +20937,8 @@ class Items {
20918
20937
  getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
20919
20938
  return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
20920
20939
  }
20921
- getZIndex(item2) {
20922
- return this.index.getZIndex(item2);
20940
+ getZIndex(item) {
20941
+ return this.index.getZIndex(item);
20923
20942
  }
20924
20943
  getByZIndex(index2) {
20925
20944
  return this.index.getByZIndex(index2);
@@ -20928,11 +20947,11 @@ class Items {
20928
20947
  return this.index.getLastZIndex();
20929
20948
  }
20930
20949
  getLinkedConnectorsById(id) {
20931
- return this.listAll().filter((item2) => {
20932
- if (!(item2 instanceof Connector2)) {
20950
+ return this.listAll().filter((item) => {
20951
+ if (!(item instanceof Connector2)) {
20933
20952
  return false;
20934
20953
  }
20935
- const { startItem, endItem } = item2.getConnectedItems();
20954
+ const { startItem, endItem } = item.getConnectedItems();
20936
20955
  if (startItem?.getId() === id || endItem?.getId() === id) {
20937
20956
  return true;
20938
20957
  }
@@ -20943,11 +20962,11 @@ class Items {
20943
20962
  if (!startPointerItemId && !endPointerItemId) {
20944
20963
  return [];
20945
20964
  }
20946
- return this.listAll().filter((item2) => {
20947
- if (!(item2 instanceof Connector2) || !item2.isConnected()) {
20965
+ return this.listAll().filter((item) => {
20966
+ if (!(item instanceof Connector2) || !item.isConnected()) {
20948
20967
  return false;
20949
20968
  }
20950
- const { startItem, endItem } = item2.getConnectedItems();
20969
+ const { startItem, endItem } = item.getConnectedItems();
20951
20970
  if (startPointerItemId && endPointerItemId) {
20952
20971
  if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
20953
20972
  return true;
@@ -20965,9 +20984,9 @@ class Items {
20965
20984
  }
20966
20985
  render(context) {
20967
20986
  const items = this.getItemsInView();
20968
- items.forEach((item2) => {
20969
- if (item2.parent === "Board") {
20970
- item2.render(context);
20987
+ items.forEach((item) => {
20988
+ if (item.parent === "Board") {
20989
+ item.render(context);
20971
20990
  }
20972
20991
  });
20973
20992
  }
@@ -20980,17 +20999,17 @@ class Items {
20980
20999
  return this.getHTML(documentFactory, items);
20981
21000
  }
20982
21001
  getHTML(documentFactory, items) {
20983
- const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
21002
+ const lowestCoordinates = items.map((item) => item.getMbr()).reduce((acc, mbr) => ({
20984
21003
  left: Math.min(acc.left, mbr.left),
20985
21004
  top: Math.min(acc.top, mbr.top)
20986
21005
  }), { left: 0, top: 0 });
20987
21006
  const groups = [];
20988
21007
  const rest = [];
20989
- items.forEach((item2) => {
20990
- if ("index" in item2 && item2.index) {
20991
- groups.push(item2);
21008
+ items.forEach((item) => {
21009
+ if ("index" in item && item.index) {
21010
+ groups.push(item);
20992
21011
  } else {
20993
- rest.push(item2);
21012
+ rest.push(item);
20994
21013
  }
20995
21014
  });
20996
21015
  const childrenMap = new Map;
@@ -21000,34 +21019,34 @@ class Items {
21000
21019
  translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
21001
21020
  return html;
21002
21021
  });
21003
- const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
21004
- if (item2.tagName.toLowerCase() === "connector-item") {
21005
- const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
21006
- const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
21007
- const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
21008
- const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
21009
- item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21010
- item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21011
- item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21012
- item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21013
- }
21014
- return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
21015
- });
21016
- for (const item2 of restHTML) {
21017
- const parentFrameId = childrenMap.get(item2.id);
21022
+ const restHTML = rest.map((item) => ("renderHTML" in item) && item.renderHTML(documentFactory)).filter((item) => !!item).map((item) => {
21023
+ if (item.tagName.toLowerCase() === "connector-item") {
21024
+ const startX = parseFloat(item.getAttribute("data-start-point-x") || "0");
21025
+ const startY = parseFloat(item.getAttribute("data-start-point-y") || "0");
21026
+ const endX = parseFloat(item.getAttribute("data-end-point-x") || "0");
21027
+ const endY = parseFloat(item.getAttribute("data-end-point-y") || "0");
21028
+ item.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
21029
+ item.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
21030
+ item.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
21031
+ item.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
21032
+ }
21033
+ return translateElementBy(item, -lowestCoordinates.left, -lowestCoordinates.top);
21034
+ });
21035
+ for (const item of restHTML) {
21036
+ const parentFrameId = childrenMap.get(item.id);
21018
21037
  const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
21019
21038
  if (group) {
21020
- positionRelatively(item2, group);
21021
- group.appendChild(item2);
21039
+ positionRelatively(item, group);
21040
+ group.appendChild(item);
21022
21041
  }
21023
21042
  }
21024
21043
  let result = "";
21025
21044
  for (const group of GroupsHTML) {
21026
21045
  result += group.outerHTML;
21027
21046
  }
21028
- for (const item2 of restHTML) {
21029
- if (!childrenMap.get(item2.id)) {
21030
- result += item2.outerHTML;
21047
+ for (const item of restHTML) {
21048
+ if (!childrenMap.get(item.id)) {
21049
+ result += item.outerHTML;
21031
21050
  }
21032
21051
  }
21033
21052
  return result;
@@ -21047,52 +21066,52 @@ class SimpleSpatialIndex {
21047
21066
  this.itemsArray = [];
21048
21067
  this.Mbr = new Mbr;
21049
21068
  }
21050
- insert(item2) {
21051
- this.itemsArray.push(item2);
21069
+ insert(item) {
21070
+ this.itemsArray.push(item);
21052
21071
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21053
- this.Mbr = item2.getMbr().copy();
21072
+ this.Mbr = item.getMbr().copy();
21054
21073
  } else {
21055
- this.Mbr.combine([item2.getMbr()]);
21074
+ this.Mbr.combine([item.getMbr()]);
21056
21075
  }
21057
- item2.subject.subscribe(this.change);
21076
+ item.subject.subscribe(this.change);
21058
21077
  this.subject.publish(this.items);
21059
21078
  }
21060
- change = (item2) => {
21079
+ change = (item) => {
21061
21080
  if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
21062
- this.Mbr = item2.getMbr().copy();
21081
+ this.Mbr = item.getMbr().copy();
21063
21082
  } else {
21064
- this.Mbr.combine([item2.getMbr()]);
21083
+ this.Mbr.combine([item.getMbr()]);
21065
21084
  }
21066
21085
  this.subject.publish(this.items);
21067
21086
  };
21068
- remove(item2) {
21069
- if ("index" in item2 && item2.index) {
21070
- item2.removeChildItems(item2.index.list());
21087
+ remove(item) {
21088
+ if ("index" in item && item.index) {
21089
+ item.removeChildItems(item.index.list());
21071
21090
  }
21072
- if (item2.parent !== "Board") {
21073
- const parentFrame = this.items.getById(item2.parent);
21074
- parentFrame?.removeChildItems(item2);
21091
+ if (item.parent !== "Board") {
21092
+ const parentFrame = this.items.getById(item.parent);
21093
+ parentFrame?.removeChildItems(item);
21075
21094
  }
21076
- this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
21095
+ this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
21077
21096
  this.Mbr = new Mbr;
21078
- this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
21097
+ this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
21079
21098
  this.subject.publish(this.items);
21080
21099
  }
21081
21100
  copy() {
21082
- return this.itemsArray.map((item2) => ({
21083
- ...item2.serialize(true),
21084
- id: item2.getId()
21101
+ return this.itemsArray.map((item) => ({
21102
+ ...item.serialize(true),
21103
+ id: item.getId()
21085
21104
  }));
21086
21105
  }
21087
- moveToZIndex(item2, zIndex) {
21088
- const index2 = this.itemsArray.indexOf(item2);
21106
+ moveToZIndex(item, zIndex) {
21107
+ const index2 = this.itemsArray.indexOf(item);
21089
21108
  this.itemsArray.splice(index2, 1);
21090
- this.itemsArray.splice(zIndex, 0, item2);
21091
- this.change(item2);
21109
+ this.itemsArray.splice(zIndex, 0, item);
21110
+ this.change(item);
21092
21111
  this.subject.publish(this.items);
21093
21112
  }
21094
21113
  moveManyToZIndex(itemsRecord) {
21095
- const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
21114
+ const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item) => item !== undefined);
21096
21115
  const zIndex = Object.values(itemsRecord);
21097
21116
  for (let i = 0;i < zIndex.length; i++) {
21098
21117
  const index2 = zIndex[i];
@@ -21100,37 +21119,37 @@ class SimpleSpatialIndex {
21100
21119
  }
21101
21120
  this.itemsArray.forEach(this.change.bind(this));
21102
21121
  }
21103
- sendToBack(item2, shouldPublish = true) {
21104
- const index2 = this.itemsArray.indexOf(item2);
21122
+ sendToBack(item, shouldPublish = true) {
21123
+ const index2 = this.itemsArray.indexOf(item);
21105
21124
  this.itemsArray.splice(index2, 1);
21106
- this.itemsArray.unshift(item2);
21125
+ this.itemsArray.unshift(item);
21107
21126
  if (shouldPublish) {
21108
21127
  this.subject.publish(this.items);
21109
21128
  }
21110
21129
  }
21111
21130
  sendManyToBack(items) {
21112
21131
  const newItems = [...items];
21113
- this.itemsArray.forEach((item2) => {
21114
- if (!items.includes(item2)) {
21115
- newItems.push(item2);
21132
+ this.itemsArray.forEach((item) => {
21133
+ if (!items.includes(item)) {
21134
+ newItems.push(item);
21116
21135
  }
21117
21136
  });
21118
21137
  this.itemsArray = newItems;
21119
21138
  this.itemsArray.forEach(this.change.bind(this));
21120
21139
  }
21121
- bringToFront(item2, shouldPublish = true) {
21122
- const index2 = this.itemsArray.indexOf(item2);
21140
+ bringToFront(item, shouldPublish = true) {
21141
+ const index2 = this.itemsArray.indexOf(item);
21123
21142
  this.itemsArray.splice(index2, 1);
21124
- this.itemsArray.push(item2);
21143
+ this.itemsArray.push(item);
21125
21144
  if (shouldPublish) {
21126
21145
  this.subject.publish(this.items);
21127
21146
  }
21128
21147
  }
21129
21148
  bringManyToFront(items) {
21130
21149
  const newItems = [];
21131
- this.itemsArray.forEach((item2) => {
21132
- if (!items.includes(item2)) {
21133
- newItems.push(item2);
21150
+ this.itemsArray.forEach((item) => {
21151
+ if (!items.includes(item)) {
21152
+ newItems.push(item);
21134
21153
  }
21135
21154
  });
21136
21155
  newItems.push(...items);
@@ -21156,9 +21175,9 @@ class SimpleSpatialIndex {
21156
21175
  this.subject.publish(this.items);
21157
21176
  }
21158
21177
  getById(id) {
21159
- const item2 = this.itemsArray.find((item3) => item3.getId() === id);
21160
- if (item2) {
21161
- return item2;
21178
+ const item = this.itemsArray.find((item2) => item2.getId() === id);
21179
+ if (item) {
21180
+ return item;
21162
21181
  }
21163
21182
  }
21164
21183
  findById(id) {
@@ -21167,9 +21186,9 @@ class SimpleSpatialIndex {
21167
21186
  getEnclosed(left, top, right, bottom) {
21168
21187
  const mbr = new Mbr(left, top, right, bottom);
21169
21188
  const items = [];
21170
- this.itemsArray.forEach((item2) => {
21171
- if (item2.isEnclosedBy(mbr)) {
21172
- items.push(item2);
21189
+ this.itemsArray.forEach((item) => {
21190
+ if (item.isEnclosedBy(mbr)) {
21191
+ items.push(item);
21173
21192
  }
21174
21193
  });
21175
21194
  return items;
@@ -21177,18 +21196,18 @@ class SimpleSpatialIndex {
21177
21196
  getEnclosedOrCrossed(left, top, right, bottom) {
21178
21197
  const mbr = new Mbr(left, top, right, bottom);
21179
21198
  const items = [];
21180
- this.itemsArray.forEach((item2) => {
21181
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21182
- items.push(item2);
21199
+ this.itemsArray.forEach((item) => {
21200
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21201
+ items.push(item);
21183
21202
  }
21184
21203
  });
21185
21204
  return items;
21186
21205
  }
21187
21206
  getUnderPoint(point3, tolerace = 5) {
21188
21207
  const items = [];
21189
- this.itemsArray.forEach((item2) => {
21190
- if (item2.isUnderPoint(point3, tolerace)) {
21191
- items.push(item2);
21208
+ this.itemsArray.forEach((item) => {
21209
+ if (item.isUnderPoint(point3, tolerace)) {
21210
+ items.push(item);
21192
21211
  }
21193
21212
  });
21194
21213
  return items;
@@ -21199,8 +21218,8 @@ class SimpleSpatialIndex {
21199
21218
  list() {
21200
21219
  return this.itemsArray.concat();
21201
21220
  }
21202
- getZIndex(item2) {
21203
- return this.itemsArray.indexOf(item2);
21221
+ getZIndex(item) {
21222
+ return this.itemsArray.indexOf(item);
21204
21223
  }
21205
21224
  getLastZIndex() {
21206
21225
  return this.itemsArray.length - 1;
@@ -21214,8 +21233,8 @@ class SimpleSpatialIndex {
21214
21233
  }
21215
21234
  }
21216
21235
  render(context) {
21217
- this.itemsArray.forEach((item2) => {
21218
- item2.render(context);
21236
+ this.itemsArray.forEach((item) => {
21237
+ item.render(context);
21219
21238
  });
21220
21239
  }
21221
21240
  }
@@ -21266,7 +21285,7 @@ class BaseItem extends Mbr {
21266
21285
  if (!this.index) {
21267
21286
  return null;
21268
21287
  }
21269
- return this.index.items.listAll().map((item2) => item2.getId());
21288
+ return this.index.items.listAll().map((item) => item.getId());
21270
21289
  }
21271
21290
  addChildItems(children) {
21272
21291
  if (!this.index) {
@@ -21304,17 +21323,17 @@ class BaseItem extends Mbr {
21304
21323
  this.addChildItems(itemsToAdd);
21305
21324
  this.removeChildItems(itemsToRemove);
21306
21325
  }
21307
- handleNesting(item2, options) {
21308
- const isItem = "itemType" in item2;
21309
- const itemMbr = isItem ? item2.getMbr() : item2;
21310
- if (item2 instanceof BaseItem && !item2.canBeNested) {
21326
+ handleNesting(item, options) {
21327
+ const isItem = "itemType" in item;
21328
+ const itemMbr = isItem ? item.getMbr() : item;
21329
+ if (item instanceof BaseItem && !item.canBeNested) {
21311
21330
  return false;
21312
21331
  }
21313
- if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
21332
+ if (options?.cancelIfChild && isItem && item.parent !== "Board") {
21314
21333
  return false;
21315
21334
  }
21316
21335
  const mbr = this.getMbr().copy();
21317
- if (item2.isEnclosedOrCrossedBy(mbr)) {
21336
+ if (item.isEnclosedOrCrossedBy(mbr)) {
21318
21337
  if (mbr.isInside(itemMbr.getCenter())) {
21319
21338
  if (!options || !options.onlyForOut) {
21320
21339
  return true;
@@ -23611,8 +23630,8 @@ function isChild(value) {
23611
23630
  if (!Array.isArray(value2))
23612
23631
  return true;
23613
23632
  const list2 = value2;
23614
- for (const item2 of list2) {
23615
- if (typeof item2 !== "number" && typeof item2 !== "string") {
23633
+ for (const item of list2) {
23634
+ if (typeof item !== "number" && typeof item !== "string") {
23616
23635
  return true;
23617
23636
  }
23618
23637
  }
@@ -23651,8 +23670,8 @@ function addProperty(schema, properties, key, value) {
23651
23670
  }
23652
23671
  if (Array.isArray(result)) {
23653
23672
  const finalResult = [];
23654
- for (const item2 of result) {
23655
- finalResult.push(parsePrimitive(info, info.property, item2));
23673
+ for (const item of result) {
23674
+ finalResult.push(parsePrimitive(info, info.property, item));
23656
23675
  }
23657
23676
  result = finalResult;
23658
23677
  }
@@ -34719,8 +34738,8 @@ function list5(node2, parent, state, info) {
34719
34738
  if (checkRule(state) === bullet && firstListItem) {
34720
34739
  let index2 = -1;
34721
34740
  while (++index2 < node2.children.length) {
34722
- const item2 = node2.children[index2];
34723
- if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
34741
+ const item = node2.children[index2];
34742
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
34724
34743
  useDifferentMarker = true;
34725
34744
  break;
34726
34745
  }
@@ -35380,12 +35399,12 @@ async function convertMarkdownToSlate(text5) {
35380
35399
  ...nodes.filter((node2) => node2.type !== "list_item")
35381
35400
  ];
35382
35401
  }
35383
- return nodes.map((item2) => {
35402
+ return nodes.map((item) => {
35384
35403
  setNodeStyles({
35385
- node: item2,
35386
- isPaddingTopNeeded: item2.type !== "code_block"
35404
+ node: item,
35405
+ isPaddingTopNeeded: item.type !== "code_block"
35387
35406
  });
35388
- return item2;
35407
+ return item;
35389
35408
  });
35390
35409
  }
35391
35410
  function detectListType(text5) {
@@ -35798,17 +35817,17 @@ class FloatingPoint extends Point {
35798
35817
  relativePoint;
35799
35818
  pointType = "Floating";
35800
35819
  edge;
35801
- constructor(item2, relativePoint) {
35820
+ constructor(item, relativePoint) {
35802
35821
  super();
35803
- this.item = item2;
35822
+ this.item = item;
35804
35823
  this.relativePoint = relativePoint;
35805
35824
  if (relativePoint.y <= 0) {
35806
35825
  this.edge = "top";
35807
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35826
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35808
35827
  this.edge = "bottom";
35809
35828
  } else if (relativePoint.x <= 0) {
35810
35829
  this.edge = "left";
35811
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35830
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35812
35831
  this.edge = "right";
35813
35832
  }
35814
35833
  this.recalculatePoint();
@@ -35839,17 +35858,17 @@ class FixedPoint extends Point {
35839
35858
  relativePoint;
35840
35859
  pointType = "Fixed";
35841
35860
  edge;
35842
- constructor(item2, relativePoint) {
35861
+ constructor(item, relativePoint) {
35843
35862
  super();
35844
- this.item = item2;
35863
+ this.item = item;
35845
35864
  this.relativePoint = relativePoint;
35846
35865
  if (relativePoint.y <= 0) {
35847
35866
  this.edge = "top";
35848
- } else if (relativePoint.y >= item2.getMbr().getHeight()) {
35867
+ } else if (relativePoint.y >= item.getMbr().getHeight()) {
35849
35868
  this.edge = "bottom";
35850
35869
  } else if (relativePoint.x <= 0) {
35851
35870
  this.edge = "left";
35852
- } else if (relativePoint.x >= item2.getMbr().getWidth()) {
35871
+ } else if (relativePoint.x >= item.getMbr().getWidth()) {
35853
35872
  this.edge = "right";
35854
35873
  }
35855
35874
  this.recalculatePoint();
@@ -35880,16 +35899,16 @@ class FixedConnectorPoint extends Point {
35880
35899
  tangent;
35881
35900
  segmentIndex;
35882
35901
  pointType = "FixedConnector";
35883
- constructor(item2, tangent, segmentIndex) {
35902
+ constructor(item, tangent, segmentIndex) {
35884
35903
  super();
35885
- this.item = item2;
35904
+ this.item = item;
35886
35905
  this.tangent = tangent;
35887
35906
  this.segmentIndex = segmentIndex;
35888
35907
  this.recalculatePoint();
35889
35908
  }
35890
35909
  recalculatePoint() {
35891
- const item2 = this.item;
35892
- const segments = item2.getPaths().getSegments();
35910
+ const item = this.item;
35911
+ const segments = item.getPaths().getSegments();
35893
35912
  const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
35894
35913
  const point5 = segment.getPoint(this.tangent);
35895
35914
  this.x = point5.x;
@@ -35914,38 +35933,38 @@ function getControlPoint(data, findItem2) {
35914
35933
  if (data.pointType === "Board") {
35915
35934
  return new BoardPoint(Math.round(data.x), Math.round(data.y));
35916
35935
  } else {
35917
- const item2 = findItem2(data.itemId);
35918
- if (!item2) {
35936
+ const item = findItem2(data.itemId);
35937
+ if (!item) {
35919
35938
  console.warn(`getControlPoint(): item not found for ${data.itemId}`);
35920
35939
  return new BoardPoint(0, 0);
35921
35940
  }
35922
35941
  switch (data.pointType) {
35923
35942
  case "FixedConnector":
35924
- if (item2 instanceof Connector2) {
35925
- return new FixedConnectorPoint(item2, data.tangent, data.segment);
35943
+ if (item instanceof Connector2) {
35944
+ return new FixedConnectorPoint(item, data.tangent, data.segment);
35926
35945
  } else {
35927
35946
  throw new Error(`getControlPoint(): item must be a connector`);
35928
35947
  }
35929
35948
  case "Floating":
35930
- return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
35949
+ return new FloatingPoint(item, new Point(data.relativeX, data.relativeY));
35931
35950
  case "Fixed":
35932
- return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
35951
+ return new FixedPoint(item, new Point(data.relativeX, data.relativeY));
35933
35952
  }
35934
35953
  }
35935
35954
  }
35936
- function toRelativePoint(point5, item2) {
35937
- const matrix = item2.transformation?.matrix || new Matrix2;
35955
+ function toRelativePoint(point5, item) {
35956
+ const matrix = item.transformation?.matrix || new Matrix2;
35938
35957
  const inverse = matrix.getInverse();
35939
35958
  point5 = point5.copy();
35940
35959
  point5.transform(inverse);
35941
35960
  return point5;
35942
35961
  }
35943
- function fromRelativePoint(relativePoint, item2, edge) {
35944
- const matrix = item2.transformation?.matrix.copy() || new Matrix2;
35962
+ function fromRelativePoint(relativePoint, item, edge) {
35963
+ const matrix = item.transformation?.matrix.copy() || new Matrix2;
35945
35964
  const point5 = relativePoint.copy();
35946
35965
  point5.transform(matrix);
35947
- if (item2 instanceof RichText || item2 instanceof AINode) {
35948
- const itemMbr = item2.getMbr();
35966
+ if (item instanceof RichText || item instanceof AINode) {
35967
+ const itemMbr = item.getMbr();
35949
35968
  const { x: centerX, y: centerY } = itemMbr.getCenter();
35950
35969
  switch (edge) {
35951
35970
  case "left":
@@ -35957,7 +35976,7 @@ function fromRelativePoint(relativePoint, item2, edge) {
35957
35976
  case "bottom":
35958
35977
  return new Point(centerX, itemMbr.bottom);
35959
35978
  default:
35960
- return item2.getMbr().getClosestEdgeCenterPoint(point5);
35979
+ return item.getMbr().getClosestEdgeCenterPoint(point5);
35961
35980
  }
35962
35981
  }
35963
35982
  return point5;
@@ -37306,7 +37325,7 @@ class Connector2 extends BaseItem {
37306
37325
  return this;
37307
37326
  }
37308
37327
  getConnectorById(items, connectorId) {
37309
- return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
37328
+ return items.find((item) => item instanceof Connector2 && item.getId() === connectorId);
37310
37329
  }
37311
37330
  updateTitle() {
37312
37331
  const selection = this.board.selection;
@@ -39943,8 +39962,8 @@ async function exportBoardSnapshot({
39943
39962
  context.matrix.applyToContext(context.ctx);
39944
39963
  const { left, top, right, bottom } = selection;
39945
39964
  const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
39946
- for (const item2 of inView) {
39947
- item2.render(context);
39965
+ for (const item of inView) {
39966
+ item.render(context);
39948
39967
  }
39949
39968
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
39950
39969
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -40142,7 +40161,7 @@ class Frame2 extends BaseItem {
40142
40161
  return this.id;
40143
40162
  }
40144
40163
  getChildrenIds() {
40145
- return this.index?.list().map((item2) => item2.getId()) || [];
40164
+ return this.index?.list().map((item) => item.getId()) || [];
40146
40165
  }
40147
40166
  updateMbr() {
40148
40167
  const rect = this.path.getMbr().copy();
@@ -40377,11 +40396,11 @@ class Frame2 extends BaseItem {
40377
40396
  }
40378
40397
  });
40379
40398
  const currMbr = this.getMbr();
40380
- this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
40381
- if (item2.parent === "Board") {
40382
- if (this.handleNesting(item2)) {
40383
- this.applyAddChildren([item2.getId()]);
40384
- item2.parent = this.getId();
40399
+ this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
40400
+ if (item.parent === "Board") {
40401
+ if (this.handleNesting(item)) {
40402
+ this.applyAddChildren([item.getId()]);
40403
+ item.parent = this.getId();
40385
40404
  }
40386
40405
  }
40387
40406
  });
@@ -42579,9 +42598,9 @@ class Group extends BaseItem {
42579
42598
  if (data.children) {
42580
42599
  data.children.forEach((childId) => {
42581
42600
  this.applyAddChild(childId);
42582
- const item2 = this.board.items.getById(childId);
42583
- if (item2) {
42584
- item2.parent = this.getId();
42601
+ const item = this.board.items.getById(childId);
42602
+ if (item) {
42603
+ item.parent = this.getId();
42585
42604
  }
42586
42605
  });
42587
42606
  }
@@ -42611,11 +42630,11 @@ class Group extends BaseItem {
42611
42630
  let right = Number.MIN_SAFE_INTEGER;
42612
42631
  let bottom = Number.MIN_SAFE_INTEGER;
42613
42632
  const mbrs = this.children.flatMap((childId) => {
42614
- const item2 = this.board.items.getById(childId);
42615
- if (!item2) {
42633
+ const item = this.board.items.getById(childId);
42634
+ if (!item) {
42616
42635
  return [];
42617
42636
  }
42618
- const mbr2 = item2.getMbr();
42637
+ const mbr2 = item.getMbr();
42619
42638
  if (!mbr2) {
42620
42639
  return [];
42621
42640
  }
@@ -42650,7 +42669,7 @@ class Group extends BaseItem {
42650
42669
  return this.children;
42651
42670
  }
42652
42671
  getChildren() {
42653
- return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
42672
+ return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item) => item !== undefined);
42654
42673
  }
42655
42674
  updateMbr() {
42656
42675
  const rect = this.getMbr();
@@ -42663,9 +42682,9 @@ class Group extends BaseItem {
42663
42682
  setChildren(items) {
42664
42683
  items.forEach((itemId) => {
42665
42684
  this.addChild(itemId);
42666
- const item2 = this.board.items.getById(itemId);
42667
- if (item2) {
42668
- item2.parent = this.getId();
42685
+ const item = this.board.items.getById(itemId);
42686
+ if (item) {
42687
+ item.parent = this.getId();
42669
42688
  }
42670
42689
  });
42671
42690
  this.updateMbr();
@@ -42673,9 +42692,9 @@ class Group extends BaseItem {
42673
42692
  removeChildren() {
42674
42693
  this.children.forEach((itemId) => {
42675
42694
  this.removeChild(itemId);
42676
- const item2 = this.board.items.getById(itemId);
42677
- if (item2) {
42678
- item2.parent = this.parent;
42695
+ const item = this.board.items.getById(itemId);
42696
+ if (item) {
42697
+ item.parent = this.parent;
42679
42698
  }
42680
42699
  });
42681
42700
  this.updateMbr();
@@ -43008,16 +43027,16 @@ class Anchor extends Mbr {
43008
43027
  }
43009
43028
  }
43010
43029
  // src/Items/Connector/ConnectorSnap.ts
43011
- function getFixedPoint(item2, point5) {
43012
- if (item2 instanceof Connector2) {
43013
- const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
43030
+ function getFixedPoint(item, point5) {
43031
+ if (item instanceof Connector2) {
43032
+ const nearestSegmentData = item.getPaths().getNearestEdgeAndPointTo(point5);
43014
43033
  const segment = nearestSegmentData.segment;
43015
43034
  const index2 = nearestSegmentData.index;
43016
43035
  const tangent = segment.getParameter(point5);
43017
- return new FixedConnectorPoint(item2, tangent, index2);
43036
+ return new FixedConnectorPoint(item, tangent, index2);
43018
43037
  } else {
43019
- const relativePoint = toRelativePoint(point5, item2);
43020
- return new FixedPoint(item2, relativePoint);
43038
+ const relativePoint = toRelativePoint(point5, item);
43039
+ return new FixedPoint(item, relativePoint);
43021
43040
  }
43022
43041
  }
43023
43042
 
@@ -43070,20 +43089,20 @@ class ConnectorSnap {
43070
43089
  }
43071
43090
  this.setSnap();
43072
43091
  const pointer = this.board.pointer.point;
43073
- const { anchor, item: item2, point: point5 } = this.snap;
43074
- if (!item2) {
43092
+ const { anchor, item, point: point5 } = this.snap;
43093
+ if (!item) {
43075
43094
  const pointer2 = this.board.pointer.point;
43076
43095
  this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
43077
43096
  } else if (anchor) {
43078
- this.controlPoint = getFixedPoint(item2, anchor.getCenter());
43097
+ this.controlPoint = getFixedPoint(item, anchor.getCenter());
43079
43098
  } else if (point5) {
43080
- const nearest2 = item2.getNearestEdgePointTo(pointer);
43081
- this.controlPoint = getFixedPoint(item2, nearest2);
43099
+ const nearest2 = item.getNearestEdgePointTo(pointer);
43100
+ this.controlPoint = getFixedPoint(item, nearest2);
43082
43101
  } else {
43083
43102
  if (this.hover.isTimeoutElapsed) {
43084
- this.controlPoint = getFixedPoint(item2, pointer);
43103
+ this.controlPoint = getFixedPoint(item, pointer);
43085
43104
  } else {
43086
- this.controlPoint = getFixedPoint(item2, pointer);
43105
+ this.controlPoint = getFixedPoint(item, pointer);
43087
43106
  }
43088
43107
  }
43089
43108
  }
@@ -43144,23 +43163,23 @@ class ConnectorSnap {
43144
43163
  }
43145
43164
  return nearest;
43146
43165
  }
43147
- getClosestPointOnItem(item2, position4) {
43148
- const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
43149
- return getFixedPoint(item2, nearestEdgePoint);
43166
+ getClosestPointOnItem(item, position4) {
43167
+ const nearestEdgePoint = item.getNearestEdgePointTo(position4);
43168
+ return getFixedPoint(item, nearestEdgePoint);
43150
43169
  }
43151
- isNearBorder(item2) {
43152
- if (!item2) {
43170
+ isNearBorder(item) {
43171
+ if (!item) {
43153
43172
  return false;
43154
43173
  }
43155
43174
  const pointer = this.board.pointer.point;
43156
- const point5 = item2.getNearestEdgePointTo(pointer);
43175
+ const point5 = item.getNearestEdgePointTo(pointer);
43157
43176
  const distance = pointer.getDistance(point5);
43158
43177
  return distance < this.distance.border / this.board.camera.getScale();
43159
43178
  }
43160
43179
  setSnap() {
43161
- const item2 = this.snap.item;
43162
- const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
43163
- if (!item2 || !path2) {
43180
+ const item = this.snap.item;
43181
+ const path2 = item && "getPath" in item ? item?.getPath() : null;
43182
+ if (!item || !path2) {
43164
43183
  this.snap.path = null;
43165
43184
  this.snap.anchors = [];
43166
43185
  this.snap.anchor = null;
@@ -43171,11 +43190,11 @@ class ConnectorSnap {
43171
43190
  if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
43172
43191
  path2.setBackgroundColor(this.color.snapBackgroundHighlight);
43173
43192
  }
43174
- this.setAnchors(item2);
43193
+ this.setAnchors(item);
43175
43194
  }
43176
43195
  }
43177
- setAnchors(item2) {
43178
- const points = item2.getSnapAnchorPoints();
43196
+ setAnchors(item) {
43197
+ const points = item.getSnapAnchorPoints();
43179
43198
  if (!points) {
43180
43199
  return;
43181
43200
  }
@@ -43209,10 +43228,10 @@ class ConnectorSnap {
43209
43228
  }
43210
43229
  setPoint() {
43211
43230
  const pointer = this.board.pointer.point;
43212
- const { item: item2, anchor } = this.snap;
43213
- if (item2) {
43231
+ const { item, anchor } = this.snap;
43232
+ if (item) {
43214
43233
  if (!anchor) {
43215
- const point5 = item2.getNearestEdgePointTo(pointer);
43234
+ const point5 = item.getNearestEdgePointTo(pointer);
43216
43235
  if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
43217
43236
  this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
43218
43237
  } else {
@@ -43585,12 +43604,12 @@ class NestingHighlighter extends Tool {
43585
43604
  this.toHighlight.push({ groupItem, children: array });
43586
43605
  }
43587
43606
  }
43588
- addSingleItem(item2) {
43589
- this.toHighlight.push({ children: [item2] });
43607
+ addSingleItem(item) {
43608
+ this.toHighlight.push({ children: [item] });
43590
43609
  }
43591
- remove(item2) {
43610
+ remove(item) {
43592
43611
  this.toHighlight.forEach((group) => {
43593
- group.children = group.children.filter((child) => child !== item2);
43612
+ group.children = group.children.filter((child) => child !== item);
43594
43613
  });
43595
43614
  this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
43596
43615
  }
@@ -43657,7 +43676,7 @@ class AddFrame extends BoardTool {
43657
43676
  this.mbr.borderColor = "blue";
43658
43677
  this.nestingHighlighter.clear();
43659
43678
  const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
43660
- const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
43679
+ const inside = enclosedOrCrossed.filter((item) => !(item instanceof Frame2) && item.parent === "Board" && this.mbr.isInside(item.getMbr().getCenter()));
43661
43680
  this.nestingHighlighter.add(this.frame, inside);
43662
43681
  this.initTransformation();
43663
43682
  this.board.tools.publish();
@@ -43678,7 +43697,7 @@ class AddFrame extends BoardTool {
43678
43697
  localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
43679
43698
  }
43680
43699
  const currMbr = this.frame.getMbr();
43681
- 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));
43700
+ 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));
43682
43701
  this.applyAddChildren(frameChildren);
43683
43702
  if (this.shape !== "Custom") {
43684
43703
  this.applyCanChangeRatio(false);
@@ -43694,7 +43713,7 @@ class AddFrame extends BoardTool {
43694
43713
  return true;
43695
43714
  }
43696
43715
  addNextTo() {
43697
- const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
43716
+ const framesInView = this.board.items.getItemsInView().filter((item) => item instanceof Frame2);
43698
43717
  if (framesInView.length === 0) {
43699
43718
  if (this.shape === "Custom") {
43700
43719
  const { x, y } = this.frame.getLastFrameScale();
@@ -43732,7 +43751,7 @@ class AddFrame extends BoardTool {
43732
43751
  this.board.camera.viewRectangle(this.frame.getMbr());
43733
43752
  }
43734
43753
  const frameMbr = this.frame.getMbr();
43735
- 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]));
43754
+ 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]));
43736
43755
  const frame = this.board.add(this.frame);
43737
43756
  frame.text.editor.moveCursorToEndOfTheText();
43738
43757
  this.nestingHighlighter.clear();
@@ -44237,13 +44256,13 @@ class Eraser extends BoardTool {
44237
44256
  }
44238
44257
  removeUnderPointOrLine() {
44239
44258
  const segments = this.drawing.getLines();
44240
- const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
44241
- return item2.itemType === "Drawing" && item2.getLines().find((line) => {
44242
- return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
44259
+ const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item) => {
44260
+ return item.itemType === "Drawing" && item.getLines().find((line) => {
44261
+ return line.getDistance(this.board.pointer.point) <= item.strokeWidth / 2 + this.strokeWidth / 2;
44243
44262
  });
44244
44263
  });
44245
- 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) => {
44246
- return item2.itemType === "Drawing" && item2.getLines().some((line) => {
44264
+ 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) => {
44265
+ return item.itemType === "Drawing" && item.getLines().some((line) => {
44247
44266
  return segments.some((segment) => segment.hasIntersectionPoint(line));
44248
44267
  });
44249
44268
  }));
@@ -44695,20 +44714,20 @@ function createCanvasDrawer(board) {
44695
44714
  context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
44696
44715
  context.matrix.applyToContext(context.ctx);
44697
44716
  const items = Object.keys(translation).map((id) => {
44698
- const item2 = board2.items.getById(id);
44699
- if (item2) {
44700
- if (item2.itemType !== "Frame") {
44701
- return item2;
44717
+ const item = board2.items.getById(id);
44718
+ if (item) {
44719
+ if (item.itemType !== "Frame") {
44720
+ return item;
44702
44721
  }
44703
- item2.render(context);
44704
- return item2;
44722
+ item.render(context);
44723
+ return item;
44705
44724
  }
44706
44725
  return;
44707
- }).filter((item2) => !!item2);
44708
- items.forEach((item2) => {
44709
- if (item2.itemType !== "Frame") {
44710
- item2.render(context);
44711
- board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
44726
+ }).filter((item) => !!item);
44727
+ items.forEach((item) => {
44728
+ if (item.itemType !== "Frame") {
44729
+ item.render(context);
44730
+ board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
44712
44731
  }
44713
44732
  });
44714
44733
  return { canvas: container, items };
@@ -44769,10 +44788,10 @@ function createCanvasDrawer(board) {
44769
44788
  if (lastTranslationKeys) {
44770
44789
  board.selection.shouldPublish = false;
44771
44790
  lastTranslationKeys.forEach((id) => {
44772
- const item2 = board.items.getById(id);
44773
- if (item2) {
44774
- item2.transformationRenderBlock = undefined;
44775
- item2.subject.publish(item2);
44791
+ const item = board.items.getById(id);
44792
+ if (item) {
44793
+ item.transformationRenderBlock = undefined;
44794
+ item.subject.publish(item);
44776
44795
  }
44777
44796
  });
44778
44797
  lastTranslationKeys = undefined;
@@ -44804,9 +44823,9 @@ function createCanvasDrawer(board) {
44804
44823
  lastCreatedCanvas = cnvs;
44805
44824
  lastTranslationKeys = Object.keys(translation);
44806
44825
  lastTranslationKeys.forEach((id) => {
44807
- const item2 = board.items.getById(id);
44808
- if (item2) {
44809
- item2.transformationRenderBlock = true;
44826
+ const item = board.items.getById(id);
44827
+ if (item) {
44828
+ item.transformationRenderBlock = true;
44810
44829
  }
44811
44830
  });
44812
44831
  board.selection.transformationRenderBlock = true;
@@ -44816,14 +44835,14 @@ function createCanvasDrawer(board) {
44816
44835
  }
44817
44836
  function countSumMbr(translation) {
44818
44837
  return Object.keys(translation).reduce((mbr, id) => {
44819
- const item2 = board.items.getById(id);
44820
- if (item2) {
44838
+ const item = board.items.getById(id);
44839
+ if (item) {
44821
44840
  if (!mbr) {
44822
- mbr = item2.getMbr();
44841
+ mbr = item.getMbr();
44823
44842
  } else {
44824
- mbr.combine(item2.getMbr());
44825
- if (item2.itemType === "Frame") {
44826
- mbr.combine(item2.getRichText().getMbr());
44843
+ mbr.combine(item.getMbr());
44844
+ if (item.itemType === "Frame") {
44845
+ mbr.combine(item.getRichText().getMbr());
44827
44846
  }
44828
44847
  }
44829
44848
  }
@@ -44854,8 +44873,8 @@ function createCanvasDrawer(board) {
44854
44873
  }
44855
44874
  function highlightNesting() {
44856
44875
  const container = getLastCreatedCanvas();
44857
- const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
44858
- acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
44876
+ const drawnItemsMap = drawnItems?.reduce((acc, item) => {
44877
+ acc.set(item.getId(), { item, mbr: item.getMbr() });
44859
44878
  return acc;
44860
44879
  }, new Map);
44861
44880
  if (!container || !drawnItems) {
@@ -44890,11 +44909,11 @@ function createCanvasDrawer(board) {
44890
44909
  mbr.transform(currMatrix);
44891
44910
  });
44892
44911
  groups.forEach((group) => {
44893
- drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
44894
- if ("canBeNested" in item2 && !item2.canBeNested) {
44912
+ drawnItemsMap?.forEach(({ mbr, item }, key) => {
44913
+ if ("canBeNested" in item && !item.canBeNested) {
44895
44914
  return;
44896
44915
  }
44897
- if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
44916
+ if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item.parent !== group.getId()) && group.handleNesting(mbr)) {
44898
44917
  const div = createBorderDivForItem(mbr, lastCreatedCanvas);
44899
44918
  removeHighlighted(key);
44900
44919
  highlightedDivs.set(key, div);
@@ -44955,10 +44974,10 @@ function createCanvasDrawer(board) {
44955
44974
  }
44956
44975
 
44957
44976
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
44958
- function getControlPointData(item2, index2, isRichText = false) {
44959
- const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
44960
- const width2 = item2.getPathMbr().getWidth();
44961
- let height3 = item2.getPathMbr().getHeight();
44977
+ function getControlPointData(item, index2, isRichText = false) {
44978
+ const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
44979
+ const width2 = item.getPathMbr().getWidth();
44980
+ let height3 = item.getPathMbr().getHeight();
44962
44981
  const adjMapScaled = {
44963
44982
  0: { x: 0, y: height3 / 2 / itemScale.y },
44964
44983
  1: {
@@ -44973,7 +44992,7 @@ function getControlPointData(item2, index2, isRichText = false) {
44973
44992
  };
44974
44993
  return {
44975
44994
  pointType: "Fixed",
44976
- itemId: item2.getId(),
44995
+ itemId: item.getId(),
44977
44996
  relativeX: adjMapScaled[index2].x,
44978
44997
  relativeY: adjMapScaled[index2].y
44979
44998
  };
@@ -45108,10 +45127,10 @@ function getQuickAddButtons(selection, board) {
45108
45127
  let newHeight = height3;
45109
45128
  let itemData;
45110
45129
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
45111
- const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45112
- newWidth = item2.getMbr().getWidth();
45113
- newHeight = item2.getMbr().getHeight();
45114
- itemData = item2.serialize();
45130
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
45131
+ newWidth = item.getMbr().getWidth();
45132
+ newHeight = item.getMbr().getHeight();
45133
+ itemData = item.serialize();
45115
45134
  const { minX, minY, maxY, maxX } = offsets;
45116
45135
  offsetX = Math.min(offsetX, maxX);
45117
45136
  offsetX = Math.max(offsetX, minX);
@@ -45144,7 +45163,7 @@ function getQuickAddButtons(selection, board) {
45144
45163
  }
45145
45164
  const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
45146
45165
  let step = 1;
45147
- while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
45166
+ while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
45148
45167
  const xDirection = step % 2 === 0 ? -1 : 1;
45149
45168
  const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
45150
45169
  newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
@@ -45277,7 +45296,7 @@ function getQuickAddButtons(selection, board) {
45277
45296
  clear();
45278
45297
  return;
45279
45298
  }
45280
- const { positions, item: item2 } = position4;
45299
+ const { positions, item } = position4;
45281
45300
  const cameraMatrix = board.camera.getMatrix();
45282
45301
  const cameraMbr = board.camera.getMbr();
45283
45302
  const positionAdjustments = {
@@ -45305,7 +45324,7 @@ function getQuickAddButtons(selection, board) {
45305
45324
  };
45306
45325
  const button = document.createElement("button");
45307
45326
  button.classList.add("microboard-quickAddButton");
45308
- if (item2.itemType === "AINode" && index2 === 2) {
45327
+ if (item.itemType === "AINode" && index2 === 2) {
45309
45328
  button.classList.add("microboard-invisible");
45310
45329
  }
45311
45330
  button.classList.add(`microboard-${adjustment.rotate}`);
@@ -45321,7 +45340,7 @@ function getQuickAddButtons(selection, board) {
45321
45340
  clearTimeout(timeoutId);
45322
45341
  }
45323
45342
  if (button.isMouseDown) {
45324
- board.tools.addConnector(true, item2, pos);
45343
+ board.tools.addConnector(true, item, pos);
45325
45344
  } else {
45326
45345
  quickAddItems = undefined;
45327
45346
  selection.subject.publish(selection);
@@ -45428,11 +45447,11 @@ class AlignmentHelper {
45428
45447
  return baseThickness / (zoom / 100);
45429
45448
  }
45430
45449
  combineMBRs(items) {
45431
- return items.reduce((acc, item2, i) => {
45450
+ return items.reduce((acc, item, i) => {
45432
45451
  if (i === 0) {
45433
45452
  return acc;
45434
45453
  }
45435
- const itemMbr = item2.getPathMbr();
45454
+ const itemMbr = item.getPathMbr();
45436
45455
  return acc.combine(itemMbr);
45437
45456
  }, items[0].getMbr());
45438
45457
  }
@@ -45446,7 +45465,7 @@ class AlignmentHelper {
45446
45465
  const scale = this.board.camera.getScale();
45447
45466
  const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
45448
45467
  const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
45449
- 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);
45468
+ 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);
45450
45469
  const verticalAlignments = new Map;
45451
45470
  const horizontalAlignments = new Map;
45452
45471
  const addVerticalAlignment = (x, minY, maxY) => {
@@ -45467,11 +45486,11 @@ class AlignmentHelper {
45467
45486
  horizontalAlignments.set(y, { minX, maxX });
45468
45487
  }
45469
45488
  };
45470
- nearbyItems.forEach((item2) => {
45471
- if (item2 === movingItem || item2.itemType === "Comment") {
45489
+ nearbyItems.forEach((item) => {
45490
+ if (item === movingItem || item.itemType === "Comment") {
45472
45491
  return;
45473
45492
  }
45474
- const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
45493
+ const itemMbr = item.itemType === "Shape" ? item.getPath().getMbr() : item.getMbr();
45475
45494
  const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
45476
45495
  const centerXItem = (itemMbr.left + itemMbr.right) / 2;
45477
45496
  const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
@@ -45738,20 +45757,20 @@ class AlignmentHelper {
45738
45757
  }
45739
45758
  return false;
45740
45759
  }
45741
- translateItems(item2, x, y, timeStamp) {
45760
+ translateItems(item, x, y, timeStamp) {
45742
45761
  if (this.canvasDrawer.getLastCreatedCanvas()) {
45743
45762
  return;
45744
45763
  }
45745
- if (Array.isArray(item2)) {
45764
+ if (Array.isArray(item)) {
45746
45765
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45747
45766
  this.board.selection.transformMany(translation, timeStamp);
45748
45767
  return;
45749
45768
  }
45750
- if (item2.itemType === "Frame") {
45769
+ if (item.itemType === "Frame") {
45751
45770
  const translation = this.board.selection.getManyItemsTranslation(x, y);
45752
45771
  this.board.selection.transformMany(translation, timeStamp);
45753
45772
  } else {
45754
- const id = item2.getId();
45773
+ const id = item.getId();
45755
45774
  const transformMap = {};
45756
45775
  transformMap[id] = {
45757
45776
  class: "Transformation",
@@ -45879,12 +45898,12 @@ class Select extends Tool {
45879
45898
  this.debounceUpd.setFalse();
45880
45899
  this.snapLines = { verticalLines: [], horizontalLines: [] };
45881
45900
  }
45882
- handleSnapping(item2) {
45901
+ handleSnapping(item) {
45883
45902
  if (this.board.keyboard.isShift) {
45884
45903
  return false;
45885
45904
  }
45886
- const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
45887
- this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45905
+ const increasedSnapThreshold = Array.isArray(item) ? 40 : 35;
45906
+ this.isSnapped = this.alignmentHelper.snapToClosestLine(item, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
45888
45907
  if (this.isSnapped) {
45889
45908
  if (!this.snapCursorPos) {
45890
45909
  this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
@@ -45894,10 +45913,10 @@ class Select extends Tool {
45894
45913
  if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
45895
45914
  this.isSnapped = false;
45896
45915
  this.snapCursorPos = null;
45897
- const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
45916
+ const itemCenter = Array.isArray(item) ? this.alignmentHelper.combineMBRs(item).getCenter() : item.getMbr().getCenter();
45898
45917
  const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
45899
45918
  const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
45900
- this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
45919
+ this.alignmentHelper.translateItems(item, translateX, translateY, this.beginTimeStamp);
45901
45920
  }
45902
45921
  }
45903
45922
  return false;
@@ -45947,10 +45966,10 @@ class Select extends Tool {
45947
45966
  angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
45948
45967
  return Math.min(angleDiff, 360 - angleDiff);
45949
45968
  }
45950
- handleShiftGuidelines(item2, mousePosition) {
45951
- if (item2) {
45969
+ handleShiftGuidelines(item, mousePosition) {
45970
+ if (item) {
45952
45971
  if (!this.originalCenter) {
45953
- this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
45972
+ this.originalCenter = Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().copy() : item.getMbr().getCenter().copy();
45954
45973
  this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
45955
45974
  }
45956
45975
  this.mainLine = new Line(this.originalCenter, mousePosition);
@@ -45971,13 +45990,13 @@ class Select extends Tool {
45971
45990
  const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
45972
45991
  const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
45973
45992
  const threshold = Infinity;
45974
- const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
45975
- const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
45976
- if (Array.isArray(item2)) {
45993
+ const translateX = newEndX - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().x : item.getMbr().getCenter().x);
45994
+ const translateY = newEndY - (Array.isArray(item) ? this.board.selection.getMbr()?.getCenter().y : item.getMbr().getCenter().y);
45995
+ if (Array.isArray(item)) {
45977
45996
  const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
45978
45997
  this.board.selection.transformMany(translation, this.beginTimeStamp);
45979
45998
  } else {
45980
- item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
45999
+ item.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
45981
46000
  }
45982
46001
  }
45983
46002
  }
@@ -46020,7 +46039,7 @@ class Select extends Tool {
46020
46039
  return false;
46021
46040
  }
46022
46041
  this.isDownOnBoard = hover.length === 0;
46023
- this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46042
+ this.isDrawingRectangle = hover.filter((item) => !(item instanceof Frame2)).length === 0 && hover.filter((item) => item instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
46024
46043
  if (this.isDrawingRectangle) {
46025
46044
  const { x, y } = pointer.point;
46026
46045
  this.line = new Line(new Point(x, y), new Point(x, y));
@@ -46040,7 +46059,7 @@ class Select extends Tool {
46040
46059
  });
46041
46060
  return false;
46042
46061
  }
46043
- const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
46062
+ const isHoverLocked = hover.every((item) => item.transformation.isLocked);
46044
46063
  if (isHoverLocked) {
46045
46064
  return false;
46046
46065
  }
@@ -46174,7 +46193,7 @@ class Select extends Tool {
46174
46193
  const translation = selection.getManyItemsTranslation(x, y);
46175
46194
  const translationKeys = Object.keys(translation);
46176
46195
  const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
46177
- if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
46196
+ if (translationKeys.filter((item) => !commentsSet.has(item)).length > 10) {
46178
46197
  const selectedMbr = this.board.selection.getMbr()?.copy();
46179
46198
  const sumMbr = this.canvasDrawer.countSumMbr(translation);
46180
46199
  if (sumMbr) {
@@ -46201,7 +46220,7 @@ class Select extends Tool {
46201
46220
  return false;
46202
46221
  }
46203
46222
  const draggingMbr = draggingItem.getMbr();
46204
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
46223
+ const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46205
46224
  frames.forEach((frame) => {
46206
46225
  if (frame.handleNesting(draggingItem)) {
46207
46226
  this.nestingHighlighter.add(frame, draggingItem);
@@ -46211,7 +46230,7 @@ class Select extends Tool {
46211
46230
  });
46212
46231
  }
46213
46232
  const hover = items.getUnderPointer();
46214
- this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
46233
+ this.isHoverUnselectedItem = hover.filter((item) => item.itemType === "Placeholder").length === 1;
46215
46234
  if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
46216
46235
  selection.setContext("HoverUnderPointer");
46217
46236
  return false;
@@ -46255,15 +46274,15 @@ class Select extends Tool {
46255
46274
  }
46256
46275
  }
46257
46276
  updateFramesNesting(selectionMbr, selection) {
46258
- 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));
46259
- const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
46260
- selection.list().forEach((item2) => {
46261
- if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
46277
+ 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));
46278
+ const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46279
+ selection.list().forEach((item) => {
46280
+ if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46262
46281
  frames.forEach((frame) => {
46263
- if (frame.handleNesting(item2)) {
46264
- this.nestingHighlighter.add(frame, item2);
46282
+ if (frame.handleNesting(item)) {
46283
+ this.nestingHighlighter.add(frame, item);
46265
46284
  } else {
46266
- this.nestingHighlighter.remove(item2);
46285
+ this.nestingHighlighter.remove(item);
46267
46286
  }
46268
46287
  });
46269
46288
  }
@@ -46355,7 +46374,7 @@ class Select extends Tool {
46355
46374
  const childrenIds = underPointer.getChildrenIds();
46356
46375
  console.log("UNDERPOINTER", underPointer);
46357
46376
  console.log("CHILDREN", childrenIds);
46358
- const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
46377
+ const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
46359
46378
  this.board.selection.add(itemsInFrame);
46360
46379
  }
46361
46380
  this.board.selection.setContext("EditUnderPointer");
@@ -46595,8 +46614,8 @@ class ShapeTool extends CustomTool {
46595
46614
  resizeType = "leftBottom";
46596
46615
  bounds = new Mbr;
46597
46616
  isDown = false;
46598
- constructor(board, name, item2, settings) {
46599
- super(board, name, item2);
46617
+ constructor(board, name, item, settings) {
46618
+ super(board, name, item);
46600
46619
  this.settings = settings;
46601
46620
  this.setCursor();
46602
46621
  }
@@ -46679,8 +46698,8 @@ class ShapeTool extends CustomTool {
46679
46698
 
46680
46699
  class StickerTool extends CustomTool {
46681
46700
  settings;
46682
- constructor(board, name, item2, settings) {
46683
- super(board, name, item2);
46701
+ constructor(board, name, item, settings) {
46702
+ super(board, name, item);
46684
46703
  this.settings = settings;
46685
46704
  this.setCursor();
46686
46705
  }
@@ -46986,7 +47005,7 @@ class Tools extends ToolContext {
46986
47005
  this.subject.publish(this);
46987
47006
  }
46988
47007
  sortFrames() {
46989
- const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
47008
+ const frames = this.board.items.listAll().filter((item) => item instanceof Frame2);
46990
47009
  const sortedFrames = frames.sort((fr1, fr2) => {
46991
47010
  const mbr1 = fr1.getMbr();
46992
47011
  const mbr2 = fr2.getMbr();
@@ -47212,24 +47231,24 @@ function validateGroupData(groupData) {
47212
47231
  }
47213
47232
  // src/Items/RegisterItem.ts
47214
47233
  function registerItem({
47215
- item: item2,
47234
+ item,
47216
47235
  defaultData: defaultData2,
47217
47236
  toolData
47218
47237
  }) {
47219
47238
  const { itemType } = defaultData2;
47220
- itemFactories[itemType] = createItemFactory(item2, defaultData2);
47239
+ itemFactories[itemType] = createItemFactory(item, defaultData2);
47221
47240
  itemValidators[itemType] = createItemValidator(defaultData2);
47222
47241
  if (toolData) {
47223
47242
  registeredTools[toolData.name] = toolData.tool;
47224
47243
  }
47225
47244
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47226
47245
  }
47227
- function createItemFactory(item2, defaultData2) {
47246
+ function createItemFactory(item, defaultData2) {
47228
47247
  return function itemFactory(id, data, board) {
47229
47248
  if (data.itemType !== defaultData2.itemType) {
47230
47249
  throw new Error(`Invalid data for ${defaultData2.itemType}`);
47231
47250
  }
47232
- return new item2(board, id, defaultData2).setId(id).deserialize(data);
47251
+ return new item(board, id, defaultData2).setId(id).deserialize(data);
47233
47252
  };
47234
47253
  }
47235
47254
  function createItemValidator(defaultData2) {
@@ -47244,7 +47263,7 @@ function createItemValidator(defaultData2) {
47244
47263
  }
47245
47264
  function createItemCommandFactory(itemType) {
47246
47265
  return function itemCommandFactory(items, operation) {
47247
- return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
47266
+ return new BaseCommand(items.filter((item) => item.itemType === itemType), operation);
47248
47267
  };
47249
47268
  }
47250
47269
  // src/Items/Examples/Star/AddStar.ts
@@ -48269,8 +48288,8 @@ class Camera {
48269
48288
  this.observableItem = null;
48270
48289
  }
48271
48290
  }
48272
- subscribeToItem(item2) {
48273
- this.observableItem = item2;
48291
+ subscribeToItem(item) {
48292
+ this.observableItem = item;
48274
48293
  this.observableItem.subject.subscribe(this.observeItem);
48275
48294
  }
48276
48295
  observeItem = () => {
@@ -48496,7 +48515,7 @@ class Camera {
48496
48515
  }
48497
48516
  addToView(mbr, inView) {
48498
48517
  if (!mbr.isEnclosedBy(this.getMbr())) {
48499
- this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48518
+ this.viewRectangle(inView.reduce((acc, item) => acc.combine(item.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
48500
48519
  }
48501
48520
  }
48502
48521
  viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
@@ -50105,8 +50124,8 @@ class Presence {
50105
50124
  <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}"/>
50106
50125
  </svg>`;
50107
50126
  }
50108
- renderItemMbr(context, item2, color2, customScale) {
50109
- const mbr = item2.getMbr();
50127
+ renderItemMbr(context, item, color2, customScale) {
50128
+ const mbr = item.getMbr();
50110
50129
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
50111
50130
  mbr.borderColor = color2;
50112
50131
  mbr.render(context);
@@ -50246,8 +50265,8 @@ class Presence {
50246
50265
  selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
50247
50266
  selectionMbr.borderColor = selection.color;
50248
50267
  selectionMbr.render(context);
50249
- for (const item2 of selection.selection) {
50250
- this.renderItemMbr(context, item2, selection.color);
50268
+ for (const item of selection.selection) {
50269
+ this.renderItemMbr(context, item, selection.color);
50251
50270
  }
50252
50271
  }
50253
50272
  }
@@ -50280,14 +50299,14 @@ class SelectionItems {
50280
50299
  items = new Map;
50281
50300
  add(value) {
50282
50301
  if (Array.isArray(value)) {
50283
- value.forEach((item2) => this.items.set(item2.getId(), item2));
50302
+ value.forEach((item) => this.items.set(item.getId(), item));
50284
50303
  } else {
50285
50304
  this.items.set(value.getId(), value);
50286
50305
  }
50287
50306
  }
50288
50307
  remove(value) {
50289
50308
  if (Array.isArray(value)) {
50290
- value.forEach((item2) => this.items.delete(item2.getId()));
50309
+ value.forEach((item) => this.items.delete(item.getId()));
50291
50310
  } else {
50292
50311
  this.items.delete(value.getId());
50293
50312
  }
@@ -50317,8 +50336,8 @@ class SelectionItems {
50317
50336
  if (this.isEmpty()) {
50318
50337
  return false;
50319
50338
  }
50320
- for (const item2 of this.items.values()) {
50321
- if (item2.itemType !== "RichText") {
50339
+ for (const item of this.items.values()) {
50340
+ if (item.itemType !== "RichText") {
50322
50341
  return false;
50323
50342
  }
50324
50343
  }
@@ -50328,14 +50347,14 @@ class SelectionItems {
50328
50347
  if (this.isEmpty()) {
50329
50348
  return false;
50330
50349
  }
50331
- return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
50350
+ return Array.from(this.items).every(([, item]) => item.itemType === itemType);
50332
50351
  }
50333
50352
  isItemTypes(itemTypes) {
50334
50353
  if (this.isEmpty()) {
50335
50354
  return false;
50336
50355
  }
50337
- for (const item2 of this.items.values()) {
50338
- if (!itemTypes.includes(item2.itemType)) {
50356
+ for (const item of this.items.values()) {
50357
+ if (!itemTypes.includes(item.itemType)) {
50339
50358
  return false;
50340
50359
  }
50341
50360
  }
@@ -50343,16 +50362,16 @@ class SelectionItems {
50343
50362
  }
50344
50363
  getItemTypes() {
50345
50364
  const itemTypes = new Set;
50346
- this.items.forEach((item2) => itemTypes.add(item2.itemType));
50365
+ this.items.forEach((item) => itemTypes.add(item.itemType));
50347
50366
  return Array.from(itemTypes);
50348
50367
  }
50349
50368
  getItemsByItemTypes(itemTypes) {
50350
- return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
50369
+ return Array.from(this.items.values()).filter((item) => itemTypes.includes(item.itemType));
50351
50370
  }
50352
50371
  getIdsByItemTypes(itemTypes) {
50353
50372
  const ids = [];
50354
- this.items.forEach((item2, id) => {
50355
- if (itemTypes.includes(item2.itemType)) {
50373
+ this.items.forEach((item, id) => {
50374
+ if (itemTypes.includes(item.itemType)) {
50356
50375
  ids.push(id);
50357
50376
  }
50358
50377
  });
@@ -50362,7 +50381,7 @@ class SelectionItems {
50362
50381
  return this.isSingle() ? this.items.values().next().value || null : null;
50363
50382
  }
50364
50383
  listByIds(itemIdList) {
50365
- return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
50384
+ return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
50366
50385
  }
50367
50386
  ids() {
50368
50387
  return Array.from(this.items.keys());
@@ -50373,7 +50392,7 @@ class SelectionItems {
50373
50392
  return;
50374
50393
  }
50375
50394
  const mbr = items[0].getMbr();
50376
- items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
50395
+ items.slice(1).forEach((item) => mbr.combine(item.getMbr()));
50377
50396
  return mbr;
50378
50397
  }
50379
50398
  }
@@ -50578,33 +50597,33 @@ function handleMultipleItemsResize({
50578
50597
  const translation = {};
50579
50598
  const items = itemsToResize ? itemsToResize : board.selection.items.list();
50580
50599
  board.items.getComments().forEach((comment2) => {
50581
- if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
50600
+ if (items.some((item) => item.getId() === comment2.getItemToFollow())) {
50582
50601
  items.push(comment2);
50583
50602
  }
50584
50603
  });
50585
- for (const item2 of items) {
50586
- let itemX = item2.getMbr().left;
50587
- let itemY = item2.getMbr().top;
50588
- if (item2.itemType === "Drawing") {
50589
- itemX = item2.transformation.matrix.translateX;
50590
- itemY = item2.transformation.matrix.translateY;
50604
+ for (const item of items) {
50605
+ let itemX = item.getMbr().left;
50606
+ let itemY = item.getMbr().top;
50607
+ if (item.itemType === "Drawing") {
50608
+ itemX = item.transformation.matrix.translateX;
50609
+ itemY = item.transformation.matrix.translateY;
50591
50610
  }
50592
50611
  const deltaX = itemX - initMbr.left;
50593
50612
  const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
50594
50613
  const deltaY = itemY - initMbr.top;
50595
50614
  const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
50596
- if (item2 instanceof RichText) {
50597
- translation[item2.getId()] = getRichTextTranslation({
50598
- item: item2,
50615
+ if (item instanceof RichText) {
50616
+ translation[item.getId()] = getRichTextTranslation({
50617
+ item,
50599
50618
  isWidth,
50600
50619
  isHeight,
50601
50620
  matrix,
50602
50621
  translateX,
50603
50622
  translateY
50604
50623
  });
50605
- } else if (item2 instanceof AINode) {
50606
- translation[item2.getId()] = getAINodeTranslation({
50607
- item: item2,
50624
+ } else if (item instanceof AINode) {
50625
+ translation[item.getId()] = getAINodeTranslation({
50626
+ item,
50608
50627
  isWidth,
50609
50628
  isHeight,
50610
50629
  matrix,
@@ -50612,8 +50631,8 @@ function handleMultipleItemsResize({
50612
50631
  translateY
50613
50632
  });
50614
50633
  } else {
50615
- translation[item2.getId()] = getItemTranslation({
50616
- item: item2,
50634
+ translation[item.getId()] = getItemTranslation({
50635
+ item,
50617
50636
  isWidth,
50618
50637
  isHeight,
50619
50638
  matrix,
@@ -50626,7 +50645,7 @@ function handleMultipleItemsResize({
50626
50645
  return translation;
50627
50646
  }
50628
50647
  function getRichTextTranslation({
50629
- item: item2,
50648
+ item,
50630
50649
  isWidth,
50631
50650
  isHeight,
50632
50651
  matrix,
@@ -50634,11 +50653,11 @@ function getRichTextTranslation({
50634
50653
  translateY
50635
50654
  }) {
50636
50655
  if (isWidth) {
50637
- item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50656
+ item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50638
50657
  return {
50639
50658
  class: "Transformation",
50640
50659
  method: "scaleByTranslateBy",
50641
- item: [item2.getId()],
50660
+ item: [item.getId()],
50642
50661
  translate: { x: matrix.translateX, y: 0 },
50643
50662
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50644
50663
  };
@@ -50646,7 +50665,7 @@ function getRichTextTranslation({
50646
50665
  return {
50647
50666
  class: "Transformation",
50648
50667
  method: "scaleByTranslateBy",
50649
- item: [item2.getId()],
50668
+ item: [item.getId()],
50650
50669
  translate: { x: translateX, y: translateY },
50651
50670
  scale: { x: 1, y: 1 }
50652
50671
  };
@@ -50654,14 +50673,14 @@ function getRichTextTranslation({
50654
50673
  return {
50655
50674
  class: "Transformation",
50656
50675
  method: "scaleByTranslateBy",
50657
- item: [item2.getId()],
50676
+ item: [item.getId()],
50658
50677
  translate: { x: translateX, y: translateY },
50659
50678
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50660
50679
  };
50661
50680
  }
50662
50681
  }
50663
50682
  function getAINodeTranslation({
50664
- item: item2,
50683
+ item,
50665
50684
  isWidth,
50666
50685
  isHeight,
50667
50686
  matrix,
@@ -50669,11 +50688,11 @@ function getAINodeTranslation({
50669
50688
  translateY
50670
50689
  }) {
50671
50690
  if (isWidth) {
50672
- item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
50691
+ item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
50673
50692
  return {
50674
50693
  class: "Transformation",
50675
50694
  method: "scaleByTranslateBy",
50676
- item: [item2.getId()],
50695
+ item: [item.getId()],
50677
50696
  translate: { x: matrix.translateX, y: 0 },
50678
50697
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50679
50698
  };
@@ -50681,7 +50700,7 @@ function getAINodeTranslation({
50681
50700
  return {
50682
50701
  class: "Transformation",
50683
50702
  method: "scaleByTranslateBy",
50684
- item: [item2.getId()],
50703
+ item: [item.getId()],
50685
50704
  translate: { x: translateX, y: translateY },
50686
50705
  scale: { x: 1, y: 1 }
50687
50706
  };
@@ -50689,14 +50708,14 @@ function getAINodeTranslation({
50689
50708
  return {
50690
50709
  class: "Transformation",
50691
50710
  method: "scaleByTranslateBy",
50692
- item: [item2.getId()],
50711
+ item: [item.getId()],
50693
50712
  translate: { x: translateX, y: translateY },
50694
50713
  scale: { x: matrix.scaleX, y: matrix.scaleX }
50695
50714
  };
50696
50715
  }
50697
50716
  }
50698
50717
  function getItemTranslation({
50699
- item: item2,
50718
+ item,
50700
50719
  isWidth,
50701
50720
  isHeight,
50702
50721
  matrix,
@@ -50704,22 +50723,22 @@ function getItemTranslation({
50704
50723
  translateY,
50705
50724
  isShiftPressed
50706
50725
  }) {
50707
- if (item2 instanceof Sticker && (isWidth || isHeight)) {
50726
+ if (item instanceof Sticker && (isWidth || isHeight)) {
50708
50727
  return {
50709
50728
  class: "Transformation",
50710
50729
  method: "scaleByTranslateBy",
50711
- item: [item2.getId()],
50730
+ item: [item.getId()],
50712
50731
  translate: { x: translateX, y: translateY },
50713
50732
  scale: { x: 1, y: 1 }
50714
50733
  };
50715
50734
  } else {
50716
- if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
50717
- item2.setFrameType("Custom");
50735
+ if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
50736
+ item.setFrameType("Custom");
50718
50737
  }
50719
50738
  return {
50720
50739
  class: "Transformation",
50721
50740
  method: "scaleByTranslateBy",
50722
- item: [item2.getId()],
50741
+ item: [item.getId()],
50723
50742
  translate: { x: translateX, y: translateY },
50724
50743
  scale: { x: matrix.scaleX, y: matrix.scaleY }
50725
50744
  };
@@ -50992,11 +51011,11 @@ function transformItems({
50992
51011
  setSnapCursorPos
50993
51012
  }) {
50994
51013
  const items = selection.items.list();
50995
- const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
51014
+ const includesProportionalItem = items.some((item) => item.itemType === "Sticker" || item.itemType === "RichText" || item.itemType === "AINode" || item.itemType === "Video" || item.itemType === "Audio");
50996
51015
  if (includesProportionalItem && (isWidth || isHeight)) {
50997
51016
  return null;
50998
51017
  }
50999
- const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
51018
+ const isIncludesFixedFrame = items.some((item) => item instanceof Frame2 && !item.getCanChangeRatio());
51000
51019
  const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
51001
51020
  const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
51002
51021
  if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
@@ -51074,23 +51093,23 @@ function updateFrameChildren({
51074
51093
  nestingHighlighter
51075
51094
  }) {
51076
51095
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51077
- board.selection.items.list().forEach((item2) => {
51078
- if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
51079
- const currMbr = item2.getMbr();
51096
+ board.selection.items.list().forEach((item) => {
51097
+ if ("getChildrenIds" in item && item.getChildrenIds()) {
51098
+ const currMbr = item.getMbr();
51080
51099
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51081
51100
  itemsToCheck.forEach((currItem) => {
51082
- if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
51083
- nestingHighlighter.add(item2, currItem);
51101
+ if (item.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item.getId())) {
51102
+ nestingHighlighter.add(item, currItem);
51084
51103
  } else {
51085
51104
  nestingHighlighter.remove(currItem);
51086
51105
  }
51087
51106
  });
51088
51107
  } else {
51089
51108
  groups.forEach((group) => {
51090
- if (group.handleNesting(item2)) {
51091
- nestingHighlighter.add(group, item2);
51109
+ if (group.handleNesting(item)) {
51110
+ nestingHighlighter.add(group, item);
51092
51111
  } else {
51093
- nestingHighlighter.remove(item2);
51112
+ nestingHighlighter.remove(item);
51094
51113
  }
51095
51114
  });
51096
51115
  }
@@ -51158,9 +51177,9 @@ class Transformer extends Tool {
51158
51177
  const pointer = this.board.pointer;
51159
51178
  const camera = this.board.camera;
51160
51179
  const items = this.selection.items;
51161
- const item2 = items.getSingle();
51180
+ const item = items.getSingle();
51162
51181
  let resizeType;
51163
- if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
51182
+ if (item && (item.itemType === "RichText" || item.itemType === "Sticker")) {
51164
51183
  resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
51165
51184
  } else {
51166
51185
  resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
@@ -51414,8 +51433,8 @@ class SelectionTransformer extends Tool {
51414
51433
  return;
51415
51434
  }
51416
51435
  if (this.selection.items.isSingle()) {
51417
- const item2 = this.selection.items.getSingle();
51418
- if (item2?.itemType === "Connector") {
51436
+ const item = this.selection.items.getSingle();
51437
+ if (item?.itemType === "Connector") {
51419
51438
  this.tool = this.connectorTransformerTool;
51420
51439
  return;
51421
51440
  } else {
@@ -51498,16 +51517,16 @@ class BoardSelection {
51498
51517
  this.quickAddButtons = getQuickAddButtons(this, board);
51499
51518
  }
51500
51519
  serialize() {
51501
- const selectedItems = this.items.list().map((item2) => item2.getId());
51520
+ const selectedItems = this.items.list().map((item) => item.getId());
51502
51521
  return JSON.stringify(selectedItems);
51503
51522
  }
51504
51523
  deserialize(serializedData) {
51505
51524
  const selectedItems = JSON.parse(serializedData);
51506
51525
  this.removeAll();
51507
51526
  selectedItems.forEach((itemId) => {
51508
- const item2 = this.board.items.getById(itemId);
51509
- if (item2) {
51510
- this.items.add(item2);
51527
+ const item = this.board.items.getById(itemId);
51528
+ if (item) {
51529
+ this.items.add(item);
51511
51530
  }
51512
51531
  });
51513
51532
  }
@@ -51585,19 +51604,19 @@ class BoardSelection {
51585
51604
  this.updateQueue.clear();
51586
51605
  safeRequestAnimationFrame(this.updateScheduledObservers);
51587
51606
  };
51588
- itemObserver = (item2) => {
51607
+ itemObserver = (item) => {
51589
51608
  if (!this.shouldPublish) {
51590
51609
  return;
51591
51610
  }
51592
51611
  this.subject.publish(this);
51593
- this.itemSubject.publish(item2);
51612
+ this.itemSubject.publish(item);
51594
51613
  };
51595
51614
  decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
51596
51615
  add(value) {
51597
51616
  this.items.add(value);
51598
51617
  if (Array.isArray(value)) {
51599
- for (const item2 of value) {
51600
- item2.subject.subscribe(this.itemObserver);
51618
+ for (const item of value) {
51619
+ item.subject.subscribe(this.itemObserver);
51601
51620
  }
51602
51621
  } else {
51603
51622
  value.subject.subscribe(this.itemObserver);
@@ -51606,15 +51625,15 @@ class BoardSelection {
51606
51625
  this.itemsSubject.publish([]);
51607
51626
  }
51608
51627
  addAll() {
51609
- const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
51628
+ const items = this.board.items.listAll().filter((item) => !item.transformation.isLocked);
51610
51629
  this.add(items);
51611
51630
  this.setContext("SelectByRect");
51612
51631
  }
51613
51632
  remove(value) {
51614
51633
  this.items.remove(value);
51615
51634
  if (Array.isArray(value)) {
51616
- for (const item2 of value) {
51617
- item2.subject.unsubscribe(this.itemObserver);
51635
+ for (const item of value) {
51636
+ item.subject.unsubscribe(this.itemObserver);
51618
51637
  }
51619
51638
  } else {
51620
51639
  value.subject.unsubscribe(this.itemObserver);
@@ -51708,11 +51727,11 @@ class BoardSelection {
51708
51727
  if (!this.items.isSingle()) {
51709
51728
  return;
51710
51729
  }
51711
- const item2 = this.items.getSingle();
51712
- if (!item2) {
51730
+ const item = this.items.getSingle();
51731
+ if (!item) {
51713
51732
  return;
51714
51733
  }
51715
- const text5 = item2.getRichText();
51734
+ const text5 = item.getRichText();
51716
51735
  if (!text5) {
51717
51736
  return;
51718
51737
  }
@@ -51723,7 +51742,7 @@ class BoardSelection {
51723
51742
  if (shouldReplace || moveCursorToEnd) {
51724
51743
  text5.editor.moveCursorToEndOfTheText();
51725
51744
  }
51726
- this.setTextToEdit(item2);
51745
+ this.setTextToEdit(item);
51727
51746
  this.setContext("EditTextUnderPointer");
51728
51747
  if (shouldSelect) {
51729
51748
  text5.editor.selectWholeText();
@@ -51733,13 +51752,13 @@ class BoardSelection {
51733
51752
  editUnderPointer() {
51734
51753
  this.removeAll();
51735
51754
  const stack = this.board.items.getUnderPointer();
51736
- const item2 = stack.pop();
51737
- if (item2) {
51738
- this.add(item2);
51755
+ const item = stack.pop();
51756
+ if (item) {
51757
+ this.add(item);
51739
51758
  this.setTextToEdit(undefined);
51740
- const text5 = item2.getRichText();
51759
+ const text5 = item.getRichText();
51741
51760
  if (text5) {
51742
- this.setTextToEdit(item2);
51761
+ this.setTextToEdit(item);
51743
51762
  text5.editor.selectWholeText();
51744
51763
  this.board.items.subject.publish(this.board.items);
51745
51764
  }
@@ -51748,26 +51767,26 @@ class BoardSelection {
51748
51767
  this.setContext("None");
51749
51768
  }
51750
51769
  }
51751
- setTextToEdit(item2) {
51770
+ setTextToEdit(item) {
51752
51771
  if (this.textToEdit) {
51753
51772
  this.textToEdit.updateElement();
51754
51773
  this.textToEdit.enableRender();
51755
51774
  }
51756
- if (!(item2 && item2.getRichText())) {
51775
+ if (!(item && item.getRichText())) {
51757
51776
  this.textToEdit = undefined;
51758
51777
  return;
51759
51778
  }
51760
- const text5 = item2.getRichText();
51779
+ const text5 = item.getRichText();
51761
51780
  if (!text5) {
51762
51781
  return;
51763
51782
  }
51764
51783
  if (text5.isEmpty()) {
51765
- const textColor = tempStorage.getFontColor(item2.itemType);
51766
- const textSize = tempStorage.getFontSize(item2.itemType);
51767
- const highlightColor = tempStorage.getFontHighlight(item2.itemType);
51768
- const styles = tempStorage.getFontStyles(item2.itemType);
51769
- const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
51770
- const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
51784
+ const textColor = tempStorage.getFontColor(item.itemType);
51785
+ const textSize = tempStorage.getFontSize(item.itemType);
51786
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
51787
+ const styles = tempStorage.getFontStyles(item.itemType);
51788
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
51789
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
51771
51790
  if (textColor) {
51772
51791
  text5.setSelectionFontColor(textColor, "None");
51773
51792
  }
@@ -51775,7 +51794,7 @@ class BoardSelection {
51775
51794
  this.emit({
51776
51795
  class: "RichText",
51777
51796
  method: "setFontSize",
51778
- item: [item2.getId()],
51797
+ item: [item.getId()],
51779
51798
  fontSize: textSize,
51780
51799
  context: this.getContext()
51781
51800
  });
@@ -51787,10 +51806,10 @@ class BoardSelection {
51787
51806
  const stylesArr = styles;
51788
51807
  text5.setSelectionFontStyle(stylesArr, "None");
51789
51808
  }
51790
- if (horizontalAlignment && !(item2 instanceof Sticker)) {
51809
+ if (horizontalAlignment && !(item instanceof Sticker)) {
51791
51810
  text5.setSelectionHorisontalAlignment(horizontalAlignment);
51792
51811
  }
51793
- if (verticalAlignment && !(item2 instanceof Sticker)) {
51812
+ if (verticalAlignment && !(item instanceof Sticker)) {
51794
51813
  this.setVerticalAlignment(verticalAlignment);
51795
51814
  }
51796
51815
  }
@@ -51823,8 +51842,8 @@ class BoardSelection {
51823
51842
  }
51824
51843
  selectEnclosedOrCrossedBy(rect) {
51825
51844
  this.removeAll();
51826
- const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
51827
- 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);
51845
+ const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item) => !item.transformation.isLocked);
51846
+ 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);
51828
51847
  if (list6.length !== 0) {
51829
51848
  this.add(list6);
51830
51849
  this.setContext("SelectByRect");
@@ -51838,14 +51857,14 @@ class BoardSelection {
51838
51857
  canChangeText() {
51839
51858
  return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
51840
51859
  }
51841
- handleItemCopy(item2, copiedItemsMap) {
51842
- const serializedData = item2.serialize(true);
51843
- const zIndex = this.board.items.index.getZIndex(item2);
51844
- if (item2.itemType === "Comment") {
51860
+ handleItemCopy(item, copiedItemsMap) {
51861
+ const serializedData = item.serialize(true);
51862
+ const zIndex = this.board.items.index.getZIndex(item);
51863
+ if (item.itemType === "Comment") {
51845
51864
  return;
51846
51865
  }
51847
- if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
51848
- const connector = item2;
51866
+ if (item.itemType === "Connector" && serializedData.itemType === "Connector") {
51867
+ const connector = item;
51849
51868
  const startPoint = connector.getStartPoint();
51850
51869
  const endPoint = connector.getEndPoint();
51851
51870
  const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
@@ -51861,19 +51880,19 @@ class BoardSelection {
51861
51880
  serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
51862
51881
  }
51863
51882
  }
51864
- const textItem = item2.getRichText()?.getTextString();
51883
+ const textItem = item.getRichText()?.getTextString();
51865
51884
  const copyText = conf.i18n.t("frame.copy");
51866
51885
  const isCopyTextExist = textItem?.includes(copyText);
51867
- const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51886
+ const isChangeCopiedFrameText = item.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
51868
51887
  if (isChangeCopiedFrameText) {
51869
51888
  const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
51870
- item2.getRichText()?.editor.clearText();
51871
- item2.getRichText()?.editor.addText(copiedFrameText);
51872
- serializedData.text = item2.getRichText()?.serialize();
51873
- item2.getRichText()?.editor.clearText();
51874
- item2.getRichText()?.editor.addText(textItem || "");
51889
+ item.getRichText()?.editor.clearText();
51890
+ item.getRichText()?.editor.addText(copiedFrameText);
51891
+ serializedData.text = item.getRichText()?.serialize();
51892
+ item.getRichText()?.editor.clearText();
51893
+ item.getRichText()?.editor.addText(textItem || "");
51875
51894
  }
51876
- copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
51895
+ copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
51877
51896
  }
51878
51897
  copy(skipImageBlobCopy) {
51879
51898
  const copiedItemsMap = {};
@@ -51882,12 +51901,12 @@ class BoardSelection {
51882
51901
  this.handleItemCopy(single, copiedItemsMap);
51883
51902
  return { imageElement: single.image, imageData: copiedItemsMap };
51884
51903
  }
51885
- this.list().forEach((item2) => {
51886
- this.handleItemCopy(item2, copiedItemsMap);
51904
+ this.list().forEach((item) => {
51905
+ this.handleItemCopy(item, copiedItemsMap);
51887
51906
  });
51888
- this.list().flatMap((item2) => {
51889
- if (item2 instanceof Frame2) {
51890
- return item2.getChildrenIds();
51907
+ this.list().flatMap((item) => {
51908
+ if (item instanceof Frame2) {
51909
+ return item.getChildrenIds();
51891
51910
  }
51892
51911
  return [];
51893
51912
  }).forEach((id) => {
@@ -51915,11 +51934,11 @@ class BoardSelection {
51915
51934
  let maxRichText = null;
51916
51935
  let minRichText = null;
51917
51936
  const itemType = items[0].itemType;
51918
- for (const item2 of items) {
51919
- if (item2.itemType !== itemType) {
51937
+ for (const item of items) {
51938
+ if (item.itemType !== itemType) {
51920
51939
  return null;
51921
51940
  }
51922
- const richText = item2.getRichText();
51941
+ const richText = item.getRichText();
51923
51942
  if (richText) {
51924
51943
  if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
51925
51944
  maxRichText = richText;
@@ -52025,22 +52044,22 @@ class BoardSelection {
52025
52044
  }
52026
52045
  nestSelectedItems(unselectedItem, checkFrames = true) {
52027
52046
  const selected = this.board.selection.items.list();
52028
- if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
52047
+ if (unselectedItem && !selected.find((item) => item.getId() === unselectedItem.getId())) {
52029
52048
  selected.push(unselectedItem);
52030
52049
  }
52031
- const selectedMbr = selected.reduce((acc, item2) => {
52050
+ const selectedMbr = selected.reduce((acc, item) => {
52032
52051
  if (!acc) {
52033
- return item2.getMbr();
52052
+ return item.getMbr();
52034
52053
  }
52035
- return acc.combine(item2.getMbr());
52054
+ return acc.combine(item.getMbr());
52036
52055
  }, undefined);
52037
52056
  if (selectedMbr) {
52038
- const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
52057
+ const selectedMap = Object.fromEntries(selected.map((item) => [item.getId(), { item, nested: false }]));
52039
52058
  const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
52040
52059
  enclosedGroups.forEach((group) => {
52041
- selected.forEach((item2) => {
52042
- if (group.handleNesting(item2)) {
52043
- selectedMap[item2.getId()].nested = group;
52060
+ selected.forEach((item) => {
52061
+ if (group.handleNesting(item)) {
52062
+ selectedMap[item.getId()].nested = group;
52044
52063
  }
52045
52064
  });
52046
52065
  });
@@ -52064,11 +52083,11 @@ class BoardSelection {
52064
52083
  if (childrenIds && checkFrames) {
52065
52084
  const currGroup = val.item;
52066
52085
  const currMbr = currGroup.getMbr();
52067
- const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
52068
- const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
52086
+ const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
52087
+ const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board" || item.parent === currGroup.getId());
52069
52088
  const uniqueItems = new Set;
52070
- const toCheck = [...children, ...underGroup].filter((item2) => {
52071
- const id = item2.getId();
52089
+ const toCheck = [...children, ...underGroup].filter((item) => {
52090
+ const id = item.getId();
52072
52091
  if (uniqueItems.has(id)) {
52073
52092
  return false;
52074
52093
  }
@@ -52109,8 +52128,8 @@ class BoardSelection {
52109
52128
  addItemToTranslation(childId);
52110
52129
  }
52111
52130
  }
52112
- const createTranslationWithComments = (item2) => {
52113
- const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
52131
+ const createTranslationWithComments = (item) => {
52132
+ const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item.getId());
52114
52133
  for (const comment2 of followedComments) {
52115
52134
  translation[comment2.getId()] = {
52116
52135
  class: "Transformation",
@@ -52171,21 +52190,21 @@ class BoardSelection {
52171
52190
  newData: { borderColor }
52172
52191
  };
52173
52192
  const operations2 = {};
52174
- this.items.list().forEach((item2) => {
52175
- if (!operations2[item2.itemType]) {
52193
+ this.items.list().forEach((item) => {
52194
+ if (!operations2[item.itemType]) {
52176
52195
  const operationCopy = { ...operation };
52177
- if (item2.itemType === "Connector") {
52196
+ if (item.itemType === "Connector") {
52178
52197
  operationCopy.method = "setLineColor";
52179
52198
  operationCopy.lineColor = borderColor;
52180
- } else if (item2.itemType === "Drawing") {
52199
+ } else if (item.itemType === "Drawing") {
52181
52200
  operationCopy.method = "setStrokeColor";
52182
52201
  operationCopy.color = borderColor;
52183
52202
  } else {
52184
52203
  operationCopy.borderColor = borderColor;
52185
52204
  }
52186
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52205
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52187
52206
  } else {
52188
- operations2[item2.itemType].item.push(item2.getId());
52207
+ operations2[item.itemType].item.push(item.getId());
52189
52208
  }
52190
52209
  });
52191
52210
  Object.values(operations2).forEach((op) => {
@@ -52200,13 +52219,13 @@ class BoardSelection {
52200
52219
  newData: { borderWidth: width2 }
52201
52220
  };
52202
52221
  const operations2 = {};
52203
- this.items.list().forEach((item2) => {
52204
- if (!operations2[item2.itemType]) {
52222
+ this.items.list().forEach((item) => {
52223
+ if (!operations2[item.itemType]) {
52205
52224
  const operationCopy = { ...operation };
52206
- if (item2.itemType === "Connector") {
52225
+ if (item.itemType === "Connector") {
52207
52226
  operationCopy.method = "setLineWidth";
52208
52227
  operationCopy.lineWidth = width2;
52209
- } else if (item2.itemType === "Drawing") {
52228
+ } else if (item.itemType === "Drawing") {
52210
52229
  operationCopy.method = "setStrokeWidth";
52211
52230
  operationCopy.width = width2;
52212
52231
  operationCopy.prevWidth = this.getStrokeWidth();
@@ -52214,9 +52233,9 @@ class BoardSelection {
52214
52233
  operationCopy.borderWidth = width2;
52215
52234
  operationCopy.prevBorderWidth = this.getStrokeWidth();
52216
52235
  }
52217
- operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
52236
+ operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
52218
52237
  } else {
52219
- operations2[item2.itemType].item.push(item2.getId());
52238
+ operations2[item.itemType].item.push(item.getId());
52220
52239
  }
52221
52240
  });
52222
52241
  Object.values(operations2).forEach((op) => {
@@ -52232,11 +52251,11 @@ class BoardSelection {
52232
52251
  newData: { backgroundColor }
52233
52252
  };
52234
52253
  const operations2 = {};
52235
- this.items.list().forEach((item2) => {
52236
- if (!operations2[item2.itemType]) {
52237
- operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
52254
+ this.items.list().forEach((item) => {
52255
+ if (!operations2[item.itemType]) {
52256
+ operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
52238
52257
  } else {
52239
- operations2[item2.itemType].item.push(item2.getId());
52258
+ operations2[item.itemType].item.push(item.getId());
52240
52259
  }
52241
52260
  });
52242
52261
  Object.values(operations2).forEach((op) => {
@@ -52260,9 +52279,9 @@ class BoardSelection {
52260
52279
  }
52261
52280
  setFrameType(frameType) {
52262
52281
  const items = this.items.list();
52263
- items.forEach((item2) => {
52264
- if (item2 instanceof Frame2) {
52265
- item2.setFrameType(frameType);
52282
+ items.forEach((item) => {
52283
+ if (item instanceof Frame2) {
52284
+ item.setFrameType(frameType);
52266
52285
  }
52267
52286
  });
52268
52287
  }
@@ -52281,21 +52300,21 @@ class BoardSelection {
52281
52300
  setFontSize(size) {
52282
52301
  const fontSize = size === "auto" ? size : toFiniteNumber(size);
52283
52302
  const itemsOps = [];
52284
- for (const item2 of this.items.list()) {
52285
- const text5 = item2.getRichText();
52303
+ for (const item of this.items.list()) {
52304
+ const text5 = item.getRichText();
52286
52305
  if (!text5) {
52287
52306
  continue;
52288
52307
  }
52289
52308
  const ops = text5.setSelectionFontSize(fontSize, this.context);
52290
52309
  itemsOps.push({
52291
- item: item2.getId(),
52310
+ item: item.getId(),
52292
52311
  selection: text5.editor.getSelection(),
52293
52312
  ops
52294
52313
  });
52295
- if (item2.itemType === "Sticker" && fontSize === "auto") {
52296
- tempStorage.remove(`fontSize_${item2.itemType}`);
52297
- } else if (item2.itemType !== "AINode") {
52298
- tempStorage.setFontSize(item2.itemType, fontSize);
52314
+ if (item.itemType === "Sticker" && fontSize === "auto") {
52315
+ tempStorage.remove(`fontSize_${item.itemType}`);
52316
+ } else if (item.itemType !== "AINode") {
52317
+ tempStorage.setFontSize(item.itemType, fontSize);
52299
52318
  }
52300
52319
  }
52301
52320
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -52318,8 +52337,8 @@ class BoardSelection {
52318
52337
  setFontStyle(fontStyle) {
52319
52338
  const isMultiple = !this.items.isSingle();
52320
52339
  const itemsOps = [];
52321
- for (const item2 of this.items.list()) {
52322
- const text5 = item2.getRichText();
52340
+ for (const item of this.items.list()) {
52341
+ const text5 = item.getRichText();
52323
52342
  if (!text5) {
52324
52343
  continue;
52325
52344
  }
@@ -52328,12 +52347,12 @@ class BoardSelection {
52328
52347
  }
52329
52348
  const ops = text5.setSelectionFontStyle(fontStyle, this.context);
52330
52349
  itemsOps.push({
52331
- item: item2.getId(),
52350
+ item: item.getId(),
52332
52351
  selection: text5.editor.getSelection(),
52333
52352
  ops
52334
52353
  });
52335
- if (item2.itemType !== "AINode") {
52336
- tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
52354
+ if (item.itemType !== "AINode") {
52355
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
52337
52356
  }
52338
52357
  }
52339
52358
  this.emitApplied({
@@ -52345,8 +52364,8 @@ class BoardSelection {
52345
52364
  setFontColor(fontColor) {
52346
52365
  const isMultiple = !this.items.isSingle();
52347
52366
  const itemsOps = [];
52348
- for (const item2 of this.items.list()) {
52349
- const text5 = item2.getRichText();
52367
+ for (const item of this.items.list()) {
52368
+ const text5 = item.getRichText();
52350
52369
  if (!text5) {
52351
52370
  continue;
52352
52371
  }
@@ -52355,11 +52374,11 @@ class BoardSelection {
52355
52374
  }
52356
52375
  const ops = text5.setSelectionFontColor(fontColor, this.context);
52357
52376
  itemsOps.push({
52358
- item: item2.getId(),
52377
+ item: item.getId(),
52359
52378
  selection: text5.editor.getSelection(),
52360
52379
  ops
52361
52380
  });
52362
- tempStorage.setFontColor(item2.itemType, fontColor);
52381
+ tempStorage.setFontColor(item.itemType, fontColor);
52363
52382
  }
52364
52383
  this.emitApplied({
52365
52384
  class: "RichText",
@@ -52388,8 +52407,8 @@ class BoardSelection {
52388
52407
  setFontHighlight(fontHighlight) {
52389
52408
  const isMultiple = !this.items.isSingle();
52390
52409
  const itemsOps = [];
52391
- for (const item2 of this.items.list()) {
52392
- const text5 = item2.getRichText();
52410
+ for (const item of this.items.list()) {
52411
+ const text5 = item.getRichText();
52393
52412
  if (!text5) {
52394
52413
  continue;
52395
52414
  }
@@ -52398,12 +52417,12 @@ class BoardSelection {
52398
52417
  }
52399
52418
  const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
52400
52419
  itemsOps.push({
52401
- item: item2.getId(),
52420
+ item: item.getId(),
52402
52421
  selection: text5.editor.getSelection(),
52403
52422
  ops
52404
52423
  });
52405
- if (item2.itemType !== "AINode") {
52406
- tempStorage.setFontHighlight(item2.itemType, fontHighlight);
52424
+ if (item.itemType !== "AINode") {
52425
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
52407
52426
  }
52408
52427
  }
52409
52428
  this.emitApplied({
@@ -52415,8 +52434,8 @@ class BoardSelection {
52415
52434
  setHorisontalAlignment(horisontalAlignment) {
52416
52435
  const isMultiple = !this.items.isSingle();
52417
52436
  const itemsOps = [];
52418
- for (const item2 of this.items.list()) {
52419
- const text5 = item2.getRichText();
52437
+ for (const item of this.items.list()) {
52438
+ const text5 = item.getRichText();
52420
52439
  if (!text5) {
52421
52440
  continue;
52422
52441
  }
@@ -52425,11 +52444,11 @@ class BoardSelection {
52425
52444
  }
52426
52445
  const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
52427
52446
  itemsOps.push({
52428
- item: item2.getId(),
52447
+ item: item.getId(),
52429
52448
  selection: text5.editor.getSelection(),
52430
52449
  ops
52431
52450
  });
52432
- tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
52451
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
52433
52452
  }
52434
52453
  this.emitApplied({
52435
52454
  class: "RichText",
@@ -52445,23 +52464,23 @@ class BoardSelection {
52445
52464
  verticalAlignment
52446
52465
  });
52447
52466
  if (this.items.isSingle()) {
52448
- const item2 = this.items.getSingle();
52449
- if (!item2) {
52467
+ const item = this.items.getSingle();
52468
+ if (!item) {
52450
52469
  return;
52451
52470
  }
52452
- const text5 = item2.getRichText();
52471
+ const text5 = item.getRichText();
52453
52472
  if (!text5) {
52454
52473
  return;
52455
52474
  }
52456
- tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
52457
- if (item2 instanceof RichText) {
52458
- item2.setEditorFocus(this.context);
52475
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
52476
+ if (item instanceof RichText) {
52477
+ item.setEditorFocus(this.context);
52459
52478
  }
52460
52479
  text5.setEditorFocus(this.context);
52461
52480
  }
52462
52481
  }
52463
52482
  removeFromBoard() {
52464
- const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
52483
+ const isLocked = this.items.list().some((item) => item.transformation.isLocked);
52465
52484
  if (isLocked) {
52466
52485
  return;
52467
52486
  }
@@ -52484,7 +52503,7 @@ class BoardSelection {
52484
52503
  }
52485
52504
  getIsLockedSelection() {
52486
52505
  const items = this.list();
52487
- return items.some((item2) => item2.transformation.isLocked);
52506
+ return items.some((item) => item.transformation.isLocked);
52488
52507
  }
52489
52508
  isLocked() {
52490
52509
  return false;
@@ -52511,9 +52530,9 @@ class BoardSelection {
52511
52530
  }
52512
52531
  async duplicate() {
52513
52532
  const mediaIds = [];
52514
- this.items.list().forEach((item2) => {
52515
- if ("getStorageId" in item2) {
52516
- const storageId = item2.getStorageId();
52533
+ this.items.list().forEach((item) => {
52534
+ if ("getStorageId" in item) {
52535
+ const storageId = item.getStorageId();
52517
52536
  if (storageId) {
52518
52537
  mediaIds.push(storageId);
52519
52538
  }
@@ -52523,7 +52542,7 @@ class BoardSelection {
52523
52542
  if (!canDuplicate) {
52524
52543
  return;
52525
52544
  }
52526
- const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
52545
+ const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item]) => item.itemType !== "Group"));
52527
52546
  this.board.duplicate(filteredItemMap);
52528
52547
  this.setContext("EditUnderPointer");
52529
52548
  }
@@ -52557,10 +52576,10 @@ class BoardSelection {
52557
52576
  lastAssistantMessageId
52558
52577
  };
52559
52578
  }
52560
- renderItemMbr(context, item2, customScale) {
52561
- const mbr = item2.getMbr();
52579
+ renderItemMbr(context, item, customScale) {
52580
+ const mbr = item.getMbr();
52562
52581
  mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
52563
- const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52582
+ const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
52564
52583
  mbr.borderColor = selectionColor;
52565
52584
  mbr.render(context);
52566
52585
  }
@@ -52576,8 +52595,8 @@ class BoardSelection {
52576
52595
  }
52577
52596
  if (!this.transformationRenderBlock) {
52578
52597
  if (this.shouldRenderItemsMbr) {
52579
- for (const item2 of this.items.list()) {
52580
- this.renderItemMbr(context, item2);
52598
+ for (const item of this.items.list()) {
52599
+ this.renderItemMbr(context, item);
52581
52600
  }
52582
52601
  }
52583
52602
  this.tool.render(context);
@@ -52589,7 +52608,7 @@ class BoardSelection {
52589
52608
  if (single && single instanceof AINode) {
52590
52609
  const contextItemsIds = single.getContextItems();
52591
52610
  if (contextItemsIds.length) {
52592
- const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
52611
+ const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
52593
52612
  contextItems.push(...newContextItems);
52594
52613
  }
52595
52614
  }
@@ -52607,15 +52626,15 @@ class BoardSelection {
52607
52626
  }
52608
52627
  }
52609
52628
  }
52610
- contextItems.forEach((item2) => {
52611
- if (item2 instanceof AINode) {
52612
- const path2 = item2.getPath();
52629
+ contextItems.forEach((item) => {
52630
+ if (item instanceof AINode) {
52631
+ const path2 = item.getPath();
52613
52632
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
52614
52633
  path2.setBorderWidth(2);
52615
52634
  path2.setBackgroundColor("none");
52616
52635
  path2.render(context);
52617
52636
  } else {
52618
- const itemRect = item2.getMbr();
52637
+ const itemRect = item.getMbr();
52619
52638
  itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
52620
52639
  itemRect.strokeWidth = 2;
52621
52640
  itemRect.render(context);
@@ -53116,16 +53135,16 @@ class Board {
53116
53135
  applyBoardOperation(op) {
53117
53136
  switch (op.method) {
53118
53137
  case "moveToZIndex": {
53119
- const item2 = this.index.getById(op.item);
53120
- if (!item2) {
53138
+ const item = this.index.getById(op.item);
53139
+ if (!item) {
53121
53140
  return;
53122
53141
  }
53123
- return this.index.moveToZIndex(item2, op.zIndex);
53142
+ return this.index.moveToZIndex(item, op.zIndex);
53124
53143
  }
53125
53144
  case "moveManyToZIndex": {
53126
53145
  for (const id in op.item) {
53127
- const item2 = this.items.getById(id);
53128
- if (!item2) {
53146
+ const item = this.items.getById(id);
53147
+ if (!item) {
53129
53148
  delete op.item.id;
53130
53149
  }
53131
53150
  }
@@ -53147,11 +53166,11 @@ class Board {
53147
53166
  }
53148
53167
  return this.index.moveSecondAfterFirst(first, second);
53149
53168
  case "bringToFront": {
53150
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53169
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53151
53170
  return this.index.bringManyToFront(items);
53152
53171
  }
53153
53172
  case "sendToBack": {
53154
- const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
53173
+ const items = op.item.map((item) => this.items.getById(item)).filter((item) => item !== undefined);
53155
53174
  return this.index.sendManyToBack(items);
53156
53175
  }
53157
53176
  case "add":
@@ -53175,82 +53194,82 @@ class Board {
53175
53194
  applyAddItems(op) {
53176
53195
  if (Array.isArray(op.item)) {
53177
53196
  const data = op.data;
53178
- const items = op.item.map((item3) => {
53179
- const created = this.createItem(item3, data[item3]);
53197
+ const items = op.item.map((item2) => {
53198
+ const created = this.createItem(item2, data[item2]);
53180
53199
  this.index.insert(created);
53181
53200
  return created;
53182
53201
  });
53183
- items.forEach((item3) => {
53184
- if (item3 instanceof Connector2 && data[item3.getId()]) {
53185
- const connectorData = data[item3.getId()];
53186
- item3.applyStartPoint(connectorData.startPoint);
53187
- item3.applyEndPoint(connectorData.endPoint);
53202
+ items.forEach((item2) => {
53203
+ if (item2 instanceof Connector2 && data[item2.getId()]) {
53204
+ const connectorData = data[item2.getId()];
53205
+ item2.applyStartPoint(connectorData.startPoint);
53206
+ item2.applyEndPoint(connectorData.endPoint);
53188
53207
  }
53189
53208
  });
53190
53209
  return;
53191
53210
  }
53192
- const item2 = this.createItem(op.item, op.data);
53193
- return this.index.insert(item2);
53211
+ const item = this.createItem(op.item, op.data);
53212
+ return this.index.insert(item);
53194
53213
  }
53195
53214
  applyAddLockedGroupOperation(op) {
53196
- const item2 = this.createItem(op.item, op.data);
53197
- const groupChildrenIds = item2.getChildrenIds();
53198
- this.index.insert(item2);
53215
+ const item = this.createItem(op.item, op.data);
53216
+ const groupChildrenIds = item.getChildrenIds();
53217
+ this.index.insert(item);
53199
53218
  const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
53200
53219
  if (lastChildrenId) {
53201
53220
  const zIndex = this.index.getZIndex(lastChildrenId) + 1;
53202
- this.index.moveToZIndex(item2, zIndex);
53221
+ this.index.moveToZIndex(item, zIndex);
53203
53222
  }
53204
- item2.getChildren().forEach((item3) => {
53205
- item3.transformation.isLocked = true;
53223
+ item.getChildren().forEach((item2) => {
53224
+ item2.transformation.isLocked = true;
53206
53225
  });
53207
- item2.transformation.isLocked = true;
53226
+ item.transformation.isLocked = true;
53208
53227
  }
53209
53228
  applyRemoveOperation(op) {
53210
53229
  const removedItems = [];
53211
- this.findItemAndApply(op.item, (item2) => {
53212
- this.index.remove(item2);
53213
- this.selection.remove(item2);
53214
- if (item2 instanceof Connector2) {
53215
- item2.clearObservedItems();
53230
+ this.findItemAndApply(op.item, (item) => {
53231
+ this.index.remove(item);
53232
+ this.selection.remove(item);
53233
+ if (item instanceof Connector2) {
53234
+ item.clearObservedItems();
53216
53235
  }
53217
- removedItems.push(item2);
53236
+ removedItems.push(item);
53218
53237
  });
53219
53238
  }
53220
53239
  applyRemoveLockedGroupOperation(op) {
53221
- const item2 = this.index.getById(op.item[0]);
53222
- if (!item2 || !(item2 instanceof Group)) {
53240
+ const item = this.index.getById(op.item[0]);
53241
+ if (!item || !(item instanceof Group)) {
53223
53242
  return;
53224
53243
  }
53225
- item2.getChildren().forEach((item3) => {
53226
- item3.transformation.isLocked = false;
53227
- item3.parent = "Board";
53244
+ item.getChildren().forEach((item2) => {
53245
+ item2.transformation.isLocked = false;
53246
+ item2.parent = "Board";
53228
53247
  });
53229
- item2.transformation.isLocked = false;
53248
+ item.transformation.isLocked = false;
53230
53249
  const removedItems = [];
53231
- this.findItemAndApply(op.item, (item3) => {
53232
- this.index.remove(item3);
53233
- this.selection.remove(item3);
53234
- removedItems.push(item3);
53250
+ this.findItemAndApply(op.item, (item2) => {
53251
+ this.index.remove(item2);
53252
+ this.selection.remove(item2);
53253
+ removedItems.push(item2);
53235
53254
  });
53236
53255
  }
53237
53256
  applyItemOperation(op) {
53238
53257
  if ("item" in op) {
53239
- this.findItemAndApply(op.item, (item2) => {
53240
- item2.apply(op);
53258
+ this.findItemAndApply(op.item, (item) => {
53259
+ item.apply(op);
53241
53260
  });
53242
53261
  }
53243
53262
  }
53244
- findItemAndApply(item2, apply) {
53245
- if (Array.isArray(item2)) {
53246
- for (const itemId of item2) {
53263
+ findItemAndApply(item, apply) {
53264
+ if (Array.isArray(item)) {
53265
+ for (const itemId of item) {
53247
53266
  const found = this.items.findById(itemId);
53248
53267
  if (found) {
53249
53268
  apply(found);
53250
53269
  }
53251
53270
  }
53252
53271
  } else {
53253
- const found = this.items.findById(item2);
53272
+ const found = this.items.findById(item);
53254
53273
  if (found) {
53255
53274
  apply(found);
53256
53275
  }
@@ -53259,9 +53278,9 @@ class Board {
53259
53278
  handleNesting(items) {
53260
53279
  const arrayed = Array.isArray(items) ? items : [items];
53261
53280
  const groupsMap = new Map;
53262
- arrayed.forEach((item2) => {
53263
- const itemCenter = item2.getMbr().getCenter();
53264
- const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
53281
+ arrayed.forEach((item) => {
53282
+ const itemCenter = item.getMbr().getCenter();
53283
+ const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item)).reduce((acc, groupItem2) => {
53265
53284
  if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
53266
53285
  acc = groupItem2;
53267
53286
  }
@@ -53271,7 +53290,7 @@ class Board {
53271
53290
  if (!groupsMap.has(groupItem)) {
53272
53291
  groupsMap.set(groupItem, []);
53273
53292
  }
53274
- groupsMap.get(groupItem)?.push(item2);
53293
+ groupsMap.get(groupItem)?.push(item);
53275
53294
  }
53276
53295
  });
53277
53296
  groupsMap.forEach((items2, group) => {
@@ -53292,13 +53311,13 @@ class Board {
53292
53311
  }
53293
53312
  return parser(el);
53294
53313
  }
53295
- add(item2, timeStamp) {
53314
+ add(item, timeStamp) {
53296
53315
  const id = this.getNewItemId();
53297
53316
  this.emit({
53298
53317
  class: "Board",
53299
53318
  method: "add",
53300
53319
  item: id,
53301
- data: item2.serialize(),
53320
+ data: item.serialize(),
53302
53321
  timeStamp
53303
53322
  });
53304
53323
  const newItem = this.items.getById(id);
@@ -53308,13 +53327,13 @@ class Board {
53308
53327
  this.handleNesting(newItem);
53309
53328
  return newItem;
53310
53329
  }
53311
- addLockedGroup(item2) {
53330
+ addLockedGroup(item) {
53312
53331
  const id = this.getNewItemId();
53313
53332
  this.emit({
53314
53333
  class: "Board",
53315
53334
  method: "addLockedGroup",
53316
53335
  item: id,
53317
- data: item2.serialize()
53336
+ data: item.serialize()
53318
53337
  });
53319
53338
  const newItem = this.items.getById(id);
53320
53339
  if (!newItem) {
@@ -53323,32 +53342,32 @@ class Board {
53323
53342
  this.handleNesting(newItem);
53324
53343
  return newItem;
53325
53344
  }
53326
- remove(item2, withConnectors = true) {
53345
+ remove(item, withConnectors = true) {
53327
53346
  let connectors = [];
53328
53347
  if (withConnectors) {
53329
- connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
53348
+ connectors = this.items.getLinkedConnectorsById(item.getId()).map((connector) => connector.getId());
53330
53349
  }
53331
- if ("onRemove" in item2) {
53332
- item2.onRemove();
53350
+ if ("onRemove" in item) {
53351
+ item.onRemove();
53333
53352
  }
53334
53353
  this.emit({
53335
53354
  class: "Board",
53336
53355
  method: "remove",
53337
- item: [item2.getId(), ...connectors]
53356
+ item: [item.getId(), ...connectors]
53338
53357
  });
53339
53358
  }
53340
- removeLockedGroup(item2) {
53359
+ removeLockedGroup(item) {
53341
53360
  this.emit({
53342
53361
  class: "Board",
53343
53362
  method: "removeLockedGroup",
53344
- item: [item2.getId()]
53363
+ item: [item.getId()]
53345
53364
  });
53346
53365
  }
53347
53366
  getByZIndex(index2) {
53348
53367
  return this.index.getByZIndex(index2);
53349
53368
  }
53350
- getZIndex(item2) {
53351
- return this.index.getZIndex(item2);
53369
+ getZIndex(item) {
53370
+ return this.index.getZIndex(item);
53352
53371
  }
53353
53372
  getLastZIndex() {
53354
53373
  return this.index.getLastZIndex();
@@ -53360,11 +53379,11 @@ class Board {
53360
53379
  item: items
53361
53380
  });
53362
53381
  }
53363
- moveToZIndex(item2, zIndex) {
53382
+ moveToZIndex(item, zIndex) {
53364
53383
  this.emit({
53365
53384
  class: "Board",
53366
53385
  method: "moveToZIndex",
53367
- item: item2.getId(),
53386
+ item: item.getId(),
53368
53387
  zIndex
53369
53388
  });
53370
53389
  }
@@ -53392,8 +53411,8 @@ class Board {
53392
53411
  this.emit({
53393
53412
  class: "Board",
53394
53413
  method: "bringToFront",
53395
- item: items.map((item2) => item2.getId()),
53396
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53414
+ item: items.map((item) => item.getId()),
53415
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53397
53416
  });
53398
53417
  }
53399
53418
  sendToBack(items) {
@@ -53404,8 +53423,8 @@ class Board {
53404
53423
  this.emit({
53405
53424
  class: "Board",
53406
53425
  method: "sendToBack",
53407
- item: items.map((item2) => item2.getId()),
53408
- prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
53426
+ item: items.map((item) => item.getId()),
53427
+ prevZIndex: Object.fromEntries(boardItems.map((item) => [item.getId(), boardItems.indexOf(item)]))
53409
53428
  });
53410
53429
  }
53411
53430
  copy() {
@@ -53482,7 +53501,7 @@ class Board {
53482
53501
  return added;
53483
53502
  });
53484
53503
  addedFrame.addChildItems(addedChildren);
53485
- parsedData.data.children = addedChildren.map((item2) => item2.getId());
53504
+ parsedData.data.children = addedChildren.map((item) => item.getId());
53486
53505
  idsMap[parsedData.data.id] = addedFrame.getId();
53487
53506
  } else {
53488
53507
  const added = this.add(this.createItem(this.getNewItemId(), parsedData));
@@ -53523,15 +53542,15 @@ class Board {
53523
53542
  const createdConnectors = {};
53524
53543
  const createdFrames = {};
53525
53544
  const addItem = (itemData) => {
53526
- const item2 = this.createItem(itemData.id, itemData);
53527
- if (item2 instanceof Connector2) {
53528
- createdConnectors[itemData.id] = { item: item2, itemData };
53545
+ const item = this.createItem(itemData.id, itemData);
53546
+ if (item instanceof Connector2) {
53547
+ createdConnectors[itemData.id] = { item, itemData };
53529
53548
  }
53530
- if (item2 instanceof Frame2) {
53531
- createdFrames[item2.getId()] = { item: item2, itemData };
53549
+ if (item instanceof Frame2) {
53550
+ createdFrames[item.getId()] = { item, itemData };
53532
53551
  }
53533
- this.index.insert(item2);
53534
- return item2;
53552
+ this.index.insert(item);
53553
+ return item;
53535
53554
  };
53536
53555
  for (const itemData of items) {
53537
53556
  if ("childrenMap" in itemData) {
@@ -53542,13 +53561,13 @@ class Board {
53542
53561
  }
53543
53562
  }
53544
53563
  for (const key in createdConnectors) {
53545
- const { item: item2, itemData } = createdConnectors[key];
53546
- item2.applyStartPoint(itemData.startPoint);
53547
- item2.applyEndPoint(itemData.endPoint);
53564
+ const { item, itemData } = createdConnectors[key];
53565
+ item.applyStartPoint(itemData.startPoint);
53566
+ item.applyEndPoint(itemData.endPoint);
53548
53567
  }
53549
53568
  for (const key in createdFrames) {
53550
- const { item: item2, itemData } = createdFrames[key];
53551
- item2.applyAddChildren(itemData.children);
53569
+ const { item, itemData } = createdFrames[key];
53570
+ item.applyAddChildren(itemData.children);
53552
53571
  }
53553
53572
  }
53554
53573
  deserialize(snapshot) {
@@ -53558,33 +53577,33 @@ class Board {
53558
53577
  const createdFrames = {};
53559
53578
  if (Array.isArray(items)) {
53560
53579
  for (const itemData of items) {
53561
- const item2 = this.createItem(itemData.id, itemData);
53562
- if (item2 instanceof Connector2) {
53563
- createdConnectors[itemData.id] = { item: item2, itemData };
53580
+ const item = this.createItem(itemData.id, itemData);
53581
+ if (item instanceof Connector2) {
53582
+ createdConnectors[itemData.id] = { item, itemData };
53564
53583
  }
53565
- if (item2 instanceof Frame2) {
53566
- createdFrames[item2.getId()] = { item: item2, itemData };
53584
+ if (item instanceof Frame2) {
53585
+ createdFrames[item.getId()] = { item, itemData };
53567
53586
  }
53568
- this.index.insert(item2);
53587
+ this.index.insert(item);
53569
53588
  }
53570
53589
  } else {
53571
53590
  for (const key in items) {
53572
53591
  const itemData = items[key];
53573
- const item2 = this.createItem(key, itemData);
53574
- if (item2 instanceof Connector2) {
53575
- createdConnectors[key] = { item: item2, itemData };
53592
+ const item = this.createItem(key, itemData);
53593
+ if (item instanceof Connector2) {
53594
+ createdConnectors[key] = { item, itemData };
53576
53595
  }
53577
- this.index.insert(item2);
53596
+ this.index.insert(item);
53578
53597
  }
53579
53598
  }
53580
53599
  for (const key in createdConnectors) {
53581
- const { item: item2, itemData } = createdConnectors[key];
53582
- item2.applyStartPoint(itemData.startPoint);
53583
- item2.applyEndPoint(itemData.endPoint);
53600
+ const { item, itemData } = createdConnectors[key];
53601
+ item.applyStartPoint(itemData.startPoint);
53602
+ item.applyEndPoint(itemData.endPoint);
53584
53603
  }
53585
53604
  for (const key in createdFrames) {
53586
- const { item: item2, itemData } = createdFrames[key];
53587
- item2.applyAddChildren(itemData.children);
53605
+ const { item, itemData } = createdFrames[key];
53606
+ item.applyAddChildren(itemData.children);
53588
53607
  }
53589
53608
  this.events?.log.deserialize(events);
53590
53609
  }
@@ -53822,7 +53841,7 @@ class Board {
53822
53841
  itemsMap: newMap,
53823
53842
  select: select2
53824
53843
  });
53825
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53844
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53826
53845
  this.handleNesting(items);
53827
53846
  this.selection.removeAll();
53828
53847
  this.selection.add(items);
@@ -53830,8 +53849,8 @@ class Board {
53830
53849
  return;
53831
53850
  }
53832
53851
  removeVoidComments() {
53833
- const voidComments = this.items.listAll().filter((item2) => {
53834
- return item2 instanceof Comment && !item2.getThread().length;
53852
+ const voidComments = this.items.listAll().filter((item) => {
53853
+ return item instanceof Comment && !item.getThread().length;
53835
53854
  });
53836
53855
  if (voidComments) {
53837
53856
  for (const comment2 of voidComments) {
@@ -53905,7 +53924,7 @@ class Board {
53905
53924
  }
53906
53925
  const mbr = this.selection.getMbr();
53907
53926
  const selectedItems = this.selection.items.list();
53908
- const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
53927
+ const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
53909
53928
  const right = mbr ? mbr.right : 0;
53910
53929
  const top = mbr ? mbr.top : 0;
53911
53930
  const width2 = mbr ? mbr.getWidth() / 10 : 10;
@@ -53947,7 +53966,7 @@ class Board {
53947
53966
  method: "duplicate",
53948
53967
  itemsMap: newMap
53949
53968
  });
53950
- const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
53969
+ const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
53951
53970
  this.handleNesting(items);
53952
53971
  this.selection.removeAll();
53953
53972
  this.selection.add(items);
@@ -53968,9 +53987,9 @@ class Board {
53968
53987
  if (data.itemType === "Frame") {
53969
53988
  data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
53970
53989
  }
53971
- const item2 = this.createItem(itemId, data);
53972
- this.index.insert(item2);
53973
- items.push(item2);
53990
+ const item = this.createItem(itemId, data);
53991
+ this.index.insert(item);
53992
+ items.push(item);
53974
53993
  };
53975
53994
  sortedItemsMap.map(([id, data]) => {
53976
53995
  if (data.itemType === "Connector") {
@@ -53985,8 +54004,8 @@ class Board {
53985
54004
  return;
53986
54005
  });
53987
54006
  }
53988
- isOnBoard(item2) {
53989
- return this.items.findById(item2.getId()) !== undefined;
54007
+ isOnBoard(item) {
54008
+ return this.items.findById(item.getId()) !== undefined;
53990
54009
  }
53991
54010
  getMaxFrameSerial() {
53992
54011
  const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
@@ -54032,7 +54051,7 @@ function areItemsTheSame(opA, opB) {
54032
54051
  const itemsB = Object.keys(opB.items);
54033
54052
  const setA = new Set(itemsA);
54034
54053
  const setB = new Set(itemsB);
54035
- const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
54054
+ const areArraysEqual = setA.size === setB.size && [...setA].every((item) => setB.has(item));
54036
54055
  return areArraysEqual;
54037
54056
  }
54038
54057
  if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
@@ -55691,9 +55710,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
55691
55710
  list6.applyUnconfirmed(filter);
55692
55711
  const hasAnyOverlap = (arr1, arr2) => {
55693
55712
  const lookup9 = new Set(arr1);
55694
- return arr2.some((item2) => lookup9.has(item2));
55713
+ return arr2.some((item) => lookup9.has(item));
55695
55714
  };
55696
- const currSelection = board.selection.list().map((item2) => item2.getId());
55715
+ const currSelection = board.selection.list().map((item) => item.getId());
55697
55716
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
55698
55717
  board.selection.applyMemoizedCaretOrRange();
55699
55718
  }
@@ -56015,27 +56034,27 @@ function handleAiChatMassage(message, board) {
56015
56034
  }
56016
56035
  }
56017
56036
  function handleChatChunk(chunk, board) {
56018
- const item2 = board.items.getById(chunk.itemId);
56037
+ const item = board.items.getById(chunk.itemId);
56019
56038
  switch (chunk.type) {
56020
56039
  case "chunk":
56021
- if (!item2 || item2.itemType !== "AINode") {
56040
+ if (!item || item.itemType !== "AINode") {
56022
56041
  return;
56023
56042
  }
56024
- item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56043
+ item.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
56025
56044
  break;
56026
56045
  case "done":
56027
- if (!item2 || item2.itemType !== "AINode") {
56046
+ if (!item || item.itemType !== "AINode") {
56028
56047
  board.aiGeneratingOnItem = undefined;
56029
56048
  return;
56030
56049
  }
56031
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56050
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56032
56051
  break;
56033
56052
  case "end":
56034
- if (!item2 || item2.itemType !== "AINode") {
56053
+ if (!item || item.itemType !== "AINode") {
56035
56054
  board.aiGeneratingOnItem = undefined;
56036
56055
  return;
56037
56056
  }
56038
- item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56057
+ item.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
56039
56058
  break;
56040
56059
  case "error":
56041
56060
  default:
@@ -56052,7 +56071,7 @@ function handleChatChunk(chunk, board) {
56052
56071
  if (board.aiGeneratingOnItem && generatingItem) {
56053
56072
  board.selection.removeAll();
56054
56073
  board.selection.add(generatingItem);
56055
- const rt = item2?.getRichText();
56074
+ const rt = item?.getRichText();
56056
56075
  if (generatingItem.itemType === "AINode" && rt) {
56057
56076
  const editor = rt.editor;
56058
56077
  editor.markdownProcessor.setStopProcessingMarkDownCb(null);
@@ -56185,14 +56204,14 @@ function handleImageGenerate(response, board) {
56185
56204
  console.error("Image generation error:", response.message);
56186
56205
  if (response.isExternalApiError) {
56187
56206
  if (board.aiGeneratingOnItem) {
56188
- const item2 = board.items.getById(board.aiGeneratingOnItem);
56189
- if (item2) {
56207
+ const item = board.items.getById(board.aiGeneratingOnItem);
56208
+ if (item) {
56190
56209
  board.selection.removeAll();
56191
- board.selection.add(item2);
56192
- const editor = item2.getRichText()?.editor;
56210
+ board.selection.add(item);
56211
+ const editor = item.getRichText()?.editor;
56193
56212
  editor?.clearText();
56194
56213
  editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
56195
- board.camera.zoomToFit(item2.getMbr(), 20);
56214
+ board.camera.zoomToFit(item.getMbr(), 20);
56196
56215
  }
56197
56216
  }
56198
56217
  } else {