headless-vpl 0.1.0

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.
@@ -0,0 +1,1107 @@
1
+ var B = Object.defineProperty;
2
+ var R = (n, t, e) => t in n ? B(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var r = (n, t, e) => R(n, typeof t != "symbol" ? t + "" : t, e);
4
+ let D = 1;
5
+ function A(n = "vpl") {
6
+ return `${n}_${D++}`;
7
+ }
8
+ class v {
9
+ constructor(t, e, i, s) {
10
+ r(this, "id");
11
+ /** スナップ接続による親 (型安全) */
12
+ r(this, "Parent", null);
13
+ /** スナップ接続による子 (型安全) */
14
+ r(this, "Children", null);
15
+ r(this, "workspace");
16
+ r(this, "position");
17
+ r(this, "name");
18
+ r(this, "type");
19
+ r(this, "selected", !1);
20
+ this.id = A(s), t && (this.workspace = t), this.position = e, this.name = i, this.type = s;
21
+ }
22
+ /**
23
+ * プロパティ変更を通知する。Renderer が 'update' イベントで再描画する。
24
+ */
25
+ update() {
26
+ this.workspace.eventBus.emit("update", this);
27
+ }
28
+ /**
29
+ * 位置を変更し 'move' イベントを発火する。
30
+ */
31
+ move(t, e) {
32
+ const i = t - this.position.x, s = e - this.position.y;
33
+ this.position.x = t, this.position.y = e, this.workspace.eventBus.emit("move", this), this.Children && this.Children.move(this.Children.position.x + i, this.Children.position.y + s);
34
+ }
35
+ toJSON() {
36
+ return {
37
+ id: this.id,
38
+ type: this.type,
39
+ name: this.name,
40
+ position: { x: this.position.x, y: this.position.y },
41
+ selected: this.selected
42
+ };
43
+ }
44
+ }
45
+ class C extends v {
46
+ constructor({ workspace: t, position: e, name: i, type: s }) {
47
+ super(t, e, i, s), this.workspace && this.workspace.addElement(this);
48
+ }
49
+ toJSON() {
50
+ return {
51
+ ...super.toJSON(),
52
+ connectorType: this.type
53
+ };
54
+ }
55
+ }
56
+ class O {
57
+ constructor() {
58
+ r(this, "handlers", /* @__PURE__ */ new Map());
59
+ }
60
+ on(t, e) {
61
+ return this.handlers.has(t) || this.handlers.set(t, /* @__PURE__ */ new Set()), this.handlers.get(t).add(e), () => {
62
+ var i;
63
+ (i = this.handlers.get(t)) == null || i.delete(e);
64
+ };
65
+ }
66
+ emit(t, e, i) {
67
+ var o;
68
+ const s = { type: t, target: e, data: i };
69
+ (o = this.handlers.get(t)) == null || o.forEach((h) => h(s));
70
+ }
71
+ }
72
+ class I {
73
+ constructor(t = 100) {
74
+ r(this, "_undoStack", []);
75
+ r(this, "_redoStack", []);
76
+ r(this, "_maxDepth");
77
+ this._maxDepth = t;
78
+ }
79
+ /**
80
+ * コマンドを実行し、Undo スタックに追加する。
81
+ * 新しいコマンド実行時に Redo スタックはクリアされる。
82
+ */
83
+ execute(t) {
84
+ t.execute(), this._undoStack.push(t), this._redoStack = [], this._undoStack.length > this._maxDepth && this._undoStack.shift();
85
+ }
86
+ undo() {
87
+ const t = this._undoStack.pop();
88
+ t && (t.undo(), this._redoStack.push(t));
89
+ }
90
+ redo() {
91
+ const t = this._redoStack.pop();
92
+ t && (t.execute(), this._undoStack.push(t));
93
+ }
94
+ get canUndo() {
95
+ return this._undoStack.length > 0;
96
+ }
97
+ get canRedo() {
98
+ return this._redoStack.length > 0;
99
+ }
100
+ clear() {
101
+ this._undoStack = [], this._redoStack = [];
102
+ }
103
+ }
104
+ class N {
105
+ constructor(t) {
106
+ r(this, "_selected", /* @__PURE__ */ new Set());
107
+ r(this, "eventBus");
108
+ this.eventBus = t;
109
+ }
110
+ select(t) {
111
+ this._selected.has(t) || (this._selected.add(t), t.selected = !0, this.eventBus.emit("select", t));
112
+ }
113
+ deselect(t) {
114
+ this._selected.has(t) && (this._selected.delete(t), t.selected = !1, this.eventBus.emit("deselect", t));
115
+ }
116
+ toggleSelect(t) {
117
+ this._selected.has(t) ? this.deselect(t) : this.select(t);
118
+ }
119
+ selectAll(t) {
120
+ for (const e of t)
121
+ this.select(e);
122
+ }
123
+ deselectAll() {
124
+ for (const t of [...this._selected])
125
+ this.deselect(t);
126
+ }
127
+ getSelection() {
128
+ return [...this._selected];
129
+ }
130
+ isSelected(t) {
131
+ return this._selected.has(t);
132
+ }
133
+ get size() {
134
+ return this._selected.size;
135
+ }
136
+ }
137
+ class J {
138
+ constructor() {
139
+ r(this, "eventBus", new O());
140
+ r(this, "viewport", { x: 0, y: 0, scale: 1 });
141
+ r(this, "selection", new N(this.eventBus));
142
+ r(this, "history", new I());
143
+ r(this, "_elements", []);
144
+ r(this, "_edges", []);
145
+ }
146
+ addElement(t) {
147
+ this._elements.push(t), this.eventBus.emit("add", t);
148
+ }
149
+ addEdge(t) {
150
+ this._edges.push(t), this.eventBus.emit("add", t);
151
+ }
152
+ removeElement(t) {
153
+ const e = this._elements.indexOf(t);
154
+ e !== -1 && (this._elements.splice(e, 1), this.eventBus.emit("remove", t));
155
+ }
156
+ removeEdge(t) {
157
+ const e = this._edges.indexOf(t);
158
+ e !== -1 && (this._edges.splice(e, 1), this.eventBus.emit("remove", t));
159
+ }
160
+ /**
161
+ * コンテナを削除する。関連 Edge の自動削除、Parent/Children 関係のクリア、
162
+ * 子要素の再帰削除を行う。
163
+ * instanceof を使わずダックタイピングで判定し、循環参照を回避する。
164
+ */
165
+ removeContainer(t) {
166
+ const e = /* @__PURE__ */ new Set();
167
+ if (e.add(t.id), "children" in t) {
168
+ const o = t.children;
169
+ for (const h of Object.values(o))
170
+ h && typeof h == "object" && "id" in h && e.add(h.id);
171
+ }
172
+ const i = this._edges.filter((o) => {
173
+ const h = o;
174
+ return h.startConnector && e.has(h.startConnector.id) || h.endConnector && e.has(h.endConnector.id);
175
+ });
176
+ for (const o of i)
177
+ this.removeEdge(o);
178
+ const s = t;
179
+ if (s.Parent && (s.Parent.Children = null, s.Parent = null), s.Children && (s.Children.Parent = null, s.Children = null), "children" in t) {
180
+ const o = t.children;
181
+ for (const h of Object.values(o))
182
+ h && typeof h == "object" && "id" in h && this.removeElement(h);
183
+ }
184
+ "selected" in t && this.selection.deselect(t), this.removeElement(t);
185
+ }
186
+ get elements() {
187
+ return this._elements;
188
+ }
189
+ get edges() {
190
+ return this._edges;
191
+ }
192
+ on(t, e) {
193
+ return this.eventBus.on(t, e);
194
+ }
195
+ pan(t, e) {
196
+ this.viewport.x = t, this.viewport.y = e, this.eventBus.emit("pan", this.viewport);
197
+ }
198
+ panBy(t, e) {
199
+ this.viewport.x += t, this.viewport.y += e, this.eventBus.emit("pan", this.viewport);
200
+ }
201
+ zoomAt(t, e, i) {
202
+ const s = (t - this.viewport.x) / this.viewport.scale, o = (e - this.viewport.y) / this.viewport.scale;
203
+ this.viewport.scale = i, this.viewport.x = t - s * i, this.viewport.y = e - o * i, this.eventBus.emit("zoom", this.viewport);
204
+ }
205
+ setScale(t) {
206
+ this.viewport.scale = t, this.eventBus.emit("zoom", this.viewport);
207
+ }
208
+ /**
209
+ * 全要素が収まるようにビューポートを自動調整する。
210
+ * scale は 1.0 を上限とし、過度なズームインを防止する。
211
+ * canvasWidth/canvasHeight は引数で渡す(DOM 依存回避)。
212
+ */
213
+ fitView(t, e, i = 50) {
214
+ const s = this._elements.filter(
215
+ (y) => "width" in y && "height" in y
216
+ );
217
+ if (s.length === 0) return;
218
+ let o = 1 / 0, h = 1 / 0, l = -1 / 0, c = -1 / 0;
219
+ for (const y of s) {
220
+ const g = y.position.x, w = y.position.y;
221
+ o = Math.min(o, g), h = Math.min(h, w), l = Math.max(l, g + y.width), c = Math.max(c, w + y.height);
222
+ }
223
+ const a = l - o, d = c - h;
224
+ if (a <= 0 || d <= 0) return;
225
+ const u = t - i * 2, f = e - i * 2, p = Math.min(1, u / a, f / d);
226
+ this.viewport.scale = p, this.viewport.x = (t - a * p) / 2 - o * p, this.viewport.y = (e - d * p) / 2 - h * p, this.eventBus.emit("zoom", this.viewport), this.eventBus.emit("pan", this.viewport);
227
+ }
228
+ }
229
+ class W {
230
+ constructor(t, e) {
231
+ r(this, "x");
232
+ r(this, "y");
233
+ this.x = t, this.y = e;
234
+ }
235
+ setPosition(t, e) {
236
+ this.x = t, this.y = e;
237
+ }
238
+ getPosition() {
239
+ return { x: this.x, y: this.y };
240
+ }
241
+ }
242
+ function $(n, t) {
243
+ return {
244
+ path: `M ${n.x} ${n.y} L ${t.x} ${t.y}`,
245
+ labelPosition: {
246
+ x: (n.x + t.x) / 2,
247
+ y: (n.y + t.y) / 2
248
+ }
249
+ };
250
+ }
251
+ function P(n, t) {
252
+ const e = Math.abs(t.x - n.x), i = Math.max(e * 0.5, 50), s = n.x + i, o = n.y, h = t.x - i, l = t.y, c = 0.5, a = 1 - c, d = a * a * a * n.x + 3 * a * a * c * s + 3 * a * c * c * h + c * c * c * t.x, u = a * a * a * n.y + 3 * a * a * c * o + 3 * a * c * c * l + c * c * c * t.y;
253
+ return {
254
+ path: `M ${n.x} ${n.y} C ${s} ${o}, ${h} ${l}, ${t.x} ${t.y}`,
255
+ labelPosition: { x: d, y: u }
256
+ };
257
+ }
258
+ function _(n, t) {
259
+ const e = (n.x + t.x) / 2;
260
+ return {
261
+ path: `M ${n.x} ${n.y} L ${e} ${n.y} L ${e} ${t.y} L ${t.x} ${t.y}`,
262
+ labelPosition: {
263
+ x: e,
264
+ y: (n.y + t.y) / 2
265
+ }
266
+ };
267
+ }
268
+ function S(n, t, e = 8) {
269
+ const i = (n.x + t.x) / 2, s = t.y - n.y, o = Math.min(e, Math.abs(s) / 2, Math.abs(i - n.x), Math.abs(t.x - i));
270
+ if (o <= 0 || s === 0)
271
+ return _(n, t);
272
+ const h = s > 0 ? 1 : -1;
273
+ return {
274
+ path: [
275
+ `M ${n.x} ${n.y}`,
276
+ `L ${i - o} ${n.y}`,
277
+ `Q ${i} ${n.y}, ${i} ${n.y + o * h}`,
278
+ `L ${i} ${t.y - o * h}`,
279
+ `Q ${i} ${t.y}, ${i + o} ${t.y}`,
280
+ `L ${t.x} ${t.y}`
281
+ ].join(" "),
282
+ labelPosition: {
283
+ x: i,
284
+ y: (n.y + t.y) / 2
285
+ }
286
+ };
287
+ }
288
+ class k {
289
+ constructor({ workspace: t, start: e, end: i, edgeType: s, label: o, markerStart: h, markerEnd: l }) {
290
+ r(this, "id");
291
+ r(this, "workspace");
292
+ r(this, "startConnector");
293
+ r(this, "endConnector");
294
+ r(this, "edgeType");
295
+ r(this, "label");
296
+ r(this, "markerStart");
297
+ r(this, "markerEnd");
298
+ this.id = A("edge"), this.workspace = t ?? e.workspace, this.startConnector = e, this.endConnector = i, this.edgeType = s ?? "straight", this.label = o, this.markerStart = h, this.markerEnd = l, this.workspace.addEdge(this);
299
+ }
300
+ get startPosition() {
301
+ return this.startConnector.position;
302
+ }
303
+ get endPosition() {
304
+ return this.endConnector.position;
305
+ }
306
+ /**
307
+ * edgeType に応じたパス文字列とラベル位置を計算する。
308
+ */
309
+ computePath() {
310
+ const t = { x: this.startPosition.x, y: this.startPosition.y }, e = { x: this.endPosition.x, y: this.endPosition.y };
311
+ switch (this.edgeType) {
312
+ case "bezier":
313
+ return P(t, e);
314
+ case "step":
315
+ return _(t, e);
316
+ case "smoothstep":
317
+ return S(t, e);
318
+ case "straight":
319
+ default:
320
+ return $(t, e);
321
+ }
322
+ }
323
+ /**
324
+ * ラベルの表示位置を返す。
325
+ */
326
+ getLabelPosition() {
327
+ return this.computePath().labelPosition;
328
+ }
329
+ toJSON() {
330
+ return {
331
+ id: this.id,
332
+ type: "edge",
333
+ edgeType: this.edgeType,
334
+ startConnectorId: this.startConnector.id,
335
+ endConnectorId: this.endConnector.id,
336
+ label: this.label,
337
+ markerStart: this.markerStart,
338
+ markerEnd: this.markerEnd
339
+ };
340
+ }
341
+ }
342
+ class b {
343
+ constructor({ workspace: t, position: e, width: i, height: s, direction: o, gap: h, alignment: l, containers: c }) {
344
+ r(this, "id");
345
+ r(this, "Children", []);
346
+ r(this, "position");
347
+ r(this, "parentContainer", null);
348
+ r(this, "width", 100);
349
+ r(this, "height", 100);
350
+ r(this, "direction");
351
+ r(this, "gap");
352
+ r(this, "alignment");
353
+ r(this, "workspace");
354
+ r(this, "name", "autoLayout");
355
+ r(this, "type", "autoLayout");
356
+ r(this, "frame", 0);
357
+ this.id = A("autolayout"), t && (this.workspace = t), this.Children = c, this.position = e, this.width = i ?? 100, this.height = s ?? 100, this.direction = o ?? "horizontal", this.gap = h ?? 10, this.alignment = l ?? "center", this.workspace && this.workspace.addElement(this);
358
+ }
359
+ get absolutePosition() {
360
+ var i, s;
361
+ const t = ((i = this.parentContainer) == null ? void 0 : i.position.x) ?? 0, e = ((s = this.parentContainer) == null ? void 0 : s.position.y) ?? 0;
362
+ return { x: this.position.x + t, y: this.position.y + e };
363
+ }
364
+ setParent(t) {
365
+ this.parentContainer = t;
366
+ }
367
+ addElement(t) {
368
+ this.Children.push(t), this.update();
369
+ }
370
+ update() {
371
+ if (!this.parentContainer) return;
372
+ this.Children.forEach((i, s) => {
373
+ s === 1 && (i.width = 100 + Math.sin(this.frame / 10) * 20), s === 2 && (i.width = 50 + Math.sin(this.frame / 10) * 30);
374
+ }), this.frame++;
375
+ const t = this.absolutePosition;
376
+ this.direction === "horizontal" ? this.layoutHorizontal(t) : this.layoutVertical(t);
377
+ const e = this.computeContentSize();
378
+ this.width = e.width, this.height = e.height, this.parentContainer.applyContentSize(e.width, e.height), this.workspace.eventBus.emit("update", this);
379
+ }
380
+ layoutHorizontal(t) {
381
+ let e = t.x;
382
+ this.Children.forEach((i) => {
383
+ const s = this.alignCrossAxis(t.y, this.height, i.height);
384
+ i.move(e, s), e += i.width + this.gap;
385
+ });
386
+ }
387
+ layoutVertical(t) {
388
+ let e = t.y;
389
+ this.Children.forEach((i) => {
390
+ const s = this.alignCrossAxis(t.x, this.width, i.width);
391
+ i.move(s, e), e += i.height + this.gap;
392
+ });
393
+ }
394
+ alignCrossAxis(t, e, i) {
395
+ switch (this.alignment) {
396
+ case "start":
397
+ return t;
398
+ case "center":
399
+ return t + (e - i) / 2;
400
+ case "end":
401
+ return t + e - i;
402
+ }
403
+ }
404
+ computeContentSize() {
405
+ if (this.Children.length === 0) return { width: 0, height: 0 };
406
+ const t = this.gap * (this.Children.length - 1);
407
+ if (this.direction === "horizontal") {
408
+ const e = this.Children.reduce((s, o) => s + o.width, 0) + t, i = Math.max(...this.Children.map((s) => s.height));
409
+ return { width: e, height: i };
410
+ } else {
411
+ const e = Math.max(...this.Children.map((s) => s.width)), i = this.Children.reduce((s, o) => s + o.height, 0) + t;
412
+ return { width: e, height: i };
413
+ }
414
+ }
415
+ move(t, e) {
416
+ this.position.x = t, this.position.y = e, this.workspace.eventBus.emit("move", this);
417
+ }
418
+ toJSON() {
419
+ return {
420
+ id: this.id,
421
+ type: this.type,
422
+ name: this.name,
423
+ position: { x: this.position.x, y: this.position.y },
424
+ width: this.width,
425
+ height: this.height,
426
+ children: this.Children.map((t) => t.toJSON())
427
+ };
428
+ }
429
+ }
430
+ class x extends v {
431
+ constructor({
432
+ workspace: e,
433
+ position: i = new W(0, 0),
434
+ name: s,
435
+ color: o,
436
+ width: h,
437
+ height: l,
438
+ widthMode: c,
439
+ heightMode: a,
440
+ padding: d,
441
+ minWidth: u,
442
+ maxWidth: f,
443
+ minHeight: p,
444
+ maxHeight: y,
445
+ resizable: g,
446
+ children: w
447
+ }) {
448
+ super(e, i, s, "container");
449
+ r(this, "color");
450
+ r(this, "width");
451
+ r(this, "height");
452
+ r(this, "widthMode");
453
+ r(this, "heightMode");
454
+ r(this, "padding");
455
+ r(this, "minWidth");
456
+ r(this, "maxWidth");
457
+ r(this, "minHeight");
458
+ r(this, "maxHeight");
459
+ r(this, "resizable");
460
+ r(this, "children");
461
+ this.color = o || "red", this.width = h || 100, this.height = l || 100, this.widthMode = c || "fixed", this.heightMode = a || "fixed", this.padding = {
462
+ top: (d == null ? void 0 : d.top) ?? 0,
463
+ right: (d == null ? void 0 : d.right) ?? 0,
464
+ bottom: (d == null ? void 0 : d.bottom) ?? 0,
465
+ left: (d == null ? void 0 : d.left) ?? 0
466
+ }, this.minWidth = u ?? 0, this.maxWidth = f ?? 1 / 0, this.minHeight = p ?? 0, this.maxHeight = y ?? 1 / 0, this.resizable = g ?? !1, this.children = w || {}, this.workspace && (this.propagateWorkspace(this.workspace), this.workspace.addElement(this), this.move(i.x, i.y), this.updateChildren());
467
+ }
468
+ propagateWorkspace(e) {
469
+ for (const i of Object.values(this.children))
470
+ this.bindChildWorkspace(i, e);
471
+ }
472
+ bindChildWorkspace(e, i) {
473
+ if (!e.workspace) {
474
+ if (e.workspace = i, i.addElement(e), e instanceof x)
475
+ for (const s of Object.values(e.children))
476
+ this.bindChildWorkspace(s, i);
477
+ else if (e instanceof b)
478
+ for (const s of e.Children)
479
+ this.bindChildWorkspace(s, i);
480
+ }
481
+ }
482
+ setColor(e) {
483
+ this.color = e, this.update();
484
+ }
485
+ applyContentSize(e, i) {
486
+ let s = !1;
487
+ if (this.widthMode === "hug") {
488
+ const o = Math.min(Math.max(e + this.padding.left + this.padding.right, this.minWidth), this.maxWidth);
489
+ this.width !== o && (this.width = o, s = !0);
490
+ }
491
+ if (this.heightMode === "hug") {
492
+ const o = Math.min(Math.max(i + this.padding.top + this.padding.bottom, this.minHeight), this.maxHeight);
493
+ this.height !== o && (this.height = o, s = !0);
494
+ }
495
+ s && this.update();
496
+ }
497
+ updateChildren() {
498
+ for (const e of Object.values(this.children))
499
+ this.updateChildPosition(e), this.updateChildLayout(e);
500
+ }
501
+ updateChildPosition(e) {
502
+ this.isMovableObject(e) && e.move(this.position.x + e.position.x, this.position.y - e.position.y);
503
+ }
504
+ updateChildLayout(e) {
505
+ this.isAutoLayout(e) && (e.setParent(this), e.update());
506
+ }
507
+ move(e, i) {
508
+ const s = this.position.x - e, o = this.position.y - i;
509
+ super.move(e, i), this.updateChildrenPosition({ x: s, y: o });
510
+ }
511
+ updateChildrenPosition(e) {
512
+ for (const i of Object.values(this.children))
513
+ this.isMovableObject(i) ? i.move(i.position.x - e.x, i.position.y - e.y) : this.isAutoLayout(i) && i.update();
514
+ }
515
+ isMovableObject(e) {
516
+ return e instanceof v;
517
+ }
518
+ isAutoLayout(e) {
519
+ return e instanceof b;
520
+ }
521
+ toJSON() {
522
+ return {
523
+ ...super.toJSON(),
524
+ color: this.color,
525
+ width: this.width,
526
+ height: this.height,
527
+ widthMode: this.widthMode,
528
+ heightMode: this.heightMode,
529
+ padding: this.padding,
530
+ children: Object.fromEntries(
531
+ Object.entries(this.children).map(([e, i]) => {
532
+ const s = i;
533
+ return [e, "toJSON" in s ? s.toJSON() : {}];
534
+ })
535
+ )
536
+ };
537
+ }
538
+ }
539
+ class Y {
540
+ constructor(t, e, i, s, o) {
541
+ r(this, "element");
542
+ r(this, "fromX");
543
+ r(this, "fromY");
544
+ r(this, "toX");
545
+ r(this, "toY");
546
+ this.element = t, this.fromX = e, this.fromY = i, this.toX = s, this.toY = o;
547
+ }
548
+ execute() {
549
+ this.element.move(this.toX, this.toY);
550
+ }
551
+ undo() {
552
+ this.element.move(this.fromX, this.fromY);
553
+ }
554
+ }
555
+ class V {
556
+ constructor(t, e) {
557
+ r(this, "workspace");
558
+ r(this, "element");
559
+ this.workspace = t, this.element = e;
560
+ }
561
+ execute() {
562
+ this.workspace.addElement(this.element);
563
+ }
564
+ undo() {
565
+ this.workspace.removeElement(this.element);
566
+ }
567
+ }
568
+ class K {
569
+ constructor(t, e) {
570
+ r(this, "workspace");
571
+ r(this, "element");
572
+ r(this, "relatedEdges", []);
573
+ r(this, "savedParent", null);
574
+ r(this, "savedChildren", null);
575
+ this.workspace = t, this.element = e, this.relatedEdges = this.findRelatedEdges();
576
+ }
577
+ findRelatedEdges() {
578
+ const t = /* @__PURE__ */ new Set();
579
+ if (t.add(this.element.id), "children" in this.element) {
580
+ const e = this.element.children;
581
+ for (const i of Object.values(e))
582
+ i && typeof i == "object" && "id" in i && t.add(i.id);
583
+ }
584
+ return this.workspace.edges.filter((e) => {
585
+ const i = e;
586
+ return i.startConnector && t.has(i.startConnector.id) || i.endConnector && t.has(i.endConnector.id);
587
+ });
588
+ }
589
+ execute() {
590
+ const t = this.element;
591
+ this.savedParent = t.Parent, this.savedChildren = t.Children;
592
+ for (const e of this.relatedEdges)
593
+ this.workspace.removeEdge(e);
594
+ t.Parent && (t.Parent.Children = null, t.Parent = null), t.Children && (t.Children.Parent = null, t.Children = null), this.workspace.removeElement(this.element);
595
+ }
596
+ undo() {
597
+ this.workspace.addElement(this.element);
598
+ for (const e of this.relatedEdges)
599
+ this.workspace.addEdge(e);
600
+ const t = this.element;
601
+ this.savedParent && (t.Parent = this.savedParent, this.savedParent.Children = t), this.savedChildren && (t.Children = this.savedChildren, this.savedChildren.Parent = t);
602
+ }
603
+ }
604
+ class U {
605
+ constructor(t, e, i) {
606
+ r(this, "workspace");
607
+ r(this, "parent");
608
+ r(this, "child");
609
+ this.workspace = t, this.parent = e, this.child = i;
610
+ }
611
+ execute() {
612
+ this.child.Parent = this.parent, this.parent.Children = this.child, this.workspace.eventBus.emit("connect", this.child, {
613
+ parent: this.parent.id,
614
+ child: this.child.id
615
+ });
616
+ }
617
+ undo() {
618
+ this.workspace.eventBus.emit("disconnect", this.child, {
619
+ parent: this.parent.id,
620
+ child: this.child.id
621
+ }), this.child.Parent = null, this.parent.Children = null;
622
+ }
623
+ }
624
+ const m = "http://www.w3.org/2000/svg";
625
+ class q {
626
+ constructor(t, e) {
627
+ r(this, "svgRoot");
628
+ r(this, "viewportGroup");
629
+ r(this, "defsElement");
630
+ r(this, "workspace");
631
+ r(this, "elementMap", /* @__PURE__ */ new Map());
632
+ r(this, "markerDefs", /* @__PURE__ */ new Set());
633
+ this.svgRoot = t, this.workspace = e, this.defsElement = document.createElementNS(m, "defs"), this.svgRoot.appendChild(this.defsElement), this.viewportGroup = document.createElementNS(m, "g"), this.viewportGroup.setAttribute("data-role", "viewport"), this.svgRoot.appendChild(this.viewportGroup), e.on("add", (i) => this.onAdd(i)), e.on("move", (i) => this.onMove(i)), e.on("update", (i) => this.onUpdate(i)), e.on("remove", (i) => this.onRemove(i)), e.on("select", (i) => this.onSelect(i)), e.on("deselect", (i) => this.onDeselect(i)), e.on("pan", () => this.updateViewportTransform()), e.on("zoom", () => this.updateViewportTransform());
634
+ }
635
+ updateViewportTransform() {
636
+ const { x: t, y: e, scale: i } = this.workspace.viewport;
637
+ this.viewportGroup.setAttribute("transform", `translate(${t}, ${e}) scale(${i})`);
638
+ }
639
+ // --- Event handlers ---
640
+ onAdd(t) {
641
+ const e = t.target;
642
+ this.ensureElement(e);
643
+ }
644
+ onMove(t) {
645
+ const e = t.target;
646
+ this.ensureElement(e), this.updateElement(e);
647
+ for (const i of this.workspace.edges)
648
+ this.ensureElement(i), this.updateEdgePath(i);
649
+ }
650
+ onUpdate(t) {
651
+ const e = t.target;
652
+ this.ensureElement(e), this.updateElement(e);
653
+ }
654
+ onRemove(t) {
655
+ const e = t.target, i = this.getId(e);
656
+ if (!i) return;
657
+ const s = this.elementMap.get(i);
658
+ s && (s.remove(), this.elementMap.delete(i));
659
+ }
660
+ onSelect(t) {
661
+ const e = t.target, i = this.getId(e);
662
+ if (!i) return;
663
+ const s = this.elementMap.get(i);
664
+ s && (s.setAttribute("stroke-dasharray", "6 3"), s.setAttribute("stroke-width", "6"));
665
+ }
666
+ onDeselect(t) {
667
+ const e = t.target, i = this.getId(e);
668
+ if (!i) return;
669
+ const s = this.elementMap.get(i);
670
+ s && (s.removeAttribute("stroke-dasharray"), e instanceof x ? s.setAttribute("stroke-width", "4") : e instanceof C && s.removeAttribute("stroke-width"));
671
+ }
672
+ // --- Lazy SVG creation ---
673
+ ensureElement(t) {
674
+ const e = this.getId(t);
675
+ return e ? this.elementMap.has(e) ? this.elementMap.get(e) : this.createElement(t, e) : null;
676
+ }
677
+ createElement(t, e) {
678
+ let i = null;
679
+ return t instanceof x ? i = this.createContainerRect(t) : t instanceof C ? i = this.createConnectorCircle(t) : t instanceof k ? i = this.createEdgeGroup(t) : t instanceof b && (i = this.createAutoLayoutRect(t)), i && (this.elementMap.set(e, i), this.viewportGroup.appendChild(i)), i;
680
+ }
681
+ updateElement(t) {
682
+ t instanceof x ? this.updateContainerRect(t) : t instanceof C ? this.updateConnectorCircle(t) : t instanceof k ? this.updateEdgePath(t) : t instanceof b && this.updateAutoLayoutRect(t);
683
+ }
684
+ getId(t) {
685
+ return t && typeof t == "object" && "id" in t ? t.id : null;
686
+ }
687
+ // --- Container ---
688
+ createContainerRect(t) {
689
+ const e = document.createElementNS(m, "rect");
690
+ return e.setAttribute("x", `${t.position.x}`), e.setAttribute("y", `${t.position.y}`), e.setAttribute("width", `${t.width}`), e.setAttribute("height", `${t.height}`), e.setAttribute("stroke-width", "4"), e.setAttribute("rx", "10"), e.setAttribute("ry", "10"), e.setAttribute("stroke", t.color), e.setAttribute("fill", t.color), e.setAttribute("fill-opacity", "0.15"), e;
691
+ }
692
+ updateContainerRect(t) {
693
+ const e = this.elementMap.get(t.id);
694
+ e && (e.setAttribute("x", `${t.position.x}`), e.setAttribute("y", `${t.position.y}`), e.setAttribute("width", `${t.width}`), e.setAttribute("height", `${t.height}`), e.setAttribute("stroke", t.color), e.setAttribute("fill", t.color));
695
+ }
696
+ // --- Connector ---
697
+ createConnectorCircle(t) {
698
+ const e = document.createElementNS(m, "circle");
699
+ return e.setAttribute("cx", `${t.position.x}`), e.setAttribute("cy", `${t.position.y}`), e.setAttribute("r", "10"), e.setAttribute("stroke", "black"), e.setAttribute("fill", "red"), e;
700
+ }
701
+ updateConnectorCircle(t) {
702
+ const e = this.elementMap.get(t.id);
703
+ e && (e.setAttribute("cx", `${t.position.x}`), e.setAttribute("cy", `${t.position.y}`));
704
+ }
705
+ // --- Edge (<g> wrapping <path> + optional <text>) ---
706
+ getMarkerId(t) {
707
+ const e = t.color ?? "black", i = t.size ?? 10;
708
+ return `marker-${t.type}-${e.replace("#", "")}-${i}`;
709
+ }
710
+ ensureMarkerDef(t) {
711
+ const e = this.getMarkerId(t);
712
+ if (this.markerDefs.has(e)) return e;
713
+ const i = t.color ?? "black", s = t.size ?? 10, o = document.createElementNS(m, "marker");
714
+ o.setAttribute("id", e), o.setAttribute("viewBox", `0 0 ${s} ${s}`), o.setAttribute("refX", `${s}`), o.setAttribute("refY", `${s / 2}`), o.setAttribute("markerWidth", `${s}`), o.setAttribute("markerHeight", `${s}`), o.setAttribute("orient", "auto-start-reverse");
715
+ const h = document.createElementNS(m, "path");
716
+ return h.setAttribute("d", `M 0 0 L ${s} ${s / 2} L 0 ${s}`), h.setAttribute("fill", t.type === "arrowClosed" ? i : "none"), h.setAttribute("stroke", i), h.setAttribute("stroke-width", "1"), o.appendChild(h), this.defsElement.appendChild(o), this.markerDefs.add(e), e;
717
+ }
718
+ createEdgeGroup(t) {
719
+ const e = document.createElementNS(m, "g");
720
+ e.setAttribute("data-edge-id", t.id);
721
+ const i = t.computePath(), s = document.createElementNS(m, "path");
722
+ if (s.setAttribute("d", i.path), s.setAttribute("stroke", "black"), s.setAttribute("stroke-width", "2"), s.setAttribute("fill", "none"), s.setAttribute("data-role", "edge-path"), t.markerStart && t.markerStart.type !== "none") {
723
+ const o = this.ensureMarkerDef(t.markerStart);
724
+ s.setAttribute("marker-start", `url(#${o})`);
725
+ }
726
+ if (t.markerEnd && t.markerEnd.type !== "none") {
727
+ const o = this.ensureMarkerDef(t.markerEnd);
728
+ s.setAttribute("marker-end", `url(#${o})`);
729
+ }
730
+ if (e.appendChild(s), t.label) {
731
+ const o = document.createElementNS(m, "text");
732
+ o.setAttribute("x", `${i.labelPosition.x}`), o.setAttribute("y", `${i.labelPosition.y}`), o.setAttribute("text-anchor", "middle"), o.setAttribute("dominant-baseline", "middle"), o.setAttribute("font-size", "12"), o.setAttribute("fill", "#333"), o.setAttribute("data-role", "edge-label"), o.textContent = t.label, e.appendChild(o);
733
+ }
734
+ return e;
735
+ }
736
+ updateEdgePath(t) {
737
+ const e = this.elementMap.get(t.id);
738
+ if (!e) return;
739
+ const i = t.computePath(), s = e.querySelector('[data-role="edge-path"]');
740
+ s && s.setAttribute("d", i.path);
741
+ const o = e.querySelector('[data-role="edge-label"]');
742
+ o && t.label && (o.setAttribute("x", `${i.labelPosition.x}`), o.setAttribute("y", `${i.labelPosition.y}`), o.textContent = t.label);
743
+ }
744
+ // --- AutoLayout ---
745
+ createAutoLayoutRect(t) {
746
+ const e = document.createElementNS(m, "rect"), i = t.absolutePosition;
747
+ return e.setAttribute("x", `${i.x}`), e.setAttribute("y", `${i.y}`), e.setAttribute("width", `${t.width}`), e.setAttribute("height", `${t.height}`), e.setAttribute("stroke-width", "4"), e.setAttribute("stroke", "blue"), e.setAttribute("fill", "none"), e;
748
+ }
749
+ updateAutoLayoutRect(t) {
750
+ const e = this.elementMap.get(t.id);
751
+ if (!e) return;
752
+ const i = t.absolutePosition;
753
+ e.setAttribute("x", `${i.x}`), e.setAttribute("y", `${i.y}`), e.setAttribute("width", `${t.width}`), e.setAttribute("height", `${t.height}`);
754
+ }
755
+ }
756
+ function E(n, t) {
757
+ return Math.sqrt((n.x - t.x) ** 2 + (n.y - t.y) ** 2);
758
+ }
759
+ function Q(n, t) {
760
+ return Math.atan2(t.y - n.y, t.x - n.x);
761
+ }
762
+ function M(n, t) {
763
+ return {
764
+ x: (n.x - t.x) / t.scale,
765
+ y: (n.y - t.y) / t.scale
766
+ };
767
+ }
768
+ function Z(n, t) {
769
+ return {
770
+ x: n.x * t.scale + t.x,
771
+ y: n.y * t.scale + t.y
772
+ };
773
+ }
774
+ function L(n, t) {
775
+ const e = Math.min(n.x, t.x), i = Math.min(n.y, t.y);
776
+ return {
777
+ x: e,
778
+ y: i,
779
+ width: Math.abs(t.x - n.x),
780
+ height: Math.abs(t.y - n.y)
781
+ };
782
+ }
783
+ function H(n, t, e = "full") {
784
+ const i = t.x, s = t.y, o = t.x + t.width, h = t.y + t.height;
785
+ return n.filter((l) => {
786
+ const c = l.position.x, a = l.position.y, d = l.position.x + l.width, u = l.position.y + l.height;
787
+ return e === "full" ? c >= i && a >= s && d <= o && u <= h : c < o && d > i && a < h && u > s;
788
+ });
789
+ }
790
+ function F(n, t, e, i, s = "full") {
791
+ const o = M(t, i), h = M(e, i), l = L(o, h);
792
+ return H(n, l, s);
793
+ }
794
+ function tt(n, t) {
795
+ return {
796
+ x: Math.round(n.x / t) * t,
797
+ y: Math.round(n.y / t) * t
798
+ };
799
+ }
800
+ function et(n, t) {
801
+ return {
802
+ x: Math.round(n.x / t) * t,
803
+ y: Math.round(n.y / t) * t
804
+ };
805
+ }
806
+ function it(n) {
807
+ return {
808
+ elements: n.map((t) => t.toJSON())
809
+ };
810
+ }
811
+ function T(n, t = { x: 20, y: 20 }) {
812
+ return n.elements.map((e) => {
813
+ const i = e.position;
814
+ return {
815
+ x: ((i == null ? void 0 : i.x) ?? 0) + t.x,
816
+ y: ((i == null ? void 0 : i.y) ?? 0) + t.y
817
+ };
818
+ });
819
+ }
820
+ function st(n, t, e = { x: 20, y: 20 }) {
821
+ const i = T(n, e);
822
+ return n.elements.map((s, o) => t(s, i[o]));
823
+ }
824
+ class nt {
825
+ constructor(t) {
826
+ r(this, "bindings", []);
827
+ r(this, "element");
828
+ r(this, "listener");
829
+ this.element = t, this.listener = (e) => this.handleKeyDown(e), this.element.addEventListener("keydown", this.listener);
830
+ }
831
+ bind(t) {
832
+ this.bindings.push(t);
833
+ }
834
+ unbind(t, e) {
835
+ this.bindings = this.bindings.filter(
836
+ (i) => !(i.key === t && this.modifiersMatch(i.modifiers, e))
837
+ );
838
+ }
839
+ destroy() {
840
+ this.element.removeEventListener("keydown", this.listener), this.bindings = [];
841
+ }
842
+ handleKeyDown(t) {
843
+ for (const e of this.bindings)
844
+ if (this.matches(t, e)) {
845
+ t.preventDefault(), e.handler(t);
846
+ return;
847
+ }
848
+ }
849
+ matches(t, e) {
850
+ if (t.key.toLowerCase() !== e.key.toLowerCase()) return !1;
851
+ const i = e.modifiers ?? [], s = i.includes("ctrl"), o = t.ctrlKey || t.metaKey;
852
+ return !(s !== o || i.includes("shift") !== t.shiftKey || i.includes("alt") !== t.altKey);
853
+ }
854
+ modifiersMatch(t, e) {
855
+ const i = new Set(t ?? []), s = new Set(e ?? []);
856
+ if (i.size !== s.size) return !1;
857
+ for (const o of i)
858
+ if (!s.has(o)) return !1;
859
+ return !0;
860
+ }
861
+ }
862
+ function ot(n, t, e, i = 40, s = 10) {
863
+ if (!e) return { dx: 0, dy: 0, active: !1 };
864
+ let o = 0, h = 0;
865
+ const l = n.x - t.x;
866
+ l < i && l >= 0 && (o = s * (1 - l / i));
867
+ const c = t.x + t.width - n.x;
868
+ c < i && c >= 0 && (o = -s * (1 - c / i));
869
+ const a = n.y - t.y;
870
+ a < i && a >= 0 && (h = s * (1 - a / i));
871
+ const d = t.y + t.height - n.y;
872
+ return d < i && d >= 0 && (h = -s * (1 - d / i)), { dx: o, dy: h, active: o !== 0 || h !== 0 };
873
+ }
874
+ function rt(n, t, e = 8) {
875
+ const { x: i, y: s } = t.position, { width: o, height: h } = t, l = n.x >= i - e && n.x <= i + e, c = n.x >= i + o - e && n.x <= i + o + e, a = n.y >= s - e && n.y <= s + e, d = n.y >= s + h - e && n.y <= s + h + e, u = n.x >= i - e && n.x <= i + o + e, f = n.y >= s - e && n.y <= s + h + e;
876
+ return a && l ? "nw" : a && c ? "ne" : d && l ? "sw" : d && c ? "se" : a && u ? "n" : d && u ? "s" : l && f ? "w" : c && f ? "e" : null;
877
+ }
878
+ function ht(n, t, e) {
879
+ return {
880
+ handle: n,
881
+ startMousePos: { x: t.x, y: t.y },
882
+ startBounds: {
883
+ x: e.position.x,
884
+ y: e.position.y,
885
+ width: e.width,
886
+ height: e.height
887
+ }
888
+ };
889
+ }
890
+ function at(n, t, e = {}) {
891
+ const i = n.x - t.startMousePos.x, s = n.y - t.startMousePos.y;
892
+ let { x: o, y: h, width: l, height: c } = t.startBounds;
893
+ const a = t.handle;
894
+ a.includes("e") ? l += i : a.includes("w") && (l -= i, o += i), a.includes("s") ? c += s : (a === "n" || a === "ne" || a === "nw") && (c -= s, h += s);
895
+ const d = e.minWidth ?? 10, u = e.maxWidth ?? 1 / 0, f = e.minHeight ?? 10, p = e.maxHeight ?? 1 / 0;
896
+ return l < d && (a.includes("w") && (o -= d - l), l = d), l > u && (a.includes("w") && (o -= u - l), l = u), c < f && ((a === "n" || a === "ne" || a === "nw") && (h -= f - c), c = f), c > p && ((a === "n" || a === "ne" || a === "nw") && (h -= p - c), c = p), { x: o, y: h, width: l, height: c };
897
+ }
898
+ function ct(n, t, e = 16) {
899
+ return E(n, t.position) <= e;
900
+ }
901
+ function lt(n, t, e = 16) {
902
+ let i = null;
903
+ for (const s of t) {
904
+ const o = E(n, s.position);
905
+ o <= e && (!i || o < i.distance) && (i = { connector: s, distance: o });
906
+ }
907
+ return i;
908
+ }
909
+ class dt {
910
+ constructor(t) {
911
+ r(this, "workspace");
912
+ r(this, "hitRadius");
913
+ r(this, "edgeType");
914
+ r(this, "onPreview");
915
+ r(this, "onComplete");
916
+ r(this, "onCancel");
917
+ r(this, "_active", !1);
918
+ r(this, "_startConnector", null);
919
+ r(this, "_previewPath", null);
920
+ this.workspace = t.workspace, this.hitRadius = t.hitRadius ?? 16, this.edgeType = t.edgeType ?? "bezier", this.onPreview = t.onPreview, this.onComplete = t.onComplete, this.onCancel = t.onCancel;
921
+ }
922
+ get active() {
923
+ return this._active;
924
+ }
925
+ get previewPath() {
926
+ return this._previewPath;
927
+ }
928
+ get startConnector() {
929
+ return this._startConnector;
930
+ }
931
+ /**
932
+ * ドラッグ開始。出力コネクターからスタート。
933
+ */
934
+ start(t) {
935
+ this._active = !0, this._startConnector = t, this._previewPath = null;
936
+ }
937
+ /**
938
+ * マウス移動ごとにプレビューパスを更新。
939
+ */
940
+ update(t) {
941
+ var s;
942
+ if (!this._active || !this._startConnector) return;
943
+ const e = this._startConnector.position, i = t;
944
+ this._previewPath = this.computePath(e, i), (s = this.onPreview) == null || s.call(this, this._previewPath, e, i);
945
+ }
946
+ /**
947
+ * 入力コネクターにドロップして Edge を作成。
948
+ */
949
+ complete(t) {
950
+ var i;
951
+ if (!this._active || !this._startConnector) return;
952
+ if (t === this._startConnector) {
953
+ this.cancel();
954
+ return;
955
+ }
956
+ const e = new k({
957
+ workspace: this.workspace,
958
+ start: this._startConnector,
959
+ end: t,
960
+ edgeType: this.edgeType
961
+ });
962
+ (i = this.onComplete) == null || i.call(this, e), this.reset();
963
+ }
964
+ /**
965
+ * キャンセル。
966
+ */
967
+ cancel() {
968
+ var t;
969
+ this._active && ((t = this.onCancel) == null || t.call(this), this.reset());
970
+ }
971
+ reset() {
972
+ this._active = !1, this._startConnector = null, this._previewPath = null;
973
+ }
974
+ computePath(t, e) {
975
+ switch (this.edgeType) {
976
+ case "bezier":
977
+ return P(t, e).path;
978
+ case "step":
979
+ return _(t, e).path;
980
+ case "smoothstep":
981
+ return S(t, e).path;
982
+ case "straight":
983
+ default:
984
+ return $(t, e).path;
985
+ }
986
+ }
987
+ }
988
+ function j(n, t) {
989
+ return {
990
+ x: n.x - t.x,
991
+ y: n.y - t.y
992
+ };
993
+ }
994
+ function z(n, t, e, i, s = 50, o, h, l) {
995
+ if (i.buttonState.leftButton !== "up")
996
+ return !1;
997
+ if (l && !l())
998
+ return h == null || h(), !1;
999
+ const c = t, a = e;
1000
+ if (E(c, a) < s) {
1001
+ const u = j(c, a);
1002
+ return n.move(n.position.x - u.x, n.position.y - u.y), o == null || o(), !0;
1003
+ }
1004
+ return h == null || h(), !1;
1005
+ }
1006
+ const G = (n, t, e) => e.includes(n), ut = (n, t, e) => e.includes(t), pt = (n, t, e) => e.includes(n) || e.includes(t);
1007
+ class ft {
1008
+ constructor(t) {
1009
+ r(this, "source");
1010
+ r(this, "sourcePosition");
1011
+ r(this, "target");
1012
+ r(this, "targetPosition");
1013
+ r(this, "workspace");
1014
+ r(this, "snapDistance");
1015
+ r(this, "strategy");
1016
+ r(this, "validator");
1017
+ r(this, "_locked", !1);
1018
+ r(this, "_hasFailed", !1);
1019
+ r(this, "_destroyed", !1);
1020
+ r(this, "_lastDragContainers", []);
1021
+ this.source = t.source, this.sourcePosition = t.sourcePosition, this.target = t.target, this.targetPosition = t.targetPosition, this.workspace = t.workspace, this.snapDistance = t.snapDistance ?? 50, this.strategy = t.strategy ?? G, this.validator = t.validator;
1022
+ }
1023
+ get locked() {
1024
+ return this._locked;
1025
+ }
1026
+ get destroyed() {
1027
+ return this._destroyed;
1028
+ }
1029
+ destroy() {
1030
+ this._destroyed || (this._destroyed = !0, this._locked && (this.source.Parent = null, this.target.Children = null, this.workspace.eventBus.emit("disconnect", this.source, {
1031
+ parent: this.target.id,
1032
+ child: this.source.id
1033
+ })), this._locked = !1);
1034
+ }
1035
+ tick(t, e) {
1036
+ if (this._locked || this._destroyed || (e.length > 0 && (this._lastDragContainers = e), !this.strategy(this.source, this.target, this._lastDragContainers))) return;
1037
+ z(
1038
+ this.source,
1039
+ this.sourcePosition,
1040
+ this.targetPosition,
1041
+ t,
1042
+ this.snapDistance,
1043
+ () => this.onSnap(),
1044
+ () => this.onFail(),
1045
+ this.validator
1046
+ ) && (this._locked = !0);
1047
+ }
1048
+ unlock() {
1049
+ this._locked = !1, this._lastDragContainers = [];
1050
+ }
1051
+ onSnap() {
1052
+ this.source.Parent = this.target, this.target.Children = this.source, this.workspace.eventBus.emit("connect", this.source, {
1053
+ parent: this.target.id,
1054
+ child: this.source.id
1055
+ }), this._hasFailed = !1;
1056
+ }
1057
+ onFail() {
1058
+ this._hasFailed || (this.source.Parent && this.workspace.eventBus.emit("disconnect", this.source, {
1059
+ parent: this.target.id,
1060
+ child: this.source.id
1061
+ }), this.source.Parent = null, this.target.Children = null, this._hasFailed = !0);
1062
+ }
1063
+ }
1064
+ export {
1065
+ V as AddCommand,
1066
+ b as AutoLayout,
1067
+ U as ConnectCommand,
1068
+ C as Connector,
1069
+ x as Container,
1070
+ k as Edge,
1071
+ dt as EdgeBuilder,
1072
+ O as EventBus,
1073
+ I as History,
1074
+ nt as KeyboardManager,
1075
+ Y as MoveCommand,
1076
+ W as Position,
1077
+ K as RemoveCommand,
1078
+ N as SelectionManager,
1079
+ ft as SnapConnection,
1080
+ q as SvgRenderer,
1081
+ J as Workspace,
1082
+ at as applyResize,
1083
+ ht as beginResize,
1084
+ T as calculatePastePositions,
1085
+ G as childOnly,
1086
+ ot as computeAutoPan,
1087
+ it as copyElements,
1088
+ L as createMarqueeRect,
1089
+ rt as detectResizeHandle,
1090
+ pt as either,
1091
+ lt as findNearestConnector,
1092
+ Q as getAngle,
1093
+ P as getBezierPath,
1094
+ E as getDistance,
1095
+ H as getElementsInMarquee,
1096
+ F as getElementsInScreenMarquee,
1097
+ S as getSmoothStepPath,
1098
+ _ as getStepPath,
1099
+ $ as getStraightPath,
1100
+ ct as isConnectorHit,
1101
+ ut as parentOnly,
1102
+ st as pasteElements,
1103
+ M as screenToWorld,
1104
+ et as snapDeltaToGrid,
1105
+ tt as snapToGrid,
1106
+ Z as worldToScreen
1107
+ };