@8btc/whiteboard 0.0.20-alpha.31 → 0.0.20-alpha.32

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.
Files changed (2) hide show
  1. package/dist/index.js +689 -689
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,11 +4,11 @@ var ai = (n) => {
4
4
  };
5
5
  var kn = (n, i, t) => i in n ? In(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
6
6
  var p = (n, i, t) => kn(n, typeof i != "symbol" ? i + "" : i, t), Fe = (n, i, t) => i.has(n) || ai("Cannot " + t);
7
- var r = (n, i, t) => (Fe(n, i, "read from private field"), t ? t.call(n) : i.get(n)), g = (n, i, t) => i.has(n) ? ai("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(n) : i.set(n, t), x = (n, i, t, e) => (Fe(n, i, "write to private field"), e ? e.call(n, t) : i.set(n, t), t), E = (n, i, t) => (Fe(n, i, "access private method"), t);
7
+ var r = (n, i, t) => (Fe(n, i, "read from private field"), t ? t.call(n) : i.get(n)), u = (n, i, t) => i.has(n) ? ai("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(n) : i.set(n, t), C = (n, i, t, e) => (Fe(n, i, "write to private field"), e ? e.call(n, t) : i.set(n, t), t), E = (n, i, t) => (Fe(n, i, "access private method"), t);
8
8
  import { jsxs as k, jsx as c, Fragment as Ie } from "react/jsx-runtime";
9
- import { useState as R, useEffect as Z, useRef as Ue, useMemo as St, forwardRef as $, createContext as Rn, isValidElement as li, version as $n, cloneElement as An, useContext as Fn, Fragment as Hn, useCallback as J, memo as ct } from "react";
9
+ import { useState as $, useEffect as U, useRef as Ue, useMemo as St, forwardRef as A, createContext as Rn, isValidElement as li, version as $n, cloneElement as An, useContext as Fn, Fragment as Hn, useCallback as Q, memo as dt } from "react";
10
10
  import M from "konva";
11
- import { N as b, R as N, I as Q } from "./const-BJHbPsA9.js";
11
+ import { N as b, R as N, I as tt } from "./const-BJHbPsA9.js";
12
12
  import Ln from "mitt";
13
13
  import { Editor as Dn } from "@tiptap/core";
14
14
  import Pn from "@tiptap/starter-kit";
@@ -28,42 +28,42 @@ import { useCurrentEditor as ts, useEditorState as es } from "@tiptap/react";
28
28
  import { FloatingDelayGroup as is, useMergeRefs as Ni, FloatingPortal as ns, useFloating as ss, offset as os, flip as rs, shift as as, autoUpdate as ls, useHover as hs, useFocus as cs, useDismiss as ds, useRole as gs, useInteractions as us } from "@floating-ui/react";
29
29
  import * as ie from "@radix-ui/react-popover";
30
30
  import { useHotkeys as Ti } from "react-hotkeys-hook";
31
- var T, S, tt, ne, se, oe, re, ae, le, he, ce, de, _i;
31
+ var T, S, et, ne, se, oe, re, ae, le, he, ce, de, _i;
32
32
  class ms {
33
33
  constructor(i, t) {
34
- g(this, de);
35
- g(this, T);
36
- g(this, S);
37
- g(this, tt, { x: 0, y: 0, scale: 1 });
34
+ u(this, de);
35
+ u(this, T);
36
+ u(this, S);
37
+ u(this, et, { x: 0, y: 0, scale: 1 });
38
38
  /**
39
39
  * 处理滚轮缩放和平移
40
40
  */
41
- g(this, ne, (i) => {
41
+ u(this, ne, (i) => {
42
42
  i.evt.preventDefault();
43
43
  const e = r(this, S).getPointerPosition();
44
44
  if (e)
45
45
  if (i.evt.ctrlKey) {
46
- const s = r(this, tt).scale, o = {
47
- x: (e.x - r(this, tt).x) / s,
48
- y: (e.y - r(this, tt).y) / s
49
- }, a = 1.01, h = i.evt.deltaY > 0 ? -1 : 1, l = Math.min(Math.abs(i.evt.deltaY), 10);
46
+ const s = r(this, et).scale, o = {
47
+ x: (e.x - r(this, et).x) / s,
48
+ y: (e.y - r(this, et).y) / s
49
+ }, a = 1.01, l = i.evt.deltaY > 0 ? -1 : 1, h = Math.min(Math.abs(i.evt.deltaY), 10);
50
50
  let d = s;
51
- for (let u = 0; u < l; u++)
52
- d = h > 0 ? d * a : d / a;
53
- const f = Math.max(0.1, Math.min(5, d)), m = {
54
- x: e.x - o.x * f,
55
- y: e.y - o.y * f
51
+ for (let g = 0; g < h; g++)
52
+ d = l > 0 ? d * a : d / a;
53
+ const m = Math.max(0.1, Math.min(5, d)), f = {
54
+ x: e.x - o.x * m,
55
+ y: e.y - o.y * m
56
56
  };
57
- r(this, T)._updateViewport({ x: m.x, y: m.y, scale: f });
57
+ r(this, T)._updateViewport({ x: f.x, y: f.y, scale: m });
58
58
  } else {
59
59
  const s = i.evt.shiftKey ? i.evt.deltaY : i.evt.deltaX, o = i.evt.shiftKey ? 0 : i.evt.deltaY;
60
60
  r(this, T)._updateViewport({
61
- x: r(this, tt).x - s,
62
- y: r(this, tt).y - o
61
+ x: r(this, et).x - s,
62
+ y: r(this, et).y - o
63
63
  });
64
64
  }
65
65
  });
66
- g(this, se, (i) => {
66
+ u(this, se, (i) => {
67
67
  const t = r(this, T).getToolType();
68
68
  if (i.evt.button !== 0 || t === "hand")
69
69
  return;
@@ -89,7 +89,7 @@ class ms {
89
89
  if (s) {
90
90
  const o = s.width(), a = s.height();
91
91
  if (o && a) {
92
- const h = {
92
+ const l = {
93
93
  x: s.x(),
94
94
  y: s.y(),
95
95
  width: o,
@@ -97,14 +97,14 @@ class ms {
97
97
  };
98
98
  r(this, T)._createDraftNode(t, {
99
99
  $_parentId: s.id(),
100
- $_bounds: h
100
+ $_bounds: l
101
101
  });
102
102
  }
103
103
  }
104
104
  }
105
105
  r(this, T)._selectNodes();
106
106
  });
107
- g(this, oe, () => {
107
+ u(this, oe, () => {
108
108
  const i = r(this, T).getState().toolType;
109
109
  if (i === "hand")
110
110
  return;
@@ -123,7 +123,7 @@ class ms {
123
123
  "arrow"
124
124
  ].includes(i) && r(this, T)._updateDraftNode();
125
125
  });
126
- g(this, re, () => {
126
+ u(this, re, () => {
127
127
  const i = r(this, T).getState().toolType;
128
128
  if (i !== "hand") {
129
129
  if (i === "select") {
@@ -141,25 +141,25 @@ class ms {
141
141
  ].includes(i) && r(this, T)._finalizeDraftNode(), i === "text" && r(this, T)._createTextNodeAtDrawingPosition("");
142
142
  }
143
143
  });
144
- g(this, ae, (i) => {
144
+ u(this, ae, (i) => {
145
145
  if (i.target !== r(this, S))
146
146
  return;
147
147
  const t = r(this, T).getState().toolType;
148
148
  t === "hand" ? this.setCursor("grabbing") : t === "select" && this.setCursor("all-scroll");
149
149
  });
150
- g(this, le, (i) => {
150
+ u(this, le, (i) => {
151
151
  i.target === r(this, S) && r(this, T)._updateViewport({
152
152
  x: r(this, S).x(),
153
153
  y: r(this, S).y()
154
154
  });
155
155
  });
156
- g(this, he, (i) => {
156
+ u(this, he, (i) => {
157
157
  i.target === r(this, S) && (r(this, T)._updateViewport({
158
158
  x: r(this, S).x(),
159
159
  y: r(this, S).y()
160
160
  }), this.resetCursor());
161
161
  });
162
- g(this, ce, (i) => {
162
+ u(this, ce, (i) => {
163
163
  if (i.evt.preventDefault(), r(this, T).getToolType() !== "select")
164
164
  return;
165
165
  const t = r(this, S).getPointerPosition(), e = i.target;
@@ -172,7 +172,7 @@ class ms {
172
172
  targetIds: Array.isArray(s) ? s.map((o) => o.id()) : s ? [s.id()] : []
173
173
  });
174
174
  });
175
- x(this, T, i), x(this, S, new M.Stage({
175
+ C(this, T, i), C(this, S, new M.Stage({
176
176
  id: "canvas-stage",
177
177
  container: t.container,
178
178
  width: t.width,
@@ -195,14 +195,14 @@ class ms {
195
195
  * 获取当前视口状态
196
196
  */
197
197
  getViewport() {
198
- return { ...r(this, tt) };
198
+ return { ...r(this, et) };
199
199
  }
200
200
  /**
201
201
  * 设置视口(包括位置、缩放和尺寸)
202
202
  */
203
203
  setViewport(i) {
204
- const t = { ...r(this, tt), ...i };
205
- x(this, tt, t), i.x !== void 0 && r(this, S).x(i.x), i.y !== void 0 && r(this, S).y(i.y), i.scale !== void 0 && (r(this, S).scaleX(i.scale), r(this, S).scaleY(i.scale));
204
+ const t = { ...r(this, et), ...i };
205
+ C(this, et, t), i.x !== void 0 && r(this, S).x(i.x), i.y !== void 0 && r(this, S).y(i.y), i.scale !== void 0 && (r(this, S).scaleX(i.scale), r(this, S).scaleY(i.scale));
206
206
  }
207
207
  /**
208
208
  * 设置是否可拖拽
@@ -235,7 +235,7 @@ class ms {
235
235
  r(this, S).destroy();
236
236
  }
237
237
  }
238
- T = new WeakMap(), S = new WeakMap(), tt = new WeakMap(), ne = new WeakMap(), se = new WeakMap(), oe = new WeakMap(), re = new WeakMap(), ae = new WeakMap(), le = new WeakMap(), he = new WeakMap(), ce = new WeakMap(), de = new WeakSet(), /**
238
+ T = new WeakMap(), S = new WeakMap(), et = new WeakMap(), ne = new WeakMap(), se = new WeakMap(), oe = new WeakMap(), re = new WeakMap(), ae = new WeakMap(), le = new WeakMap(), he = new WeakMap(), ce = new WeakMap(), de = new WeakSet(), /**
239
239
  * 设置事件监听器
240
240
  */
241
241
  _i = function() {
@@ -244,46 +244,46 @@ _i = function() {
244
244
  var Lt, _, ge, ue, me, fe, pe, ye, ve, Mi;
245
245
  class fs {
246
246
  constructor(i, t) {
247
- g(this, ve);
248
- g(this, Lt);
249
- g(this, _);
247
+ u(this, ve);
248
+ u(this, Lt);
249
+ u(this, _);
250
250
  /**
251
251
  * 处理 transformstart 事件
252
252
  */
253
- g(this, ge, () => {
253
+ u(this, ge, () => {
254
254
  this.emitPositionChange();
255
255
  });
256
256
  /**
257
257
  * 处理 transform 事件
258
258
  */
259
- g(this, ue, () => {
259
+ u(this, ue, () => {
260
260
  this.emitPositionChange();
261
261
  });
262
262
  /**
263
263
  * 处理 transformend 事件
264
264
  */
265
- g(this, me, () => {
265
+ u(this, me, () => {
266
266
  this.emitPositionChange();
267
267
  });
268
268
  /**
269
269
  * 处理 dragstart 事件
270
270
  */
271
- g(this, fe, () => {
271
+ u(this, fe, () => {
272
272
  this.emitPositionChange();
273
273
  });
274
274
  /**
275
275
  * 处理 dragmove 事件
276
276
  */
277
- g(this, pe, () => {
277
+ u(this, pe, () => {
278
278
  this.emitPositionChange();
279
279
  });
280
280
  /**
281
281
  * 处理 dragend 事件
282
282
  */
283
- g(this, ye, () => {
283
+ u(this, ye, () => {
284
284
  this.emitPositionChange();
285
285
  });
286
- x(this, Lt, i), x(this, _, new M.Transformer({
286
+ C(this, Lt, i), C(this, _, new M.Transformer({
287
287
  rotateEnabled: t?.rotateEnabled ?? !0,
288
288
  ignoreStroke: t?.ignoreStroke ?? !0,
289
289
  anchorSize: t?.anchorSize ?? 8,
@@ -385,85 +385,85 @@ Mi = function() {
385
385
  }
386
386
  });
387
387
  };
388
- var L, V, W, O;
388
+ var P, O, G, Z;
389
389
  class ps {
390
390
  // todo: 优化 selectedNodeIds 的存储和查询性能
391
391
  // private _selectedNodeIds: Set<string> = new Set();
392
392
  constructor(i) {
393
- g(this, L, []);
394
- g(this, V);
395
- g(this, W, []);
396
- g(this, O);
397
- x(this, V, i), x(this, O, Ln());
393
+ u(this, P, []);
394
+ u(this, O);
395
+ u(this, G, []);
396
+ u(this, Z);
397
+ C(this, O, i), C(this, Z, Ln());
398
398
  }
399
399
  /**
400
400
  * 获取当前状态
401
401
  */
402
402
  getState() {
403
- return { ...r(this, V) };
403
+ return { ...r(this, O) };
404
404
  }
405
405
  /**
406
406
  * 获取完整历史状态
407
407
  */
408
408
  getHistory() {
409
409
  return {
410
- past: [...r(this, L)],
411
- present: { ...r(this, V) },
412
- future: [...r(this, W)]
410
+ past: [...r(this, P)],
411
+ present: { ...r(this, O) },
412
+ future: [...r(this, G)]
413
413
  };
414
414
  }
415
415
  /**
416
416
  * 是否可以撤销
417
417
  */
418
418
  canUndo() {
419
- return r(this, L).length > 0;
419
+ return r(this, P).length > 0;
420
420
  }
421
421
  /**
422
422
  * 是否可以重做
423
423
  */
424
424
  canRedo() {
425
- return r(this, W).length > 0;
425
+ return r(this, G).length > 0;
426
426
  }
427
427
  /**
428
428
  * 订阅状态事件
429
429
  */
430
430
  on(i, t) {
431
- r(this, O).on(i, t);
431
+ r(this, Z).on(i, t);
432
432
  }
433
433
  /**
434
434
  * 取消订阅状态事件
435
435
  */
436
436
  off(i, t) {
437
- r(this, O).off(i, t);
437
+ r(this, Z).off(i, t);
438
438
  }
439
439
  /**
440
440
  * @internal
441
441
  * 发送事件
442
442
  */
443
443
  _emit(i, t) {
444
- r(this, O).emit(i, t);
444
+ r(this, Z).emit(i, t);
445
445
  }
446
446
  /**
447
447
  * 撤销操作
448
448
  */
449
449
  undo() {
450
- if (r(this, L).length === 0) return;
451
- const i = r(this, L)[r(this, L).length - 1], t = r(this, L).slice(0, r(this, L).length - 1);
452
- x(this, L, t), x(this, W, [r(this, V), ...r(this, W)]), x(this, V, i), this._renderCanvas(i), r(this, O).emit("state:undo", i), r(this, O).emit("state:change", i);
450
+ if (r(this, P).length === 0) return;
451
+ const i = r(this, P)[r(this, P).length - 1], t = r(this, P).slice(0, r(this, P).length - 1);
452
+ C(this, P, t), C(this, G, [r(this, O), ...r(this, G)]), C(this, O, i), this._renderCanvas(i), r(this, Z).emit("state:undo", i), r(this, Z).emit("state:change", i);
453
453
  }
454
454
  /**
455
455
  * 重做操作
456
456
  */
457
457
  redo() {
458
- if (r(this, W).length === 0) return;
459
- const i = r(this, W)[0], t = r(this, W).slice(1);
460
- x(this, L, [...r(this, L), r(this, V)]), x(this, W, t), x(this, V, i), this._renderCanvas(i), r(this, O).emit("state:redo", i), r(this, O).emit("state:change", i);
458
+ if (r(this, G).length === 0) return;
459
+ const i = r(this, G)[0], t = r(this, G).slice(1);
460
+ C(this, P, [...r(this, P), r(this, O)]), C(this, G, t), C(this, O, i), this._renderCanvas(i), r(this, Z).emit("state:redo", i), r(this, Z).emit("state:change", i);
461
461
  }
462
462
  /**
463
463
  * 重置历史记录
464
464
  */
465
465
  resetHistory() {
466
- x(this, L, []), x(this, W, []), r(this, O).emit("state:reset", r(this, V)), r(this, O).emit("state:change", r(this, V));
466
+ C(this, P, []), C(this, G, []), r(this, Z).emit("state:reset", r(this, O)), r(this, Z).emit("state:change", r(this, O));
467
467
  }
468
468
  /**
469
469
  * 更新状态
@@ -471,17 +471,17 @@ class ps {
471
471
  * @param addToHistory - 是否添加到历史记录
472
472
  */
473
473
  _updateState(i, t) {
474
- const e = { ...r(this, V), ...i };
475
- t && (x(this, L, [...r(this, L), r(this, V)]), x(this, W, [])), x(this, V, e), r(this, O).emit("state:change", e);
474
+ const e = { ...r(this, O), ...i };
475
+ t && (C(this, P, [...r(this, P), r(this, O)]), C(this, G, [])), C(this, O, e), r(this, Z).emit("state:change", e);
476
476
  }
477
477
  /**
478
478
  * 清理资源
479
479
  */
480
480
  _dispose() {
481
- r(this, O).all.clear();
481
+ r(this, Z).all.clear();
482
482
  }
483
483
  }
484
- L = new WeakMap(), V = new WeakMap(), W = new WeakMap(), O = new WeakMap();
484
+ P = new WeakMap(), O = new WeakMap(), G = new WeakMap(), Z = new WeakMap();
485
485
  class st {
486
486
  }
487
487
  const ys = {
@@ -583,9 +583,9 @@ function ki(n, i) {
583
583
  { x: 0, y: 0.25 }
584
584
  // 左上
585
585
  ]
586
- }[i].map((l) => ({
587
- x: Number((t + l.x * s).toFixed(2)) - n.x,
588
- y: Number((e + l.y * o).toFixed(2)) - n.y
586
+ }[i].map((h) => ({
587
+ x: Number((t + h.x * s).toFixed(2)) - n.x,
588
+ y: Number((e + h.y * o).toFixed(2)) - n.y
589
589
  }));
590
590
  }
591
591
  function hi(n, i) {
@@ -609,7 +609,7 @@ function hi(n, i) {
609
609
  };
610
610
  }
611
611
  function ci(n, i) {
612
- const t = n.width ?? Q.MIN_SIZE, e = n.height ?? Q.MIN_SIZE, s = ot(n, i);
612
+ const t = n.width ?? tt.MIN_SIZE, e = n.height ?? tt.MIN_SIZE, s = ot(n, i);
613
613
  if (!n.image) {
614
614
  const a = document.createElement("canvas");
615
615
  a.width = t, a.height = e, n.image = a;
@@ -622,7 +622,7 @@ function ci(n, i) {
622
622
  };
623
623
  }
624
624
  function di(n, i) {
625
- const t = n.width ?? Q.MIN_SIZE, e = n.height ?? Q.MIN_SIZE, s = ot(n, i);
625
+ const t = n.width ?? tt.MIN_SIZE, e = n.height ?? tt.MIN_SIZE, s = ot(n, i);
626
626
  if (!n.$_coverUrl) {
627
627
  const a = document.createElement("canvas");
628
628
  a.width = t, a.height = e, n.image = a;
@@ -734,7 +734,7 @@ function vi(n, i) {
734
734
  strokeWidth: 2,
735
735
  ...n,
736
736
  ...s,
737
- points: o.flatMap((h) => [h.x, h.y]),
737
+ points: o.flatMap((l) => [l.x, l.y]),
738
738
  closed: !0,
739
739
  name: `${b.nodeRoot} ${b.selectable} ${b.polygon}`,
740
740
  draggable: !0,
@@ -777,12 +777,12 @@ var Dt, Ce, $i;
777
777
  class ws extends st {
778
778
  constructor(t, e, s = !1) {
779
779
  super();
780
- g(this, Ce);
780
+ u(this, Ce);
781
781
  p(this, "core");
782
782
  p(this, "config");
783
783
  p(this, "element");
784
784
  p(this, "isDraft");
785
- g(this, Dt, ({ type: t }) => {
785
+ u(this, Dt, ({ type: t }) => {
786
786
  const e = t === "select";
787
787
  this.element.listening(e && (this.config.$_listening ?? !0));
788
788
  });
@@ -840,20 +840,20 @@ $i = function() {
840
840
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
841
841
  });
842
842
  };
843
- var ht, He, Pt, Bt, Ai, Le;
843
+ var ct, He, Pt, Bt, Ai, Le;
844
844
  class bs extends st {
845
845
  constructor(t, e, s = !1) {
846
846
  super();
847
- g(this, ht);
847
+ u(this, ct);
848
848
  p(this, "core");
849
849
  p(this, "config");
850
850
  p(this, "element");
851
851
  p(this, "isDraft");
852
- g(this, Pt, ({ type: t }) => {
852
+ u(this, Pt, ({ type: t }) => {
853
853
  const e = t === "select";
854
854
  this.element.listening(e && (this.config.$_listening ?? !0));
855
855
  });
856
- g(this, Bt, () => {
856
+ u(this, Bt, () => {
857
857
  const t = this.getElement().getLayer();
858
858
  if (!t) return;
859
859
  const e = t.find(
@@ -867,7 +867,7 @@ class bs extends st {
867
867
  !0
868
868
  );
869
869
  });
870
- this.core = t, this.config = ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, ht, He).call(this), E(this, ht, Ai).call(this, this.getElement());
870
+ this.core = t, this.config = ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, ct, He).call(this), E(this, ct, Ai).call(this, this.getElement());
871
871
  }
872
872
  getID() {
873
873
  return this.config.id;
@@ -898,7 +898,7 @@ class bs extends st {
898
898
  ...t
899
899
  },
900
900
  this.core.getTheme()
901
- ), delete this.config.image, this.getElement().setAttrs(this.config), t.$_imageUrl && t.$_imageUrl !== e.$_imageUrl && E(this, ht, He).call(this);
901
+ ), delete this.config.image, this.getElement().setAttrs(this.config), t.$_imageUrl && t.$_imageUrl !== e.$_imageUrl && E(this, ct, He).call(this);
902
902
  }
903
903
  /**
904
904
  * 销毁
@@ -913,7 +913,7 @@ class bs extends st {
913
913
  };
914
914
  }
915
915
  }
916
- ht = new WeakSet(), /**
916
+ ct = new WeakSet(), /**
917
917
  * 加载图片
918
918
  */
919
919
  He = function() {
@@ -926,7 +926,7 @@ He = function() {
926
926
  e.crossOrigin = "anonymous", e.src = t, e.onload = () => {
927
927
  this.getElement().image(e);
928
928
  const s = this.config.width ?? e.width, o = this.config.height ?? e.height;
929
- this.getElement().width(Math.max(s, Q.MIN_SIZE)), this.getElement().height(Math.max(o, Q.MIN_SIZE));
929
+ this.getElement().width(Math.max(s, tt.MIN_SIZE)), this.getElement().height(Math.max(o, tt.MIN_SIZE));
930
930
  }, e.onerror = () => {
931
931
  console.error("Failed to load image:", t);
932
932
  };
@@ -935,12 +935,12 @@ He = function() {
935
935
  */
936
936
  Ai = function(t) {
937
937
  this.core.on("toolType:change", r(this, Pt)), t.on("transform", (e) => {
938
- const s = e.target, o = Math.max(Q.MIN_SIZE, s.width() * s.scaleX()), a = Math.max(Q.MIN_SIZE, s.height() * s.scaleY());
939
- s.scale({ x: 1, y: 1 }), s.width(o), s.height(a), E(this, ht, Le).call(this);
938
+ const s = e.target, o = Math.max(tt.MIN_SIZE, s.width() * s.scaleX()), a = Math.max(tt.MIN_SIZE, s.height() * s.scaleY());
939
+ s.scale({ x: 1, y: 1 }), s.width(o), s.height(a), E(this, ct, Le).call(this);
940
940
  }), t.on("transformend", () => {
941
941
  this.syncConfigFromElement(), r(this, Bt).call(this);
942
942
  }), t.on("dragmove", () => {
943
- E(this, ht, Le).call(this);
943
+ E(this, ct, Le).call(this);
944
944
  }), t.on("dragend", () => {
945
945
  this.syncConfigFromElement(), r(this, Bt).call(this);
946
946
  });
@@ -950,46 +950,46 @@ Ai = function(t) {
950
950
  Le = function() {
951
951
  const t = this.getElement(), e = t.getLayer();
952
952
  if (!e) return;
953
- const s = t.x(), o = t.y(), a = t.width(), h = t.height(), l = e.find(
954
- (f) => f.hasName(this.config.id)
953
+ const s = t.x(), o = t.y(), a = t.width(), l = t.height(), h = e.find(
954
+ (m) => m.hasName(this.config.id)
955
955
  ), d = this.core.getState().nodes || [];
956
- l.forEach((f) => {
957
- const m = d.find((u) => u.id === f.id());
958
- if (m?.$_type === "image-marker" && m.$_relativeBox) {
959
- const { start: u, end: y } = m.$_relativeBox, w = s + u.ratioX * a, v = o + u.ratioY * h, I = s + y.ratioX * a, C = o + y.ratioY * h, B = Math.min(w, I), dt = Math.min(v, C), K = Math.abs(I - w), q = Math.abs(C - v);
960
- f.setAttrs({
961
- x: B,
962
- y: dt,
963
- width: K,
964
- height: q
965
- }), f.getChildren().forEach((z) => {
966
- z.getClassName() === "Rect" ? z.setAttrs({ width: K, height: q }) : z.getClassName() === "Group" && z.setAttrs({ x: K, y: q });
967
- }), xi(f)?.syncConfigFromElement();
956
+ h.forEach((m) => {
957
+ const f = d.find((g) => g.id === m.id());
958
+ if (f?.$_type === "image-marker" && f.$_relativeBox) {
959
+ const { start: g, end: y } = f.$_relativeBox, x = s + g.ratioX * a, v = o + g.ratioY * l, I = s + y.ratioX * a, w = o + y.ratioY * l, z = Math.min(x, I), X = Math.min(v, w), R = Math.abs(I - x), F = Math.abs(w - v);
960
+ m.setAttrs({
961
+ x: z,
962
+ y: X,
963
+ width: R,
964
+ height: F
965
+ }), m.getChildren().forEach((Y) => {
966
+ Y.getClassName() === "Rect" ? Y.setAttrs({ width: R, height: F }) : Y.getClassName() === "Group" && Y.setAttrs({ x: R, y: F });
967
+ }), xi(m)?.syncConfigFromElement();
968
968
  }
969
969
  });
970
970
  };
971
- var et, X, mt, at, _t, Mt, $t, Fi, Hi;
971
+ var at, K, mt, lt, _t, Mt, $t, Fi, Hi;
972
972
  class Es extends st {
973
973
  constructor(t, e, s = !1) {
974
974
  super();
975
- g(this, $t);
975
+ u(this, $t);
976
976
  p(this, "core");
977
977
  p(this, "config");
978
978
  p(this, "element");
979
979
  p(this, "isDraft");
980
- g(this, et);
981
- g(this, X);
982
- g(this, mt);
983
- g(this, at);
984
- g(this, _t);
985
- g(this, Mt);
980
+ u(this, at);
981
+ u(this, K);
982
+ u(this, mt);
983
+ u(this, lt);
984
+ u(this, _t);
985
+ u(this, Mt);
986
986
  this.core = t, this.config = gi(e, this.core.getTheme()), this.isDraft = s, this.element = this.createElement(), rt(this.element, this);
987
987
  const o = this.getElement();
988
- x(this, et, o.findOne(".rect")), x(this, X, o.findOne(".marker-group")), x(this, mt, r(this, X).findOne("Circle")), x(this, at, r(this, X).findOne("Text")), E(this, $t, Hi).call(this), x(this, _t, () => {
988
+ C(this, at, o.findOne(".rect")), C(this, K, o.findOne(".marker-group")), C(this, mt, r(this, K).findOne("Circle")), C(this, lt, r(this, K).findOne("Text")), E(this, $t, Hi).call(this), C(this, _t, () => {
989
989
  E(this, $t, Fi).call(this);
990
- }), this.core.on("viewport:scale:change", r(this, _t)), x(this, Mt, (a) => {
991
- const h = a.includes(this.config.id);
992
- this.setFocusState(h);
990
+ }), this.core.on("viewport:scale:change", r(this, _t)), C(this, Mt, (a) => {
991
+ const l = a.includes(this.config.id);
992
+ this.setFocusState(l);
993
993
  }), this.core.on("nodes:selected", r(this, Mt));
994
994
  }
995
995
  getID() {
@@ -1006,7 +1006,7 @@ class Es extends st {
1006
1006
  y: this.config.y,
1007
1007
  width: t,
1008
1008
  height: e
1009
- }), o = this.core.getStageScale(), a = 2 / o, h = [5 / o, 5 / o], l = N.CORNER_RADIUS / o, d = new M.Rect({
1009
+ }), o = this.core.getStageScale(), a = 2 / o, l = N.CORNER_RADIUS / o, h = new M.Rect({
1010
1010
  name: "rect",
1011
1011
  x: 0,
1012
1012
  y: 0,
@@ -1014,20 +1014,20 @@ class Es extends st {
1014
1014
  height: e,
1015
1015
  stroke: this.config.markerColor,
1016
1016
  strokeWidth: a,
1017
- dash: h,
1017
+ // dash: rectDash,
1018
1018
  cornerRadius: l,
1019
1019
  listening: !1
1020
- }), f = new M.Group({
1020
+ }), d = new M.Group({
1021
1021
  name: "marker-group",
1022
1022
  x: t,
1023
1023
  y: e,
1024
1024
  visible: !this.isDraft
1025
- }), m = 14 / o, u = 3 / o, y = 16 / o, w = new M.Circle({
1025
+ }), m = 14 / o, f = 3 / o, g = 16 / o, y = new M.Circle({
1026
1026
  radius: m,
1027
1027
  fill: this.config.markerColor,
1028
1028
  stroke: "white",
1029
- strokeWidth: u
1030
- }), v = new M.Text({
1029
+ strokeWidth: f
1030
+ }), x = new M.Text({
1031
1031
  x: -m,
1032
1032
  y: -m,
1033
1033
  width: m * 2,
@@ -1035,10 +1035,10 @@ class Es extends st {
1035
1035
  text: String(this.config.$_markerNumber || ""),
1036
1036
  align: "center",
1037
1037
  verticalAlign: "middle",
1038
- fontSize: y,
1038
+ fontSize: g,
1039
1039
  fill: "white"
1040
1040
  });
1041
- return f.add(w), f.add(v), s.add(d), s.add(f), s;
1041
+ return d.add(y), d.add(x), s.add(h), s.add(d), s;
1042
1042
  }
1043
1043
  /**
1044
1044
  * 获取 Konva.Group 实例
@@ -1060,7 +1060,7 @@ class Es extends st {
1060
1060
  const e = this.getElement();
1061
1061
  e.x(this.config.x), e.y(this.config.y);
1062
1062
  const s = Math.max(this.config.width ?? N.MIN_SIZE, N.MIN_SIZE), o = Math.max(this.config.height ?? N.MIN_SIZE, N.MIN_SIZE);
1063
- e.width(s), e.height(o), r(this, et).width(s), r(this, et).height(o), r(this, X).x(s), r(this, X).y(o), t.markerColor && (r(this, et).stroke(t.markerColor), r(this, mt).fill(t.markerColor)), t.$_markerNumber !== void 0 && r(this, at).text(String(t.$_markerNumber));
1063
+ e.width(s), e.height(o), r(this, at).width(s), r(this, at).height(o), r(this, K).x(s), r(this, K).y(o), t.markerColor && (r(this, at).stroke(t.markerColor), r(this, mt).fill(t.markerColor)), t.$_markerNumber !== void 0 && r(this, lt).text(String(t.$_markerNumber));
1064
1064
  }
1065
1065
  /**
1066
1066
  * 销毁
@@ -1073,7 +1073,7 @@ class Es extends st {
1073
1073
  */
1074
1074
  setFocusState(t) {
1075
1075
  const e = this.core.getStageScale(), s = t ? 4 / e : 3 / e, o = t ? 1.2 : 1;
1076
- r(this, et).strokeWidth(s), r(this, mt).strokeWidth(s), r(this, X).scaleX(o), r(this, X).scaleY(o);
1076
+ r(this, at).strokeWidth(s), r(this, mt).strokeWidth(s), r(this, K).scaleX(o), r(this, K).scaleY(o);
1077
1077
  }
1078
1078
  syncConfigFromElement() {
1079
1079
  const t = this.getElement();
@@ -1086,22 +1086,22 @@ class Es extends st {
1086
1086
  };
1087
1087
  }
1088
1088
  }
1089
- et = new WeakMap(), X = new WeakMap(), mt = new WeakMap(), at = new WeakMap(), _t = new WeakMap(), Mt = new WeakMap(), $t = new WeakSet(), /**
1089
+ at = new WeakMap(), K = new WeakMap(), mt = new WeakMap(), lt = new WeakMap(), _t = new WeakMap(), Mt = new WeakMap(), $t = new WeakSet(), /**
1090
1090
  * 更新标记点的缩放以保持视觉大小不变
1091
1091
  */
1092
1092
  Fi = function() {
1093
- const t = this.core.getStageScale(), e = 14 / t, s = 3 / t, o = 16 / t, a = 3 / t, h = [5 / t, 5 / t], l = N.CORNER_RADIUS / t;
1094
- r(this, et).strokeWidth(a), r(this, et).dash(h), r(this, et).cornerRadius(l), r(this, mt).radius(e), r(this, mt).strokeWidth(s), r(this, at).x(-e), r(this, at).y(-e), r(this, at).width(e * 2), r(this, at).height(e * 2), r(this, at).fontSize(o);
1093
+ const t = this.core.getStageScale(), e = 14 / t, s = 3 / t, o = 16 / t, a = 3 / t, l = N.CORNER_RADIUS / t;
1094
+ r(this, at).strokeWidth(a), r(this, at).cornerRadius(l), r(this, mt).radius(e), r(this, mt).strokeWidth(s), r(this, lt).x(-e), r(this, lt).y(-e), r(this, lt).width(e * 2), r(this, lt).height(e * 2), r(this, lt).fontSize(o);
1095
1095
  }, /**
1096
1096
  * 设置事件处理器
1097
1097
  */
1098
1098
  Hi = function() {
1099
- r(this, X).on("pointerover", () => {
1099
+ r(this, K).on("pointerover", () => {
1100
1100
  this.setFocusState(!0), this.core._setCursor("pointer");
1101
- }), r(this, X).on("pointerout", () => {
1101
+ }), r(this, K).on("pointerout", () => {
1102
1102
  const e = (this.core.getState().selectedNodeIds || []).includes(this.config.id);
1103
1103
  this.setFocusState(e), this.core._resetCursor();
1104
- }), r(this, X).on("pointerdown", () => {
1104
+ }), r(this, K).on("pointerdown", () => {
1105
1105
  this.core._selectNodes([this.config.id]);
1106
1106
  });
1107
1107
  };
@@ -1109,17 +1109,17 @@ var gt, Vt, xe, Li;
1109
1109
  class Ss extends st {
1110
1110
  constructor(t, e, s = !1) {
1111
1111
  super();
1112
- g(this, xe);
1112
+ u(this, xe);
1113
1113
  p(this, "core");
1114
1114
  p(this, "config");
1115
1115
  p(this, "element");
1116
1116
  p(this, "isDraft");
1117
1117
  p(this, "htmlElement");
1118
- g(this, gt, () => {
1118
+ u(this, gt, () => {
1119
1119
  const t = this.element.getClientRect();
1120
1120
  this.htmlElement.style.left = `${t.x}px`, this.htmlElement.style.top = `${t.y}px`, this.htmlElement.style.width = `${t.width}px`, this.htmlElement.style.height = `${t.height}px`;
1121
1121
  });
1122
- g(this, Vt, ({ type: t }) => {
1122
+ u(this, Vt, ({ type: t }) => {
1123
1123
  const e = t === "select";
1124
1124
  this.element.listening(e && (this.config.$_listening ?? !0));
1125
1125
  });
@@ -1185,47 +1185,47 @@ var Ot, we, be, Di;
1185
1185
  class Ns extends st {
1186
1186
  constructor(t, e, s = !1) {
1187
1187
  super();
1188
- g(this, be);
1188
+ u(this, be);
1189
1189
  p(this, "core");
1190
1190
  p(this, "config");
1191
1191
  p(this, "element");
1192
1192
  p(this, "isDraft");
1193
1193
  p(this, "rect");
1194
- g(this, Ot, ({ type: t }) => {
1194
+ u(this, Ot, ({ type: t }) => {
1195
1195
  const e = t === "select";
1196
1196
  this.element.listening(e && (this.config.$_listening ?? !0));
1197
1197
  });
1198
1198
  /**
1199
1199
  * 编辑文字
1200
1200
  */
1201
- g(this, we, () => {
1201
+ u(this, we, () => {
1202
1202
  const t = this.element, e = this.core.getCanvasTransformer(), s = t.getClientRect(), o = document.createElement("textarea");
1203
1203
  this.core.getStage().getContent().appendChild(o), o.name = "text-editor", o.draggable = !1, o.value = t.text(), o.style.position = "absolute", o.style.top = s.y + "px", o.style.left = s.x + "px", o.style.minWidth = "2px", o.style.fieldSizing = "content", o.style.whiteSpace = "nowrap", o.style.height = t.height() + "px", o.style.fontSize = t.fontSize() + "px", o.style.border = "none", o.style.padding = "0px", o.style.margin = "0px", o.style.overflow = "hidden", o.style.background = "none", o.style.outline = "none", o.style.resize = "none", o.style.lineHeight = t.lineHeight().toString(), o.style.fontFamily = t.fontFamily(), o.style.transformOrigin = "left top", o.style.textAlign = t.align(), o.style.color = t.fill().toString();
1204
1204
  const a = t.rotation();
1205
- let h = "";
1206
- a && (h += "rotateZ(" + a + "deg)"), o.style.transform = h + `scale(${t.getAbsoluteScale().x})`, o.focus();
1207
- const l = () => {
1208
- this.core.off("viewport:change", f), o.parentNode?.removeChild(o), window.removeEventListener("click", d), window.removeEventListener("touchstart", d), t.show(), e.getTransformer().show(), e.getTransformer().forceUpdate();
1205
+ let l = "";
1206
+ a && (l += "rotateZ(" + a + "deg)"), o.style.transform = l + `scale(${t.getAbsoluteScale().x})`, o.focus();
1207
+ const h = () => {
1208
+ this.core.off("viewport:change", m), o.parentNode?.removeChild(o), window.removeEventListener("click", d), window.removeEventListener("touchstart", d), t.show(), e.getTransformer().show(), e.getTransformer().forceUpdate();
1209
1209
  };
1210
- o.addEventListener("keydown", function(m) {
1211
- if (m.key === "Escape") {
1212
- const u = o.value;
1213
- t.text(o.value), l(), u.trim() || t.destroy();
1210
+ o.addEventListener("keydown", function(f) {
1211
+ if (f.key === "Escape") {
1212
+ const g = o.value;
1213
+ t.text(o.value), h(), g.trim() || t.destroy();
1214
1214
  }
1215
1215
  }), o.addEventListener("keydown", function() {
1216
1216
  o.style.height = "auto", o.style.height = o.scrollHeight + t.fontSize() * t.lineHeight() + "px";
1217
1217
  });
1218
- const d = (m) => {
1219
- m.target !== o && (t.text(o.value), l());
1220
- }, f = () => {
1221
- const m = t.getClientRect();
1222
- o.style.top = m.y + "px", o.style.left = m.x + "px";
1223
- const u = t.rotation();
1218
+ const d = (f) => {
1219
+ f.target !== o && (t.text(o.value), h());
1220
+ }, m = () => {
1221
+ const f = t.getClientRect();
1222
+ o.style.top = f.y + "px", o.style.left = f.x + "px";
1223
+ const g = t.rotation();
1224
1224
  let y = "";
1225
- u && (y += "rotateZ(" + u + "deg)"), o.style.transform = y + `scale(${t.getAbsoluteScale().x})`;
1225
+ g && (y += "rotateZ(" + g + "deg)"), o.style.transform = y + `scale(${t.getAbsoluteScale().x})`;
1226
1226
  };
1227
1227
  setTimeout(() => {
1228
- this.core.on("viewport:change", f), window.addEventListener("click", d), window.addEventListener("touchstart", d);
1228
+ this.core.on("viewport:change", m), window.addEventListener("click", d), window.addEventListener("touchstart", d);
1229
1229
  });
1230
1230
  });
1231
1231
  this.core = t, this.config = mi(e, this.core.getTheme()), this.element = this.createElement(), this.rect = new M.Rect(this.config), rt(this.element, this), this.isDraft = s, E(this, be, Di).call(this), setTimeout(() => {
@@ -1288,7 +1288,7 @@ var It, ft, Ee, Zt, Ut, zt, Wt, Se, Pi;
1288
1288
  class Ts extends st {
1289
1289
  constructor(t, e, s = !1) {
1290
1290
  super();
1291
- g(this, Se);
1291
+ u(this, Se);
1292
1292
  p(this, "core");
1293
1293
  p(this, "config");
1294
1294
  p(this, "element");
@@ -1317,7 +1317,7 @@ class Ts extends st {
1317
1317
  window.addEventListener("click", r(this, Wt));
1318
1318
  }), window.addEventListener("keydown", r(this, zt));
1319
1319
  });
1320
- g(this, It, async () => {
1320
+ u(this, It, async () => {
1321
1321
  const t = this.htmlEditorElement.getBoundingClientRect();
1322
1322
  if (t.width === 0 || t.height === 0)
1323
1323
  return;
@@ -1348,11 +1348,11 @@ class Ts extends st {
1348
1348
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !1);
1349
1349
  }));
1350
1350
  });
1351
- g(this, ft, () => {
1351
+ u(this, ft, () => {
1352
1352
  const t = this.element.getClientRect();
1353
1353
  this.htmlElement.style.left = `${t.x}px`, this.htmlElement.style.top = `${t.y}px`, this.config.lockX ? this.htmlEditorElement.style.width = `${this.element.width() / this.config.htmlScale * this.config.scaleWhenCreate}px` : this.htmlEditorElement.style.width = "max-content", this.htmlEditorElement.style.transform = `scale(${this.config.htmlScale})`;
1354
1354
  });
1355
- g(this, Ee, () => {
1355
+ u(this, Ee, () => {
1356
1356
  this.resizeObserver = new ResizeObserver((t) => {
1357
1357
  for (const e of t) {
1358
1358
  let s = !1;
@@ -1363,18 +1363,18 @@ class Ts extends st {
1363
1363
  }
1364
1364
  }), this.resizeObserver.observe(this.htmlEditorElement);
1365
1365
  });
1366
- g(this, Zt, ({ type: t }) => {
1366
+ u(this, Zt, ({ type: t }) => {
1367
1367
  const e = t === "select";
1368
1368
  this.element.listening(e && (this.config.$_listening ?? !0));
1369
1369
  });
1370
- g(this, Ut, (t) => {
1370
+ u(this, Ut, (t) => {
1371
1371
  const e = this.element.getClientRect();
1372
1372
  this.htmlElement.style.left = `${e.x}px`, this.htmlElement.style.top = `${e.y}px`, this.htmlElement.style.transform = `scale(${this.core.getState().viewport.scale / this.config.scaleWhenCreate})`;
1373
1373
  });
1374
- g(this, zt, (t) => {
1374
+ u(this, zt, (t) => {
1375
1375
  t.key === "Escape" && this.detachEditor();
1376
1376
  });
1377
- g(this, Wt, (t) => {
1377
+ u(this, Wt, (t) => {
1378
1378
  const e = t.target;
1379
1379
  this.htmlElement.contains(e) || this.detachEditor();
1380
1380
  });
@@ -1450,7 +1450,7 @@ var Et, De, Xt, Yt, Bi;
1450
1450
  class _s extends st {
1451
1451
  constructor(t, e, s = !1) {
1452
1452
  super();
1453
- g(this, Et);
1453
+ u(this, Et);
1454
1454
  p(this, "core");
1455
1455
  p(this, "config");
1456
1456
  p(this, "element");
@@ -1458,16 +1458,16 @@ class _s extends st {
1458
1458
  p(this, "imgCover");
1459
1459
  p(this, "playIcon");
1460
1460
  p(this, "isDraft");
1461
- g(this, Xt, ({ type: t }) => {
1461
+ u(this, Xt, ({ type: t }) => {
1462
1462
  const e = t === "select";
1463
1463
  this.element.listening(e && (this.config.$_listening ?? !0));
1464
1464
  });
1465
- g(this, Yt, () => {
1465
+ u(this, Yt, () => {
1466
1466
  this.getElement().getLayer() && this.core._rebuildStateAfterNodeChange([this], !0);
1467
1467
  });
1468
1468
  this.core = t, this.config = di(e, this.core.getTheme());
1469
- const { group: o, image: a, imgCover: h, playIcon: l } = this.createElement();
1470
- this.element = o, this.cover = a, this.imgCover = h, this.playIcon = l, this.element = o, rt(this.element, this), this.isDraft = s, E(this, Et, De).call(this), E(this, Et, Bi).call(this, this.getElement());
1469
+ const { group: o, image: a, imgCover: l, playIcon: h } = this.createElement();
1470
+ this.element = o, this.cover = a, this.imgCover = l, this.playIcon = h, this.element = o, rt(this.element, this), this.isDraft = s, E(this, Et, De).call(this), E(this, Et, Bi).call(this, this.getElement());
1471
1471
  }
1472
1472
  getID() {
1473
1473
  return this.config.id;
@@ -1566,7 +1566,7 @@ De = function() {
1566
1566
  e.crossOrigin = "anonymous", e.src = t, e.onload = () => {
1567
1567
  this.cover.image(e);
1568
1568
  let s = this.config.width ?? e.width, o = this.config.height ?? e.height;
1569
- s = Math.max(s, Q.MIN_SIZE), o = Math.max(o, Q.MIN_SIZE), this.cover.width(s), this.cover.height(o), this.imgCover.width(s), this.imgCover.height(o), this.playIcon.x(s / 2), this.playIcon.y(o / 2);
1569
+ s = Math.max(s, tt.MIN_SIZE), o = Math.max(o, tt.MIN_SIZE), this.cover.width(s), this.cover.height(o), this.imgCover.width(s), this.imgCover.height(o), this.playIcon.x(s / 2), this.playIcon.y(o / 2);
1570
1570
  }, e.onerror = () => {
1571
1571
  console.error("Failed to load image:", t);
1572
1572
  };
@@ -1575,8 +1575,8 @@ De = function() {
1575
1575
  */
1576
1576
  Bi = function(t) {
1577
1577
  this.core.on("toolType:change", r(this, Xt)), t.on("transform", (e) => {
1578
- const s = e.target, o = Math.max(Q.MIN_SIZE, this.cover.width() * s.scaleX()), a = Math.max(
1579
- Q.MIN_SIZE,
1578
+ const s = e.target, o = Math.max(tt.MIN_SIZE, this.cover.width() * s.scaleX()), a = Math.max(
1579
+ tt.MIN_SIZE,
1580
1580
  this.cover.height() * s.scaleY()
1581
1581
  );
1582
1582
  this.cover.width(o), this.cover.height(a), this.imgCover.width(o), this.imgCover.height(a), this.playIcon.x(o / 2), this.playIcon.y(a / 2), t.scale({ x: 1, y: 1 });
@@ -1590,12 +1590,12 @@ var Gt, Ne, Vi;
1590
1590
  class Ms extends st {
1591
1591
  constructor(t, e, s = !1) {
1592
1592
  super();
1593
- g(this, Ne);
1593
+ u(this, Ne);
1594
1594
  p(this, "core");
1595
1595
  p(this, "config");
1596
1596
  p(this, "element");
1597
1597
  p(this, "isDraft");
1598
- g(this, Gt, ({ type: t }) => {
1598
+ u(this, Gt, ({ type: t }) => {
1599
1599
  const e = t === "select";
1600
1600
  this.element.listening(e && (this.config.$_listening ?? !0));
1601
1601
  });
@@ -1664,12 +1664,12 @@ var Kt, Te, Oi;
1664
1664
  class ks extends st {
1665
1665
  constructor(t, e, s = !1) {
1666
1666
  super();
1667
- g(this, Te);
1667
+ u(this, Te);
1668
1668
  p(this, "core");
1669
1669
  p(this, "config");
1670
1670
  p(this, "element");
1671
1671
  p(this, "isDraft");
1672
- g(this, Kt, ({ type: t }) => {
1672
+ u(this, Kt, ({ type: t }) => {
1673
1673
  const e = t === "select";
1674
1674
  this.element.listening(e && (this.config.$_listening ?? !0));
1675
1675
  });
@@ -1737,12 +1737,12 @@ var qt, _e, Zi;
1737
1737
  class $s extends st {
1738
1738
  constructor(t, e, s = !1) {
1739
1739
  super();
1740
- g(this, _e);
1740
+ u(this, _e);
1741
1741
  p(this, "core");
1742
1742
  p(this, "config");
1743
1743
  p(this, "element");
1744
1744
  p(this, "isDraft");
1745
- g(this, qt, ({ type: t }) => {
1745
+ u(this, qt, ({ type: t }) => {
1746
1746
  const e = t === "select";
1747
1747
  this.element.listening(e && (this.config.$_listening ?? !0));
1748
1748
  });
@@ -1794,35 +1794,35 @@ Zi = function() {
1794
1794
  this.core.on("toolType:change", r(this, qt)), t.on("transform", (e) => {
1795
1795
  const s = e.target, { width: o, height: a } = Rs(s);
1796
1796
  s.scale({ x: 1, y: 1 }), s.width(o), s.height(a);
1797
- const h = ki(
1797
+ const l = ki(
1798
1798
  { x: s.x(), y: s.y(), width: o, height: a },
1799
1799
  this.config.$_shape
1800
1800
  );
1801
- s.points(h.flatMap((l) => [l.x, l.y]));
1801
+ s.points(l.flatMap((h) => [h.x, h.y]));
1802
1802
  }), t.on("transformend", (e) => {
1803
1803
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1804
1804
  }), t.on("dragend", (e) => {
1805
1805
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1806
1806
  });
1807
1807
  };
1808
- var A, F, wt, bt, P, Ui, Nt, zi, Wi, jt, Xi;
1808
+ var H, L, wt, bt, V, Ui, Nt, zi, Wi, jt, Xi;
1809
1809
  class As extends st {
1810
1810
  constructor(t, e, s = !1) {
1811
1811
  super();
1812
- g(this, P);
1812
+ u(this, V);
1813
1813
  p(this, "core");
1814
1814
  p(this, "config");
1815
1815
  p(this, "element");
1816
1816
  p(this, "isDraft");
1817
- g(this, A, null);
1818
- g(this, F, null);
1819
- g(this, wt, null);
1820
- g(this, bt, null);
1821
- g(this, jt, ({ type: t }) => {
1817
+ u(this, H, null);
1818
+ u(this, L, null);
1819
+ u(this, wt, null);
1820
+ u(this, bt, null);
1821
+ u(this, jt, ({ type: t }) => {
1822
1822
  const e = t === "select";
1823
1823
  this.element.listening(e && (this.config.$_listening ?? !0));
1824
1824
  });
1825
- this.core = t, this.config = Ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, P, Ui).call(this), E(this, P, Xi).call(this);
1825
+ this.core = t, this.config = Ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, V, Ui).call(this), E(this, V, Xi).call(this);
1826
1826
  }
1827
1827
  getID() {
1828
1828
  return this.config.id;
@@ -1853,23 +1853,23 @@ class As extends st {
1853
1853
  ...t
1854
1854
  },
1855
1855
  this.core.getTheme()
1856
- ), this.getElement().setAttrs(this.config), E(this, P, Nt).call(this);
1856
+ ), this.getElement().setAttrs(this.config), E(this, V, Nt).call(this);
1857
1857
  }
1858
1858
  /**
1859
1859
  * 销毁
1860
1860
  */
1861
1861
  destroy() {
1862
- this.core.off("toolType:change", r(this, jt)), r(this, bt) && this.core.off("nodes:selected", r(this, bt)), r(this, wt) && this.core.off("viewport:scale:change", r(this, wt)), r(this, A)?.destroy(), r(this, F)?.destroy(), this.element.destroy();
1862
+ this.core.off("toolType:change", r(this, jt)), r(this, bt) && this.core.off("nodes:selected", r(this, bt)), r(this, wt) && this.core.off("viewport:scale:change", r(this, wt)), r(this, H)?.destroy(), r(this, L)?.destroy(), this.element.destroy();
1863
1863
  }
1864
1864
  }
1865
- A = new WeakMap(), F = new WeakMap(), wt = new WeakMap(), bt = new WeakMap(), P = new WeakSet(), /**
1865
+ H = new WeakMap(), L = new WeakMap(), wt = new WeakMap(), bt = new WeakMap(), V = new WeakSet(), /**
1866
1866
  * 创建起点和终点的控制锚点
1867
1867
  */
1868
1868
  Ui = function() {
1869
1869
  const t = this.core.getMainLayer();
1870
1870
  if (!t) return;
1871
1871
  const e = this.core.getStageScale(), s = 6 / e, o = 2 / e;
1872
- x(this, A, new M.Circle({
1872
+ C(this, H, new M.Circle({
1873
1873
  radius: s,
1874
1874
  fill: "white",
1875
1875
  stroke: "#1976d2",
@@ -1877,7 +1877,7 @@ Ui = function() {
1877
1877
  draggable: !0,
1878
1878
  visible: !1,
1879
1879
  name: "arrow-anchor"
1880
- })), x(this, F, new M.Circle({
1880
+ })), C(this, L, new M.Circle({
1881
1881
  radius: s,
1882
1882
  fill: "white",
1883
1883
  stroke: "#1976d2",
@@ -1885,33 +1885,33 @@ Ui = function() {
1885
1885
  draggable: !0,
1886
1886
  visible: !1,
1887
1887
  name: "arrow-anchor"
1888
- })), t.add(r(this, A)), t.add(r(this, F)), E(this, P, Nt).call(this), r(this, A).on("dragmove", () => {
1888
+ })), t.add(r(this, H)), t.add(r(this, L)), E(this, V, Nt).call(this), r(this, H).on("dragmove", () => {
1889
1889
  const a = [...this.element.points()];
1890
1890
  if (a.length < 4) return;
1891
- const h = this.element, l = r(this, A).position();
1892
- a[0] = l.x - h.x(), a[1] = l.y - h.y(), h.points(a), this.core.getCanvasTransformer().emitPositionChange();
1893
- }), r(this, A).on("dragend", () => {
1891
+ const l = this.element, h = r(this, H).position();
1892
+ a[0] = h.x - l.x(), a[1] = h.y - l.y(), l.points(a), this.core.getCanvasTransformer().emitPositionChange();
1893
+ }), r(this, H).on("dragend", () => {
1894
1894
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1895
- }), r(this, F).on("dragmove", () => {
1895
+ }), r(this, L).on("dragmove", () => {
1896
1896
  const a = [...this.element.points()];
1897
1897
  if (a.length < 4) return;
1898
- const h = this.element, l = r(this, F).position();
1899
- a[a.length - 2] = l.x - h.x(), a[a.length - 1] = l.y - h.y(), h.points(a), this.core.getCanvasTransformer().emitPositionChange();
1900
- }), r(this, F).on("dragend", () => {
1898
+ const l = this.element, h = r(this, L).position();
1899
+ a[a.length - 2] = h.x - l.x(), a[a.length - 1] = h.y - l.y(), l.points(a), this.core.getCanvasTransformer().emitPositionChange();
1900
+ }), r(this, L).on("dragend", () => {
1901
1901
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1902
1902
  });
1903
1903
  }, /**
1904
1904
  * 更新锚点位置
1905
1905
  */
1906
1906
  Nt = function() {
1907
- if (!r(this, A) || !r(this, F)) return;
1907
+ if (!r(this, H) || !r(this, L)) return;
1908
1908
  const t = this.element.points();
1909
1909
  if (t.length < 4) return;
1910
1910
  const e = this.element, s = e.x(), o = e.y();
1911
- r(this, A).position({
1911
+ r(this, H).position({
1912
1912
  x: s + t[0],
1913
1913
  y: o + t[1]
1914
- }), r(this, F).position({
1914
+ }), r(this, L).position({
1915
1915
  x: s + t[t.length - 2],
1916
1916
  y: o + t[t.length - 1]
1917
1917
  });
@@ -1919,31 +1919,31 @@ Nt = function() {
1919
1919
  * 更新锚点样式(根据缩放调整大小)
1920
1920
  */
1921
1921
  zi = function() {
1922
- if (!r(this, A) || !r(this, F)) return;
1922
+ if (!r(this, H) || !r(this, L)) return;
1923
1923
  const t = this.core.getStageScale(), e = 6 / t, s = 2 / t;
1924
- r(this, A).radius(e), r(this, A).strokeWidth(s), r(this, F).radius(e), r(this, F).strokeWidth(s);
1924
+ r(this, H).radius(e), r(this, H).strokeWidth(s), r(this, L).radius(e), r(this, L).strokeWidth(s);
1925
1925
  }, /**
1926
1926
  * 显示或隐藏锚点
1927
1927
  */
1928
1928
  Wi = function(t) {
1929
- !r(this, A) || !r(this, F) || (r(this, A).visible(t), r(this, F).visible(t), t && (E(this, P, Nt).call(this), r(this, A).moveToTop(), r(this, F).moveToTop()));
1929
+ !r(this, H) || !r(this, L) || (r(this, H).visible(t), r(this, L).visible(t), t && (E(this, V, Nt).call(this), r(this, H).moveToTop(), r(this, L).moveToTop()));
1930
1930
  }, jt = new WeakMap(), /**
1931
1931
  * 设置事件处理器
1932
1932
  */
1933
1933
  Xi = function() {
1934
1934
  const t = this.getElement();
1935
- this.core.on("toolType:change", r(this, jt)), x(this, bt, (e) => {
1935
+ this.core.on("toolType:change", r(this, jt)), C(this, bt, (e) => {
1936
1936
  const s = e.includes(this.config.id);
1937
- E(this, P, Wi).call(this, s);
1938
- }), this.core.on("nodes:selected", r(this, bt)), x(this, wt, () => {
1939
- E(this, P, zi).call(this);
1937
+ E(this, V, Wi).call(this, s);
1938
+ }), this.core.on("nodes:selected", r(this, bt)), C(this, wt, () => {
1939
+ E(this, V, zi).call(this);
1940
1940
  }), this.core.on("viewport:scale:change", r(this, wt)), t.on("transform", (e) => {
1941
- const s = e.target, o = s.scaleX(), a = s.scaleY(), l = s.points().map((d, f) => f % 2 === 0 ? d * o : d * a);
1942
- s.points(l), s.scale({ x: 1, y: 1 }), E(this, P, Nt).call(this);
1941
+ const s = e.target, o = s.scaleX(), a = s.scaleY(), h = s.points().map((d, m) => m % 2 === 0 ? d * o : d * a);
1942
+ s.points(h), s.scale({ x: 1, y: 1 }), E(this, V, Nt).call(this);
1943
1943
  }), t.on("transformend", () => {
1944
1944
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1945
1945
  }), t.on("dragmove", () => {
1946
- E(this, P, Nt).call(this);
1946
+ E(this, V, Nt).call(this);
1947
1947
  }), t.on("dragend", () => {
1948
1948
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1949
1949
  });
@@ -2073,7 +2073,7 @@ function ee(n, i) {
2073
2073
  { x: s, y: o }
2074
2074
  ];
2075
2075
  }
2076
- var kt, D, j, it, H, Rt, Y, G, lt, pt, Me, U, Yi, Gi, Pe, Be, Ki;
2076
+ var kt, B, J, it, D, Rt, q, j, ht, pt, Me, W, Yi, Gi, Pe, Be, Ki;
2077
2077
  class Ls extends ps {
2078
2078
  constructor(t, e) {
2079
2079
  const s = e?.state, o = {
@@ -2088,29 +2088,29 @@ class Ls extends ps {
2088
2088
  }
2089
2089
  };
2090
2090
  super(o);
2091
- g(this, U);
2092
- g(this, kt);
2093
- g(this, D);
2094
- g(this, j);
2095
- g(this, it);
2096
- g(this, H, null);
2097
- g(this, Rt);
2098
- g(this, Y, null);
2099
- g(this, G, null);
2091
+ u(this, W);
2092
+ u(this, kt);
2093
+ u(this, B);
2094
+ u(this, J);
2095
+ u(this, it);
2096
+ u(this, D, null);
2097
+ u(this, Rt);
2098
+ u(this, q, null);
2099
+ u(this, j, null);
2100
2100
  /** 节点映射,方便快速查找 */
2101
- g(this, lt, /* @__PURE__ */ new Map());
2102
- g(this, pt, null);
2101
+ u(this, ht, /* @__PURE__ */ new Map());
2102
+ u(this, pt, null);
2103
2103
  p(this, "isEditingText", !1);
2104
- g(this, Me, (t) => {
2104
+ u(this, Me, (t) => {
2105
2105
  (t.key === "Delete" || t.key === "Backspace") && (t.stopPropagation(), this.deleteSelectedNodes());
2106
2106
  });
2107
- x(this, kt, e?.theme ?? Ii), x(this, Rt, t), x(this, D, new ms(this, {
2107
+ C(this, kt, e?.theme ?? Ii), C(this, Rt, t), C(this, B, new ms(this, {
2108
2108
  container: t,
2109
2109
  width: t.clientWidth,
2110
2110
  height: t.clientHeight,
2111
2111
  draggable: !1,
2112
2112
  className: "touch-none"
2113
- })), x(this, j, new M.Layer()), x(this, it, new fs(this)), r(this, D).getStage().add(r(this, j)), r(this, j).add(r(this, it).getTransformer()), this._renderCanvas(o), E(this, U, Yi).call(this), E(this, U, Gi).call(this);
2113
+ })), C(this, J, new M.Layer()), C(this, it, new fs(this)), r(this, B).getStage().add(r(this, J)), r(this, J).add(r(this, it).getTransformer()), this._renderCanvas(o), E(this, W, Yi).call(this), E(this, W, Gi).call(this);
2114
2114
  }
2115
2115
  /**
2116
2116
  * 获取当前主题
@@ -2122,13 +2122,13 @@ class Ls extends ps {
2122
2122
  * 设置主题并重新渲染
2123
2123
  */
2124
2124
  setTheme(t) {
2125
- x(this, kt, t), this._renderCanvas(this.getState()), this._emit("theme:change", t);
2125
+ C(this, kt, t), this._renderCanvas(this.getState()), this._emit("theme:change", t);
2126
2126
  }
2127
2127
  /**
2128
2128
  * 获取 CanvasStage 实例
2129
2129
  */
2130
2130
  getCanvasStage() {
2131
- return r(this, D);
2131
+ return r(this, B);
2132
2132
  }
2133
2133
  /**
2134
2134
  * 获取 CanvasTransformer 实例
@@ -2146,7 +2146,7 @@ class Ls extends ps {
2146
2146
  * 获取 Konva.Stage 实例
2147
2147
  */
2148
2148
  getStage() {
2149
- return r(this, D).getStage();
2149
+ return r(this, B).getStage();
2150
2150
  }
2151
2151
  /**
2152
2152
  * 获取 Stage 容器元素
@@ -2158,7 +2158,7 @@ class Ls extends ps {
2158
2158
  * 获取主图层
2159
2159
  */
2160
2160
  getMainLayer() {
2161
- return r(this, j);
2161
+ return r(this, J);
2162
2162
  }
2163
2163
  /**
2164
2164
  * 获取当前工具类型
@@ -2189,46 +2189,46 @@ class Ls extends ps {
2189
2189
  ), this._emit("toolType:change", {
2190
2190
  type: t,
2191
2191
  meta: e
2192
- }), t === "hand" ? (r(this, D).setDraggable(!0), r(this, D).setCursor("grab")) : (r(this, D).setDraggable(!1), r(this, D).resetCursor());
2192
+ }), t === "hand" ? (r(this, B).setDraggable(!0), r(this, B).setCursor("grab")) : (r(this, B).setDraggable(!1), r(this, B).resetCursor());
2193
2193
  }
2194
2194
  /**
2195
2195
  * 根据 ID 获取 Canvas 节点实例
2196
2196
  */
2197
2197
  getCanvasNodeById(t) {
2198
- return r(this, lt).get(t) || null;
2198
+ return r(this, ht).get(t) || null;
2199
2199
  }
2200
2200
  /**
2201
2201
  * 设置是否可拖拽(内部使用)
2202
2202
  */
2203
2203
  setDraggable(t) {
2204
- r(this, D).setDraggable(t);
2204
+ r(this, B).setDraggable(t);
2205
2205
  }
2206
2206
  /**
2207
2207
  * 设置光标
2208
2208
  * @internal 仅供内部使用
2209
2209
  */
2210
2210
  _setCursor(t) {
2211
- r(this, D).setCursor(t);
2211
+ r(this, B).setCursor(t);
2212
2212
  }
2213
2213
  /**
2214
2214
  * 重置光标
2215
2215
  * @internal 仅供内部使用
2216
2216
  */
2217
2217
  _resetCursor() {
2218
- r(this, D).resetCursor();
2218
+ r(this, B).resetCursor();
2219
2219
  }
2220
2220
  /**
2221
2221
  * 获取当前 Stage 缩放比例
2222
2222
  */
2223
2223
  getStageScale() {
2224
- return r(this, D).getStage().scaleX();
2224
+ return r(this, B).getStage().scaleX();
2225
2225
  }
2226
2226
  /**
2227
2227
  * 更新视口位置
2228
2228
  * @internal 仅供内部使用,外部请使用 CanvasApi
2229
2229
  */
2230
2230
  _updateViewport(t, e = !1) {
2231
- r(this, D).setViewport(t);
2231
+ r(this, B).setViewport(t);
2232
2232
  const s = this.getState().viewport, o = {
2233
2233
  ...s,
2234
2234
  ...t
@@ -2243,37 +2243,37 @@ class Ls extends ps {
2243
2243
  createNodes(t, e) {
2244
2244
  const s = t.map((o) => wi(this, o.$_type, o, !1)).filter((o) => o !== null);
2245
2245
  s.forEach((o) => {
2246
- r(this, j).add(o.getElement());
2247
- }), E(this, U, Be).call(this, s, e), this._emit("nodes:created", t);
2246
+ r(this, J).add(o.getElement());
2247
+ }), E(this, W, Be).call(this, s, e), this._emit("nodes:created", t);
2248
2248
  }
2249
2249
  /**
2250
2250
  * 创建图片标注节点(内部使用)
2251
2251
  */
2252
2252
  createImageMarkerNode(t, e, s, o) {
2253
2253
  const a = this.getState().nodes || [];
2254
- let h = 0;
2255
- a.forEach((C) => {
2256
- C.$_type === "image-marker" && typeof C.$_markerNumber == "number" && (h = Math.max(h, C.$_markerNumber));
2254
+ let l = 0;
2255
+ a.forEach((w) => {
2256
+ w.$_type === "image-marker" && typeof w.$_markerNumber == "number" && (l = Math.max(l, w.$_markerNumber));
2257
2257
  });
2258
- const l = (e.x - o.x) / o.width, d = (e.y - o.y) / o.height, f = (s.x - o.x) / o.width, m = (s.y - o.y) / o.height, u = Math.min(e.x, s.x), y = Math.min(e.y, s.y), w = Math.abs(s.x - e.x), v = Math.abs(s.y - e.y), I = {
2258
+ const h = (e.x - o.x) / o.width, d = (e.y - o.y) / o.height, m = (s.x - o.x) / o.width, f = (s.y - o.y) / o.height, g = Math.min(e.x, s.x), y = Math.min(e.y, s.y), x = Math.abs(s.x - e.x), v = Math.abs(s.y - e.y), I = {
2259
2259
  id: Tt(),
2260
2260
  $_type: "image-marker",
2261
- x: u,
2261
+ x: g,
2262
2262
  y,
2263
- width: w,
2263
+ width: x,
2264
2264
  height: v,
2265
2265
  visible: !0,
2266
2266
  line: "dashed",
2267
2267
  $_parentId: t,
2268
- $_markerNumber: h + 1,
2268
+ $_markerNumber: l + 1,
2269
2269
  $_relativeBox: {
2270
2270
  start: {
2271
- ratioX: Math.max(0, Math.min(1, l)),
2271
+ ratioX: Math.max(0, Math.min(1, h)),
2272
2272
  ratioY: Math.max(0, Math.min(1, d))
2273
2273
  },
2274
2274
  end: {
2275
- ratioX: Math.max(0, Math.min(1, f)),
2276
- ratioY: Math.max(0, Math.min(1, m))
2275
+ ratioX: Math.max(0, Math.min(1, m)),
2276
+ ratioY: Math.max(0, Math.min(1, f))
2277
2277
  }
2278
2278
  }
2279
2279
  };
@@ -2284,13 +2284,13 @@ class Ls extends ps {
2284
2284
  * @internal 仅供内部使用
2285
2285
  */
2286
2286
  _findImageAtPosition(t) {
2287
- const a = r(this, j).getChildren().filter(
2288
- (h) => !h.name().includes("imageMarker")
2289
- ).slice().sort((h, l) => l.zIndex() - h.zIndex());
2290
- for (const h of a) {
2291
- const l = h.x(), d = h.y(), f = h.width(), m = h.height();
2292
- if (t.x >= l && t.x <= l + f && t.y >= d && t.y <= d + m)
2293
- return h.getAttr("$_type") === "image" ? h : null;
2287
+ const a = r(this, J).getChildren().filter(
2288
+ (l) => !l.name().includes("imageMarker")
2289
+ ).slice().sort((l, h) => h.zIndex() - l.zIndex());
2290
+ for (const l of a) {
2291
+ const h = l.x(), d = l.y(), m = l.width(), f = l.height();
2292
+ if (t.x >= h && t.x <= h + m && t.y >= d && t.y <= d + f)
2293
+ return l.getAttr("$_type") === "image" ? l : null;
2294
2294
  }
2295
2295
  return null;
2296
2296
  }
@@ -2298,83 +2298,83 @@ class Ls extends ps {
2298
2298
  * @internal 仅供内部使用
2299
2299
  */
2300
2300
  _setDrawingPosition(t) {
2301
- x(this, G, [t, t]);
2301
+ C(this, j, [t, t]);
2302
2302
  }
2303
2303
  /**
2304
2304
  * @internal 仅供内部使用
2305
2305
  */
2306
2306
  _updateDrawingPosition(t) {
2307
- r(this, G) && (r(this, G)[1] = t);
2307
+ r(this, j) && (r(this, j)[1] = t);
2308
2308
  }
2309
2309
  /**
2310
2310
  * @internal 仅供内部使用
2311
2311
  */
2312
2312
  _createDraftNode(t, e) {
2313
- r(this, H) && r(this, H).destroy();
2313
+ r(this, D) && r(this, D).destroy();
2314
2314
  const s = Fs(
2315
2315
  t,
2316
- r(this, G)[0],
2316
+ r(this, j)[0],
2317
2317
  {
2318
2318
  ...e,
2319
2319
  ...this.getToolMeta()
2320
2320
  }
2321
2321
  );
2322
- x(this, H, wi(this, t, s, !0)), r(this, H) && r(this, j).add(r(this, H).getElement());
2322
+ C(this, D, wi(this, t, s, !0)), r(this, D) && r(this, J).add(r(this, D).getElement());
2323
2323
  }
2324
2324
  /**
2325
2325
  * @internal 仅供内部使用
2326
2326
  */
2327
2327
  _updateDraftNode() {
2328
- if (!r(this, H)) return;
2329
- const t = r(this, H).getConfig(), e = Hs(
2328
+ if (!r(this, D)) return;
2329
+ const t = r(this, D).getConfig(), e = Hs(
2330
2330
  t,
2331
- r(this, G)[1],
2332
- r(this, G)[0]
2331
+ r(this, j)[1],
2332
+ r(this, j)[0]
2333
2333
  );
2334
- r(this, H).update(e);
2334
+ r(this, D).update(e);
2335
2335
  }
2336
2336
  /**
2337
2337
  * @internal 仅供内部使用
2338
2338
  */
2339
2339
  _finalizeDraftNode() {
2340
- if (!r(this, H)) return;
2341
- const t = Tt(), e = r(this, H).getConfig();
2340
+ if (!r(this, D)) return;
2341
+ const t = Tt(), e = r(this, D).getConfig();
2342
2342
  if (e.$_type === "image-marker") {
2343
2343
  const o = e.$_bounds, a = {
2344
2344
  x: e.x,
2345
2345
  y: e.y
2346
- }, h = {
2346
+ }, l = {
2347
2347
  x: e.x + (e.width || 0),
2348
2348
  y: e.y + (e.height || 0)
2349
- }, l = this.getState().nodes || [];
2349
+ }, h = this.getState().nodes || [];
2350
2350
  let d = 0;
2351
- l.forEach((v) => {
2351
+ h.forEach((v) => {
2352
2352
  v.$_type === "image-marker" && typeof v.$_markerNumber == "number" && (d = Math.max(d, v.$_markerNumber));
2353
2353
  });
2354
- const f = (a.x - o.x) / o.width, m = (a.y - o.y) / o.height, u = (h.x - o.x) / o.width, y = (h.y - o.y) / o.height, w = {
2354
+ const m = (a.x - o.x) / o.width, f = (a.y - o.y) / o.height, g = (l.x - o.x) / o.width, y = (l.y - o.y) / o.height, x = {
2355
2355
  ...e,
2356
2356
  $_markerNumber: d + 1,
2357
2357
  $_relativeBox: {
2358
2358
  start: {
2359
- ratioX: Math.max(0, Math.min(1, f)),
2360
- ratioY: Math.max(0, Math.min(1, m))
2359
+ ratioX: Math.max(0, Math.min(1, m)),
2360
+ ratioY: Math.max(0, Math.min(1, f))
2361
2361
  },
2362
2362
  end: {
2363
- ratioX: Math.max(0, Math.min(1, u)),
2363
+ ratioX: Math.max(0, Math.min(1, g)),
2364
2364
  ratioY: Math.max(0, Math.min(1, y))
2365
2365
  }
2366
2366
  },
2367
2367
  $_type: "image-marker",
2368
2368
  id: t
2369
2369
  };
2370
- this.createNodes([w], !0), r(this, H).destroy(), x(this, H, null), this.setToolType("select");
2370
+ this.createNodes([x], !0), r(this, D).destroy(), C(this, D, null), this.setToolType("select");
2371
2371
  return;
2372
2372
  }
2373
2373
  const s = {
2374
2374
  ...e,
2375
2375
  id: t
2376
2376
  };
2377
- if (s.$_type === "ellipse" && (s.width || 0) < 10 && (s.height || 0) < 10 && (s.width = 10, s.height = 10), s.$_type === "star" && (s.outerRadius || 0) < 10 && (s.outerRadius = 10), this.createNodes([s], !0), r(this, H).destroy(), x(this, H, null), this.setToolType("select"), s.$_type === "rich-text") {
2377
+ if (s.$_type === "ellipse" && (s.width || 0) < 10 && (s.height || 0) < 10 && (s.width = 10, s.height = 10), s.$_type === "star" && (s.outerRadius || 0) < 10 && (s.outerRadius = 10), this.createNodes([s], !0), r(this, D).destroy(), C(this, D, null), this.setToolType("select"), s.$_type === "rich-text") {
2378
2378
  const o = this.getCanvasNodeById(t);
2379
2379
  o && o.attachEditor();
2380
2380
  }
@@ -2384,7 +2384,7 @@ class Ls extends ps {
2384
2384
  * @internal 仅供内部使用
2385
2385
  */
2386
2386
  _createTextNodeAtDrawingPosition(t) {
2387
- const e = r(this, G)[1], s = {
2387
+ const e = r(this, j)[1], s = {
2388
2388
  id: Tt(),
2389
2389
  $_type: "text",
2390
2390
  x: e.x,
@@ -2397,34 +2397,34 @@ class Ls extends ps {
2397
2397
  * @internal 仅供内部使用
2398
2398
  */
2399
2399
  _createSelectRect() {
2400
- this.isEditingText || (r(this, Y) && r(this, Y).destroy(), x(this, Y, new M.Rect({
2401
- x: r(this, G)[0].x,
2402
- y: r(this, G)[0].y,
2400
+ this.isEditingText || (r(this, q) && r(this, q).destroy(), C(this, q, new M.Rect({
2401
+ x: r(this, j)[0].x,
2402
+ y: r(this, j)[0].y,
2403
2403
  width: 0,
2404
2404
  height: 0,
2405
2405
  stroke: this.getTheme()["theme.select-rect-border"],
2406
2406
  strokeWidth: 1,
2407
2407
  fill: this.getTheme()["theme.select-rect-fill"]
2408
- })), r(this, j).add(r(this, Y)));
2408
+ })), r(this, J).add(r(this, q)));
2409
2409
  }
2410
2410
  /*
2411
2411
  * @internal 仅供内部使用
2412
2412
  */
2413
2413
  _updateSelectRect() {
2414
- if (!r(this, Y)) return;
2415
- const [t, e] = ee(...r(this, G));
2416
- r(this, Y).setAttrs({
2414
+ if (!r(this, q)) return;
2415
+ const [t, e] = ee(...r(this, j));
2416
+ r(this, q).setAttrs({
2417
2417
  x: t.x,
2418
2418
  y: t.y,
2419
2419
  width: e.x - t.x,
2420
2420
  height: e.y - t.y
2421
2421
  });
2422
- const s = r(this, Y).getClientRect(), a = r(this, j).find(`.${b.selectable}`).filter((h) => {
2423
- const l = h.getClientRect();
2424
- return M.Util.haveIntersection(s, l);
2422
+ const s = r(this, q).getClientRect(), a = r(this, J).find(`.${b.selectable}`).filter((l) => {
2423
+ const h = l.getClientRect();
2424
+ return M.Util.haveIntersection(s, h);
2425
2425
  });
2426
2426
  this._selectNodes(
2427
- a.length > 0 ? a.filter((h) => h.listening()).map((h) => h.id()) : void 0,
2427
+ a.length > 0 ? a.filter((l) => l.listening()).map((l) => l.id()) : void 0,
2428
2428
  !1
2429
2429
  );
2430
2430
  }
@@ -2432,7 +2432,7 @@ class Ls extends ps {
2432
2432
  * @internal 仅供内部使用
2433
2433
  */
2434
2434
  _finalizeSelectRect() {
2435
- r(this, Y) && (r(this, Y).destroy(), x(this, Y, null));
2435
+ r(this, q) && (r(this, q).destroy(), C(this, q, null));
2436
2436
  }
2437
2437
  /**
2438
2438
  * 选择节点
@@ -2446,8 +2446,8 @@ class Ls extends ps {
2446
2446
  if (a.length === 0)
2447
2447
  r(this, it).clearNodes();
2448
2448
  else {
2449
- const h = this.getStage().find(`.${b.selectable}`).filter((l) => a.includes(l.id())).filter((l) => l.listening()).filter((l) => l.isVisible());
2450
- r(this, it).setNodes(h);
2449
+ const l = this.getStage().find(`.${b.selectable}`).filter((h) => a.includes(h.id())).filter((h) => h.listening()).filter((h) => h.isVisible());
2450
+ r(this, it).setNodes(l);
2451
2451
  }
2452
2452
  this._updateState({ selectedNodeIds: a }, !1), this._emit("nodes:selected", a);
2453
2453
  }
@@ -2463,15 +2463,15 @@ class Ls extends ps {
2463
2463
  if (t.length === 0) return [];
2464
2464
  const e = this.getState().nodes || [], s = new Set(t);
2465
2465
  t.forEach((a) => {
2466
- e.find((l) => l.id === a)?.$_type === "image" && e.forEach((l) => {
2467
- l.$_type === "image-marker" && l.$_parentId === a && s.add(l.id);
2466
+ e.find((h) => h.id === a)?.$_type === "image" && e.forEach((h) => {
2467
+ h.$_type === "image-marker" && h.$_parentId === a && s.add(h.id);
2468
2468
  });
2469
2469
  });
2470
2470
  const o = e.filter((a) => s.has(a.id));
2471
2471
  return s.forEach((a) => {
2472
- const h = this.getStage().findOne(`#${a}`);
2473
- h && h.destroy();
2474
- }), E(this, U, Ki).call(this, Array.from(s), !0), r(this, it).clearNodes(), this._updateState(
2472
+ const l = this.getStage().findOne(`#${a}`);
2473
+ l && l.destroy();
2474
+ }), E(this, W, Ki).call(this, Array.from(s), !0), r(this, it).clearNodes(), this._updateState(
2475
2475
  {
2476
2476
  selectedNodeIds: []
2477
2477
  },
@@ -2490,14 +2490,14 @@ class Ls extends ps {
2490
2490
  * 销毁 canvas
2491
2491
  */
2492
2492
  dispose() {
2493
- r(this, pt) && (r(this, pt).disconnect(), x(this, pt, null)), this.getCanvasTransformer().destroy(), this.getMainLayer().destroy(), this.getCanvasStage().destroy(), this._dispose();
2493
+ r(this, pt) && (r(this, pt).disconnect(), C(this, pt, null)), this.getCanvasTransformer().destroy(), this.getMainLayer().destroy(), this.getCanvasStage().destroy(), this._dispose();
2494
2494
  }
2495
2495
  /**
2496
2496
  * @internal 仅供内部使用
2497
2497
  * 在元素节点改变后(例如 tranfromEnd dragEnd)重建 state.nodes
2498
2498
  */
2499
2499
  _rebuildStateAfterNodeChange(t, e) {
2500
- E(this, U, Be).call(this, Array.isArray(t) ? t : [t], e);
2500
+ E(this, W, Be).call(this, Array.isArray(t) ? t : [t], e);
2501
2501
  }
2502
2502
  /**
2503
2503
  * 实现父类的状态同步方法
@@ -2511,9 +2511,9 @@ class Ls extends ps {
2511
2511
  scale: t.viewport.scale
2512
2512
  },
2513
2513
  !1
2514
- ), r(this, lt).forEach((e, s) => {
2514
+ ), r(this, ht).forEach((e, s) => {
2515
2515
  e.destroy();
2516
- }), r(this, lt).clear(), this.createNodes(t.nodes || [], !1), this._selectNodes(t.selectedNodeIds || [], !1, !0);
2516
+ }), r(this, ht).clear(), this.createNodes(t.nodes || [], !1), this._selectNodes(t.selectedNodeIds || [], !1, !0);
2517
2517
  }
2518
2518
  _showContextMenu(t) {
2519
2519
  this._emit("contextmenu:show", t);
@@ -2521,12 +2521,12 @@ class Ls extends ps {
2521
2521
  // 在调整节点上下层级后调用,同步到 store 中
2522
2522
  _syncNodesZIndexToStore() {
2523
2523
  const t = this.getStage().find(`.${b.nodeRoot}`).map((a) => a.id()).filter((a) => a), e = this.getState().nodes || [], s = /* @__PURE__ */ new Map();
2524
- t.forEach((a, h) => {
2525
- s.set(a, h);
2524
+ t.forEach((a, l) => {
2525
+ s.set(a, l);
2526
2526
  });
2527
- const o = [...e].sort((a, h) => {
2528
- const l = s.get(a.id) ?? Number.MIN_SAFE_INTEGER, d = s.get(h.id) ?? Number.MIN_SAFE_INTEGER;
2529
- return l - d;
2527
+ const o = [...e].sort((a, l) => {
2528
+ const h = s.get(a.id) ?? Number.MIN_SAFE_INTEGER, d = s.get(l.id) ?? Number.MIN_SAFE_INTEGER;
2529
+ return h - d;
2530
2530
  });
2531
2531
  this._updateState({ nodes: o }, !0), this._emit("nodes:sorted", t);
2532
2532
  }
@@ -2537,7 +2537,7 @@ class Ls extends ps {
2537
2537
  this._emit("texteditor:unregister", void 0);
2538
2538
  }
2539
2539
  }
2540
- kt = new WeakMap(), D = new WeakMap(), j = new WeakMap(), it = new WeakMap(), H = new WeakMap(), Rt = new WeakMap(), Y = new WeakMap(), G = new WeakMap(), lt = new WeakMap(), pt = new WeakMap(), Me = new WeakMap(), U = new WeakSet(), /**
2540
+ kt = new WeakMap(), B = new WeakMap(), J = new WeakMap(), it = new WeakMap(), D = new WeakMap(), Rt = new WeakMap(), q = new WeakMap(), j = new WeakMap(), ht = new WeakMap(), pt = new WeakMap(), Me = new WeakMap(), W = new WeakSet(), /**
2541
2541
  * 设置键盘事件监听
2542
2542
  */
2543
2543
  Yi = function() {
@@ -2547,14 +2547,14 @@ Yi = function() {
2547
2547
  * 设置尺寸变化监听
2548
2548
  */
2549
2549
  Gi = function() {
2550
- x(this, pt, new ResizeObserver((t) => {
2550
+ C(this, pt, new ResizeObserver((t) => {
2551
2551
  for (const e of t) {
2552
- const { width: s, height: o } = e.contentRect, a = this.getStage(), h = this.getState().viewport, l = a.width(), d = a.height(), f = h.x + l / 2, m = h.y + d / 2;
2552
+ const { width: s, height: o } = e.contentRect, a = this.getStage(), l = this.getState().viewport, h = a.width(), d = a.height(), m = l.x + h / 2, f = l.y + d / 2;
2553
2553
  a.width(s), a.height(o);
2554
- const u = f - s / 2, y = m - o / 2;
2554
+ const g = m - s / 2, y = f - o / 2;
2555
2555
  this._updateViewport(
2556
2556
  {
2557
- x: u,
2557
+ x: g,
2558
2558
  y
2559
2559
  },
2560
2560
  !1
@@ -2566,34 +2566,34 @@ Gi = function() {
2566
2566
  */
2567
2567
  Pe = function(t) {
2568
2568
  const e = this.getState().nodes || [], s = /* @__PURE__ */ new Map();
2569
- e.forEach((d, f) => {
2570
- s.set(d.id, f);
2569
+ e.forEach((d, m) => {
2570
+ s.set(d.id, m);
2571
2571
  });
2572
- const o = Array.from(r(this, lt).values()).map(
2572
+ const o = Array.from(r(this, ht).values()).map(
2573
2573
  (d) => d.getConfig()
2574
- ), a = [], h = [];
2574
+ ), a = [], l = [];
2575
2575
  o.forEach((d) => {
2576
- s.has(d.id) ? a.push(d) : h.push(d);
2577
- }), a.sort((d, f) => {
2578
- const m = s.get(d.id) ?? 0, u = s.get(f.id) ?? 0;
2579
- return m - u;
2576
+ s.has(d.id) ? a.push(d) : l.push(d);
2577
+ }), a.sort((d, m) => {
2578
+ const f = s.get(d.id) ?? 0, g = s.get(m.id) ?? 0;
2579
+ return f - g;
2580
2580
  });
2581
- const l = {
2582
- nodes: [...a, ...h]
2581
+ const h = {
2582
+ nodes: [...a, ...l]
2583
2583
  };
2584
- this._updateState(l, t);
2584
+ this._updateState(h, t);
2585
2585
  }, /**
2586
2586
  * 更新 state.nodes
2587
2587
  */
2588
2588
  Be = function(t, e) {
2589
2589
  t.length !== 0 && (t.forEach((s) => {
2590
- r(this, lt).set(s.getID(), s);
2591
- }), E(this, U, Pe).call(this, e));
2590
+ r(this, ht).set(s.getID(), s);
2591
+ }), E(this, W, Pe).call(this, e));
2592
2592
  }, Ki = function(t, e = !1) {
2593
2593
  t.length !== 0 && (t.forEach((s) => {
2594
- const o = r(this, lt).get(s);
2595
- o && o.destroy(), r(this, lt).delete(s);
2596
- }), E(this, U, Pe).call(this, e));
2594
+ const o = r(this, ht).get(s);
2595
+ o && o.destroy(), r(this, ht).delete(s);
2596
+ }), E(this, W, Pe).call(this, e));
2597
2597
  };
2598
2598
  class Ds extends Ls {
2599
2599
  /**
@@ -2675,10 +2675,10 @@ class Ds extends Ls {
2675
2675
  if (t.length === 0)
2676
2676
  return console.warn("No selection to export"), null;
2677
2677
  const e = i?.padding ?? 0, s = new M.Group();
2678
- t.forEach((h) => {
2679
- const l = this.getStage().findOne(`#${h}`);
2680
- if (l) {
2681
- const d = l.clone();
2678
+ t.forEach((l) => {
2679
+ const h = this.getStage().findOne(`#${l}`);
2680
+ if (h) {
2681
+ const d = h.clone();
2682
2682
  s.add(d);
2683
2683
  }
2684
2684
  });
@@ -2703,37 +2703,37 @@ class Ds extends Ls {
2703
2703
  if (!e)
2704
2704
  return console.warn("Image shape not found on stage"), null;
2705
2705
  const o = (this.getState().nodes || []).filter(
2706
- (m) => m.$_type === "image-marker" && m.$_parentId === i
2706
+ (x) => x.$_type === "image-marker" && x.$_parentId === i
2707
2707
  );
2708
2708
  if (o.length === 0)
2709
2709
  return console.warn("No image-marker nodes found for the given image ID"), null;
2710
- const a = new M.Group(), h = e.clone();
2711
- a.add(h);
2712
- const l = t?.markerScale ?? 1;
2713
- o.forEach((m) => {
2714
- const u = this.getStage().findOne(`#${m.id}`);
2715
- if (u) {
2716
- const y = u.clone(), w = y.findOne(".rect"), v = y.findOne(".marker-group");
2717
- if (w && (w.strokeWidth(3 * l), w.dash([5 * l, 5 * l]), w.cornerRadius(6 * l)), v) {
2718
- const I = v.findOne("Circle"), C = v.findOne("Text");
2719
- if (I && (I.radius(14 * l), I.strokeWidth(3 * l)), C) {
2720
- const B = 14 * l;
2721
- C.x(-B), C.y(-B), C.width(B * 2), C.height(B * 2), C.fontSize(16 * l);
2710
+ const a = new M.Group(), l = e.clone();
2711
+ a.add(l);
2712
+ const h = e.width(), d = e.height(), m = Math.min(h, d), f = t?.markerScale ?? Math.max(1, Math.min(8, m / 400));
2713
+ o.forEach((x) => {
2714
+ const v = this.getStage().findOne(`#${x.id}`);
2715
+ if (v) {
2716
+ const I = v.clone(), w = I.findOne(".rect"), z = I.findOne(".marker-group");
2717
+ if (w && (w.strokeWidth(3 * f), w.cornerRadius(6 * f)), z) {
2718
+ const X = z.findOne("Circle"), R = z.findOne("Text");
2719
+ if (X && (X.radius(14 * f), X.strokeWidth(3 * f)), R) {
2720
+ const F = 14 * f;
2721
+ R.x(-F), R.y(-F), R.width(F * 2), R.height(F * 2), R.fontSize(16 * f);
2722
2722
  }
2723
2723
  }
2724
- a.add(y);
2724
+ a.add(I);
2725
2725
  }
2726
2726
  });
2727
- const d = a.getClientRect(), f = a.toDataURL({
2728
- x: d.x,
2729
- y: d.y,
2730
- width: d.width,
2731
- height: d.height,
2727
+ const g = a.getClientRect(), y = a.toDataURL({
2728
+ x: g.x,
2729
+ y: g.y,
2730
+ width: g.width,
2731
+ height: g.height,
2732
2732
  pixelRatio: t?.pixelRatio ?? 2,
2733
2733
  mimeType: t?.mimeType ?? "image/png",
2734
2734
  quality: t?.quality ?? 1
2735
2735
  });
2736
- return a.destroy(), f;
2736
+ return a.destroy(), y;
2737
2737
  }
2738
2738
  /**
2739
2739
  * 删除当前选中的节点
@@ -2831,30 +2831,30 @@ class Ds extends Ls {
2831
2831
  scrollToContent(i) {
2832
2832
  if ((this.getState().nodes || []).length === 0) return;
2833
2833
  const e = i?.padding ?? 50, s = i?.scale === !0, o = i?.nodeIds;
2834
- let a = 1 / 0, h = 1 / 0, l = -1 / 0, d = -1 / 0;
2835
- const f = this.getMainLayer(), m = this.getState().selectedNodeIds || [], u = o && o.length > 0, y = !u && m.length > 0, w = u ? o : y ? m : null;
2836
- if (f.children.forEach((z) => {
2837
- if (z.visible() && z.getClassName() !== "Transformer" && z.hasName(b.selectable)) {
2838
- if (w) {
2839
- const ut = z.id();
2840
- if (!w.includes(ut)) return;
2834
+ let a = 1 / 0, l = 1 / 0, h = -1 / 0, d = -1 / 0;
2835
+ const m = this.getMainLayer(), f = this.getState().selectedNodeIds || [], g = o && o.length > 0, y = !g && f.length > 0, x = g ? o : y ? f : null;
2836
+ if (m.children.forEach((Y) => {
2837
+ if (Y.visible() && Y.getClassName() !== "Transformer" && Y.hasName(b.selectable)) {
2838
+ if (x) {
2839
+ const ut = Y.id();
2840
+ if (!x.includes(ut)) return;
2841
2841
  }
2842
- const xt = z.getAttrs(), ni = xt.x || 0, si = xt.y || 0, En = xt.width || 0, Sn = xt.height || 0;
2842
+ const xt = Y.getAttrs(), ni = xt.x || 0, si = xt.y || 0, En = xt.width || 0, Sn = xt.height || 0;
2843
2843
  if (xt.rotation || 0) {
2844
- const ut = z.getClientRect({ skipTransform: !1 }), Ae = this.getStage(), te = Ae.scaleX(), oi = Ae.x(), ri = Ae.y(), Nn = (ut.x - oi) / te, Tn = (ut.y - ri) / te, _n = (ut.x + ut.width - oi) / te, Mn = (ut.y + ut.height - ri) / te;
2845
- a = Math.min(a, Nn), h = Math.min(h, Tn), l = Math.max(l, _n), d = Math.max(d, Mn);
2844
+ const ut = Y.getClientRect({ skipTransform: !1 }), Ae = this.getStage(), te = Ae.scaleX(), oi = Ae.x(), ri = Ae.y(), Nn = (ut.x - oi) / te, Tn = (ut.y - ri) / te, _n = (ut.x + ut.width - oi) / te, Mn = (ut.y + ut.height - ri) / te;
2845
+ a = Math.min(a, Nn), l = Math.min(l, Tn), h = Math.max(h, _n), d = Math.max(d, Mn);
2846
2846
  } else
2847
- a = Math.min(a, ni), h = Math.min(h, si), l = Math.max(l, ni + En), d = Math.max(d, si + Sn);
2847
+ a = Math.min(a, ni), l = Math.min(l, si), h = Math.max(h, ni + En), d = Math.max(d, si + Sn);
2848
2848
  }
2849
- }), a === 1 / 0 || h === 1 / 0) return;
2850
- const v = l - a, I = d - h, C = a + v / 2, B = h + I / 2;
2851
- let K = this.getState().viewport.scale;
2849
+ }), a === 1 / 0 || l === 1 / 0) return;
2850
+ const v = h - a, I = d - l, w = a + v / 2, z = l + I / 2;
2851
+ let R = this.getState().viewport.scale;
2852
2852
  if (s) {
2853
- const z = (this.getStage().width() - e * 2) / v, xt = (this.getStage().height() - e * 2) / I;
2854
- K = Math.min(z, xt, 1);
2853
+ const Y = (this.getStage().width() - e * 2) / v, xt = (this.getStage().height() - e * 2) / I;
2854
+ R = Math.min(Y, xt, 1);
2855
2855
  }
2856
- const q = this.getStage().width() / 2 - C * K, Ct = this.getStage().height() / 2 - B * K;
2857
- this.updateViewport({ x: q, y: Ct, scale: K }, !0);
2856
+ const F = this.getStage().width() / 2 - w * R, Ct = this.getStage().height() / 2 - z * R;
2857
+ this.updateViewport({ x: F, y: Ct, scale: R }, !0);
2858
2858
  }
2859
2859
  /**
2860
2860
  * 导出当前状态
@@ -2909,8 +2909,8 @@ class Ds extends Ls {
2909
2909
  }
2910
2910
  }
2911
2911
  function Ps(n, i, t, e = !1) {
2912
- const [s, o] = i, [a, h] = t, l = a + (n - s) / (o - s) * (h - a);
2913
- return e ? a < h ? Math.max(Math.min(l, h), a) : Math.max(Math.min(l, a), h) : l;
2912
+ const [s, o] = i, [a, l] = t, h = a + (n - s) / (o - s) * (l - a);
2913
+ return e ? a < l ? Math.max(Math.min(h, l), a) : Math.max(Math.min(h, a), l) : h;
2914
2914
  }
2915
2915
  const Ei = [
2916
2916
  {
@@ -2941,7 +2941,7 @@ function Bs({
2941
2941
  size: e = 15,
2942
2942
  showGrid: s = !0
2943
2943
  }) {
2944
- const o = n / t, a = i / t, h = t;
2944
+ const o = n / t, a = i / t, l = t;
2945
2945
  return s ? /* @__PURE__ */ k(
2946
2946
  "svg",
2947
2947
  {
@@ -2950,14 +2950,14 @@ function Bs({
2950
2950
  xmlns: "http://www.w3.org/2000/svg",
2951
2951
  "aria-hidden": "true",
2952
2952
  children: [
2953
- /* @__PURE__ */ c("defs", { children: Ei.map(({ min: l, mid: d, step: f }, m) => {
2954
- const u = f * e * h, y = 0.5 + o * h, w = 0.5 + a * h, v = y > 0 ? y % u : u + y % u, I = w > 0 ? w % u : u + w % u, C = h < d ? Ps(h, [l, d], [0, 1]) : 1;
2953
+ /* @__PURE__ */ c("defs", { children: Ei.map(({ min: h, mid: d, step: m }, f) => {
2954
+ const g = m * e * l, y = 0.5 + o * l, x = 0.5 + a * l, v = y > 0 ? y % g : g + y % g, I = x > 0 ? x % g : g + x % g, w = l < d ? Ps(l, [h, d], [0, 1]) : 1;
2955
2955
  return /* @__PURE__ */ c(
2956
2956
  "pattern",
2957
2957
  {
2958
- id: `grid_${f}`,
2959
- width: u,
2960
- height: u,
2958
+ id: `grid_${m}`,
2959
+ width: g,
2960
+ height: g,
2961
2961
  patternUnits: "userSpaceOnUse",
2962
2962
  children: /* @__PURE__ */ c(
2963
2963
  "circle",
@@ -2966,14 +2966,14 @@ function Bs({
2966
2966
  cx: v,
2967
2967
  cy: I,
2968
2968
  r: 1,
2969
- opacity: C
2969
+ opacity: w
2970
2970
  }
2971
2971
  )
2972
2972
  },
2973
- m
2973
+ f
2974
2974
  );
2975
2975
  }) }),
2976
- Ei.map(({ step: l }, d) => /* @__PURE__ */ c("rect", { width: "100%", height: "100%", fill: `url(#grid_${l})` }, d))
2976
+ Ei.map(({ step: h }, d) => /* @__PURE__ */ c("rect", { width: "100%", height: "100%", fill: `url(#grid_${h})` }, d))
2977
2977
  ]
2978
2978
  }
2979
2979
  ) : null;
@@ -3027,24 +3027,24 @@ function Ft({
3027
3027
  );
3028
3028
  }
3029
3029
  function Zs({ api: n }) {
3030
- const [i, t] = R(n.getState().viewport);
3031
- Z(() => {
3032
- n.on("viewport:change", (l) => {
3033
- t(l);
3030
+ const [i, t] = $(n.getState().viewport);
3031
+ U(() => {
3032
+ n.on("viewport:change", (h) => {
3033
+ t(h);
3034
3034
  });
3035
3035
  }, [t, n]);
3036
- const e = (l) => {
3037
- const d = n.getStage().width() / 2, f = n.getStage().height() / 2, m = (d - i.x) / i.scale, u = (f - i.y) / i.scale, y = d - m * l, w = f - u * l;
3038
- n.updateViewport({ x: y, y: w, scale: l });
3036
+ const e = (h) => {
3037
+ const d = n.getStage().width() / 2, m = n.getStage().height() / 2, f = (d - i.x) / i.scale, g = (m - i.y) / i.scale, y = d - f * h, x = m - g * h;
3038
+ n.updateViewport({ x: y, y: x, scale: h });
3039
3039
  }, s = () => {
3040
- const l = Math.min(i.scale * 1.2, 5);
3041
- e(l);
3040
+ const h = Math.min(i.scale * 1.2, 5);
3041
+ e(h);
3042
3042
  }, o = () => {
3043
- const l = Math.max(i.scale / 1.2, 0.1);
3044
- e(l);
3043
+ const h = Math.max(i.scale / 1.2, 0.1);
3044
+ e(h);
3045
3045
  }, a = () => {
3046
3046
  e(1);
3047
- }, h = Math.round(i.scale * 100);
3047
+ }, l = Math.round(i.scale * 100);
3048
3048
  return /* @__PURE__ */ k("div", { className: "zoom-panel flex items-center gap-2", children: [
3049
3049
  /* @__PURE__ */ c(
3050
3050
  Ft,
@@ -3062,10 +3062,10 @@ function Zs({ api: n }) {
3062
3062
  size: "sm",
3063
3063
  variant: "secondary",
3064
3064
  onClick: a,
3065
- title: `${h}%`,
3065
+ title: `${l}%`,
3066
3066
  className: "min-w-16",
3067
3067
  children: [
3068
- h,
3068
+ l,
3069
3069
  "%"
3070
3070
  ]
3071
3071
  }
@@ -3083,8 +3083,8 @@ function Zs({ api: n }) {
3083
3083
  ] });
3084
3084
  }
3085
3085
  function Us({ api: n }) {
3086
- const [i, t] = R(n.canUndo()), [e, s] = R(n.canRedo());
3087
- return Z(() => {
3086
+ const [i, t] = $(n.canUndo()), [e, s] = $(n.canRedo());
3087
+ return U(() => {
3088
3088
  const o = () => {
3089
3089
  t(n.canUndo()), s(n.canRedo());
3090
3090
  };
@@ -3117,18 +3117,18 @@ function Us({ api: n }) {
3117
3117
  ] });
3118
3118
  }
3119
3119
  function Xo({ setApi: n, theme: i }) {
3120
- const t = Ue(null), [e, s] = R(null), [o, a] = R({ x: 0, y: 0, scale: 1 });
3121
- return Z(() => {
3120
+ const t = Ue(null), [e, s] = $(null), [o, a] = $({ x: 0, y: 0, scale: 1 });
3121
+ return U(() => {
3122
3122
  if (!t.current) return;
3123
- const h = new Ds(t.current, {
3123
+ const l = new Ds(t.current, {
3124
3124
  theme: i
3125
3125
  });
3126
- return s(h), n?.(h), h.on("viewport:change", (l) => {
3127
- a(l);
3126
+ return s(l), n?.(l), l.on("viewport:change", (h) => {
3127
+ a(h);
3128
3128
  }), () => {
3129
- h.dispose();
3129
+ l.dispose();
3130
3130
  };
3131
- }, []), Z(() => {
3131
+ }, []), U(() => {
3132
3132
  e && i && e.setTheme(i);
3133
3133
  }, [e, i]), /* @__PURE__ */ k("div", { className: "whiteboard relative size-full", children: [
3134
3134
  /* @__PURE__ */ c(
@@ -3153,17 +3153,17 @@ function Xo({ setApi: n, theme: i }) {
3153
3153
  ] });
3154
3154
  }
3155
3155
  function Yo(n) {
3156
- const [i, t] = R(null);
3157
- return Z(() => {
3156
+ const [i, t] = $(null);
3157
+ return U(() => {
3158
3158
  if (!n) return;
3159
3159
  const s = ({
3160
3160
  clientX: o,
3161
3161
  clientY: a,
3162
- targetIds: h
3162
+ targetIds: l
3163
3163
  }) => {
3164
- let l = [];
3165
- if (h.length > 1)
3166
- l = [
3164
+ let h = [];
3165
+ if (l.length > 1)
3166
+ h = [
3167
3167
  // {
3168
3168
  // label: "组合",
3169
3169
  // action: () => {
@@ -3179,9 +3179,9 @@ function Yo(n) {
3179
3179
  // },
3180
3180
  // },
3181
3181
  ];
3182
- else if (h.length === 1) {
3183
- const d = h[0];
3184
- d === "canvas-stage" ? l = [] : l = [
3182
+ else if (l.length === 1) {
3183
+ const d = l[0];
3184
+ d === "canvas-stage" ? h = [] : h = [
3185
3185
  {
3186
3186
  label: "置顶",
3187
3187
  action: () => {
@@ -3208,20 +3208,20 @@ function Yo(n) {
3208
3208
  }
3209
3209
  ];
3210
3210
  }
3211
- if (l.length === 0) {
3211
+ if (h.length === 0) {
3212
3212
  t(null);
3213
3213
  return;
3214
3214
  }
3215
3215
  t({
3216
3216
  x: o,
3217
3217
  y: a,
3218
- items: l
3218
+ items: h
3219
3219
  });
3220
3220
  };
3221
3221
  return n.on("contextmenu:show", s), () => {
3222
3222
  n.off("contextmenu:show", s);
3223
3223
  };
3224
- }, [n]), Z(() => {
3224
+ }, [n]), U(() => {
3225
3225
  const s = () => {
3226
3226
  i && t(null);
3227
3227
  };
@@ -3321,9 +3321,9 @@ function Ys({
3321
3321
  delay: s = 600,
3322
3322
  closeDelay: o = 0
3323
3323
  } = {}) {
3324
- const [a, h] = R(n), l = t ?? a, d = e ?? h, f = ss({
3324
+ const [a, l] = $(n), h = t ?? a, d = e ?? l, m = ss({
3325
3325
  placement: i,
3326
- open: l,
3326
+ open: h,
3327
3327
  onOpenChange: d,
3328
3328
  whileElementsMounted: ls,
3329
3329
  middleware: [
@@ -3335,7 +3335,7 @@ function Ys({
3335
3335
  }),
3336
3336
  as({ padding: 4 })
3337
3337
  ]
3338
- }), m = f.context, u = hs(m, {
3338
+ }), f = m.context, g = hs(f, {
3339
3339
  mouseOnly: !0,
3340
3340
  move: !1,
3341
3341
  restMs: s,
@@ -3343,17 +3343,17 @@ function Ys({
3343
3343
  delay: {
3344
3344
  close: o
3345
3345
  }
3346
- }), y = cs(m, {
3346
+ }), y = cs(f, {
3347
3347
  enabled: t == null
3348
- }), w = ds(m), v = gs(m, { role: "tooltip" }), I = us([u, y, w, v]);
3348
+ }), x = ds(f), v = gs(f, { role: "tooltip" }), I = us([g, y, x, v]);
3349
3349
  return St(
3350
3350
  () => ({
3351
- open: l,
3351
+ open: h,
3352
3352
  setOpen: d,
3353
3353
  ...I,
3354
- ...f
3354
+ ...m
3355
3355
  }),
3356
- [l, d, I, f]
3356
+ [h, d, I, m]
3357
3357
  );
3358
3358
  }
3359
3359
  const Ve = Rn(null);
@@ -3374,7 +3374,7 @@ function Ji({ children: n, ...i }) {
3374
3374
  }
3375
3375
  ) : /* @__PURE__ */ c(Ve.Provider, { value: t, children: n });
3376
3376
  }
3377
- const Qi = $(
3377
+ const Qi = A(
3378
3378
  function({ children: i, asChild: t = !1, ...e }, s) {
3379
3379
  const o = ji(), a = li(i) ? parseInt($n, 10) >= 19 ? (
3380
3380
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -3382,44 +3382,44 @@ const Qi = $(
3382
3382
  ) : (
3383
3383
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3384
3384
  i.ref
3385
- ) : void 0, h = Ni([o.refs.setReference, s, a]);
3385
+ ) : void 0, l = Ni([o.refs.setReference, s, a]);
3386
3386
  if (t && li(i)) {
3387
- const l = {
3387
+ const h = {
3388
3388
  "data-tooltip-state": o.open ? "open" : "closed"
3389
3389
  };
3390
3390
  return An(
3391
3391
  i,
3392
3392
  o.getReferenceProps({
3393
- ref: h,
3393
+ ref: l,
3394
3394
  ...e,
3395
3395
  ...typeof i.props == "object" ? i.props : {},
3396
- ...l
3396
+ ...h
3397
3397
  })
3398
3398
  );
3399
3399
  }
3400
3400
  return /* @__PURE__ */ c(
3401
3401
  "button",
3402
3402
  {
3403
- ref: h,
3403
+ ref: l,
3404
3404
  "data-tooltip-state": o.open ? "open" : "closed",
3405
3405
  ...o.getReferenceProps(e),
3406
3406
  children: i
3407
3407
  }
3408
3408
  );
3409
3409
  }
3410
- ), tn = $(
3410
+ ), tn = A(
3411
3411
  function({ style: i, children: t, portal: e = !0, portalProps: s = {}, ...o }, a) {
3412
- const h = ji(), l = Ni([h.refs.setFloating, a]);
3413
- if (!h.open) return null;
3412
+ const l = ji(), h = Ni([l.refs.setFloating, a]);
3413
+ if (!l.open) return null;
3414
3414
  const d = /* @__PURE__ */ c(
3415
3415
  "div",
3416
3416
  {
3417
- ref: l,
3417
+ ref: h,
3418
3418
  style: {
3419
- ...h.floatingStyles,
3419
+ ...l.floatingStyles,
3420
3420
  ...i
3421
3421
  },
3422
- ...h.getFloatingProps(o),
3422
+ ...l.getFloatingProps(o),
3423
3423
  className: "tiptap-tooltip",
3424
3424
  children: t
3425
3425
  }
@@ -3435,7 +3435,7 @@ const Gs = ({
3435
3435
  }) => n.length === 0 ? null : /* @__PURE__ */ c("div", { children: n.map((i, t) => /* @__PURE__ */ k(Hn, { children: [
3436
3436
  t > 0 && /* @__PURE__ */ c("kbd", { children: "+" }),
3437
3437
  /* @__PURE__ */ c("kbd", { children: i })
3438
- ] }, t)) }), vt = $(
3438
+ ] }, t)) }), vt = A(
3439
3439
  ({
3440
3440
  className: n,
3441
3441
  children: i,
@@ -3444,8 +3444,8 @@ const Gs = ({
3444
3444
  shortcutKeys: s,
3445
3445
  variant: o,
3446
3446
  size: a,
3447
- ...h
3448
- }, l) => {
3447
+ ...l
3448
+ }, h) => {
3449
3449
  const d = St(
3450
3450
  () => ke({ shortcutKeys: s }),
3451
3451
  [s]
@@ -3454,10 +3454,10 @@ const Gs = ({
3454
3454
  "button",
3455
3455
  {
3456
3456
  className: nt("tiptap-button", n),
3457
- ref: l,
3457
+ ref: h,
3458
3458
  "data-style": o,
3459
3459
  "data-size": a,
3460
- ...h,
3460
+ ...l,
3461
3461
  children: i
3462
3462
  }
3463
3463
  ) : /* @__PURE__ */ k(Ji, { delay: 200, children: [
@@ -3465,10 +3465,10 @@ const Gs = ({
3465
3465
  Qi,
3466
3466
  {
3467
3467
  className: nt("tiptap-button", n),
3468
- ref: l,
3468
+ ref: h,
3469
3469
  "data-style": o,
3470
3470
  "data-size": a,
3471
- ...h,
3471
+ ...l,
3472
3472
  children: i
3473
3473
  }
3474
3474
  ),
@@ -3480,7 +3480,7 @@ const Gs = ({
3480
3480
  }
3481
3481
  );
3482
3482
  vt.displayName = "Button";
3483
- const Ht = $(({ className: n, children: i, orientation: t = "vertical", ...e }, s) => /* @__PURE__ */ c(
3483
+ const Ht = A(({ className: n, children: i, orientation: t = "vertical", ...e }, s) => /* @__PURE__ */ c(
3484
3484
  "div",
3485
3485
  {
3486
3486
  ref: s,
@@ -3492,7 +3492,7 @@ const Ht = $(({ className: n, children: i, orientation: t = "vertical", ...e },
3492
3492
  }
3493
3493
  ));
3494
3494
  Ht.displayName = "ButtonGroup";
3495
- const Re = $(
3495
+ const Re = A(
3496
3496
  ({
3497
3497
  variant: n,
3498
3498
  size: i = "default",
@@ -3501,10 +3501,10 @@ const Re = $(
3501
3501
  className: s,
3502
3502
  children: o,
3503
3503
  ...a
3504
- }, h) => /* @__PURE__ */ c(
3504
+ }, l) => /* @__PURE__ */ c(
3505
3505
  "div",
3506
3506
  {
3507
- ref: h,
3507
+ ref: l,
3508
3508
  className: `tiptap-badge ${s || ""}`,
3509
3509
  "data-style": n,
3510
3510
  "data-size": i,
@@ -3522,7 +3522,7 @@ function Ks({
3522
3522
  }) {
3523
3523
  return /* @__PURE__ */ c(Re, { children: ke({ shortcutKeys: i }) });
3524
3524
  }
3525
- const At = $(
3525
+ const At = A(
3526
3526
  ({
3527
3527
  editor: n,
3528
3528
  type: i,
@@ -3531,55 +3531,55 @@ const At = $(
3531
3531
  onToggled: s,
3532
3532
  showShortcut: o = !1,
3533
3533
  onClick: a,
3534
- children: h,
3535
- ...l
3534
+ children: l,
3535
+ ...h
3536
3536
  }, d) => {
3537
- const { editor: f } = yt(n), {
3538
- isVisible: m,
3539
- handleMark: u,
3537
+ const { editor: m } = yt(n), {
3538
+ isVisible: f,
3539
+ handleMark: g,
3540
3540
  label: y,
3541
- canToggle: w,
3541
+ canToggle: x,
3542
3542
  isActive: v,
3543
3543
  Icon: I,
3544
- shortcutKeys: C
3544
+ shortcutKeys: w
3545
3545
  } = eo({
3546
- editor: f,
3546
+ editor: m,
3547
3547
  type: i,
3548
3548
  hideWhenUnavailable: e,
3549
3549
  onToggled: s
3550
- }), B = J(
3551
- (dt) => {
3552
- a?.(dt), !dt.defaultPrevented && u();
3550
+ }), z = Q(
3551
+ (X) => {
3552
+ a?.(X), !X.defaultPrevented && g();
3553
3553
  },
3554
- [u, a]
3554
+ [g, a]
3555
3555
  );
3556
- return m ? /* @__PURE__ */ c(
3556
+ return f ? /* @__PURE__ */ c(
3557
3557
  vt,
3558
3558
  {
3559
3559
  type: "button",
3560
- disabled: !w,
3560
+ disabled: !x,
3561
3561
  variant: "ghost",
3562
3562
  "data-active-state": v ? "on" : "off",
3563
- "data-disabled": !w,
3563
+ "data-disabled": !x,
3564
3564
  role: "button",
3565
3565
  tabIndex: -1,
3566
3566
  "aria-label": y,
3567
3567
  "aria-pressed": v,
3568
3568
  tooltip: y,
3569
- onClick: B,
3570
- ...l,
3569
+ onClick: z,
3570
+ ...h,
3571
3571
  ref: d,
3572
- children: h ?? /* @__PURE__ */ k(Ie, { children: [
3572
+ children: l ?? /* @__PURE__ */ k(Ie, { children: [
3573
3573
  /* @__PURE__ */ c(I, { className: "tiptap-button-icon" }),
3574
3574
  t && /* @__PURE__ */ c("span", { className: "tiptap-button-text", children: t }),
3575
- o && /* @__PURE__ */ c(Ks, { type: i, shortcutKeys: C })
3575
+ o && /* @__PURE__ */ c(Ks, { type: i, shortcutKeys: w })
3576
3576
  ] })
3577
3577
  }
3578
3578
  ) : null;
3579
3579
  }
3580
3580
  );
3581
3581
  At.displayName = "MarkButton";
3582
- const en = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3582
+ const en = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3583
3583
  "svg",
3584
3584
  {
3585
3585
  width: "24",
@@ -3601,7 +3601,7 @@ const en = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3601
3601
  }
3602
3602
  ));
3603
3603
  en.displayName = "BoldIcon";
3604
- const nn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3604
+ const nn = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3605
3605
  "svg",
3606
3606
  {
3607
3607
  width: "24",
@@ -3637,7 +3637,7 @@ const nn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3637
3637
  }
3638
3638
  ));
3639
3639
  nn.displayName = "Code2Icon";
3640
- const sn = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3640
+ const sn = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3641
3641
  "svg",
3642
3642
  {
3643
3643
  width: "24",
@@ -3657,7 +3657,7 @@ const sn = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3657
3657
  }
3658
3658
  ));
3659
3659
  sn.displayName = "ItalicIcon";
3660
- const on = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3660
+ const on = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3661
3661
  "svg",
3662
3662
  {
3663
3663
  width: "24",
@@ -3686,7 +3686,7 @@ const on = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3686
3686
  }
3687
3687
  ));
3688
3688
  on.displayName = "StrikeIcon";
3689
- const rn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3689
+ const rn = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3690
3690
  "svg",
3691
3691
  {
3692
3692
  width: "24",
@@ -3728,7 +3728,7 @@ const rn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3728
3728
  }
3729
3729
  ));
3730
3730
  rn.displayName = "SubscriptIcon";
3731
- const an = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3731
+ const an = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3732
3732
  "svg",
3733
3733
  {
3734
3734
  width: "24",
@@ -3770,7 +3770,7 @@ const an = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3770
3770
  }
3771
3771
  ));
3772
3772
  an.displayName = "SuperscriptIcon";
3773
- const ln = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3773
+ const ln = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3774
3774
  "svg",
3775
3775
  {
3776
3776
  width: "24",
@@ -3831,26 +3831,26 @@ function eo(n) {
3831
3831
  type: t,
3832
3832
  hideWhenUnavailable: e = !1,
3833
3833
  onToggled: s
3834
- } = n, { editor: o } = yt(i), [a, h] = R(!0), l = We(o, t), d = js(o, t);
3835
- Z(() => {
3834
+ } = n, { editor: o } = yt(i), [a, l] = $(!0), h = We(o, t), d = js(o, t);
3835
+ U(() => {
3836
3836
  if (!o) return;
3837
- const m = () => {
3838
- h(Qs({ editor: o, type: t, hideWhenUnavailable: e }));
3837
+ const f = () => {
3838
+ l(Qs({ editor: o, type: t, hideWhenUnavailable: e }));
3839
3839
  };
3840
- return m(), o.on("selectionUpdate", m), () => {
3841
- o.off("selectionUpdate", m);
3840
+ return f(), o.on("selectionUpdate", f), () => {
3841
+ o.off("selectionUpdate", f);
3842
3842
  };
3843
3843
  }, [o, t, e]);
3844
- const f = J(() => {
3844
+ const m = Q(() => {
3845
3845
  if (!o) return !1;
3846
- const m = Js(o, t);
3847
- return m && s?.(), m;
3846
+ const f = Js(o, t);
3847
+ return f && s?.(), f;
3848
3848
  }, [o, t, s]);
3849
3849
  return {
3850
3850
  isVisible: a,
3851
3851
  isActive: d,
3852
- handleMark: f,
3853
- canToggle: l,
3852
+ handleMark: m,
3853
+ canToggle: h,
3854
3854
  label: to(t),
3855
3855
  shortcutKeys: hn[t],
3856
3856
  Icon: qs[t]
@@ -3864,44 +3864,44 @@ function cn({
3864
3864
  onSelect: s,
3865
3865
  onClose: o,
3866
3866
  orientation: a = "vertical",
3867
- autoSelectFirstItem: h = !0
3867
+ autoSelectFirstItem: l = !0
3868
3868
  }) {
3869
- const [l, d] = R(
3870
- h ? 0 : -1
3869
+ const [h, d] = $(
3870
+ l ? 0 : -1
3871
3871
  );
3872
- return Z(() => {
3873
- const f = (u) => {
3872
+ return U(() => {
3873
+ const m = (g) => {
3874
3874
  if (!e.length) return !1;
3875
- const y = () => d((v) => v === -1 ? 0 : (v + 1) % e.length), w = () => d((v) => v === -1 ? e.length - 1 : (v - 1 + e.length) % e.length);
3876
- switch (u.key) {
3875
+ const y = () => d((v) => v === -1 ? 0 : (v + 1) % e.length), x = () => d((v) => v === -1 ? e.length - 1 : (v - 1 + e.length) % e.length);
3876
+ switch (g.key) {
3877
3877
  case "ArrowUp":
3878
- return a === "horizontal" ? !1 : (u.preventDefault(), w(), !0);
3878
+ return a === "horizontal" ? !1 : (g.preventDefault(), x(), !0);
3879
3879
  case "ArrowDown":
3880
- return a === "horizontal" ? !1 : (u.preventDefault(), y(), !0);
3880
+ return a === "horizontal" ? !1 : (g.preventDefault(), y(), !0);
3881
3881
  case "ArrowLeft":
3882
- return a === "vertical" ? !1 : (u.preventDefault(), w(), !0);
3882
+ return a === "vertical" ? !1 : (g.preventDefault(), x(), !0);
3883
3883
  case "ArrowRight":
3884
- return a === "vertical" ? !1 : (u.preventDefault(), y(), !0);
3884
+ return a === "vertical" ? !1 : (g.preventDefault(), y(), !0);
3885
3885
  case "Tab":
3886
- return u.preventDefault(), u.shiftKey ? w() : y(), !0;
3886
+ return g.preventDefault(), g.shiftKey ? x() : y(), !0;
3887
3887
  case "Home":
3888
- return u.preventDefault(), d(0), !0;
3888
+ return g.preventDefault(), d(0), !0;
3889
3889
  case "End":
3890
- return u.preventDefault(), d(e.length - 1), !0;
3890
+ return g.preventDefault(), d(e.length - 1), !0;
3891
3891
  case "Enter":
3892
- return u.isComposing ? !1 : (u.preventDefault(), l !== -1 && e[l] && s?.(e[l]), !0);
3892
+ return g.isComposing ? !1 : (g.preventDefault(), h !== -1 && e[h] && s?.(e[h]), !0);
3893
3893
  case "Escape":
3894
- return u.preventDefault(), o?.(), !0;
3894
+ return g.preventDefault(), o?.(), !0;
3895
3895
  default:
3896
3896
  return !1;
3897
3897
  }
3898
3898
  };
3899
- let m = null;
3900
- if (n ? m = n.view.dom : i?.current && (m = i.current), m)
3901
- return m.addEventListener("keydown", f, !0), () => {
3902
- m?.removeEventListener(
3899
+ let f = null;
3900
+ if (n ? f = n.view.dom : i?.current && (f = i.current), f)
3901
+ return f.addEventListener("keydown", m, !0), () => {
3902
+ f?.removeEventListener(
3903
3903
  "keydown",
3904
- f,
3904
+ m,
3905
3905
  !0
3906
3906
  );
3907
3907
  };
@@ -3909,25 +3909,25 @@ function cn({
3909
3909
  n,
3910
3910
  i,
3911
3911
  e,
3912
- l,
3912
+ h,
3913
3913
  s,
3914
3914
  o,
3915
3915
  a
3916
- ]), Z(() => {
3917
- t && d(h ? 0 : -1);
3918
- }, [t, h]), {
3919
- selectedIndex: e.length ? l : void 0,
3916
+ ]), U(() => {
3917
+ t && d(l ? 0 : -1);
3918
+ }, [t, l]), {
3919
+ selectedIndex: e.length ? h : void 0,
3920
3920
  setSelectedIndex: d
3921
3921
  };
3922
3922
  }
3923
3923
  function $e(n = "max", i = 768) {
3924
- const [t, e] = R(void 0);
3925
- return Z(() => {
3926
- const s = n === "min" ? `(min-width: ${i}px)` : `(max-width: ${i - 1}px)`, o = window.matchMedia(s), a = (h) => e(h.matches);
3924
+ const [t, e] = $(void 0);
3925
+ return U(() => {
3926
+ const s = n === "min" ? `(min-width: ${i}px)` : `(max-width: ${i - 1}px)`, o = window.matchMedia(s), a = (l) => e(l.matches);
3927
3927
  return e(o.matches), o.addEventListener("change", a), () => o.removeEventListener("change", a);
3928
3928
  }, [n, i]), !!t;
3929
3929
  }
3930
- const Xe = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3930
+ const Xe = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3931
3931
  "svg",
3932
3932
  {
3933
3933
  width: "24",
@@ -3949,7 +3949,7 @@ const Xe = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3949
3949
  }
3950
3950
  ));
3951
3951
  Xe.displayName = "BanIcon";
3952
- const Ye = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3952
+ const Ye = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3953
3953
  "svg",
3954
3954
  {
3955
3955
  width: "24",
@@ -3998,7 +3998,7 @@ function un({
3998
3998
  }
3999
3999
  ) });
4000
4000
  }
4001
- const Ge = $(
4001
+ const Ge = A(
4002
4002
  ({ decorative: n, orientation: i = "vertical", className: t, ...e }, s) => {
4003
4003
  const a = n ? { role: "none" } : { "aria-orientation": i === "vertical" ? i : void 0, role: "separator" };
4004
4004
  return /* @__PURE__ */ c(
@@ -4014,11 +4014,11 @@ const Ge = $(
4014
4014
  }
4015
4015
  );
4016
4016
  Ge.displayName = "Separator";
4017
- const Ke = $(
4017
+ const Ke = A(
4018
4018
  ({ className: n, ...i }, t) => /* @__PURE__ */ c("div", { ref: t, className: nt("tiptap-card", n), ...i })
4019
4019
  );
4020
4020
  Ke.displayName = "Card";
4021
- const io = $(
4021
+ const io = A(
4022
4022
  ({ className: n, ...i }, t) => /* @__PURE__ */ c(
4023
4023
  "div",
4024
4024
  {
@@ -4029,11 +4029,11 @@ const io = $(
4029
4029
  )
4030
4030
  );
4031
4031
  io.displayName = "CardHeader";
4032
- const qe = $(
4032
+ const qe = A(
4033
4033
  ({ className: n, ...i }, t) => /* @__PURE__ */ c("div", { ref: t, className: nt("tiptap-card-body", n), ...i })
4034
4034
  );
4035
4035
  qe.displayName = "CardBody";
4036
- const je = $(({ className: n, orientation: i = "vertical", ...t }, e) => /* @__PURE__ */ c(
4036
+ const je = A(({ className: n, orientation: i = "vertical", ...t }, e) => /* @__PURE__ */ c(
4037
4037
  "div",
4038
4038
  {
4039
4039
  ref: e,
@@ -4043,7 +4043,7 @@ const je = $(({ className: n, orientation: i = "vertical", ...t }, e) => /* @__P
4043
4043
  }
4044
4044
  ));
4045
4045
  je.displayName = "CardItemGroup";
4046
- const no = $(
4046
+ const no = A(
4047
4047
  ({ className: n, ...i }, t) => /* @__PURE__ */ c(
4048
4048
  "div",
4049
4049
  {
@@ -4054,7 +4054,7 @@ const no = $(
4054
4054
  )
4055
4055
  );
4056
4056
  no.displayName = "CardGroupLabel";
4057
- const so = $(
4057
+ const so = A(
4058
4058
  ({ className: n, ...i }, t) => /* @__PURE__ */ c(
4059
4059
  "div",
4060
4060
  {
@@ -4070,7 +4070,7 @@ function oo({
4070
4070
  }) {
4071
4071
  return /* @__PURE__ */ c(Re, { children: ke({ shortcutKeys: n }) });
4072
4072
  }
4073
- const mn = $(
4073
+ const mn = A(
4074
4074
  ({
4075
4075
  editor: n,
4076
4076
  highlightColor: i,
@@ -4079,40 +4079,40 @@ const mn = $(
4079
4079
  mode: s = "mark",
4080
4080
  onApplied: o,
4081
4081
  showShortcut: a = !1,
4082
- onClick: h,
4083
- children: l,
4082
+ onClick: l,
4083
+ children: h,
4084
4084
  style: d,
4085
- useColorValue: f = !1,
4086
- ...m
4087
- }, u) => {
4085
+ useColorValue: m = !1,
4086
+ ...f
4087
+ }, g) => {
4088
4088
  const { editor: y } = yt(n), {
4089
- isVisible: w,
4089
+ isVisible: x,
4090
4090
  canColorHighlight: v,
4091
4091
  isActive: I,
4092
- handleColorHighlight: C,
4093
- label: B,
4094
- shortcutKeys: dt
4092
+ handleColorHighlight: w,
4093
+ label: z,
4094
+ shortcutKeys: X
4095
4095
  } = Qe({
4096
4096
  editor: y,
4097
4097
  highlightColor: i,
4098
- useColorValue: f,
4098
+ useColorValue: m,
4099
4099
  label: t || `Toggle highlight (${i})`,
4100
4100
  hideWhenUnavailable: e,
4101
4101
  mode: s,
4102
4102
  onApplied: o
4103
- }), K = J(
4103
+ }), R = Q(
4104
4104
  (Ct) => {
4105
- h?.(Ct), !Ct.defaultPrevented && (C(), Ct.preventDefault(), Ct.stopPropagation());
4105
+ l?.(Ct), !Ct.defaultPrevented && (w(), Ct.preventDefault(), Ct.stopPropagation());
4106
4106
  },
4107
- [C, h]
4108
- ), q = St(
4107
+ [w, l]
4108
+ ), F = St(
4109
4109
  () => ({
4110
4110
  ...d,
4111
4111
  "--highlight-color": i
4112
4112
  }),
4113
4113
  [i, d]
4114
4114
  );
4115
- return w ? /* @__PURE__ */ c(
4115
+ return x ? /* @__PURE__ */ c(
4116
4116
  vt,
4117
4117
  {
4118
4118
  type: "button",
@@ -4122,14 +4122,14 @@ const mn = $(
4122
4122
  tabIndex: -1,
4123
4123
  disabled: !v,
4124
4124
  "data-disabled": !v,
4125
- "aria-label": B,
4125
+ "aria-label": z,
4126
4126
  "aria-pressed": I,
4127
- tooltip: B,
4128
- onClick: K,
4129
- style: q,
4130
- ...m,
4131
- ref: u,
4132
- children: l ?? /* @__PURE__ */ k(Ie, { children: [
4127
+ tooltip: z,
4128
+ onClick: R,
4129
+ style: F,
4130
+ ...f,
4131
+ ref: g,
4132
+ children: h ?? /* @__PURE__ */ k(Ie, { children: [
4133
4133
  /* @__PURE__ */ c(
4134
4134
  "span",
4135
4135
  {
@@ -4138,7 +4138,7 @@ const mn = $(
4138
4138
  }
4139
4139
  ),
4140
4140
  t && /* @__PURE__ */ c("span", { className: "tiptap-button-text", children: t }),
4141
- a && /* @__PURE__ */ c(oo, { shortcutKeys: dt })
4141
+ a && /* @__PURE__ */ c(oo, { shortcutKeys: X })
4142
4142
  ] })
4143
4143
  }
4144
4144
  ) : null;
@@ -4237,8 +4237,8 @@ function ao(n, i, t = "mark") {
4237
4237
  try {
4238
4238
  const { state: e } = n, { selection: s } = e, o = s.$anchor;
4239
4239
  for (let a = o.depth; a >= 0; a--) {
4240
- const h = o.node(a);
4241
- if (h && h.attrs?.backgroundColor === i)
4240
+ const l = o.node(a);
4241
+ if (l && l.attrs?.backgroundColor === i)
4242
4242
  return !0;
4243
4243
  }
4244
4244
  return !1;
@@ -4267,62 +4267,62 @@ function Qe(n) {
4267
4267
  hideWhenUnavailable: s = !1,
4268
4268
  mode: o = "mark",
4269
4269
  useColorValue: a = !1,
4270
- onApplied: h
4271
- } = n, { editor: l } = yt(i), d = $e(), [f, m] = R(!0), u = Je(l, o), y = e && ro(e, a), w = ao(l, y, o);
4272
- Z(() => {
4273
- if (!l) return;
4274
- const C = () => {
4275
- m(ho({ editor: l, hideWhenUnavailable: s, mode: o }));
4270
+ onApplied: l
4271
+ } = n, { editor: h } = yt(i), d = $e(), [m, f] = $(!0), g = Je(h, o), y = e && ro(e, a), x = ao(h, y, o);
4272
+ U(() => {
4273
+ if (!h) return;
4274
+ const w = () => {
4275
+ f(ho({ editor: h, hideWhenUnavailable: s, mode: o }));
4276
4276
  };
4277
- return C(), l.on("selectionUpdate", C), () => {
4278
- l.off("selectionUpdate", C);
4277
+ return w(), h.on("selectionUpdate", w), () => {
4278
+ h.off("selectionUpdate", w);
4279
4279
  };
4280
- }, [l, s, o]);
4281
- const v = J(() => {
4282
- if (!l || !u || !y || !t)
4280
+ }, [h, s, o]);
4281
+ const v = Q(() => {
4282
+ if (!h || !g || !y || !t)
4283
4283
  return !1;
4284
4284
  if (o === "mark") {
4285
- if (l.state.storedMarks) {
4286
- const C = l.schema.marks.highlight;
4287
- C && l.view.dispatch(
4288
- l.state.tr.removeStoredMark(C)
4285
+ if (h.state.storedMarks) {
4286
+ const w = h.schema.marks.highlight;
4287
+ w && h.view.dispatch(
4288
+ h.state.tr.removeStoredMark(w)
4289
4289
  );
4290
4290
  }
4291
4291
  return setTimeout(() => {
4292
- const C = l.chain().focus().toggleHighlight({ color: y }).run();
4293
- return C && h?.({ color: y, label: t, mode: o }), C;
4292
+ const w = h.chain().focus().toggleHighlight({ color: y }).run();
4293
+ return w && l?.({ color: y, label: t, mode: o }), w;
4294
4294
  }, 0), !0;
4295
4295
  } else {
4296
- const C = l.chain().focus().toggleNodeBackgroundColor(y).run();
4297
- return C && h?.({ color: y, label: t, mode: o }), C;
4296
+ const w = h.chain().focus().toggleNodeBackgroundColor(y).run();
4297
+ return w && l?.({ color: y, label: t, mode: o }), w;
4298
4298
  }
4299
- }, [u, y, l, t, h, o]), I = J(() => {
4300
- const C = lo(l, o);
4301
- return C && h?.({ color: "", label: "Remove highlight", mode: o }), C;
4302
- }, [l, h, o]);
4299
+ }, [g, y, h, t, l, o]), I = Q(() => {
4300
+ const w = lo(h, o);
4301
+ return w && l?.({ color: "", label: "Remove highlight", mode: o }), w;
4302
+ }, [h, l, o]);
4303
4303
  return Ti(
4304
4304
  Oe,
4305
- (C) => {
4306
- C.preventDefault(), v();
4305
+ (w) => {
4306
+ w.preventDefault(), v();
4307
4307
  },
4308
4308
  {
4309
- enabled: f && u,
4309
+ enabled: m && g,
4310
4310
  enableOnContentEditable: !d,
4311
4311
  enableOnFormTags: !0
4312
4312
  }
4313
4313
  ), {
4314
- isVisible: f,
4315
- isActive: w,
4314
+ isVisible: m,
4315
+ isActive: x,
4316
4316
  handleColorHighlight: v,
4317
4317
  handleRemoveHighlight: I,
4318
- canColorHighlight: u,
4318
+ canColorHighlight: g,
4319
4319
  label: t || "Highlight",
4320
4320
  shortcutKeys: Oe,
4321
4321
  Icon: Ye,
4322
4322
  mode: o
4323
4323
  };
4324
4324
  }
4325
- const yn = $(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4325
+ const yn = A(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4326
4326
  vt,
4327
4327
  {
4328
4328
  type: "button",
@@ -4353,16 +4353,16 @@ function co({
4353
4353
  const { handleRemoveHighlight: e } = Qe({ editor: n }), s = $e(), o = Ue(null), a = St(
4354
4354
  () => [...i, { label: "Remove highlight", value: "none" }],
4355
4355
  [i]
4356
- ), { selectedIndex: h } = cn({
4356
+ ), { selectedIndex: l } = cn({
4357
4357
  containerRef: o,
4358
4358
  items: a,
4359
4359
  orientation: "both",
4360
- onSelect: (l) => {
4360
+ onSelect: (h) => {
4361
4361
  if (!o.current) return !1;
4362
4362
  const d = o.current.querySelector(
4363
4363
  '[data-highlighted="true"]'
4364
4364
  );
4365
- return d && d.click(), l.value === "none" && e(), !0;
4365
+ return d && d.click(), h.value === "none" && e(), !0;
4366
4366
  },
4367
4367
  autoSelectFirstItem: !1
4368
4368
  });
@@ -4373,18 +4373,18 @@ function co({
4373
4373
  tabIndex: 0,
4374
4374
  style: s ? { boxShadow: "none", border: 0 } : {},
4375
4375
  children: /* @__PURE__ */ c(qe, { style: s ? { padding: 0 } : {}, children: /* @__PURE__ */ k(je, { orientation: "horizontal", children: [
4376
- /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((l, d) => /* @__PURE__ */ c(
4376
+ /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((h, d) => /* @__PURE__ */ c(
4377
4377
  mn,
4378
4378
  {
4379
4379
  editor: n,
4380
- highlightColor: t ? l.colorValue : l.value,
4381
- tooltip: l.label,
4382
- "aria-label": `${l.label} highlight color`,
4383
- tabIndex: d === h ? 0 : -1,
4384
- "data-highlighted": h === d,
4380
+ highlightColor: t ? h.colorValue : h.value,
4381
+ tooltip: h.label,
4382
+ "aria-label": `${h.label} highlight color`,
4383
+ tabIndex: d === l ? 0 : -1,
4384
+ "data-highlighted": l === d,
4385
4385
  useColorValue: t
4386
4386
  },
4387
- l.value
4387
+ h.value
4388
4388
  )) }),
4389
4389
  /* @__PURE__ */ c(Ge, {}),
4390
4390
  /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: /* @__PURE__ */ c(
@@ -4393,11 +4393,11 @@ function co({
4393
4393
  onClick: e,
4394
4394
  "aria-label": "Remove highlight",
4395
4395
  tooltip: "Remove highlight",
4396
- tabIndex: h === i.length ? 0 : -1,
4396
+ tabIndex: l === i.length ? 0 : -1,
4397
4397
  type: "button",
4398
4398
  role: "menuitem",
4399
4399
  variant: "ghost",
4400
- "data-highlighted": h === i.length,
4400
+ "data-highlighted": l === i.length,
4401
4401
  children: /* @__PURE__ */ c(Xe, { className: "tiptap-button-icon" })
4402
4402
  }
4403
4403
  ) })
@@ -4419,21 +4419,21 @@ function go({
4419
4419
  onApplied: s,
4420
4420
  ...o
4421
4421
  }) {
4422
- const { editor: a } = yt(n), [h, l] = R(!1), { isVisible: d, canColorHighlight: f, isActive: m, label: u, Icon: y } = Qe({
4422
+ const { editor: a } = yt(n), [l, h] = $(!1), { isVisible: d, canColorHighlight: m, isActive: f, label: g, Icon: y } = Qe({
4423
4423
  editor: a,
4424
4424
  hideWhenUnavailable: t,
4425
4425
  onApplied: s
4426
4426
  });
4427
- return d ? /* @__PURE__ */ k(dn, { open: h, onOpenChange: l, children: [
4427
+ return d ? /* @__PURE__ */ k(dn, { open: l, onOpenChange: h, children: [
4428
4428
  /* @__PURE__ */ c(gn, { asChild: !0, children: /* @__PURE__ */ c(
4429
4429
  yn,
4430
4430
  {
4431
- disabled: !f,
4432
- "data-active-state": m ? "on" : "off",
4433
- "data-disabled": !f,
4434
- "aria-pressed": m,
4435
- "aria-label": u,
4436
- tooltip: u,
4431
+ disabled: !m,
4432
+ "data-active-state": f ? "on" : "off",
4433
+ "data-disabled": !m,
4434
+ "aria-pressed": f,
4435
+ "aria-label": g,
4436
+ tooltip: g,
4437
4437
  ...o,
4438
4438
  children: /* @__PURE__ */ c(y, { className: "tiptap-button-icon" })
4439
4439
  }
@@ -4448,7 +4448,7 @@ function go({
4448
4448
  ) })
4449
4449
  ] }) : null;
4450
4450
  }
4451
- const ti = ct(({ className: n, ...i }) => /* @__PURE__ */ k("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: `lucide lucide-palette-icon lucide-palette ${n}`, ...i, children: [
4451
+ const ti = dt(({ className: n, ...i }) => /* @__PURE__ */ k("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: `lucide lucide-palette-icon lucide-palette ${n}`, ...i, children: [
4452
4452
  /* @__PURE__ */ c("path", { d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z" }),
4453
4453
  /* @__PURE__ */ c("circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor" }),
4454
4454
  /* @__PURE__ */ c("circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor" }),
@@ -4461,7 +4461,7 @@ function uo({
4461
4461
  }) {
4462
4462
  return /* @__PURE__ */ c(Re, { children: ke({ shortcutKeys: n }) });
4463
4463
  }
4464
- const vn = $(
4464
+ const vn = A(
4465
4465
  ({
4466
4466
  editor: n,
4467
4467
  textColor: i,
@@ -4470,36 +4470,36 @@ const vn = $(
4470
4470
  onApplied: s,
4471
4471
  showShortcut: o = !1,
4472
4472
  onClick: a,
4473
- children: h,
4474
- style: l,
4473
+ children: l,
4474
+ style: h,
4475
4475
  useColorValue: d = !1,
4476
- ...f
4477
- }, m) => {
4478
- const { editor: u } = yt(n), {
4476
+ ...m
4477
+ }, f) => {
4478
+ const { editor: g } = yt(n), {
4479
4479
  isVisible: y,
4480
- canTextColor: w,
4480
+ canTextColor: x,
4481
4481
  isActive: v,
4482
4482
  handleTextColor: I,
4483
- label: C,
4484
- shortcutKeys: B
4483
+ label: w,
4484
+ shortcutKeys: z
4485
4485
  } = ii({
4486
- editor: u,
4486
+ editor: g,
4487
4487
  textColor: i,
4488
4488
  useColorValue: d,
4489
4489
  label: t || `Toggle text color (${i})`,
4490
4490
  hideWhenUnavailable: e,
4491
4491
  onApplied: s
4492
- }), dt = J(
4493
- (q) => {
4494
- a?.(q), !q.defaultPrevented && (I(), q.preventDefault(), q.stopPropagation());
4492
+ }), X = Q(
4493
+ (F) => {
4494
+ a?.(F), !F.defaultPrevented && (I(), F.preventDefault(), F.stopPropagation());
4495
4495
  },
4496
4496
  [I, a]
4497
- ), K = St(
4497
+ ), R = St(
4498
4498
  () => ({
4499
- ...l,
4499
+ ...h,
4500
4500
  "--text-color": i
4501
4501
  }),
4502
- [i, l]
4502
+ [i, h]
4503
4503
  );
4504
4504
  return y ? /* @__PURE__ */ k(
4505
4505
  vt,
@@ -4509,24 +4509,24 @@ const vn = $(
4509
4509
  "data-active-state": v ? "on" : "off",
4510
4510
  role: "button",
4511
4511
  tabIndex: -1,
4512
- disabled: !w,
4513
- "data-disabled": !w,
4514
- "aria-label": C,
4512
+ disabled: !x,
4513
+ "data-disabled": !x,
4514
+ "aria-label": w,
4515
4515
  "aria-pressed": v,
4516
- tooltip: C,
4517
- onClick: dt,
4518
- ref: m,
4519
- style: K,
4520
- ...f,
4516
+ tooltip: w,
4517
+ onClick: X,
4518
+ ref: f,
4519
+ style: R,
4520
+ ...m,
4521
4521
  children: [
4522
- h || /* @__PURE__ */ c(
4522
+ l || /* @__PURE__ */ c(
4523
4523
  "span",
4524
4524
  {
4525
4525
  className: "tiptap-button-text-color",
4526
4526
  style: { "--highlight-color": i }
4527
4527
  }
4528
4528
  ),
4529
- o && /* @__PURE__ */ c(uo, { shortcutKeys: B })
4529
+ o && /* @__PURE__ */ c(uo, { shortcutKeys: z })
4530
4530
  ]
4531
4531
  }
4532
4532
  ) : null;
@@ -4610,31 +4610,31 @@ function ii({
4610
4610
  useColorValue: s = !1,
4611
4611
  onApplied: o
4612
4612
  } = {}) {
4613
- const { editor: a } = yt(n), h = $e(), [l, d] = R(!0), [f, m] = R(!1), u = ei(a);
4614
- Z(() => {
4613
+ const { editor: a } = yt(n), l = $e(), [h, d] = $(!0), [m, f] = $(!1), g = ei(a);
4614
+ U(() => {
4615
4615
  if (!a) {
4616
4616
  d(!1);
4617
4617
  return;
4618
4618
  }
4619
4619
  const v = po({ editor: a, hideWhenUnavailable: e });
4620
4620
  d(v);
4621
- }, [a, e]), Z(() => {
4621
+ }, [a, e]), U(() => {
4622
4622
  if (!a) {
4623
- m(!1);
4623
+ f(!1);
4624
4624
  return;
4625
4625
  }
4626
4626
  const v = () => {
4627
- m(Si(a, i));
4627
+ f(Si(a, i));
4628
4628
  };
4629
4629
  return a.on("selectionUpdate", v), a.on("transaction", v), v(), () => {
4630
4630
  a.off("selectionUpdate", v), a.off("transaction", v);
4631
4631
  };
4632
4632
  }, [a, i]);
4633
- const y = J(() => {
4634
- if (!a || !u) return;
4633
+ const y = Q(() => {
4634
+ if (!a || !g) return;
4635
4635
  const v = i ? mo(i, s) : "#000000";
4636
4636
  Si(a, v) ? a.chain().focus().unsetColor().run() : (a.chain().focus().setColor(v).run(), o?.({ color: v, label: t }));
4637
- }, [a, i, s, t, u, o]), w = J(() => {
4637
+ }, [a, i, s, t, g, o]), x = Q(() => {
4638
4638
  fo(a);
4639
4639
  }, [a]);
4640
4640
  return Ti(
@@ -4643,22 +4643,22 @@ function ii({
4643
4643
  v.preventDefault(), y();
4644
4644
  },
4645
4645
  {
4646
- enabled: !h && l && u,
4646
+ enabled: !l && h && g,
4647
4647
  enableOnFormTags: ["INPUT", "TEXTAREA", "SELECT"]
4648
4648
  },
4649
- [y, h, l, u]
4649
+ [y, l, h, g]
4650
4650
  ), {
4651
- isVisible: l,
4652
- canTextColor: u,
4653
- isActive: f,
4651
+ isVisible: h,
4652
+ canTextColor: g,
4653
+ isActive: m,
4654
4654
  handleTextColor: y,
4655
- handleRemoveTextColor: w,
4655
+ handleRemoveTextColor: x,
4656
4656
  label: t,
4657
4657
  shortcutKeys: Ze,
4658
4658
  Icon: ti
4659
4659
  };
4660
4660
  }
4661
- const wn = $(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4661
+ const wn = A(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4662
4662
  vt,
4663
4663
  {
4664
4664
  type: "button",
@@ -4690,16 +4690,16 @@ function yo({
4690
4690
  const { handleRemoveTextColor: e } = ii({ editor: n }), s = $e(), o = Ue(null), a = St(
4691
4691
  () => [...i, { label: "Remove color", value: "none" }],
4692
4692
  [i]
4693
- ), { selectedIndex: h } = cn({
4693
+ ), { selectedIndex: l } = cn({
4694
4694
  containerRef: o,
4695
4695
  items: a,
4696
4696
  orientation: "both",
4697
- onSelect: (l) => {
4697
+ onSelect: (h) => {
4698
4698
  if (!o.current) return !1;
4699
4699
  const d = o.current.querySelector(
4700
4700
  '[data-highlighted="true"]'
4701
4701
  );
4702
- return d && d.click(), l.value === "none" && e(), !0;
4702
+ return d && d.click(), h.value === "none" && e(), !0;
4703
4703
  },
4704
4704
  autoSelectFirstItem: !1
4705
4705
  });
@@ -4710,18 +4710,18 @@ function yo({
4710
4710
  tabIndex: 0,
4711
4711
  style: s ? { boxShadow: "none", border: 0 } : {},
4712
4712
  children: /* @__PURE__ */ c(qe, { style: s ? { padding: 0 } : {}, children: /* @__PURE__ */ k(je, { orientation: "horizontal", children: [
4713
- /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((l, d) => /* @__PURE__ */ c(
4713
+ /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((h, d) => /* @__PURE__ */ c(
4714
4714
  vn,
4715
4715
  {
4716
4716
  editor: n,
4717
- textColor: t ? l.colorValue : l.value,
4718
- tooltip: l.label,
4719
- "aria-label": `${l.label} text color`,
4720
- tabIndex: d === h ? 0 : -1,
4721
- "data-highlighted": h === d,
4717
+ textColor: t ? h.colorValue : h.value,
4718
+ tooltip: h.label,
4719
+ "aria-label": `${h.label} text color`,
4720
+ tabIndex: d === l ? 0 : -1,
4721
+ "data-highlighted": l === d,
4722
4722
  useColorValue: t
4723
4723
  },
4724
- l.value
4724
+ h.value
4725
4725
  )) }),
4726
4726
  /* @__PURE__ */ c(Ge, {}),
4727
4727
  /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: /* @__PURE__ */ c(
@@ -4730,11 +4730,11 @@ function yo({
4730
4730
  onClick: e,
4731
4731
  "aria-label": "Remove text color",
4732
4732
  tooltip: "Remove text color",
4733
- tabIndex: h === i.length ? 0 : -1,
4733
+ tabIndex: l === i.length ? 0 : -1,
4734
4734
  type: "button",
4735
4735
  role: "menuitem",
4736
4736
  variant: "ghost",
4737
- "data-highlighted": h === i.length,
4737
+ "data-highlighted": l === i.length,
4738
4738
  children: /* @__PURE__ */ c(Xe, { className: "tiptap-button-icon" })
4739
4739
  }
4740
4740
  ) })
@@ -4756,21 +4756,21 @@ function vo({
4756
4756
  onApplied: s,
4757
4757
  ...o
4758
4758
  }) {
4759
- const { editor: a } = yt(n), [h, l] = R(!1), { isVisible: d, canTextColor: f, isActive: m, label: u, Icon: y } = ii({
4759
+ const { editor: a } = yt(n), [l, h] = $(!1), { isVisible: d, canTextColor: m, isActive: f, label: g, Icon: y } = ii({
4760
4760
  editor: a,
4761
4761
  hideWhenUnavailable: t,
4762
4762
  onApplied: s
4763
4763
  });
4764
- return d ? /* @__PURE__ */ k(dn, { open: h, onOpenChange: l, children: [
4764
+ return d ? /* @__PURE__ */ k(dn, { open: l, onOpenChange: h, children: [
4765
4765
  /* @__PURE__ */ c(gn, { asChild: !0, children: /* @__PURE__ */ c(
4766
4766
  wn,
4767
4767
  {
4768
- disabled: !f,
4769
- "data-active-state": m ? "on" : "off",
4770
- "data-disabled": !f,
4771
- "aria-pressed": m,
4772
- "aria-label": u,
4773
- tooltip: u,
4768
+ disabled: !m,
4769
+ "data-active-state": f ? "on" : "off",
4770
+ "data-disabled": !m,
4771
+ "aria-pressed": f,
4772
+ "aria-label": g,
4773
+ tooltip: g,
4774
4774
  ...o,
4775
4775
  children: /* @__PURE__ */ c(y, { className: "tiptap-button-icon" })
4776
4776
  }
@@ -4799,43 +4799,43 @@ function xo({
4799
4799
  editor: n,
4800
4800
  fonts: i = Co
4801
4801
  }) {
4802
- const [t, e] = R(
4802
+ const [t, e] = $(
4803
4803
  void 0
4804
- ), s = J(() => n ? n.can().setFontFamily("") : !1, [n]), o = J(
4805
- (l) => n ? l ? n.isActive("textStyle", { fontFamily: l }) : !n.isActive("textStyle", { fontFamily: /.+/ }) : !1,
4804
+ ), s = Q(() => n ? n.can().setFontFamily("") : !1, [n]), o = Q(
4805
+ (h) => n ? h ? n.isActive("textStyle", { fontFamily: h }) : !n.isActive("textStyle", { fontFamily: /.+/ }) : !1,
4806
4806
  [n]
4807
4807
  );
4808
- Z(() => {
4808
+ U(() => {
4809
4809
  if (!n) {
4810
4810
  e(void 0);
4811
4811
  return;
4812
4812
  }
4813
- const l = () => {
4813
+ const h = () => {
4814
4814
  const d = n.getAttributes("textStyle");
4815
4815
  e(d.fontFamily);
4816
4816
  };
4817
- return n.on("selectionUpdate", l), n.on("transaction", l), l(), () => {
4818
- n.off("selectionUpdate", l), n.off("transaction", l);
4817
+ return n.on("selectionUpdate", h), n.on("transaction", h), h(), () => {
4818
+ n.off("selectionUpdate", h), n.off("transaction", h);
4819
4819
  };
4820
4820
  }, [n]);
4821
- const a = J(
4822
- (l) => {
4823
- n && (l ? n.chain().focus().setFontFamily(l).run() : n.chain().focus().unsetFontFamily().run());
4821
+ const a = Q(
4822
+ (h) => {
4823
+ n && (h ? n.chain().focus().setFontFamily(h).run() : n.chain().focus().unsetFontFamily().run());
4824
4824
  },
4825
4825
  [n]
4826
- ), h = J(() => {
4826
+ ), l = Q(() => {
4827
4827
  n && n.chain().focus().unsetFontFamily().run();
4828
4828
  }, [n]);
4829
4829
  return {
4830
4830
  fonts: i,
4831
4831
  activeFontFamily: t,
4832
4832
  setFontFamily: a,
4833
- unsetFontFamily: h,
4833
+ unsetFontFamily: l,
4834
4834
  canSetFontFamily: s,
4835
4835
  isFontFamilyActive: o
4836
4836
  };
4837
4837
  }
4838
- const bn = $(({ editor: n, fonts: i }, t) => {
4838
+ const bn = A(({ editor: n, fonts: i }, t) => {
4839
4839
  const {
4840
4840
  fonts: e,
4841
4841
  activeFontFamily: s,
@@ -4851,33 +4851,33 @@ const bn = $(({ editor: n, fonts: i }, t) => {
4851
4851
  ref: t,
4852
4852
  className: "font-family-select",
4853
4853
  value: s || "",
4854
- onChange: (h) => o(h.target.value),
4855
- children: e.map((h) => /* @__PURE__ */ c(
4854
+ onChange: (l) => o(l.target.value),
4855
+ children: e.map((l) => /* @__PURE__ */ c(
4856
4856
  "option",
4857
4857
  {
4858
- value: h.value,
4859
- style: { fontFamily: h.value || void 0 },
4860
- children: h.label
4858
+ value: l.value,
4859
+ style: { fontFamily: l.value || void 0 },
4860
+ children: l.label
4861
4861
  },
4862
- h.label
4862
+ l.label
4863
4863
  ))
4864
4864
  }
4865
4865
  );
4866
4866
  });
4867
4867
  bn.displayName = "FontFamilySelect";
4868
4868
  function Go({ api: n }) {
4869
- const [i, t] = R(null), [e, s] = R(1), [o, a] = R(1);
4870
- return Z(() => {
4869
+ const [i, t] = $(null), [e, s] = $(1), [o, a] = $(1);
4870
+ return U(() => {
4871
4871
  if (!n) return;
4872
- const h = (f) => {
4873
- t(f), s(n.getState().viewport.scale), a(f.scaleWhenCreate || 1);
4874
- }, l = () => {
4872
+ const l = (m) => {
4873
+ t(m), s(n.getState().viewport.scale), a(m.scaleWhenCreate || 1);
4874
+ }, h = () => {
4875
4875
  t(null);
4876
- }, d = (f) => {
4877
- s(f);
4876
+ }, d = (m) => {
4877
+ s(m);
4878
4878
  };
4879
- return n.on("texteditor:register", h), n.on("texteditor:unregister", l), n.on("viewport:scale:change", d), () => {
4880
- n.off("texteditor:register", h), n.off("texteditor:unregister", l), n.off("viewport:scale:change", d);
4879
+ return n.on("texteditor:register", l), n.on("texteditor:unregister", h), n.on("viewport:scale:change", d), () => {
4880
+ n.off("texteditor:register", l), n.off("texteditor:unregister", h), n.off("viewport:scale:change", d);
4881
4881
  };
4882
4882
  }, [n]), !n || !i ? null : /* @__PURE__ */ c(Ie, { children: i && /* @__PURE__ */ k(Jn, { className: "rich-text-bubble-menu bubble-menu", editor: i, appendTo: () => document.getElementById("rich-text-html-element"), style: {
4883
4883
  transformOrigin: "bottom center",