@miragon/event-storming-renderer 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,67 +1,67 @@
1
1
  import e from "diagram-js/lib/Diagram";
2
- import { parseDSLWithDiagnostics as t, serializeDSL as n } from "@miragon/event-storming-dsl";
3
- import { ATTACHABLE_STICKY_KINDS as r, CURRENT_SCHEMA_VERSION as i, DEFAULT_BOARD_LEVEL as a, DEFAULT_BOARD_SIZE as o, HOST_STICKY_KINDS as s, LEVEL_STICKY_KINDS as c, validateBoard as l } from "@miragon/event-storming-schema-model";
4
- import u from "diagram-js/lib/features/change-support";
5
- import d from "diagram-js/lib/draw/BaseRenderer";
6
- import { append as f, attr as p, create as m, remove as h } from "tiny-svg";
7
- import g from "diagram-js/lib/features/selection";
8
- import _ from "diagram-js/lib/navigation/zoomscroll";
9
- import v from "diagram-js/lib/navigation/movecanvas";
10
- import ee from "diagram-js/lib/features/keyboard";
11
- import te from "diagram-js/lib/features/modeling";
12
- import y from "diagram-js/lib/features/move";
13
- import b from "diagram-js/lib/features/create";
14
- import ne from "diagram-js/lib/features/connect";
15
- import re from "diagram-js/lib/features/context-pad";
16
- import ie from "diagram-js/lib/features/palette";
17
- import ae from "diagram-js/lib/features/rules";
18
- import oe from "diagram-js/lib/features/outline";
19
- import se from "diagram-js/lib/features/popup-menu";
20
- import ce from "diagram-js/lib/features/attach-support";
21
- import le from "diagram-js/lib/command/CommandInterceptor";
22
- import ue from "diagram-js/lib/features/mouse";
23
- import de from "diagram-js/lib/features/lasso-tool";
24
- import fe from "diagram-js/lib/features/rules/RuleProvider";
25
- import pe from "diagram-js/lib/features/palette/PaletteTooltipComponent";
26
- import { html as me } from "diagram-js/lib/ui";
27
- import he from "diagram-js/lib/features/connection-preview";
28
- import ge from "diagram-js/lib/features/ordering/OrderingProvider";
29
- import _e from "diagram-js/lib/features/resize";
30
- import { MODELER_API_VERSION as ve } from "@miragon/modeler-api";
2
+ import { ATTACHABLE_STICKY_KINDS as t, CURRENT_SCHEMA_VERSION as n, DEFAULT_BOARD_LEVEL as r, DEFAULT_BOARD_SIZE as i, HOST_STICKY_KINDS as a, LEVEL_STICKY_KINDS as o, assertDrawable as s, validateBoard as c } from "@miragon/event-storming-schema-model";
3
+ import { parseDSLWithDiagnostics as l, serializeDSL as u } from "@miragon/event-storming-dsl";
4
+ import d from "diagram-js/lib/features/change-support";
5
+ import f from "diagram-js/lib/draw/BaseRenderer";
6
+ import { append as p, attr as m, create as h, remove as g } from "tiny-svg";
7
+ import _ from "diagram-js/lib/features/selection";
8
+ import ee from "diagram-js/lib/navigation/zoomscroll";
9
+ import te from "diagram-js/lib/navigation/movecanvas";
10
+ import ne from "diagram-js/lib/features/keyboard";
11
+ import re from "diagram-js/lib/features/modeling";
12
+ import ie from "diagram-js/lib/features/move";
13
+ import ae from "diagram-js/lib/features/create";
14
+ import oe from "diagram-js/lib/features/connect";
15
+ import se from "diagram-js/lib/features/context-pad";
16
+ import ce from "diagram-js/lib/features/palette";
17
+ import le from "diagram-js/lib/features/rules";
18
+ import ue from "diagram-js/lib/features/outline";
19
+ import de from "diagram-js/lib/features/popup-menu";
20
+ import fe from "diagram-js/lib/features/attach-support";
21
+ import pe from "diagram-js/lib/command/CommandInterceptor";
22
+ import me from "diagram-js/lib/features/mouse";
23
+ import he from "diagram-js/lib/features/lasso-tool";
24
+ import ge from "diagram-js/lib/features/rules/RuleProvider";
25
+ import _e from "diagram-js/lib/features/palette/PaletteTooltipComponent";
26
+ import { html as ve } from "diagram-js/lib/ui";
27
+ import ye from "diagram-js/lib/features/connection-preview";
28
+ import be from "diagram-js/lib/features/ordering/OrderingProvider";
29
+ import xe from "diagram-js/lib/features/resize";
30
+ import { MODELER_API_VERSION as Se } from "@miragon/modeler-api";
31
31
  //#region src/io/saveSvg.ts
32
- var ye = [
32
+ var Ce = [
33
33
  "tabindex",
34
34
  "role",
35
35
  "aria-label",
36
36
  "aria-labelledby"
37
37
  ];
38
- function be(e, t) {
38
+ function we(e, t) {
39
39
  let n = e.getContainer().querySelector(":scope > svg");
40
40
  if (!n) throw Error("No SVG found in the canvas container.");
41
41
  let r = n.cloneNode(!0);
42
- for (let e of ye) r.removeAttribute(e);
43
- let i = t ?? {
42
+ for (let e of Ce) r.removeAttribute(e);
43
+ let a = t ?? {
44
44
  x: 0,
45
45
  y: 0,
46
- ...o
46
+ ...i
47
47
  };
48
- r.setAttribute("xmlns", "http://www.w3.org/2000/svg"), r.setAttribute("viewBox", `${i.x} ${i.y} ${i.width} ${i.height}`), r.setAttribute("width", String(i.width)), r.setAttribute("height", String(i.height));
49
- let a = r.querySelector(".viewport");
50
- return a && a.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(r) };
48
+ r.setAttribute("xmlns", "http://www.w3.org/2000/svg"), r.setAttribute("viewBox", `${a.x} ${a.y} ${a.width} ${a.height}`), r.setAttribute("width", String(a.width)), r.setAttribute("height", String(a.height));
49
+ let o = r.querySelector(".viewport");
50
+ return o && o.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(r) };
51
51
  }
52
52
  //#endregion
53
53
  //#region src/model/di-types.ts
54
- var x = "event-storming-root";
55
- function xe(e) {
54
+ var v = "event-storming-root";
55
+ function Te(e) {
56
56
  return typeof e == "object" && !!e;
57
57
  }
58
- function S(e) {
59
- return xe(e) && typeof e.eventStormingType == "string" && !("waypoints" in e);
58
+ function y(e) {
59
+ return Te(e) && typeof e.eventStormingType == "string" && !("waypoints" in e);
60
60
  }
61
- function C(e) {
62
- return xe(e) && typeof e.eventStormingType == "string" && "waypoints" in e;
61
+ function b(e) {
62
+ return Te(e) && typeof e.eventStormingType == "string" && "waypoints" in e;
63
63
  }
64
- var w = [
64
+ var x = [
65
65
  "event",
66
66
  "command",
67
67
  "actor",
@@ -71,118 +71,33 @@ var w = [
71
71
  "external",
72
72
  "hotspot"
73
73
  ];
74
- function T(e) {
75
- return w.includes(e);
74
+ function S(e) {
75
+ return x.includes(e);
76
76
  }
77
- function E(e) {
78
- return S(e) && T(e.eventStormingType);
77
+ function C(e) {
78
+ return y(e) && S(e.eventStormingType);
79
79
  }
80
- function D(e) {
81
- return r.includes(e);
80
+ function w(e) {
81
+ return t.includes(e);
82
82
  }
83
- function O(e) {
84
- return s.includes(e);
83
+ function T(e) {
84
+ return a.includes(e);
85
85
  }
86
- function Se(e) {
87
- return S(e) && D(e.eventStormingType);
86
+ function Ee(e) {
87
+ return y(e) && w(e.eventStormingType);
88
88
  }
89
- function Ce(e) {
90
- return S(e) && O(e.eventStormingType);
89
+ function E(e) {
90
+ return y(e) && T(e.eventStormingType);
91
91
  }
92
- function k(e) {
93
- return S(e) && e.eventStormingType === "drawing";
92
+ function D(e) {
93
+ return y(e) && e.eventStormingType === "drawing";
94
94
  }
95
- function we(e) {
96
- return S(e) && e.eventStormingType === "note";
95
+ function De(e) {
96
+ return y(e) && e.eventStormingType === "note";
97
97
  }
98
98
  //#endregion
99
- //#region src/EventStormingBaseViewer.ts
100
- function Te(e) {
101
- for (let { id: t } of [...e.elements, ...e.edges]) if (t === "event-storming-root" || t.startsWith("__implicitroot")) throw Error(`Element id "${t}" is reserved for the board itself.`);
102
- }
103
- function Ee(e) {
104
- return typeof e == "number" ? `${e}px` : e;
105
- }
106
- var De = class {
107
- _diagram;
108
- _container;
109
- _options;
110
- constructor(e = {}) {
111
- this._options = e, this._container = this._createContainer(e);
112
- }
113
- _createContainer(e) {
114
- let t = e.container ?? document.createElement("div");
115
- return t.classList.add("event-storming-container"), t.style.width = Ee(e.width ?? "100%"), t.style.height = Ee(e.height ?? (e.container ? "100%" : "600px")), t;
116
- }
117
- _ensureDiagram() {
118
- if (!this._diagram) {
119
- let t = [...this._getModules(), ...this._options.additionalModules ?? []];
120
- this._diagram = new e({
121
- canvas: { container: this._container },
122
- modules: t,
123
- eventStormingKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
124
- eventStormingPalette: { freeRectInsets: this._options.freeRectInsets }
125
- });
126
- }
127
- return this._diagram;
128
- }
129
- get(e) {
130
- return this._ensureDiagram().get(e);
131
- }
132
- on(e, t, n = 1e3) {
133
- this.get("eventBus").on(e, n, t);
134
- }
135
- off(e, t) {
136
- this.get("eventBus").off(e, t);
137
- }
138
- async importMap(e) {
139
- let t = this._ensureDiagram(), n = t.get("eventBus"), r = t.get("eventStormingImporter");
140
- Te(e);
141
- let i = t.get("eventStormingLabelEditing", !1);
142
- i?.suspend(), t.get("popupMenu", !1)?.close(), r.clear();
143
- let a = r.import(e);
144
- return t.get("commandStack", !1)?.clear(!1), n.fire("import.done", { warnings: a }), i?.resumeAfterImport(), { warnings: a };
145
- }
146
- async importDSL(e) {
147
- let n = this._ensureDiagram().get("eventBus");
148
- n.fire("import.parse.start", { text: e });
149
- let { board: r, diagnostics: i } = t(e);
150
- n.fire("import.parse.done", {
151
- board: r,
152
- diagnostics: i
153
- });
154
- let { warnings: a } = await this.importMap(r);
155
- return { warnings: [...i.map((e) => ({
156
- message: `Line ${e.line}: ${e.message}`,
157
- line: e.line,
158
- source: e.text
159
- })), ...a] };
160
- }
161
- exportMap() {
162
- return this.get("eventStormingExporter").export();
163
- }
164
- exportDSL() {
165
- return n(this.exportMap());
166
- }
167
- async saveSVG() {
168
- return be(this.get("canvas"), this.get("boardBounds").contentBounds());
169
- }
170
- attachTo(e) {
171
- e.appendChild(this._container), this.get("canvas").resized();
172
- }
173
- detach() {
174
- this._container.remove();
175
- }
176
- clear() {
177
- this._ensureDiagram().clear();
178
- }
179
- destroy() {
180
- this._diagram &&= (this._diagram.destroy(), void 0), this._container.remove();
181
- }
182
- get container() {
183
- return this._container;
184
- }
185
- }, A = {
99
+ //#region src/theme/palette.ts
100
+ var O = {
186
101
  blau: "#335DE5",
187
102
  blauLink: "#2B50D4",
188
103
  blauHell: "#6B8AFF",
@@ -214,7 +129,7 @@ var De = class {
214
129
  italic: !0
215
130
  }
216
131
  ];
217
- function j(e) {
132
+ function k(e) {
218
133
  return e.split("\n").map((e) => {
219
134
  let t = e.startsWith("- ");
220
135
  return {
@@ -233,7 +148,7 @@ function ke(e) {
233
148
  }).join("\n");
234
149
  }
235
150
  function Ae(e) {
236
- return j(e).map((e) => (e.bullet ? "• " : "") + e.runs.map((e) => e.text).join("")).join("\n");
151
+ return k(e).map((e) => (e.bullet ? "• " : "") + e.runs.map((e) => e.text).join("")).join("\n");
237
152
  }
238
153
  function je(e) {
239
154
  let t = [], n = "", r = () => {
@@ -280,7 +195,7 @@ function Ne(e) {
280
195
  }
281
196
  //#endregion
282
197
  //#region src/draw/styles.ts
283
- var M = {
198
+ var A = {
284
199
  event: {
285
200
  label: "Domain Event",
286
201
  width: 130,
@@ -337,43 +252,321 @@ var M = {
337
252
  fill: "#E85D75",
338
253
  stroke: "#C43B55"
339
254
  }
340
- }, N = {
255
+ }, j = {
341
256
  label: "Note",
342
257
  fill: "#ECECEC",
343
258
  stroke: "#C4C4C4"
344
259
  }, Pe = {
345
260
  width: 60,
346
261
  height: 40
347
- }, P = 7.5, Fe = {
348
- width: M.aggregate.width,
349
- height: M.aggregate.height
262
+ }, M = 7.5, Fe = {
263
+ width: A.aggregate.width,
264
+ height: A.aggregate.height
350
265
  };
351
- function F(e) {
266
+ function N(e) {
352
267
  let t = Ae(e), n = (t && t.length ? t : "note").split("\n"), r = Math.max(1, ...n.map((e) => e.length));
353
268
  return {
354
269
  lines: n,
355
- width: Math.max(Fe.width, Math.round(r * P) + 16),
270
+ width: Math.max(Fe.width, Math.round(r * M) + 16),
356
271
  height: Math.max(Fe.height, n.length * 17 + 16)
357
272
  };
358
273
  }
359
- function I(e, t) {
360
- let n = F(e);
274
+ function P(e, t) {
275
+ let n = N(e);
361
276
  return t.width !== n.width || t.height !== n.height;
362
277
  }
363
- var L = {
364
- paper: A.grau,
365
- ink: A.schwarz,
278
+ var F = {
279
+ paper: O.grau,
280
+ ink: O.schwarz,
366
281
  inkSoft: "#5B5B5B",
367
- surface: A.weiss,
368
- stroke: A.schwarz,
282
+ surface: O.weiss,
283
+ stroke: O.schwarz,
369
284
  arrow: "#9E9E9E",
370
- accent: A.blau,
285
+ accent: O.blau,
371
286
  accentSoft: "rgba(51,93,229,0.12)",
372
- stickyText: A.schwarz
373
- }, R = A.schwarz, z = {
287
+ stickyText: O.schwarz
288
+ }, I = O.schwarz, L = {
374
289
  family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
375
290
  label: 13
376
- }, Ie = {
291
+ }, Ie = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="event-storming-palette-svg">${e}</svg>`, Le = (e, t, n = 0) => Ie(`<rect x="4" y="5" width="16" height="14" fill="${e}" stroke="${t}" stroke-width="1.5"${n ? ` transform="rotate(${n} 12 12)"` : ""}/>`), Re = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="event-storming-palette-svg">${e}</svg>`, R = {
292
+ draw: Re("<circle cx=\"19\" cy=\"5\" r=\"2\"/><circle cx=\"5\" cy=\"19\" r=\"2\"/><path d=\"M6.5 17.5 17.5 6.5\"/>"),
293
+ lasso: Re("<path d=\"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z\"/><path d=\"M5 3a2 2 0 0 0-2 2\"/><path d=\"M19 3a2 2 0 0 1 2 2\"/><path d=\"M5 21a2 2 0 0 1-2-2\"/><path d=\"M9 3h1\"/><path d=\"M9 21h2\"/><path d=\"M14 3h1\"/><path d=\"M3 9v1\"/><path d=\"M21 9v2\"/><path d=\"M3 14v1\"/>"),
294
+ note: Le(j.fill, j.stroke)
295
+ };
296
+ for (let e of x) {
297
+ let t = A[e];
298
+ R[e] = Le(t.fill, t.stroke, e === "hotspot" ? -6 : 0);
299
+ }
300
+ function ze(e, t) {
301
+ return `<svg width="14" height="14" viewBox="0 0 14 14" class="event-storming-palette-svg"><rect x="1" y="1" width="12" height="12" fill="${e}" stroke="${t}" stroke-width="1"/></svg>`;
302
+ }
303
+ //#endregion
304
+ //#region src/palette/EventStormingPaletteProvider.ts
305
+ function z(e) {
306
+ if (e.freeArea) return e.freeArea;
307
+ let t = e.freeRectInsets;
308
+ return t ? { insets: t } : void 0;
309
+ }
310
+ var Be = 24, B = "stickies-1", V = "stickies-2", Ve = "stickies-3", He = [
311
+ {
312
+ key: "event",
313
+ type: "event",
314
+ label: A.event.label,
315
+ title: "Domain event",
316
+ shortcut: "E",
317
+ group: B
318
+ },
319
+ {
320
+ key: "command",
321
+ type: "command",
322
+ label: A.command.label,
323
+ title: "Command",
324
+ shortcut: "C",
325
+ group: B
326
+ },
327
+ {
328
+ key: "actor",
329
+ type: "actor",
330
+ label: A.actor.label,
331
+ title: "Actor",
332
+ group: B
333
+ },
334
+ {
335
+ key: "aggregate",
336
+ type: "aggregate",
337
+ label: A.aggregate.label,
338
+ title: "Aggregate",
339
+ group: B
340
+ },
341
+ {
342
+ key: "policy",
343
+ type: "policy",
344
+ label: A.policy.label,
345
+ title: "Policy",
346
+ group: V
347
+ },
348
+ {
349
+ key: "readmodel",
350
+ type: "readmodel",
351
+ label: A.readmodel.label,
352
+ title: "Read model",
353
+ group: V
354
+ },
355
+ {
356
+ key: "external",
357
+ type: "external",
358
+ label: A.external.label,
359
+ title: "External system",
360
+ group: V
361
+ },
362
+ {
363
+ key: "hotspot",
364
+ type: "hotspot",
365
+ label: A.hotspot.label,
366
+ title: "Hotspot",
367
+ group: Ve
368
+ },
369
+ {
370
+ key: "note",
371
+ type: "note",
372
+ label: j.label,
373
+ title: "Note",
374
+ group: Ve
375
+ }
376
+ ], Ue = class {
377
+ create;
378
+ factory;
379
+ lassoTool;
380
+ drawTool;
381
+ eventStormingModeling;
382
+ canvas;
383
+ modeling;
384
+ selection;
385
+ elementRegistry;
386
+ labelEditing;
387
+ config;
388
+ static $inject = [
389
+ "palette",
390
+ "create",
391
+ "eventStormingElementFactory",
392
+ "lassoTool",
393
+ "eventStormingDrawTool",
394
+ "eventStormingModeling",
395
+ "eventBus",
396
+ "canvas",
397
+ "modeling",
398
+ "selection",
399
+ "elementRegistry",
400
+ "eventStormingLabelEditing",
401
+ "config.eventStormingPalette"
402
+ ];
403
+ constructor(e, t, n, r, i, a, o, s, c, l, u, d, f) {
404
+ this.create = t, this.factory = n, this.lassoTool = r, this.drawTool = i, this.eventStormingModeling = a, this.canvas = s, this.modeling = c, this.selection = l, this.elementRegistry = u, this.labelEditing = d, this.config = f, e.registerProvider(this);
405
+ let p = () => e._rebuild();
406
+ o.on("import.done", p), o.on(["commandStack.element.updateProperties.postExecuted", "commandStack.element.updateProperties.reverted"], (e) => {
407
+ e.context.element.id === "event-storming-root" && p();
408
+ });
409
+ }
410
+ getPaletteEntries() {
411
+ let e = {};
412
+ e["lasso-tool"] = {
413
+ group: "tools",
414
+ title: "Lasso",
415
+ shortcut: "L",
416
+ html: `<div class="entry event-storming-palette-entry">${R.lasso}</div>`,
417
+ action: { click: (e) => this.lassoTool.activateSelection(e) }
418
+ }, e["draw-tool"] = {
419
+ group: "tools",
420
+ title: "Draw",
421
+ html: `<div class="entry event-storming-palette-entry">${R.draw}</div>`,
422
+ action: { click: () => this.drawTool.toggle() }
423
+ };
424
+ let t = o[this.eventStormingModeling.getLevel()];
425
+ for (let n of He) {
426
+ if (n.type !== "note" && !t.includes(n.type)) continue;
427
+ let r = (e) => {
428
+ let t = this.factory.createNew(n.type, n.label);
429
+ We(e) && this.placeInFreeRect(t) || this.create.start(e, t);
430
+ };
431
+ e[`create.${n.key}`] = {
432
+ group: n.group,
433
+ title: n.title,
434
+ ...n.shortcut ? { shortcut: n.shortcut } : {},
435
+ html: `<div class="entry event-storming-palette-entry" draggable="true">${R[n.key]}</div>`,
436
+ action: {
437
+ dragstart: r,
438
+ click: r
439
+ }
440
+ };
441
+ }
442
+ return e;
443
+ }
444
+ placeInFreeRect(e) {
445
+ let { canvas: t, modeling: n, selection: r, elementRegistry: i } = this;
446
+ if (!t || !n || !r || !i) return !1;
447
+ let a = this.freeAreaCentre(t), o = (e) => i.filter(y).some((t) => Math.abs(t.x + t.width / 2 - e.x) < 1 && Math.abs(t.y + t.height / 2 - e.y) < 1);
448
+ for (; o(a);) a.x += Be, a.y += Be;
449
+ let s = n.createShape(e, a, t.getRootElement());
450
+ return r.select(s), t.focus(), this.labelEditing?.activate(s), !0;
451
+ }
452
+ freeAreaCentre(e) {
453
+ let t = this.config && z(this.config), n = t?.center?.();
454
+ if (n) return {
455
+ x: n.x,
456
+ y: n.y
457
+ };
458
+ let r = e.viewbox(), i = t?.insets?.() ?? {
459
+ top: 0,
460
+ right: 0,
461
+ bottom: 0,
462
+ left: 0
463
+ }, a = Math.max(0, r.outer.width - i.left - i.right), o = Math.max(0, r.outer.height - i.top - i.bottom);
464
+ return {
465
+ x: r.x + (i.left + a / 2) / r.scale,
466
+ y: r.y + (i.top + o / 2) / r.scale
467
+ };
468
+ }
469
+ };
470
+ function We(e) {
471
+ return e.type === "click" && e.detail === 0;
472
+ }
473
+ //#endregion
474
+ //#region src/EventStormingBaseViewer.ts
475
+ function Ge(e) {
476
+ for (let { id: t } of [...e.elements, ...e.edges]) if (t === "event-storming-root" || t.startsWith("__implicitroot")) throw Error(`Element id "${t}" is reserved for the board itself.`);
477
+ }
478
+ function Ke(e) {
479
+ return typeof e == "number" ? `${e}px` : e;
480
+ }
481
+ var qe = class {
482
+ _diagram;
483
+ _container;
484
+ _options;
485
+ constructor(e = {}) {
486
+ this._options = e, this._container = this._createContainer(e);
487
+ }
488
+ _createContainer(e) {
489
+ let t = e.container ?? document.createElement("div");
490
+ return t.classList.add("event-storming-container"), t.style.width = Ke(e.width ?? "100%"), t.style.height = Ke(e.height ?? (e.container ? "100%" : "600px")), t;
491
+ }
492
+ _ensureDiagram() {
493
+ if (!this._diagram) {
494
+ let t = [...this._getModules(), ...this._options.additionalModules ?? []];
495
+ this._diagram = new e({
496
+ canvas: { container: this._container },
497
+ modules: t,
498
+ eventStormingKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
499
+ eventStormingPalette: { freeArea: z(this._options) },
500
+ eventStormingImporter: { fitOnImport: this._options.fitOnImport ?? !0 }
501
+ });
502
+ }
503
+ return this._diagram;
504
+ }
505
+ get(e) {
506
+ return this._ensureDiagram().get(e);
507
+ }
508
+ on(e, t, n = 1e3) {
509
+ this.get("eventBus").on(e, n, t);
510
+ }
511
+ off(e, t) {
512
+ this.get("eventBus").off(e, t);
513
+ }
514
+ async importMap(e) {
515
+ let t = this._ensureDiagram(), n = t.get("eventBus"), r = t.get("eventStormingImporter");
516
+ Ge(e), s(e);
517
+ let i = t.get("eventStormingLabelEditing", !1);
518
+ i?.suspend(), t.get("popupMenu", !1)?.close(), r.clear();
519
+ let a = r.import(e);
520
+ return t.get("commandStack", !1)?.clear(!1), n.fire("import.done", { warnings: a }), i?.resumeAfterImport(), { warnings: a };
521
+ }
522
+ async importDSL(e) {
523
+ let t = this._ensureDiagram().get("eventBus");
524
+ t.fire("import.parse.start", { text: e });
525
+ let { board: n, diagnostics: r } = l(e);
526
+ t.fire("import.parse.done", {
527
+ board: n,
528
+ diagnostics: r
529
+ });
530
+ let { warnings: i } = await this.importMap(n);
531
+ return { warnings: [...r.map((e) => ({
532
+ message: `Line ${e.line}: ${e.message}`,
533
+ line: e.line,
534
+ source: e.text
535
+ })), ...i] };
536
+ }
537
+ exportMap() {
538
+ return this.get("eventStormingExporter").export();
539
+ }
540
+ exportDSL() {
541
+ return u(this.exportMap());
542
+ }
543
+ async saveSVG() {
544
+ return we(this.get("canvas"), this.get("boardBounds").contentBounds());
545
+ }
546
+ attachTo(e) {
547
+ e.appendChild(this._container), this.get("canvas").resized();
548
+ }
549
+ detach() {
550
+ this._container.remove();
551
+ }
552
+ clear() {
553
+ this._ensureDiagram().clear();
554
+ }
555
+ destroy() {
556
+ this._diagram &&= (this._diagram.destroy(), void 0), this._container.remove();
557
+ }
558
+ get container() {
559
+ return this._container;
560
+ }
561
+ }, Je = "0123456789abcdefghijklmnopqrstuvwxyz", Ye = 252;
562
+ function Xe() {
563
+ let e = "";
564
+ for (; e.length < 8;) for (let t of globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(8))) t >= Ye || e.length === 8 || (e += Je[t % 36]);
565
+ return e;
566
+ }
567
+ //#endregion
568
+ //#region src/model/EventStormingElementFactory.ts
569
+ var Ze = {
377
570
  event: "event",
378
571
  command: "cmd",
379
572
  actor: "actor",
@@ -384,7 +577,7 @@ var L = {
384
577
  hotspot: "hot",
385
578
  note: "note",
386
579
  drawing: "draw"
387
- }, Le = class {
580
+ }, Qe = class {
388
581
  elementFactory;
389
582
  elementRegistry;
390
583
  static $inject = ["elementFactory", "elementRegistry"];
@@ -403,15 +596,15 @@ var L = {
403
596
  return `${e} ${n}`;
404
597
  }
405
598
  allocateId(e, t) {
406
- let n = Ie[e];
407
- for (let e = 1;; e++) {
408
- let r = `${n}_${e}`;
409
- if (!this.elementRegistry.get(r) && !t?.has(r)) return r;
599
+ let n = Ze[e];
600
+ for (;;) {
601
+ let e = `${n}_${Xe()}`;
602
+ if (!this.elementRegistry.get(e) && !t?.has(e)) return e;
410
603
  }
411
604
  }
412
605
  createSticky(e) {
413
- if (!T(e.elementType)) throw Error(`not a sticky kind: ${e.elementType}`);
414
- let { width: t, height: n } = M[e.elementType];
606
+ if (!S(e.elementType)) throw Error(`not a sticky kind: ${e.elementType}`);
607
+ let { width: t, height: n } = A[e.elementType];
415
608
  return this.elementFactory.createShape({
416
609
  id: e.id,
417
610
  x: e.position.x - t / 2,
@@ -425,7 +618,7 @@ var L = {
425
618
  });
426
619
  }
427
620
  createNote(e) {
428
- let { width: t, height: n } = e.size ?? F(e.label), r = e.align?.horizontal, i = e.align?.vertical;
621
+ let { width: t, height: n } = e.size ?? N(e.label), r = e.align?.horizontal, i = e.align?.vertical;
429
622
  return this.elementFactory.createShape({
430
623
  id: e.id,
431
624
  x: e.position.x - t / 2,
@@ -470,7 +663,7 @@ var L = {
470
663
  });
471
664
  }
472
665
  createNew(e, t) {
473
- let n = this.uniqueLabel(t), { width: r, height: i } = T(e) ? M[e] : F(n);
666
+ let n = this.uniqueLabel(t), { width: r, height: i } = S(e) ? A[e] : N(n);
474
667
  return this.elementFactory.createShape({
475
668
  id: this.allocateId(e),
476
669
  width: r,
@@ -480,7 +673,7 @@ var L = {
480
673
  });
481
674
  }
482
675
  createProvisional() {
483
- let { width: e, height: t } = M.event;
676
+ let { width: e, height: t } = A.event;
484
677
  return this.elementFactory.createShape({
485
678
  id: this.allocateId("event"),
486
679
  width: e,
@@ -495,14 +688,14 @@ var L = {
495
688
  id: e.id,
496
689
  source: t,
497
690
  target: n,
498
- waypoints: [Re(t), Re(n)],
691
+ waypoints: [$e(t), $e(n)],
499
692
  eventStormingType: "arrow",
500
693
  ...e.label ? { linkLabel: e.label } : {},
501
694
  businessObject: e
502
695
  });
503
696
  }
504
697
  };
505
- function Re(e) {
698
+ function $e(e) {
506
699
  return {
507
700
  x: e.x + e.width / 2,
508
701
  y: e.y + e.height / 2
@@ -510,13 +703,13 @@ function Re(e) {
510
703
  }
511
704
  //#endregion
512
705
  //#region src/model/index.ts
513
- var ze = { eventStormingElementFactory: ["type", Le] };
706
+ var et = { eventStormingElementFactory: ["type", Qe] };
514
707
  //#endregion
515
708
  //#region src/board-bounds/BoardBounds.ts
516
- function Be(e) {
709
+ function tt(e) {
517
710
  return e.id !== "event-storming-root" && !e.waypoints && typeof e.x == "number" && typeof e.y == "number" && typeof e.width == "number" && typeof e.height == "number";
518
711
  }
519
- var Ve = class {
712
+ var nt = class {
520
713
  elementRegistry;
521
714
  static $inject = ["elementRegistry"];
522
715
  constructor(e) {
@@ -527,23 +720,23 @@ var Ve = class {
527
720
  if (!t.length) return {
528
721
  x: 0,
529
722
  y: 0,
530
- ...o
723
+ ...i
531
724
  };
532
- let n = Math.min(...t.map((e) => e.x)), r = Math.min(...t.map((e) => e.y)), i = Math.max(...t.map((e) => e.x + e.width)), a = Math.max(...t.map((e) => e.y + e.height));
725
+ let n = Math.min(...t.map((e) => e.x)), r = Math.min(...t.map((e) => e.y)), a = Math.max(...t.map((e) => e.x + e.width)), o = Math.max(...t.map((e) => e.y + e.height));
533
726
  return {
534
727
  x: n - e,
535
728
  y: r - e,
536
- width: i - n + 2 * e,
537
- height: a - r + 2 * e
729
+ width: a - n + 2 * e,
730
+ height: o - r + 2 * e
538
731
  };
539
732
  }
540
733
  isEmpty() {
541
734
  return this.positionedShapes().length === 0;
542
735
  }
543
736
  positionedShapes() {
544
- return this.elementRegistry.getAll().filter(Be);
737
+ return this.elementRegistry.getAll().filter(tt);
545
738
  }
546
- }, He = { boardBounds: ["type", Ve] }, Ue = "eventStorming.viewOptions.changed", We = class {
739
+ }, rt = { boardBounds: ["type", nt] }, it = "eventStorming.viewOptions.changed", at = class {
547
740
  eventBus;
548
741
  elementRegistry;
549
742
  static $inject = ["eventBus", "elementRegistry"];
@@ -556,103 +749,103 @@ var Ve = class {
556
749
  }
557
750
  setTypeCaptionsVisible(e) {
558
751
  if (e === this._typeCaptionsVisible) return;
559
- this._typeCaptionsVisible = e, this.eventBus.fire(Ue, { typeCaptionsVisible: e });
560
- let t = this.elementRegistry.filter(E);
752
+ this._typeCaptionsVisible = e, this.eventBus.fire(it, { typeCaptionsVisible: e });
753
+ let t = this.elementRegistry.filter(C);
561
754
  t.length && this.eventBus.fire("elements.changed", { elements: t });
562
755
  }
563
- }, Ge = {
564
- __depends__: [u],
565
- eventStormingViewOptions: ["type", We]
566
- }, Ke = 1500, qe = -3, Je = "event-storming-kind-caption", Ye = 9, Xe = 300, Ze = L.stickyText, Qe = 7, $e = "#FBFBFB", et = "#B9B9B9", tt = "6 4", nt = "event-storming-sticky-shadow";
567
- function rt(e) {
756
+ }, H = {
757
+ __depends__: [d],
758
+ eventStormingViewOptions: ["type", at]
759
+ }, ot = 1500, st = -3, ct = "event-storming-kind-caption", lt = 9, ut = 300, dt = F.stickyText, ft = 7, pt = "#FBFBFB", mt = "#B9B9B9", ht = "6 4", gt = "event-storming-sticky-shadow";
760
+ function _t(e) {
568
761
  let t = e.closest("svg");
569
762
  if (!t) return !1;
570
763
  if (t.querySelector("#event-storming-sticky-shadow")) return !0;
571
- let n = p(m("feDropShadow"), {
764
+ let n = m(h("feDropShadow"), {
572
765
  dx: 0,
573
766
  dy: 5,
574
767
  stdDeviation: 5,
575
768
  "flood-color": "#000000",
576
769
  "flood-opacity": .2
577
- }), r = p(m("filter"), {
578
- id: nt,
770
+ }), r = m(h("filter"), {
771
+ id: gt,
579
772
  x: "-40%",
580
773
  y: "-40%",
581
774
  width: "180%",
582
775
  height: "180%"
583
776
  });
584
- f(r, n);
585
- let i = m("defs");
586
- return f(i, r), t.insertBefore(i, t.firstChild), !0;
777
+ p(r, n);
778
+ let i = h("defs");
779
+ return p(i, r), t.insertBefore(i, t.firstChild), !0;
587
780
  }
588
- var it = class extends d {
781
+ var vt = class extends f {
589
782
  viewOptions;
590
783
  static $inject = ["eventBus", "eventStormingViewOptions"];
591
784
  constructor(e, t) {
592
- super(e, Ke), this.viewOptions = t;
785
+ super(e, ot), this.viewOptions = t;
593
786
  }
594
787
  canRender(e) {
595
- return S(e) || C(e);
788
+ return y(e) || b(e);
596
789
  }
597
790
  drawShape(e, t) {
598
791
  let n = t;
599
792
  return n.eventStormingType === "drawing" ? this.drawDrawing(e, n) : this.drawSticky(e, n);
600
793
  }
601
794
  drawDrawing(e, t) {
602
- let n = t.drawingPoints ?? [], r = t.strokeStyle === "dashed" ? "8 5" : t.strokeStyle === "dotted" ? "2 4" : void 0, i = p(m(t.closed ? "polygon" : "polyline"), {
795
+ let n = t.drawingPoints ?? [], r = t.strokeStyle === "dashed" ? "8 5" : t.strokeStyle === "dotted" ? "2 4" : void 0, i = m(h(t.closed ? "polygon" : "polyline"), {
603
796
  points: n.map((e) => `${e.x},${e.y}`).join(" "),
604
797
  fill: "none",
605
- stroke: t.color ?? R,
798
+ stroke: t.color ?? I,
606
799
  "stroke-width": 2,
607
800
  "stroke-linecap": "round",
608
801
  "stroke-linejoin": "round",
609
802
  ...r ? { "stroke-dasharray": r } : {}
610
803
  });
611
- return f(e, i), i;
804
+ return p(e, i), i;
612
805
  }
613
806
  drawSticky(e, t) {
614
- let n = t.eventStormingType, r = T(n) ? M[n] : N, i = t.provisional === !0, a = e;
807
+ let n = t.eventStormingType, r = S(n) ? A[n] : j, i = t.provisional === !0, a = e;
615
808
  if (n === "hotspot") {
616
- let n = p(m("g"), { transform: `rotate(${qe} ${t.width / 2} ${t.height / 2})` });
617
- f(e, n), a = n;
809
+ let n = m(h("g"), { transform: `rotate(${st} ${t.width / 2} ${t.height / 2})` });
810
+ p(e, n), a = n;
618
811
  }
619
- let o = p(m("rect"), {
812
+ let o = m(h("rect"), {
620
813
  x: 0,
621
814
  y: 0,
622
815
  width: Math.max(t.width, 1),
623
816
  height: Math.max(t.height, 1),
624
817
  rx: 0,
625
- fill: i ? $e : t.color ?? r.fill,
626
- stroke: i ? et : r.stroke,
818
+ fill: i ? pt : t.color ?? r.fill,
819
+ stroke: i ? mt : r.stroke,
627
820
  "stroke-width": 1.5,
628
- ...i ? { "stroke-dasharray": tt } : {}
821
+ ...i ? { "stroke-dasharray": ht } : {}
629
822
  });
630
- if (rt(e) && o.setAttribute("filter", `url(#${nt})`), f(a, o), i) return o;
631
- if (n === "note" ? lt(a, t) : ot(a, t), T(n) && this.viewOptions.typeCaptionsVisible()) {
632
- let e = mt(M[n].label, t.width / 2, t.height - Qe, {
823
+ if (_t(e) && o.setAttribute("filter", `url(#${gt})`), p(a, o), i) return o;
824
+ if (n === "note" ? Ct(a, t) : bt(a, t), S(n) && this.viewOptions.typeCaptionsVisible()) {
825
+ let e = U(A[n].label, t.width / 2, t.height - ft, {
633
826
  "text-anchor": "middle",
634
- "font-size": Ye,
635
- fill: Ze
827
+ "font-size": lt,
828
+ fill: dt
636
829
  });
637
- e.setAttribute("class", Je), e.setAttribute("font-weight", String(Xe)), f(a, e);
830
+ e.setAttribute("class", ct), e.setAttribute("font-weight", String(ut)), p(a, e);
638
831
  }
639
832
  return o;
640
833
  }
641
834
  drawConnection(e, t) {
642
- let n = t, [r, i] = vt(n), a = p(m("polyline"), {
835
+ let n = t, [r, i] = At(n), a = m(h("polyline"), {
643
836
  points: `${r.x},${r.y} ${i.x},${i.y}`,
644
837
  fill: "none",
645
- stroke: L.arrow,
838
+ stroke: F.arrow,
646
839
  "stroke-width": 1.5,
647
840
  "stroke-linecap": "round"
648
841
  });
649
- if (f(e, a), f(e, ht(r, i, L.arrow, 11, 5)), n.linkLabel) {
842
+ if (p(e, a), p(e, Ot(r, i, F.arrow, 11, 5)), n.linkLabel) {
650
843
  let t = (r.x + i.x) / 2, a = (r.y + i.y) / 2;
651
- f(e, mt(n.linkLabel, t, a - 5, {
844
+ p(e, U(n.linkLabel, t, a - 5, {
652
845
  "text-anchor": "middle",
653
846
  "font-size": 11,
654
847
  "font-style": "italic",
655
- fill: L.inkSoft
848
+ fill: F.inkSoft
656
849
  }));
657
850
  }
658
851
  return a;
@@ -666,7 +859,7 @@ var it = class extends d {
666
859
  return t ? `M${t.x},${t.y}` + n.map((e) => `L${e.x},${e.y}`).join("") : "";
667
860
  }
668
861
  };
669
- function at(e, t) {
862
+ function yt(e, t) {
670
863
  let n = e.split(/\s+/).filter((e) => e.length);
671
864
  if (!n.length) return [""];
672
865
  let r = [], i = "";
@@ -683,25 +876,25 @@ function at(e, t) {
683
876
  }
684
877
  return r.push(i), r;
685
878
  }
686
- function ot(e, t) {
687
- let n = t.width - 16, r = Math.max(1, Math.floor(n / P)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = (t.eventStormingLabel ?? "").split("\n").flatMap((e) => at(e, r)).slice(0, i), o = t.width / 2, s = t.height / 2 - (a.length - 1) * 17 / 2 + 4;
879
+ function bt(e, t) {
880
+ let n = t.width - 16, r = Math.max(1, Math.floor(n / M)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = (t.eventStormingLabel ?? "").split("\n").flatMap((e) => yt(e, r)).slice(0, i), o = t.width / 2, s = t.height / 2 - (a.length - 1) * 17 / 2 + 4;
688
881
  a.forEach((t, n) => {
689
- f(e, mt(t, o, s + n * 17, {
882
+ p(e, U(t, o, s + n * 17, {
690
883
  "text-anchor": "middle",
691
- fill: L.stickyText
884
+ fill: F.stickyText
692
885
  }));
693
886
  });
694
887
  }
695
- var st = 2, ct = 12.5;
696
- function lt(e, t) {
697
- let n = t.width - 16, r = Math.max(1, Math.floor(n / P)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = j(t.eventStormingLabel ?? "").flatMap((e) => ut(e, r)).slice(0, i), o = t.alignHorizontal ?? "left", s = t.alignVertical ?? "top", c = o === "left" ? "start" : o === "center" ? "middle" : "end", l = a.length * 17, u = s === "top" ? 8 : s === "middle" ? (t.height - l) / 2 : t.height - 8 - l;
888
+ var xt = 2, St = 12.5;
889
+ function Ct(e, t) {
890
+ let n = t.width - 16, r = Math.max(1, Math.floor(n / M)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = k(t.eventStormingLabel ?? "").flatMap((e) => wt(e, r)).slice(0, i), o = t.alignHorizontal ?? "left", s = t.alignVertical ?? "top", c = o === "left" ? "start" : o === "center" ? "middle" : "end", l = a.length * 17, u = s === "top" ? 8 : s === "middle" ? (t.height - l) / 2 : t.height - 8 - l;
698
891
  a.forEach((n, r) => {
699
- let i = o === "left" ? 8 + (n.indent ? 12 : 0) : o === "center" ? t.width / 2 : t.width - 8, a = p(m("text"), {
892
+ let i = o === "left" ? 8 + (n.indent ? 12 : 0) : o === "center" ? t.width / 2 : t.width - 8, a = m(h("text"), {
700
893
  x: i,
701
- y: u + r * 17 + ct,
702
- "font-family": z.family,
703
- "font-size": z.label,
704
- fill: L.stickyText,
894
+ y: u + r * 17 + St,
895
+ "font-family": L.family,
896
+ "font-size": L.label,
897
+ fill: F.stickyText,
705
898
  "text-anchor": c
706
899
  }), s = n.marker ? [{
707
900
  text: "• ",
@@ -709,25 +902,25 @@ function lt(e, t) {
709
902
  italic: !1
710
903
  }, ...n.runs] : n.runs;
711
904
  for (let e of s) {
712
- let t = m("tspan");
713
- t.textContent = e.text, e.bold && t.setAttribute("font-weight", "600"), e.italic && t.setAttribute("font-style", "italic"), f(a, t);
905
+ let t = h("tspan");
906
+ t.textContent = e.text, e.bold && t.setAttribute("font-weight", "600"), e.italic && t.setAttribute("font-style", "italic"), p(a, t);
714
907
  }
715
- f(e, a);
908
+ p(e, a);
716
909
  });
717
910
  }
718
- function ut(e, t) {
719
- let n = Math.max(1, t - (e.bullet ? st : 0));
720
- return dt(e.runs, n).map((t, n) => ({
911
+ function wt(e, t) {
912
+ let n = Math.max(1, t - (e.bullet ? xt : 0));
913
+ return Tt(e.runs, n).map((t, n) => ({
721
914
  runs: t,
722
915
  marker: e.bullet && n === 0,
723
916
  indent: e.bullet && n > 0
724
917
  }));
725
918
  }
726
- function dt(e, t) {
919
+ function Tt(e, t) {
727
920
  let n = e.map((e) => e.text).join("");
728
- return n.length <= t ? [e] : ft(n, t).map(([t, n]) => pt(e, t, n));
921
+ return n.length <= t ? [e] : Et(n, t).map(([t, n]) => Dt(e, t, n));
729
922
  }
730
- function ft(e, t) {
923
+ function Et(e, t) {
731
924
  let n = [...e.matchAll(/\S+/g)];
732
925
  if (!n.length) return [[0, 0]];
733
926
  let r = [], i = -1, a = -1, o = () => {
@@ -742,7 +935,7 @@ function ft(e, t) {
742
935
  }
743
936
  return o(), r;
744
937
  }
745
- function pt(e, t, n) {
938
+ function Dt(e, t, n) {
746
939
  let r = [], i = 0;
747
940
  for (let a of e) {
748
941
  let e = i;
@@ -756,32 +949,32 @@ function pt(e, t, n) {
756
949
  }
757
950
  return r;
758
951
  }
759
- function mt(e, t, n, r = {}) {
760
- let i = p(m("text"), {
952
+ function U(e, t, n, r = {}) {
953
+ let i = m(h("text"), {
761
954
  x: t,
762
955
  y: n,
763
- "font-family": z.family,
764
- "font-size": z.label,
765
- fill: L.ink,
956
+ "font-family": L.family,
957
+ "font-size": L.label,
958
+ fill: F.ink,
766
959
  ...r
767
960
  });
768
961
  return i.textContent = e, i;
769
962
  }
770
- function ht(e, t, n, r = 10, i = 5) {
963
+ function Ot(e, t, n, r = 10, i = 5) {
771
964
  let a = Math.atan2(t.y - e.y, t.x - e.x), o = t.x - r * Math.cos(a), s = t.y - r * Math.sin(a), c = `${t.x},${t.y} ${o - i * Math.sin(a)},${s + i * Math.cos(a)} ${o + i * Math.sin(a)},${s - i * Math.cos(a)}`;
772
- return p(m("polygon"), {
965
+ return m(h("polygon"), {
773
966
  points: c,
774
967
  fill: n
775
968
  });
776
969
  }
777
- function gt(e) {
970
+ function W(e) {
778
971
  return {
779
972
  x: e.x + e.width / 2,
780
973
  y: e.y + e.height / 2
781
974
  };
782
975
  }
783
- function _t(e, t) {
784
- let n = gt(e), r = t.x - n.x, i = t.y - n.y;
976
+ function kt(e, t) {
977
+ let n = W(e), r = t.x - n.x, i = t.y - n.y;
785
978
  if (r === 0 && i === 0) return n;
786
979
  let a = e.width / 2 + 2, o = e.height / 2 + 2, s = Math.min(r === 0 ? Infinity : a / Math.abs(r), i === 0 ? Infinity : o / Math.abs(i));
787
980
  return {
@@ -789,7 +982,7 @@ function _t(e, t) {
789
982
  y: n.y + i * s
790
983
  };
791
984
  }
792
- function vt(e) {
985
+ function At(e) {
793
986
  let t = e.source, n = e.target, r = e.waypoints;
794
987
  if (!t || !n) {
795
988
  let e = r[0] ?? {
@@ -798,32 +991,34 @@ function vt(e) {
798
991
  };
799
992
  return [e, r[r.length - 1] ?? e];
800
993
  }
801
- let i = gt(t), a = gt(n), o = _t(t, a), s = _t(n, i);
994
+ let i = W(t), a = W(n), o = kt(t, a), s = kt(n, i);
802
995
  return (a.x - i.x) * (s.x - o.x) + (a.y - i.y) * (s.y - o.y) <= 0 ? [i, a] : [o, s];
803
996
  }
804
997
  //#endregion
805
998
  //#region src/draw/index.ts
806
- var yt = {
807
- __depends__: [Ge],
999
+ var jt = {
1000
+ __depends__: [H],
808
1001
  __init__: ["eventStormingRenderer"],
809
- eventStormingRenderer: ["type", it]
810
- }, bt = { drawing: 0 }, xt = .001, St = class {
1002
+ eventStormingRenderer: ["type", vt]
1003
+ }, Mt = { drawing: 0 }, Nt = .001, Pt = class {
811
1004
  canvas;
812
1005
  elementFactory;
813
1006
  factory;
814
1007
  boardBounds;
815
1008
  eventBus;
816
1009
  elementRegistry;
1010
+ config;
817
1011
  static $inject = [
818
1012
  "canvas",
819
1013
  "elementFactory",
820
1014
  "eventStormingElementFactory",
821
1015
  "boardBounds",
822
1016
  "eventBus",
823
- "elementRegistry"
1017
+ "elementRegistry",
1018
+ "config.eventStormingImporter"
824
1019
  ];
825
- constructor(e, t, n, r, i, a) {
826
- this.canvas = e, this.elementFactory = t, this.factory = n, this.boardBounds = r, this.eventBus = i, this.elementRegistry = a;
1020
+ constructor(e, t, n, r, i, a, o) {
1021
+ this.canvas = e, this.elementFactory = t, this.factory = n, this.boardBounds = r, this.eventBus = i, this.elementRegistry = a, this.config = o;
827
1022
  }
828
1023
  import(e) {
829
1024
  let t = [];
@@ -833,7 +1028,7 @@ var yt = {
833
1028
  ...e.rawPassthrough ? { rawPassthrough: e.rawPassthrough } : {}
834
1029
  }, r = this.boardRoot();
835
1030
  r.businessObject = n;
836
- let i = /* @__PURE__ */ new Map(), a = [...e.elements].sort((e, t) => (bt[e.elementType] ?? 9) - (bt[t.elementType] ?? 9)), o = a.filter((e) => e.elementType === "drawing"), s = a.filter((e) => e.elementType !== "drawing");
1031
+ let i = /* @__PURE__ */ new Map(), a = [...e.elements].sort((e, t) => (Mt[e.elementType] ?? 9) - (Mt[t.elementType] ?? 9)), o = a.filter((e) => e.elementType === "drawing"), s = a.filter((e) => e.elementType !== "drawing");
837
1032
  for (let e of o) {
838
1033
  let t = this.createShape(e);
839
1034
  this.canvas.addShape(t, r), i.set(e.id, t);
@@ -846,7 +1041,7 @@ var yt = {
846
1041
  let n = "attachedTo" in e ? e.attachedTo : void 0;
847
1042
  if (!n) continue;
848
1043
  let r = i.get(n);
849
- !r || !Ce(r) ? t.push({
1044
+ !r || !E(r) ? t.push({
850
1045
  message: `“${e.id}” is pinned to “${n}”, which isn't on the board or can't hold a pin. It stays unpinned.`,
851
1046
  elementId: e.id
852
1047
  }) : i.get(e.id).host = r;
@@ -863,11 +1058,11 @@ var yt = {
863
1058
  let s = this.factory.createArrow(n, e, a);
864
1059
  this.canvas.addConnection(s, r, o.length);
865
1060
  }
866
- return this.fitToContent(), this.eventBus.fire("import.render.done", { warnings: t }), t;
1061
+ return this.config?.fitOnImport !== !1 && this.fitToContent(), this.eventBus.fire("import.render.done", { warnings: t }), t;
867
1062
  }
868
1063
  boardRoot() {
869
- let e = this.elementRegistry.get(x);
870
- e || (e = this.elementFactory.createRoot({ id: x }), this.canvas.setRootElement(e));
1064
+ let e = this.elementRegistry.get(v);
1065
+ e || (e = this.elementFactory.createRoot({ id: v }), this.canvas.setRootElement(e));
871
1066
  for (let t of this.canvas.getRootElements()) t !== e && this.canvas.removeRootElement(t);
872
1067
  return e;
873
1068
  }
@@ -877,7 +1072,7 @@ var yt = {
877
1072
  this.canvas.viewbox(e);
878
1073
  return;
879
1074
  }
880
- let r = this.boardBounds.isEmpty() ? 1 : Math.max(Math.min(t / e.width, n / e.height, 1), xt);
1075
+ let r = this.boardBounds.isEmpty() ? 1 : Math.max(Math.min(t / e.width, n / e.height, 1), Nt);
881
1076
  this.canvas.viewbox({
882
1077
  x: e.x + e.width / 2 - t / 2 / r,
883
1078
  y: e.y + e.height / 2 - n / 2 / r,
@@ -902,35 +1097,35 @@ var yt = {
902
1097
  } catch {}
903
1098
  }
904
1099
  }
905
- }, Ct = class {
1100
+ }, Ft = class {
906
1101
  elementRegistry;
907
1102
  static $inject = ["elementRegistry"];
908
1103
  constructor(e) {
909
1104
  this.elementRegistry = e;
910
1105
  }
911
1106
  export() {
912
- let e = this.elementRegistry.get(x)?.businessObject, t = e?.config ?? { title: "Untitled Board" }, n = [], r = [];
1107
+ let e = this.elementRegistry.get(v)?.businessObject, t = e?.config ?? { title: "Untitled Board" }, r = [], i = [];
913
1108
  for (let e of this.elementRegistry.getAll()) if (e.id !== "event-storming-root") {
914
- if (C(e)) r.push({
1109
+ if (b(e)) i.push({
915
1110
  id: e.id,
916
1111
  edgeType: "arrow",
917
1112
  from: e.source?.id ?? "",
918
1113
  to: e.target?.id ?? "",
919
1114
  ...e.linkLabel ? { label: e.linkLabel } : {}
920
1115
  });
921
- else if (S(e)) {
1116
+ else if (y(e)) {
922
1117
  let t = this.buildElement(e);
923
- t && n.push(t);
1118
+ t && r.push(t);
924
1119
  }
925
1120
  }
926
1121
  let a = {
927
- schemaVersion: i,
1122
+ schemaVersion: n,
928
1123
  config: t,
929
- elements: n,
930
- edges: r,
1124
+ elements: r,
1125
+ edges: i,
931
1126
  ...e?.rawPassthrough ? { rawPassthrough: e.rawPassthrough } : {}
932
1127
  };
933
- return l(a);
1128
+ return c(a);
934
1129
  }
935
1130
  buildElement(e) {
936
1131
  if (e.eventStormingType === "drawing") {
@@ -949,10 +1144,10 @@ var yt = {
949
1144
  ...e.color ? { color: e.color } : {}
950
1145
  };
951
1146
  }
952
- let t = e.eventStormingType === "note" && I(e.eventStormingLabel, e) ? {
1147
+ let t = e.eventStormingType === "note" && P(e.eventStormingLabel, e) ? {
953
1148
  width: e.width,
954
1149
  height: e.height
955
- } : void 0, n = e.eventStormingType === "note" ? wt(e) : void 0;
1150
+ } : void 0, n = e.eventStormingType === "note" ? It(e) : void 0;
956
1151
  return {
957
1152
  id: e.id,
958
1153
  elementType: e.eventStormingType,
@@ -968,7 +1163,7 @@ var yt = {
968
1163
  };
969
1164
  }
970
1165
  };
971
- function wt(e) {
1166
+ function It(e) {
972
1167
  let t = e.alignHorizontal && e.alignHorizontal !== "left" ? e.alignHorizontal : void 0, n = e.alignVertical && e.alignVertical !== "top" ? e.alignVertical : void 0;
973
1168
  if (t || n) return {
974
1169
  ...t ? { horizontal: t } : {},
@@ -977,62 +1172,62 @@ function wt(e) {
977
1172
  }
978
1173
  //#endregion
979
1174
  //#region src/io/warnings.ts
980
- function Tt(e) {
1175
+ function Lt(e) {
981
1176
  return e.source === void 0 ? e.message : `${e.message} (“${e.source}”)`;
982
1177
  }
983
1178
  //#endregion
984
1179
  //#region src/io/index.ts
985
- var Et = {
986
- eventStormingImporter: ["type", St],
987
- eventStormingExporter: ["type", Ct]
988
- }, Dt = class extends De {
1180
+ var Rt = {
1181
+ eventStormingImporter: ["type", Pt],
1182
+ eventStormingExporter: ["type", Ft]
1183
+ }, zt = class extends qe {
989
1184
  _getModules() {
990
1185
  return [
991
- ze,
992
- He,
993
- Ge,
994
- yt,
995
- Et
1186
+ et,
1187
+ rt,
1188
+ H,
1189
+ jt,
1190
+ Rt
996
1191
  ];
997
1192
  }
998
- }, B = class extends Dt {
1193
+ }, Bt = class extends zt {
999
1194
  _getModules() {
1000
1195
  return [
1001
1196
  ...super._getModules(),
1002
- g,
1003
1197
  _,
1004
- v,
1005
- ee
1198
+ ee,
1199
+ te,
1200
+ ne
1006
1201
  ];
1007
1202
  }
1008
- }, Ot = class extends le {
1203
+ }, Vt = class extends pe {
1009
1204
  static $inject = ["eventBus", "modeling"];
1010
1205
  constructor(e, t) {
1011
1206
  super(e), this.preExecute("element.updateProperties", (e) => {
1012
1207
  let { element: n, properties: r } = e.context, i = r.eventStormingType;
1013
1208
  if (typeof i != "string") return;
1014
1209
  let a = n;
1015
- if (a.host && !D(i) && t.updateAttachment(a, void 0), a.attachers?.length && !O(i)) for (let e of [...a.attachers]) t.updateAttachment(e, void 0);
1210
+ if (a.host && !w(i) && t.updateAttachment(a, void 0), a.attachers?.length && !T(i)) for (let e of [...a.attachers]) t.updateAttachment(e, void 0);
1016
1211
  });
1017
1212
  }
1018
- }, kt = {
1019
- __depends__: [ce],
1213
+ }, Ht = {
1214
+ __depends__: [fe],
1020
1215
  __init__: ["eventStormingAttachBehavior"],
1021
- eventStormingAttachBehavior: ["type", Ot]
1216
+ eventStormingAttachBehavior: ["type", Vt]
1022
1217
  };
1023
1218
  //#endregion
1024
1219
  //#region src/modeling/cmd/UpdatePropertiesHandler.ts
1025
- function At(e, t, n) {
1220
+ function Ut(e, t, n) {
1026
1221
  n === void 0 ? delete e[t] : e[t] = n;
1027
1222
  }
1028
- var jt = [
1223
+ var Wt = [
1029
1224
  "x",
1030
1225
  "y",
1031
1226
  "width",
1032
1227
  "height"
1033
1228
  ];
1034
- function Mt(e, t) {
1035
- if (!t.some((e) => jt.includes(e))) return [e];
1229
+ function Gt(e, t) {
1230
+ if (!t.some((e) => Wt.includes(e))) return [e];
1036
1231
  let n = e;
1037
1232
  return [
1038
1233
  e,
@@ -1040,18 +1235,18 @@ function Mt(e, t) {
1040
1235
  ...n.outgoing ?? []
1041
1236
  ];
1042
1237
  }
1043
- var Nt = class {
1238
+ var Kt = class {
1044
1239
  execute(e) {
1045
1240
  let { element: t, properties: n } = e, r = t, i = {};
1046
- for (let e of Object.keys(n)) i[e] = r[e], At(r, e, n[e]);
1047
- return e.oldProperties = i, Mt(t, Object.keys(n));
1241
+ for (let e of Object.keys(n)) i[e] = r[e], Ut(r, e, n[e]);
1242
+ return e.oldProperties = i, Gt(t, Object.keys(n));
1048
1243
  }
1049
1244
  revert(e) {
1050
1245
  let { element: t, oldProperties: n } = e, r = t;
1051
- if (n) for (let e of Object.keys(n)) At(r, e, n[e]);
1052
- return Mt(t, Object.keys(n ?? {}));
1246
+ if (n) for (let e of Object.keys(n)) Ut(r, e, n[e]);
1247
+ return Gt(t, Object.keys(n ?? {}));
1053
1248
  }
1054
- }, V = "element.updateProperties", Pt = class {
1249
+ }, qt = "element.updateProperties", Jt = class {
1055
1250
  commandStack;
1056
1251
  canvas;
1057
1252
  elementRegistry;
@@ -1061,17 +1256,17 @@ var Nt = class {
1061
1256
  "elementRegistry"
1062
1257
  ];
1063
1258
  constructor(e, t, n) {
1064
- this.commandStack = e, this.canvas = t, this.elementRegistry = n, e.registerHandler(V, Nt);
1259
+ this.commandStack = e, this.canvas = t, this.elementRegistry = n, e.registerHandler(qt, Kt);
1065
1260
  }
1066
1261
  updateProperties(e, t) {
1067
- this.commandStack.execute(V, {
1262
+ this.commandStack.execute(qt, {
1068
1263
  element: e,
1069
1264
  properties: t
1070
1265
  });
1071
1266
  }
1072
1267
  updateLabel(e, t) {
1073
- if (e.eventStormingType === "note" && !I(e.eventStormingLabel, e)) {
1074
- let { width: n, height: r } = F(t), i = e.x + e.width / 2, a = e.y + e.height / 2;
1268
+ if (e.eventStormingType === "note" && !P(e.eventStormingLabel, e)) {
1269
+ let { width: n, height: r } = N(t), i = e.x + e.width / 2, a = e.y + e.height / 2;
1075
1270
  this.updateProperties(e, {
1076
1271
  eventStormingLabel: t,
1077
1272
  width: n,
@@ -1082,9 +1277,9 @@ var Nt = class {
1082
1277
  } else this.updateProperties(e, { eventStormingLabel: t });
1083
1278
  }
1084
1279
  setStickyKind(e, t) {
1085
- if (!T(e.eventStormingType) || !T(t)) throw Error("setStickyKind: only sticky kinds can be retyped");
1280
+ if (!S(e.eventStormingType) || !S(t)) throw Error("setStickyKind: only sticky kinds can be retyped");
1086
1281
  if (e.eventStormingType === t && !e.provisional) return;
1087
- let { width: n, height: r } = M[t], i = e.x + e.width / 2, a = e.y + e.height / 2;
1282
+ let { width: n, height: r } = A[t], i = e.x + e.width / 2, a = e.y + e.height / 2;
1088
1283
  this.updateProperties(e, {
1089
1284
  eventStormingType: t,
1090
1285
  ...e.provisional ? { provisional: void 0 } : {},
@@ -1101,12 +1296,12 @@ var Nt = class {
1101
1296
  this.updateProperties(e, { strokeStyle: t });
1102
1297
  }
1103
1298
  getLevel() {
1104
- return this.elementRegistry.get("event-storming-root")?.businessObject?.config.level ?? a;
1299
+ return this.elementRegistry.get("event-storming-root")?.businessObject?.config.level ?? r;
1105
1300
  }
1106
1301
  setLevel(e) {
1107
1302
  if (this.getLevel() === e) return;
1108
1303
  let t = this.root(), n = t.businessObject ?? { config: { title: "Untitled Board" } };
1109
- this.commandStack.execute(V, {
1304
+ this.commandStack.execute(qt, {
1110
1305
  element: t,
1111
1306
  properties: { businessObject: {
1112
1307
  ...n,
@@ -1120,7 +1315,7 @@ var Nt = class {
1120
1315
  root() {
1121
1316
  return this.elementRegistry.get("event-storming-root") ?? this.canvas.getRootElement();
1122
1317
  }
1123
- }, Ft = 24, It = [
1318
+ }, Yt = 24, Xt = [
1124
1319
  "eventStormingType",
1125
1320
  "color",
1126
1321
  "drawingPoints",
@@ -1128,8 +1323,8 @@ var Nt = class {
1128
1323
  "strokeStyle",
1129
1324
  "alignHorizontal",
1130
1325
  "alignVertical"
1131
- ], Lt = ["eventStormingType", "linkLabel"];
1132
- function Rt(e, t) {
1326
+ ], Zt = ["eventStormingType", "linkLabel"];
1327
+ function Qt(e, t) {
1133
1328
  let n = {};
1134
1329
  for (let r of t) {
1135
1330
  let t = e[r];
@@ -1137,7 +1332,7 @@ function Rt(e, t) {
1137
1332
  }
1138
1333
  return n;
1139
1334
  }
1140
- var zt = class {
1335
+ var $t = class {
1141
1336
  selection;
1142
1337
  modeling;
1143
1338
  elementFactory;
@@ -1160,23 +1355,23 @@ var zt = class {
1160
1355
  this.selection = e, this.modeling = t, this.elementFactory = n, this.esFactory = r, this.canvas = i, this.create = a, this.mouse = o;
1161
1356
  }
1162
1357
  copy() {
1163
- let e = this.selection.get().filter((e) => S(e));
1358
+ let e = this.selection.get().filter((e) => y(e));
1164
1359
  if (!e.length) return !1;
1165
1360
  let t = new Map(e.map((e, t) => [e, t])), n = [], r = /* @__PURE__ */ new Set();
1166
1361
  for (let i of e) for (let e of [...i.incoming ?? [], ...i.outgoing ?? []]) {
1167
- if (!C(e) || r.has(e)) continue;
1362
+ if (!b(e) || r.has(e)) continue;
1168
1363
  let i = t.get(e.source), a = t.get(e.target);
1169
1364
  i !== void 0 && a !== void 0 && (r.add(e), n.push({
1170
1365
  sourceIdx: i,
1171
1366
  targetIdx: a,
1172
- props: Rt(e, Lt)
1367
+ props: Qt(e, Zt)
1173
1368
  }));
1174
1369
  }
1175
1370
  return this.clipboard = {
1176
1371
  shapes: e.map((e) => {
1177
1372
  let n = e.host ? t.get(e.host) : void 0;
1178
1373
  return {
1179
- props: Rt(e, It),
1374
+ props: Qt(e, Xt),
1180
1375
  x: e.x,
1181
1376
  y: e.y,
1182
1377
  width: e.width,
@@ -1217,26 +1412,26 @@ var zt = class {
1217
1412
  ...structuredClone(e.props),
1218
1413
  source: n[e.sourceIdx],
1219
1414
  target: n[e.targetIdx],
1220
- waypoints: [Bt(n[e.sourceIdx]), Bt(n[e.targetIdx])]
1415
+ waypoints: [en(n[e.sourceIdx]), en(n[e.targetIdx])]
1221
1416
  }))
1222
1417
  };
1223
1418
  }
1224
1419
  insertWithOffset(e) {
1225
1420
  this.pasteCount++;
1226
- let t = Ft * this.pasteCount, n = Vt(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
1421
+ let t = Yt * this.pasteCount, n = tn(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
1227
1422
  x: n.cx + t,
1228
1423
  y: n.cy + t
1229
1424
  }, this.canvas.getRootElement());
1230
1425
  return this.selection.select(r), !0;
1231
1426
  }
1232
1427
  };
1233
- function Bt(e) {
1428
+ function en(e) {
1234
1429
  return {
1235
1430
  x: e.x + e.width / 2,
1236
1431
  y: e.y + e.height / 2
1237
1432
  };
1238
1433
  }
1239
- function Vt(e) {
1434
+ function tn(e) {
1240
1435
  let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y)), r = Math.max(...e.map((e) => e.x + e.width)), i = Math.max(...e.map((e) => e.y + e.height));
1241
1436
  return {
1242
1437
  cx: (t + r) / 2,
@@ -1245,13 +1440,13 @@ function Vt(e) {
1245
1440
  }
1246
1441
  //#endregion
1247
1442
  //#region src/modeling/index.ts
1248
- var Ht = {
1249
- __depends__: [ue, b],
1443
+ var nn = {
1444
+ __depends__: [me, ae],
1250
1445
  __init__: ["eventStormingModeling"],
1251
- eventStormingModeling: ["type", Pt],
1252
- eventStormingCopyPaste: ["type", zt]
1253
- }, Ut = {
1254
- __depends__: [de],
1446
+ eventStormingModeling: ["type", Jt],
1447
+ eventStormingCopyPaste: ["type", $t]
1448
+ }, rn = {
1449
+ __depends__: [he],
1255
1450
  __init__: ["eventStormingLassoBehavior"],
1256
1451
  eventStormingLassoBehavior: ["type", class {
1257
1452
  static $inject = [
@@ -1276,43 +1471,43 @@ var Ht = {
1276
1471
  };
1277
1472
  //#endregion
1278
1473
  //#region src/rules/EventStormingRules.ts
1279
- function Wt(e, t) {
1474
+ function an(e, t) {
1280
1475
  return (e.outgoing ?? []).some((e) => e.target === t);
1281
1476
  }
1282
- function Gt(e, t) {
1283
- return e.length !== 1 || !Se(e[0]) || !Ce(t) ? !1 : "attach";
1477
+ function on(e, t) {
1478
+ return e.length !== 1 || !Ee(e[0]) || !E(t) ? !1 : "attach";
1284
1479
  }
1285
- var Kt = class extends fe {
1480
+ var sn = class extends ge {
1286
1481
  static $inject = ["eventBus"];
1287
1482
  constructor(e) {
1288
1483
  super(e);
1289
1484
  }
1290
1485
  init() {
1291
- this.addRule("connection.start", (e) => E(e.source)), this.addRule("connection.create", (e) => {
1486
+ this.addRule("connection.start", (e) => C(e.source)), this.addRule("connection.create", (e) => {
1292
1487
  let { source: t, target: n } = e;
1293
- return !E(t) || !E(n) || t === n || Wt(t, n) ? !1 : { eventStormingType: "arrow" };
1294
- }), this.addRule(["shape.move", "elements.move"], (e) => Gt(e.shapes ?? (e.shape ? [e.shape] : []), e.target) || !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => {
1295
- if (!we(e.shape)) return !1;
1488
+ return !C(t) || !C(n) || t === n || an(t, n) ? !1 : { eventStormingType: "arrow" };
1489
+ }), this.addRule(["shape.move", "elements.move"], (e) => on(e.shapes ?? (e.shape ? [e.shape] : []), e.target) || !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => {
1490
+ if (!De(e.shape)) return !1;
1296
1491
  let { newBounds: t } = e;
1297
1492
  return !t || t.width >= Pe.width && t.height >= Pe.height;
1298
1493
  });
1299
1494
  }
1300
- }, qt = {
1495
+ }, cn = {
1301
1496
  __init__: ["eventStormingRules"],
1302
- eventStormingRules: ["type", Kt]
1303
- }, Jt = 8, Yt = {
1497
+ eventStormingRules: ["type", sn]
1498
+ }, ln = 8, un = {
1304
1499
  __init__: ["elementSnapping"],
1305
1500
  elementSnapping: ["type", class {
1306
1501
  static $inject = ["eventBus", "elementRegistry"];
1307
1502
  constructor(e, t) {
1308
- let n = (e) => t.getAll().filter((t) => S(t) && t.eventStormingType !== "drawing" && !e.has(t.id)).map((e) => ({
1503
+ let n = (e) => t.getAll().filter((t) => y(t) && t.eventStormingType !== "drawing" && !e.has(t.id)).map((e) => ({
1309
1504
  x: e.x + e.width / 2,
1310
1505
  y: e.y + e.height / 2
1311
1506
  })), r = (e, t) => {
1312
1507
  let n, r = 9;
1313
1508
  for (let i of t) {
1314
1509
  let t = Math.abs(i - e);
1315
- t <= Jt && t < r && (n = i, r = t);
1510
+ t <= ln && t < r && (n = i, r = t);
1316
1511
  }
1317
1512
  return n;
1318
1513
  };
@@ -1344,177 +1539,7 @@ var Kt = class extends fe {
1344
1539
  });
1345
1540
  }
1346
1541
  }]
1347
- }, Xt = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="event-storming-palette-svg">${e}</svg>`, Zt = (e, t, n = 0) => Xt(`<rect x="4" y="5" width="16" height="14" fill="${e}" stroke="${t}" stroke-width="1.5"${n ? ` transform="rotate(${n} 12 12)"` : ""}/>`), Qt = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="event-storming-palette-svg">${e}</svg>`, H = {
1348
- draw: Qt("<circle cx=\"19\" cy=\"5\" r=\"2\"/><circle cx=\"5\" cy=\"19\" r=\"2\"/><path d=\"M6.5 17.5 17.5 6.5\"/>"),
1349
- lasso: Qt("<path d=\"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z\"/><path d=\"M5 3a2 2 0 0 0-2 2\"/><path d=\"M19 3a2 2 0 0 1 2 2\"/><path d=\"M5 21a2 2 0 0 1-2-2\"/><path d=\"M9 3h1\"/><path d=\"M9 21h2\"/><path d=\"M14 3h1\"/><path d=\"M3 9v1\"/><path d=\"M21 9v2\"/><path d=\"M3 14v1\"/>"),
1350
- note: Zt(N.fill, N.stroke)
1351
- };
1352
- for (let e of w) {
1353
- let t = M[e];
1354
- H[e] = Zt(t.fill, t.stroke, e === "hotspot" ? -6 : 0);
1355
- }
1356
- function $t(e, t) {
1357
- return `<svg width="14" height="14" viewBox="0 0 14 14" class="event-storming-palette-svg"><rect x="1" y="1" width="12" height="12" fill="${e}" stroke="${t}" stroke-width="1"/></svg>`;
1358
- }
1359
- //#endregion
1360
- //#region src/palette/EventStormingPaletteProvider.ts
1361
- var en = 24, U = "stickies-1", W = "stickies-2", tn = "stickies-3", nn = [
1362
- {
1363
- key: "event",
1364
- type: "event",
1365
- label: M.event.label,
1366
- title: "Domain event",
1367
- shortcut: "E",
1368
- group: U
1369
- },
1370
- {
1371
- key: "command",
1372
- type: "command",
1373
- label: M.command.label,
1374
- title: "Command",
1375
- shortcut: "C",
1376
- group: U
1377
- },
1378
- {
1379
- key: "actor",
1380
- type: "actor",
1381
- label: M.actor.label,
1382
- title: "Actor",
1383
- group: U
1384
- },
1385
- {
1386
- key: "aggregate",
1387
- type: "aggregate",
1388
- label: M.aggregate.label,
1389
- title: "Aggregate",
1390
- group: U
1391
- },
1392
- {
1393
- key: "policy",
1394
- type: "policy",
1395
- label: M.policy.label,
1396
- title: "Policy",
1397
- group: W
1398
- },
1399
- {
1400
- key: "readmodel",
1401
- type: "readmodel",
1402
- label: M.readmodel.label,
1403
- title: "Read model",
1404
- group: W
1405
- },
1406
- {
1407
- key: "external",
1408
- type: "external",
1409
- label: M.external.label,
1410
- title: "External system",
1411
- group: W
1412
- },
1413
- {
1414
- key: "hotspot",
1415
- type: "hotspot",
1416
- label: M.hotspot.label,
1417
- title: "Hotspot",
1418
- group: tn
1419
- },
1420
- {
1421
- key: "note",
1422
- type: "note",
1423
- label: N.label,
1424
- title: "Note",
1425
- group: tn
1426
- }
1427
- ], rn = class {
1428
- create;
1429
- factory;
1430
- lassoTool;
1431
- drawTool;
1432
- eventStormingModeling;
1433
- canvas;
1434
- modeling;
1435
- selection;
1436
- elementRegistry;
1437
- labelEditing;
1438
- config;
1439
- static $inject = [
1440
- "palette",
1441
- "create",
1442
- "eventStormingElementFactory",
1443
- "lassoTool",
1444
- "eventStormingDrawTool",
1445
- "eventStormingModeling",
1446
- "eventBus",
1447
- "canvas",
1448
- "modeling",
1449
- "selection",
1450
- "elementRegistry",
1451
- "eventStormingLabelEditing",
1452
- "config.eventStormingPalette"
1453
- ];
1454
- constructor(e, t, n, r, i, a, o, s, c, l, u, d, f) {
1455
- this.create = t, this.factory = n, this.lassoTool = r, this.drawTool = i, this.eventStormingModeling = a, this.canvas = s, this.modeling = c, this.selection = l, this.elementRegistry = u, this.labelEditing = d, this.config = f, e.registerProvider(this);
1456
- let p = () => e._rebuild();
1457
- o.on("import.done", p), o.on(["commandStack.element.updateProperties.postExecuted", "commandStack.element.updateProperties.reverted"], (e) => {
1458
- e.context.element.id === "event-storming-root" && p();
1459
- });
1460
- }
1461
- getPaletteEntries() {
1462
- let e = {};
1463
- e["lasso-tool"] = {
1464
- group: "tools",
1465
- title: "Lasso",
1466
- shortcut: "L",
1467
- html: `<div class="entry event-storming-palette-entry">${H.lasso}</div>`,
1468
- action: { click: (e) => this.lassoTool.activateSelection(e) }
1469
- }, e["draw-tool"] = {
1470
- group: "tools",
1471
- title: "Draw",
1472
- html: `<div class="entry event-storming-palette-entry">${H.draw}</div>`,
1473
- action: { click: () => this.drawTool.toggle() }
1474
- };
1475
- let t = c[this.eventStormingModeling.getLevel()];
1476
- for (let n of nn) {
1477
- if (n.type !== "note" && !t.includes(n.type)) continue;
1478
- let r = (e) => {
1479
- let t = this.factory.createNew(n.type, n.label);
1480
- an(e) && this.placeInFreeRect(t) || this.create.start(e, t);
1481
- };
1482
- e[`create.${n.key}`] = {
1483
- group: n.group,
1484
- title: n.title,
1485
- ...n.shortcut ? { shortcut: n.shortcut } : {},
1486
- html: `<div class="entry event-storming-palette-entry" draggable="true">${H[n.key]}</div>`,
1487
- action: {
1488
- dragstart: r,
1489
- click: r
1490
- }
1491
- };
1492
- }
1493
- return e;
1494
- }
1495
- placeInFreeRect(e) {
1496
- let { canvas: t, modeling: n, selection: r, elementRegistry: i } = this;
1497
- if (!t || !n || !r || !i) return !1;
1498
- let a = t.viewbox(), o = this.config?.freeRectInsets?.() ?? {
1499
- top: 0,
1500
- right: 0,
1501
- bottom: 0,
1502
- left: 0
1503
- }, s = Math.max(0, a.outer.width - o.left - o.right), c = Math.max(0, a.outer.height - o.top - o.bottom), l = {
1504
- x: a.x + (o.left + s / 2) / a.scale,
1505
- y: a.y + (o.top + c / 2) / a.scale
1506
- }, u = (e) => i.filter(S).some((t) => Math.abs(t.x + t.width / 2 - e.x) < 1 && Math.abs(t.y + t.height / 2 - e.y) < 1);
1507
- for (; u(l);) l.x += en, l.y += en;
1508
- let d = n.createShape(e, l, t.getRootElement());
1509
- return r.select(d), t.focus(), this.labelEditing?.activate(d), !0;
1510
- }
1511
- };
1512
- function an(e) {
1513
- return e.type === "click" && e.detail === 0;
1514
- }
1515
- //#endregion
1516
- //#region src/palette/EventStormingPaletteTooltip.ts
1517
- var on = ".djs-palette-entries .entry", sn = "bottom", cn = class {
1542
+ }, dn = ".djs-palette-entries .entry", fn = "bottom", pn = class {
1518
1543
  palette;
1519
1544
  hoverTooltip;
1520
1545
  static $inject = [
@@ -1529,9 +1554,9 @@ var on = ".djs-palette-entries .entry", sn = "bottom", cn = class {
1529
1554
  attachTo(e) {
1530
1555
  this.refreshEntries(), this.hoverTooltip.add({
1531
1556
  container: e,
1532
- selector: on,
1557
+ selector: dn,
1533
1558
  getContent: (e) => this.contentFor(e),
1534
- getPosition: (e) => ln(e)
1559
+ getPosition: (e) => mn(e)
1535
1560
  });
1536
1561
  }
1537
1562
  refreshEntries() {
@@ -1539,31 +1564,31 @@ var on = ".djs-palette-entries .entry", sn = "bottom", cn = class {
1539
1564
  }
1540
1565
  contentFor(e) {
1541
1566
  let t = this.entries[e.getAttribute("data-action") ?? ""];
1542
- return t?.title ? me`<${pe} title=${t.title} shortcut=${t.shortcut} />` : null;
1567
+ return t?.title ? ve`<${_e} title=${t.title} shortcut=${t.shortcut} />` : null;
1543
1568
  }
1544
1569
  };
1545
- function ln(e) {
1570
+ function mn(e) {
1546
1571
  let t = e.getBoundingClientRect();
1547
1572
  return {
1548
1573
  x: t.left + t.width / 2,
1549
1574
  y: t.bottom + 8,
1550
- placement: sn
1575
+ placement: fn
1551
1576
  };
1552
1577
  }
1553
1578
  //#endregion
1554
1579
  //#region src/palette/index.ts
1555
- var un = {
1580
+ var hn = {
1556
1581
  __init__: ["eventStormingPaletteProvider", "paletteTooltip"],
1557
- eventStormingPaletteProvider: ["type", rn],
1558
- paletteTooltip: ["type", cn]
1559
- }, G = "event-storming-element-settings", dn = {
1582
+ eventStormingPaletteProvider: ["type", Ue],
1583
+ paletteTooltip: ["type", pn]
1584
+ }, G = "event-storming-element-settings", gn = {
1560
1585
  id: "kind",
1561
1586
  name: "Change type"
1562
1587
  };
1563
- function fn(e, t) {
1588
+ function _n(e, t) {
1564
1589
  return e ? `✓ ${t}` : t;
1565
1590
  }
1566
- var pn = class {
1591
+ var vn = class {
1567
1592
  modeling;
1568
1593
  static $inject = ["popupMenu", "eventStormingModeling"];
1569
1594
  constructor(e, t) {
@@ -1571,26 +1596,26 @@ var pn = class {
1571
1596
  }
1572
1597
  getPopupMenuEntries(e) {
1573
1598
  let t = Array.isArray(e) ? e[0] : e;
1574
- return E(t) ? this.kindEntries(t) : {};
1599
+ return C(t) ? this.kindEntries(t) : {};
1575
1600
  }
1576
1601
  kindEntries(e) {
1577
- let t = {}, n = e.provisional === !0, r = c[this.modeling.getLevel()];
1578
- for (let i of w) {
1602
+ let t = {}, n = e.provisional === !0, r = o[this.modeling.getLevel()];
1603
+ for (let i of x) {
1579
1604
  if (!r.includes(i) && (n || i !== e.eventStormingType)) continue;
1580
- let a = M[i];
1605
+ let a = A[i];
1581
1606
  t[`kind-${i}`] = {
1582
- label: n ? a.label : fn(e.eventStormingType === i, a.label),
1583
- imageHtml: $t(a.fill, a.stroke),
1584
- group: dn,
1607
+ label: n ? a.label : _n(e.eventStormingType === i, a.label),
1608
+ imageHtml: ze(a.fill, a.stroke),
1609
+ group: gn,
1585
1610
  action: () => this.modeling.setStickyKind(e, i)
1586
1611
  };
1587
1612
  }
1588
1613
  return t;
1589
1614
  }
1590
- }, mn = {
1615
+ }, yn = {
1591
1616
  __init__: ["eventStormingElementSettings"],
1592
- eventStormingElementSettings: ["type", pn]
1593
- }, K = "eventStorming.readOnly.changed", hn = 5e3, gn = [
1617
+ eventStormingElementSettings: ["type", vn]
1618
+ }, K = "eventStorming.readOnly.changed", bn = 5e3, xn = [
1594
1619
  "elements.move",
1595
1620
  "shape.move",
1596
1621
  "shape.resize",
@@ -1603,7 +1628,7 @@ var pn = class {
1603
1628
  "connection.reconnect",
1604
1629
  "connection.updateWaypoints",
1605
1630
  "elements.delete"
1606
- ], _n = class extends fe {
1631
+ ], Sn = class extends ge {
1607
1632
  bus;
1608
1633
  static $inject = ["eventBus"];
1609
1634
  readOnly = !1;
@@ -1611,7 +1636,7 @@ var pn = class {
1611
1636
  super(e), this.bus = e;
1612
1637
  }
1613
1638
  init() {
1614
- this.addRule(gn, hn, () => !this.readOnly && void 0);
1639
+ this.addRule(xn, bn, () => !this.readOnly && void 0);
1615
1640
  }
1616
1641
  isReadOnly() {
1617
1642
  return this.readOnly;
@@ -1619,11 +1644,11 @@ var pn = class {
1619
1644
  setReadOnly(e) {
1620
1645
  this.readOnly !== e && (this.readOnly = e, this.bus.fire(K, { readOnly: e }));
1621
1646
  }
1622
- }, vn = {
1623
- __depends__: [ae],
1647
+ }, Cn = {
1648
+ __depends__: [le],
1624
1649
  __init__: ["eventStormingReadOnly"],
1625
- eventStormingReadOnly: ["type", _n]
1626
- }, yn = {
1650
+ eventStormingReadOnly: ["type", Sn]
1651
+ }, wn = {
1627
1652
  plus: "<path d=\"M5 12h14\"/><path d=\"M12 5v14\"/>",
1628
1653
  "arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>",
1629
1654
  pencil: "<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\"/><path d=\"m15 5 4 4\"/>",
@@ -1643,17 +1668,17 @@ var pn = class {
1643
1668
  x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>"
1644
1669
  };
1645
1670
  function q(e) {
1646
- return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${yn[e]}</svg>`;
1671
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${wn[e]}</svg>`;
1647
1672
  }
1648
1673
  //#endregion
1649
1674
  //#region src/context-pad/EventStormingContextPadProvider.ts
1650
- var bn = "Append sticky (auto-connect, choose the type after placing)";
1675
+ var Tn = "Append sticky (auto-connect, choose the type after placing)";
1651
1676
  function J(e, t, n = !1) {
1652
1677
  return `<div class="entry event-storming-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${q(e)}</div>`;
1653
1678
  }
1654
1679
  //#endregion
1655
1680
  //#region src/context-pad/index.ts
1656
- var xn = {
1681
+ var En = {
1657
1682
  __init__: ["eventStormingContextPadProvider"],
1658
1683
  eventStormingContextPadProvider: ["type", class {
1659
1684
  modeling;
@@ -1685,7 +1710,7 @@ var xn = {
1685
1710
  }
1686
1711
  getContextPadEntries(e) {
1687
1712
  if (this.readOnly?.isReadOnly()) return {};
1688
- if (C(e)) {
1713
+ if (b(e)) {
1689
1714
  let t = e;
1690
1715
  return {
1691
1716
  "edit-label": {
@@ -1702,17 +1727,17 @@ var xn = {
1702
1727
  }
1703
1728
  };
1704
1729
  }
1705
- if (!S(e)) return {};
1730
+ if (!y(e)) return {};
1706
1731
  let t = e, n = {}, r = t.eventStormingType;
1707
- if (T(r)) {
1732
+ if (S(r)) {
1708
1733
  let e = (e) => {
1709
1734
  let n = this.factory.createProvisional();
1710
1735
  this.create.start(e, n, { source: t });
1711
1736
  };
1712
1737
  n.append = {
1713
1738
  group: "append",
1714
- title: bn,
1715
- html: J("plus", bn, !0),
1739
+ title: Tn,
1740
+ html: J("plus", Tn, !0),
1716
1741
  action: {
1717
1742
  click: e,
1718
1743
  dragstart: e
@@ -1772,36 +1797,36 @@ var xn = {
1772
1797
  }, n;
1773
1798
  }
1774
1799
  }]
1775
- }, Sn = "bullet", Cn = [
1800
+ }, Dn = "bullet", On = [
1776
1801
  "left",
1777
1802
  "center",
1778
1803
  "right"
1779
- ], wn = [
1804
+ ], kn = [
1780
1805
  "top",
1781
1806
  "middle",
1782
1807
  "bottom"
1783
1808
  ];
1784
- function Tn(e, t) {
1809
+ function An(e, t) {
1785
1810
  return e[(e.indexOf(t) + 1) % e.length];
1786
1811
  }
1787
- function En(e, t) {
1812
+ function jn(e, t) {
1788
1813
  let n = e.ownerDocument;
1789
1814
  e.textContent = "";
1790
- for (let r of j(t)) {
1815
+ for (let r of k(t)) {
1791
1816
  let t = n.createElement("div");
1792
- r.bullet && (t.className = Sn);
1817
+ r.bullet && (t.className = Dn);
1793
1818
  for (let e of r.runs) {
1794
1819
  let r = n.createTextNode(e.text);
1795
- e.italic && (r = Dn(n, "i", r)), e.bold && (r = Dn(n, "b", r)), t.appendChild(r);
1820
+ e.italic && (r = Mn(n, "i", r)), e.bold && (r = Mn(n, "b", r)), t.appendChild(r);
1796
1821
  }
1797
1822
  r.runs.length === 0 && t.appendChild(n.createElement("br")), e.appendChild(t);
1798
1823
  }
1799
1824
  }
1800
- function Dn(e, t, n) {
1825
+ function Mn(e, t, n) {
1801
1826
  let r = e.createElement(t);
1802
1827
  return r.appendChild(n), r;
1803
1828
  }
1804
- function On(e) {
1829
+ function Nn(e) {
1805
1830
  let t = [], n = null, r = (e) => (n = {
1806
1831
  bullet: e,
1807
1832
  runs: []
@@ -1822,11 +1847,11 @@ function On(e) {
1822
1847
  s.nextSibling && r(!1);
1823
1848
  return;
1824
1849
  }
1825
- if (kn(s.tagName)) {
1850
+ if (Pn(s.tagName)) {
1826
1851
  a(s);
1827
1852
  return;
1828
1853
  }
1829
- let c = An(s, t, o);
1854
+ let c = Fn(s, t, o);
1830
1855
  for (let e of s.childNodes) i(e, c.bold, c.italic);
1831
1856
  }, a = (e) => {
1832
1857
  r(e.classList.contains("bullet") || e.tagName === "LI");
@@ -1836,10 +1861,10 @@ function On(e) {
1836
1861
  for (let t of e.childNodes) i(t, !1, !1);
1837
1862
  return ke(t);
1838
1863
  }
1839
- function kn(e) {
1864
+ function Pn(e) {
1840
1865
  return e === "DIV" || e === "P" || e === "LI";
1841
1866
  }
1842
- function An(e, t, n) {
1867
+ function Fn(e, t, n) {
1843
1868
  let r = e.tagName;
1844
1869
  (r === "B" || r === "STRONG") && (t = !0), (r === "I" || r === "EM") && (n = !0);
1845
1870
  let i = e.style.fontWeight;
@@ -1850,13 +1875,13 @@ function An(e, t, n) {
1850
1875
  italic: n
1851
1876
  };
1852
1877
  }
1853
- function jn(e) {
1878
+ function In(e) {
1854
1879
  let t = e.ownerDocument, n = t.getSelection();
1855
1880
  if (!n) return;
1856
1881
  let r = t.createRange();
1857
1882
  r.selectNodeContents(e), n.removeAllRanges(), n.addRange(r);
1858
1883
  }
1859
- function Mn(e, t) {
1884
+ function Ln(e, t) {
1860
1885
  let n = e.ownerDocument;
1861
1886
  if (typeof n.execCommand == "function" && n.execCommand("insertText", !1, t)) return;
1862
1887
  let r = n.getSelection();
@@ -1867,24 +1892,24 @@ function Mn(e, t) {
1867
1892
  let a = n.createTextNode(t);
1868
1893
  i.insertNode(a), i.setStartAfter(a), i.collapse(!0), r.removeAllRanges(), r.addRange(i);
1869
1894
  }
1870
- function Nn(e) {
1895
+ function Rn(e) {
1871
1896
  let t = e.ownerDocument.getSelection();
1872
1897
  if (!t || t.rangeCount === 0) return [];
1873
1898
  let n = t.getRangeAt(0);
1874
1899
  return e.contains(n.commonAncestorContainer) ? Array.from(e.children).filter((e) => n.intersectsNode(e)) : [];
1875
1900
  }
1876
- function Pn(e) {
1877
- Fn(e);
1878
- let t = Nn(e);
1901
+ function zn(e) {
1902
+ Bn(e);
1903
+ let t = Rn(e);
1879
1904
  if (t.length === 0) return;
1880
- let n = t.every((e) => e.classList.contains(Sn));
1881
- for (let e of t) e.classList.toggle(Sn, !n);
1905
+ let n = t.every((e) => e.classList.contains(Dn));
1906
+ for (let e of t) e.classList.toggle(Dn, !n);
1882
1907
  }
1883
- function Fn(e) {
1908
+ function Bn(e) {
1884
1909
  let t = e.ownerDocument, n = null;
1885
- for (let r of Array.from(e.childNodes)) r.nodeType === Node.ELEMENT_NODE && kn(r.tagName) ? n = null : (n || (n = t.createElement("div"), e.insertBefore(n, r)), n.appendChild(r));
1910
+ for (let r of Array.from(e.childNodes)) r.nodeType === Node.ELEMENT_NODE && Pn(r.tagName) ? n = null : (n || (n = t.createElement("div"), e.insertBefore(n, r)), n.appendChild(r));
1886
1911
  }
1887
- var In = {
1912
+ var Vn = {
1888
1913
  horizontal: {
1889
1914
  left: "text-align-start",
1890
1915
  center: "text-align-center",
@@ -1896,7 +1921,7 @@ var In = {
1896
1921
  bottom: "align-vertical-justify-end"
1897
1922
  }
1898
1923
  };
1899
- function Ln(e, t) {
1924
+ function Hn(e, t) {
1900
1925
  let n = e.createElement("div");
1901
1926
  n.className = "event-storming-note-toolbar";
1902
1927
  let r = (r, i, a) => {
@@ -1907,19 +1932,19 @@ function Ln(e, t) {
1907
1932
  let i = e.createElement("span");
1908
1933
  return i.className = "event-storming-note-toolbar-separator", n.appendChild(i), r("note-align-horizontal", "Horizontal alignment (click to cycle)", ""), r("note-align-vertical", "Vertical alignment (click to cycle)", ""), n;
1909
1934
  }
1910
- function Rn(e, t, n) {
1911
- let r = In[t][n];
1935
+ function Un(e, t, n) {
1936
+ let r = Vn[t][n];
1912
1937
  e.innerHTML = r ? q(r) : "", e.title = t === "horizontal" ? `Horizontal alignment: ${n} (click to cycle)` : `Vertical alignment: ${n} (click to cycle)`;
1913
1938
  }
1914
- function zn(e, t) {
1939
+ function Wn(e, t) {
1915
1940
  e.style.textAlign = t.horizontal, e.style.justifyContent = t.vertical === "top" ? "flex-start" : t.vertical === "middle" ? "center" : "flex-end";
1916
1941
  }
1917
1942
  //#endregion
1918
1943
  //#region src/label-editing/EventStormingLabelEditing.ts
1919
- function Bn(e) {
1944
+ function Gn(e) {
1920
1945
  return e.replace(/(?<!:)\/\//g, "∕∕").replace(/\/\*/g, "∕*").replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
1921
1946
  }
1922
- var Vn = class {
1947
+ var Kn = class {
1923
1948
  canvas;
1924
1949
  modeling;
1925
1950
  elementRegistry;
@@ -1940,12 +1965,8 @@ var Vn = class {
1940
1965
  }), e.on("diagram.destroy", () => {
1941
1966
  clearTimeout(this.resumeTimer), this.suspended = null, this.cancel();
1942
1967
  }), e.on("element.dblclick", (e) => {
1943
- S(e.element) ? this.activate(e.element) : C(e.element) && this.activateConnection(e.element);
1944
- }), e.on([
1945
- "element.mousedown",
1946
- "drag.init",
1947
- "canvas.viewbox.changing"
1948
- ], () => this.active?.commit());
1968
+ y(e.element) ? this.activate(e.element) : b(e.element) && this.activateConnection(e.element);
1969
+ }), e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changed", () => this.active?.place());
1949
1970
  }
1950
1971
  suspend() {
1951
1972
  clearTimeout(this.resumeTimer), this.active && (this.suspended = this.active.snapshot(), this.active.cleanup());
@@ -1959,14 +1980,14 @@ var Vn = class {
1959
1980
  resume(e) {
1960
1981
  let t = this.elementRegistry?.get(e.elementId);
1961
1982
  if (e.connection) {
1962
- if (!C(t)) return;
1983
+ if (!b(t)) return;
1963
1984
  this.activateConnection(t);
1964
1985
  } else {
1965
- if (!S(t)) return;
1986
+ if (!y(t)) return;
1966
1987
  this.activate(t);
1967
1988
  }
1968
1989
  let n = this.active?.field;
1969
- n && (n instanceof HTMLTextAreaElement || n instanceof HTMLInputElement ? (n.value = e.value, n instanceof HTMLTextAreaElement && (n.rows = Math.max(2, e.value.split("\n").length)), n.setSelectionRange(e.selectionStart ?? e.value.length, e.selectionEnd ?? e.value.length)) : (En(n, e.value), e.align && this.restoreNoteAlign?.(e.align), Un(n)));
1990
+ n && (n instanceof HTMLTextAreaElement || n instanceof HTMLInputElement ? (n.value = e.value, n instanceof HTMLTextAreaElement && (n.rows = Math.max(2, e.value.split("\n").length)), n.setSelectionRange(e.selectionStart ?? e.value.length, e.selectionEnd ?? e.value.length)) : (jn(n, e.value), e.align && this.restoreNoteAlign?.(e.align), Jn(n)));
1970
1991
  }
1971
1992
  restoreNoteAlign;
1972
1993
  activate(e) {
@@ -1975,134 +1996,152 @@ var Vn = class {
1975
1996
  this.activateNote(e);
1976
1997
  return;
1977
1998
  }
1978
- let t = this.canvas.getContainer(), n = this.canvas.zoom(), r = this.canvas.viewbox(), i = (e.x + e.width / 2 - r.x) * n, a = (e.y + e.height / 2 - r.y) * n, o = document.createElement("textarea");
1979
- o.className = "event-storming-label-input event-storming-label-textarea", o.value = e.eventStormingLabel ?? "", o.rows = Math.max(2, o.value.split("\n").length), o.wrap = "off", o.style.position = "absolute", o.style.left = `${i}px`, o.style.top = `${a}px`, o.style.transform = "translate(-50%, -50%)", o.style.width = `${e.width * n}px`, t.appendChild(o), o.focus(), o.select();
1980
- let s = !1, c = () => {
1981
- s || (s = !0, o.removeEventListener("keydown", u), o.removeEventListener("blur", d), o.remove(), this.active = null, this.canvas.restoreFocus?.());
1982
- }, l = () => {
1983
- if (s) return;
1984
- let t = Bn(o.value), n = t && t !== e.eventStormingLabel;
1985
- c(), n && this.modeling.updateLabel(e, t);
1986
- }, u = (e) => {
1987
- if (e.key === "Escape") e.preventDefault(), c();
1999
+ let t = this.canvas.getContainer(), n = document.createElement("textarea");
2000
+ n.className = "event-storming-label-input event-storming-label-textarea", n.value = e.eventStormingLabel ?? "", n.rows = Math.max(2, n.value.split("\n").length), n.wrap = "off", n.style.position = "absolute", n.style.transform = "translate(-50%, -50%)";
2001
+ let r = () => {
2002
+ let t = this.canvas.zoom(), r = this.canvas.viewbox();
2003
+ n.style.left = `${(e.x + e.width / 2 - r.x) * t}px`, n.style.top = `${(e.y + e.height / 2 - r.y) * t}px`, n.style.width = `${e.width * t}px`;
2004
+ };
2005
+ r(), t.appendChild(n), n.focus(), n.select();
2006
+ let i = !1, a = () => {
2007
+ i || (i = !0, n.removeEventListener("keydown", s), n.removeEventListener("blur", c), n.remove(), this.active = null, this.canvas.restoreFocus?.());
2008
+ }, o = () => {
2009
+ if (i) return;
2010
+ let t = Gn(n.value), r = t && t !== e.eventStormingLabel;
2011
+ a(), r && this.modeling.updateLabel(e, t);
2012
+ }, s = (e) => {
2013
+ if (e.key === "Escape") e.preventDefault(), a();
1988
2014
  else if (e.key === "Enter") {
1989
2015
  if (!(e.metaKey || e.ctrlKey)) return;
1990
- e.preventDefault(), l();
2016
+ e.preventDefault(), o();
1991
2017
  }
1992
- }, d = () => l();
1993
- o.addEventListener("keydown", u), o.addEventListener("blur", d);
1994
- let f = () => ({
2018
+ }, c = () => o();
2019
+ n.addEventListener("keydown", s), n.addEventListener("blur", c);
2020
+ let l = () => ({
1995
2021
  elementId: e.id,
1996
2022
  connection: !1,
1997
- value: o.value,
1998
- selectionStart: o.selectionStart ?? void 0,
1999
- selectionEnd: o.selectionEnd ?? void 0
2023
+ value: n.value,
2024
+ selectionStart: n.selectionStart ?? void 0,
2025
+ selectionEnd: n.selectionEnd ?? void 0
2000
2026
  });
2001
2027
  this.active = {
2002
- field: o,
2003
- commit: l,
2004
- cleanup: c,
2005
- snapshot: f
2028
+ field: n,
2029
+ place: r,
2030
+ commit: o,
2031
+ cleanup: a,
2032
+ snapshot: l
2006
2033
  };
2007
2034
  }
2008
2035
  activateNote(e) {
2009
- let t = this.canvas.getContainer(), n = this.canvas.zoom(), r = this.canvas.viewbox(), i = (e.x + e.width / 2 - r.x) * n, a = (e.y + e.height / 2 - r.y) * n, o = document.createElement("div");
2010
- o.className = "event-storming-label-input event-storming-note-editor", o.contentEditable = "true", o.style.position = "absolute", o.style.left = `${i}px`, o.style.top = `${a}px`, o.style.transform = "translate(-50%, -50%)", o.style.minWidth = `${e.width * n}px`, o.style.minHeight = `${e.height * n}px`, En(o, e.eventStormingLabel ?? "");
2011
- let s = {
2036
+ let t = this.canvas.getContainer(), n = document.createElement("div");
2037
+ n.className = "event-storming-label-input event-storming-note-editor", n.contentEditable = "true", n.style.position = "absolute", n.style.transform = "translate(-50%, -50%)", jn(n, e.eventStormingLabel ?? "");
2038
+ let r = {
2012
2039
  horizontal: e.alignHorizontal ?? "left",
2013
2040
  vertical: e.alignVertical ?? "top"
2014
2041
  };
2015
- zn(o, s);
2016
- let c = Ln(document, (e) => m(e));
2017
- c.style.left = `${i}px`, c.style.top = `${(e.y - r.y) * n - 8}px`, c.style.transform = "translate(-50%, -100%)", t.appendChild(o), t.appendChild(c), o.focus(), jn(o);
2018
- let l = (e) => c.querySelector(`[data-action="${e}"]`), u = (e, t) => {
2019
- let n = l(e);
2042
+ Wn(n, r);
2043
+ let i = Hn(document, (e) => d(e));
2044
+ i.style.transform = "translate(-50%, -100%)";
2045
+ let a = () => {
2046
+ let t = this.canvas.zoom(), r = this.canvas.viewbox(), a = (e.x + e.width / 2 - r.x) * t;
2047
+ n.style.left = `${a}px`, n.style.top = `${(e.y + e.height / 2 - r.y) * t}px`, n.style.minWidth = `${e.width * t}px`, n.style.minHeight = `${e.height * t}px`, i.style.left = `${a}px`, i.style.top = `${(e.y - r.y) * t - 8}px`;
2048
+ };
2049
+ a(), t.appendChild(n), t.appendChild(i), n.focus(), In(n);
2050
+ let o = (e) => i.querySelector(`[data-action="${e}"]`), s = (e, t) => {
2051
+ let n = o(e);
2020
2052
  n?.classList.toggle("active", t), n?.setAttribute("aria-pressed", String(t));
2021
- }, d = () => {
2022
- u("note-bold", Wn("bold")), u("note-italic", Wn("italic"));
2023
- let e = Nn(o);
2024
- u("note-bullet", e.length > 0 && e.every((e) => e.classList.contains("bullet")));
2025
- let t = l("note-align-horizontal");
2026
- t && Rn(t, "horizontal", s.horizontal);
2027
- let n = l("note-align-vertical");
2028
- n && Rn(n, "vertical", s.vertical);
2029
- }, f = (e) => {
2030
- typeof document.execCommand == "function" && document.execCommand(e, !1), d();
2031
- }, p = (e) => {
2032
- e === "horizontal" ? s.horizontal = Tn(Cn, s.horizontal) : s.vertical = Tn(wn, s.vertical), zn(o, s), d();
2033
- }, m = (e) => {
2034
- e === "note-bold" ? f("bold") : e === "note-italic" ? f("italic") : e === "note-bullet" ? (Pn(o), d()) : p(e === "note-align-horizontal" ? "horizontal" : "vertical");
2035
- }, h = () => d();
2036
- document.addEventListener("selectionchange", h);
2037
- let g = !1, _ = () => {
2038
- g || (g = !0, document.removeEventListener("selectionchange", h), o.removeEventListener("keydown", ee), o.removeEventListener("blur", te), o.removeEventListener("paste", y), o.remove(), c.remove(), this.active = null, this.restoreNoteAlign = void 0, this.canvas.restoreFocus?.());
2039
- }, v = () => {
2040
- if (g) return;
2041
- let t = Hn(e, Bn(On(o)), s);
2042
- _(), t && this.modeling.updateProperties(e, t);
2043
- }, ee = (e) => {
2053
+ }, c = () => {
2054
+ s("note-bold", Yn("bold")), s("note-italic", Yn("italic"));
2055
+ let e = Rn(n);
2056
+ s("note-bullet", e.length > 0 && e.every((e) => e.classList.contains("bullet")));
2057
+ let t = o("note-align-horizontal");
2058
+ t && Un(t, "horizontal", r.horizontal);
2059
+ let i = o("note-align-vertical");
2060
+ i && Un(i, "vertical", r.vertical);
2061
+ }, l = (e) => {
2062
+ typeof document.execCommand == "function" && document.execCommand(e, !1), c();
2063
+ }, u = (e) => {
2064
+ e === "horizontal" ? r.horizontal = An(On, r.horizontal) : r.vertical = An(kn, r.vertical), Wn(n, r), c();
2065
+ }, d = (e) => {
2066
+ e === "note-bold" ? l("bold") : e === "note-italic" ? l("italic") : e === "note-bullet" ? (zn(n), c()) : u(e === "note-align-horizontal" ? "horizontal" : "vertical");
2067
+ }, f = () => c();
2068
+ document.addEventListener("selectionchange", f);
2069
+ let p = !1, m = () => {
2070
+ p || (p = !0, document.removeEventListener("selectionchange", f), n.removeEventListener("keydown", g), n.removeEventListener("blur", _), n.removeEventListener("paste", ee), n.remove(), i.remove(), this.active = null, this.restoreNoteAlign = void 0, this.canvas.restoreFocus?.());
2071
+ }, h = () => {
2072
+ if (p) return;
2073
+ let t = qn(e, Gn(Nn(n)), r);
2074
+ m(), t && this.modeling.updateProperties(e, t);
2075
+ }, g = (e) => {
2044
2076
  if (e.key === "Escape") {
2045
- e.preventDefault(), _();
2077
+ e.preventDefault(), m();
2046
2078
  return;
2047
2079
  }
2048
2080
  if (e.key === "Enter") {
2049
2081
  if (!(e.metaKey || e.ctrlKey)) return;
2050
- e.preventDefault(), v();
2082
+ e.preventDefault(), h();
2051
2083
  return;
2052
2084
  }
2053
2085
  let t = e.key.toLowerCase();
2054
- (e.metaKey || e.ctrlKey) && (t === "b" || t === "i") && (e.preventDefault(), f(t === "b" ? "bold" : "italic"));
2055
- }, te = (e) => {
2056
- e.relatedTarget instanceof Node && c.contains(e.relatedTarget) || v();
2057
- }, y = (e) => {
2086
+ (e.metaKey || e.ctrlKey) && (t === "b" || t === "i") && (e.preventDefault(), l(t === "b" ? "bold" : "italic"));
2087
+ }, _ = (e) => {
2088
+ e.relatedTarget instanceof Node && i.contains(e.relatedTarget) || h();
2089
+ }, ee = (e) => {
2058
2090
  e.preventDefault();
2059
2091
  let t = e.clipboardData?.getData("text/plain") ?? "";
2060
- t && Mn(o, t);
2092
+ t && Ln(n, t);
2061
2093
  };
2062
- o.addEventListener("keydown", ee), o.addEventListener("blur", te), o.addEventListener("paste", y), d(), this.restoreNoteAlign = (e) => {
2063
- s.horizontal = e.horizontal, s.vertical = e.vertical, zn(o, s), d();
2094
+ n.addEventListener("keydown", g), n.addEventListener("blur", _), n.addEventListener("paste", ee), c(), this.restoreNoteAlign = (e) => {
2095
+ r.horizontal = e.horizontal, r.vertical = e.vertical, Wn(n, r), c();
2064
2096
  };
2065
- let b = () => ({
2097
+ let te = () => ({
2066
2098
  elementId: e.id,
2067
2099
  connection: !1,
2068
- value: On(o),
2069
- align: { ...s }
2100
+ value: Nn(n),
2101
+ align: { ...r }
2070
2102
  });
2071
2103
  this.active = {
2072
- field: o,
2073
- commit: v,
2074
- cleanup: _,
2075
- snapshot: b
2104
+ field: n,
2105
+ place: a,
2106
+ commit: h,
2107
+ cleanup: m,
2108
+ snapshot: te
2076
2109
  };
2077
2110
  }
2078
2111
  activateConnection(e) {
2079
2112
  if (this.active?.commit(), this.readOnly?.isReadOnly()) return;
2080
- let t = this.canvas.getContainer(), n = this.canvas.zoom(), r = this.canvas.viewbox(), i = e.waypoints[0], a = e.waypoints[e.waypoints.length - 1];
2081
- if (!i || !a) return;
2082
- let o = document.createElement("input");
2083
- o.type = "text", o.className = "event-storming-label-input", o.placeholder = "arrow label", o.value = e.linkLabel ?? "", o.style.position = "absolute", o.style.left = `${((i.x + a.x) / 2 - 60 - r.x) * n}px`, o.style.top = `${((i.y + a.y) / 2 - 26 - r.y) * n}px`, t.appendChild(o), o.focus(), o.select();
2084
- let s = !1, c = () => {
2085
- s || (s = !0, o.removeEventListener("keydown", u), o.removeEventListener("blur", d), o.remove(), this.active = null, this.canvas.restoreFocus?.());
2086
- }, l = () => {
2087
- if (s) return;
2088
- let t = Bn(o.value), n = e.linkLabel ?? "";
2089
- c(), t !== n && this.modeling.updateProperties(e, { linkLabel: t || void 0 });
2090
- }, u = (e) => {
2091
- e.key === "Escape" ? (e.preventDefault(), c()) : e.key === "Enter" && (e.preventDefault(), l());
2092
- }, d = () => l();
2093
- o.addEventListener("keydown", u), o.addEventListener("blur", d);
2094
- let f = () => ({
2113
+ let t = this.canvas.getContainer(), n = e.waypoints[0], r = e.waypoints[e.waypoints.length - 1];
2114
+ if (!n || !r) return;
2115
+ let i = document.createElement("input");
2116
+ i.type = "text", i.className = "event-storming-label-input", i.placeholder = "arrow label", i.value = e.linkLabel ?? "", i.style.position = "absolute";
2117
+ let a = () => {
2118
+ let e = this.canvas.zoom(), t = this.canvas.viewbox();
2119
+ i.style.left = `${((n.x + r.x) / 2 - 60 - t.x) * e}px`, i.style.top = `${((n.y + r.y) / 2 - 26 - t.y) * e}px`;
2120
+ };
2121
+ a(), t.appendChild(i), i.focus(), i.select();
2122
+ let o = !1, s = () => {
2123
+ o || (o = !0, i.removeEventListener("keydown", l), i.removeEventListener("blur", u), i.remove(), this.active = null, this.canvas.restoreFocus?.());
2124
+ }, c = () => {
2125
+ if (o) return;
2126
+ let t = Gn(i.value), n = e.linkLabel ?? "";
2127
+ s(), t !== n && this.modeling.updateProperties(e, { linkLabel: t || void 0 });
2128
+ }, l = (e) => {
2129
+ e.key === "Escape" ? (e.preventDefault(), s()) : e.key === "Enter" && (e.preventDefault(), c());
2130
+ }, u = () => c();
2131
+ i.addEventListener("keydown", l), i.addEventListener("blur", u);
2132
+ let d = () => ({
2095
2133
  elementId: e.id,
2096
2134
  connection: !0,
2097
- value: o.value,
2098
- selectionStart: o.selectionStart ?? void 0,
2099
- selectionEnd: o.selectionEnd ?? void 0
2135
+ value: i.value,
2136
+ selectionStart: i.selectionStart ?? void 0,
2137
+ selectionEnd: i.selectionEnd ?? void 0
2100
2138
  });
2101
2139
  this.active = {
2102
- field: o,
2103
- commit: l,
2104
- cleanup: c,
2105
- snapshot: f
2140
+ field: i,
2141
+ place: a,
2142
+ commit: c,
2143
+ cleanup: s,
2144
+ snapshot: d
2106
2145
  };
2107
2146
  }
2108
2147
  cancel() {
@@ -2117,23 +2156,23 @@ var Vn = class {
2117
2156
  };
2118
2157
  }
2119
2158
  };
2120
- function Hn(e, t, n) {
2159
+ function qn(e, t, n) {
2121
2160
  let r = !!t && t !== e.eventStormingLabel, i = n.horizontal !== (e.alignHorizontal ?? "left") || n.vertical !== (e.alignVertical ?? "top");
2122
2161
  if (!r && !i) return null;
2123
2162
  let a = {};
2124
- if (r && (a.eventStormingLabel = t, !I(e.eventStormingLabel, e))) {
2125
- let { width: n, height: r } = F(t);
2163
+ if (r && (a.eventStormingLabel = t, !P(e.eventStormingLabel, e))) {
2164
+ let { width: n, height: r } = N(t);
2126
2165
  a.width = n, a.height = r, a.x = e.x + e.width / 2 - n / 2, a.y = e.y + e.height / 2 - r / 2;
2127
2166
  }
2128
2167
  return i && (a.alignHorizontal = n.horizontal === "left" ? void 0 : n.horizontal, a.alignVertical = n.vertical === "top" ? void 0 : n.vertical), a;
2129
2168
  }
2130
- function Un(e) {
2169
+ function Jn(e) {
2131
2170
  let t = document.createRange();
2132
2171
  t.selectNodeContents(e), t.collapse(!1);
2133
2172
  let n = window.getSelection();
2134
2173
  n?.removeAllRanges(), n?.addRange(t);
2135
2174
  }
2136
- function Wn(e) {
2175
+ function Yn(e) {
2137
2176
  if (typeof document.queryCommandState != "function") return !1;
2138
2177
  try {
2139
2178
  return document.queryCommandState(e);
@@ -2143,10 +2182,10 @@ function Wn(e) {
2143
2182
  }
2144
2183
  //#endregion
2145
2184
  //#region src/label-editing/index.ts
2146
- var Gn = {
2185
+ var Xn = {
2147
2186
  __init__: ["eventStormingLabelEditing"],
2148
- eventStormingLabelEditing: ["type", Vn]
2149
- }, Kn = 2, qn = 10, Jn = {
2187
+ eventStormingLabelEditing: ["type", Kn]
2188
+ }, Zn = 2, Qn = 10, $n = {
2150
2189
  arrowleft: {
2151
2190
  x: -1,
2152
2191
  y: 0
@@ -2163,7 +2202,7 @@ var Gn = {
2163
2202
  x: 0,
2164
2203
  y: 1
2165
2204
  }
2166
- }, Yn = class {
2205
+ }, er = class {
2167
2206
  static $inject = [
2168
2207
  "config.eventStormingKeyboard",
2169
2208
  "canvas",
@@ -2181,12 +2220,12 @@ var Gn = {
2181
2220
  ];
2182
2221
  constructor(e, t, n, r, i, a, o, s, c, l, u, d, f) {
2183
2222
  let p = t.getContainer(), m = e?.undoRedoKeys ?? !0, h = (e) => {
2184
- e.defaultPrevented || Xn(e.target, p) && (Zn(e.target) || g(e) || f?.isReadOnly() || _(e));
2223
+ e.defaultPrevented || tr(e.target, p) && (nr(e.target) || g(e) || f?.isReadOnly() || _(e));
2185
2224
  }, g = (e) => {
2186
2225
  let t = e.ctrlKey || e.metaKey, n = e.key.toLowerCase();
2187
2226
  if (t && n === "a" && !e.shiftKey && !e.altKey) {
2188
2227
  e.preventDefault();
2189
- let t = (d?.getAll() ?? []).filter((e) => S(e) || C(e));
2228
+ let t = (d?.getAll() ?? []).filter((e) => y(e) || b(e));
2190
2229
  r.select(t);
2191
2230
  } else if (t && n === "c") a.copy() && e.preventDefault();
2192
2231
  else if (!t && !e.altKey && n === "l") {
@@ -2209,14 +2248,14 @@ var Gn = {
2209
2248
  let t = c.getLastMoveEvent();
2210
2249
  if (t) {
2211
2250
  e.preventDefault();
2212
- let n = l === "e" ? o.createNew("event", M.event.label) : o.createNew("command", M.command.label);
2251
+ let n = l === "e" ? o.createNew("event", A.event.label) : o.createNew("command", A.command.label);
2213
2252
  s.start(t, n);
2214
2253
  }
2215
- } else if (l in Jn && !t) {
2254
+ } else if (l in $n && !t) {
2216
2255
  let t = r.get();
2217
2256
  if (t.length) {
2218
2257
  e.preventDefault();
2219
- let n = e.shiftKey ? qn : Kn, r = Jn[l];
2258
+ let n = e.shiftKey ? Qn : Zn, r = $n[l];
2220
2259
  i.moveElements(t, {
2221
2260
  x: r.x * n,
2222
2261
  y: r.y * n
@@ -2227,20 +2266,20 @@ var Gn = {
2227
2266
  document.addEventListener("keydown", h), u.on("diagram.destroy", () => document.removeEventListener("keydown", h));
2228
2267
  }
2229
2268
  };
2230
- function Xn(e, t) {
2269
+ function tr(e, t) {
2231
2270
  return e instanceof Node ? t.contains(e) || e === document.body || e === document.documentElement : !1;
2232
2271
  }
2233
- function Zn(e) {
2272
+ function nr(e) {
2234
2273
  if (!(e instanceof HTMLElement)) return !1;
2235
2274
  let t = e.tagName;
2236
2275
  return t === "INPUT" || t === "TEXTAREA" || e.isContentEditable;
2237
2276
  }
2238
2277
  //#endregion
2239
2278
  //#region src/keyboard/index.ts
2240
- var Qn = {
2279
+ var rr = {
2241
2280
  __init__: ["eventStormingKeyboard"],
2242
- eventStormingKeyboard: ["type", Yn]
2243
- }, $n = 500, er = 6, tr = class {
2281
+ eventStormingKeyboard: ["type", er]
2282
+ }, ir = 500, ar = 6, or = class {
2244
2283
  static $inject = ["injector", "eventBus"];
2245
2284
  constructor(e, t) {
2246
2285
  let n = e.get("connectionPreview", !1), r = e.get("eventStormingLabelEditing", !1), i = e.get("popupMenu", !1), a = e.get("modeling", !1), o = e.get("canvas", !1), s = !1;
@@ -2273,14 +2312,14 @@ var Qn = {
2273
2312
  let n = o.getAbsoluteBBox(e), c = o.getContainer().getBoundingClientRect();
2274
2313
  i.open(e, G, {
2275
2314
  x: c.left + n.x,
2276
- y: c.top + n.y + n.height + er
2315
+ y: c.top + n.y + n.height + ar
2277
2316
  }), i.isOpen() ? t.once("popupMenu.close", () => {
2278
2317
  setTimeout(() => {
2279
2318
  s || (e.provisional ? e.parent && a.removeElements([e]) : r?.activate(e));
2280
2319
  }, 0);
2281
2320
  }) : a.removeElements([e]);
2282
2321
  };
2283
- t.on("create.end", $n, (e) => {
2322
+ t.on("create.end", ir, (e) => {
2284
2323
  let { context: t } = e;
2285
2324
  if (!t.source || !t.canExecute || !t.shape) return;
2286
2325
  let n = t.shape;
@@ -2297,14 +2336,14 @@ var Qn = {
2297
2336
  } else r && setTimeout(() => r.activate(n), 0);
2298
2337
  });
2299
2338
  }
2300
- }, nr = {
2301
- __depends__: [he],
2339
+ }, sr = {
2340
+ __depends__: [ye],
2302
2341
  __init__: ["eventStormingAppendBehavior"],
2303
- eventStormingAppendBehavior: ["type", tr]
2304
- }, rr = w.map((e) => ({
2305
- value: M[e].fill,
2306
- title: M[e].label
2307
- })), ir = class {
2342
+ eventStormingAppendBehavior: ["type", or]
2343
+ }, cr = x.map((e) => ({
2344
+ value: A[e].fill,
2345
+ title: A[e].label
2346
+ })), lr = class {
2308
2347
  canvas;
2309
2348
  modeling;
2310
2349
  static $inject = [
@@ -2334,7 +2373,7 @@ var Qn = {
2334
2373
  value: void 0,
2335
2374
  title: "No color",
2336
2375
  cls: "event-storming-cp-none"
2337
- }, ...rr.map((e) => ({
2376
+ }, ...cr.map((e) => ({
2338
2377
  value: e.value,
2339
2378
  title: e.title,
2340
2379
  cls: ""
@@ -2354,12 +2393,12 @@ var Qn = {
2354
2393
  close() {
2355
2394
  this.popover && (this.popover.remove(), this.popover = void 0, document.removeEventListener("click", this.onDocPointer, !0), document.removeEventListener("keydown", this.onKey, !0));
2356
2395
  }
2357
- }, ar = {
2396
+ }, ur = {
2358
2397
  __init__: ["eventStormingColorPicker"],
2359
- eventStormingColorPicker: ["type", ir]
2360
- }, or = {
2398
+ eventStormingColorPicker: ["type", lr]
2399
+ }, dr = {
2361
2400
  __init__: ["eventStormingOrderingProvider"],
2362
- eventStormingOrderingProvider: ["type", class extends ge {
2401
+ eventStormingOrderingProvider: ["type", class extends be {
2363
2402
  static $inject = ["eventBus"];
2364
2403
  constructor(e) {
2365
2404
  super(e);
@@ -2367,15 +2406,15 @@ var Qn = {
2367
2406
  getOrdering(e, t) {
2368
2407
  for (; t.parent;) t = t.parent;
2369
2408
  let n = t.children ?? [];
2370
- if (C(e)) {
2371
- let r = n.filter((t) => t !== e && (k(t) || C(t))).length;
2409
+ if (b(e)) {
2410
+ let r = n.filter((t) => t !== e && (D(t) || b(t))).length;
2372
2411
  return {
2373
2412
  parent: t,
2374
2413
  index: r
2375
2414
  };
2376
2415
  }
2377
- if (k(e)) {
2378
- let r = n.filter((t) => t !== e && k(t)).length;
2416
+ if (D(e)) {
2417
+ let r = n.filter((t) => t !== e && D(t)).length;
2379
2418
  return {
2380
2419
  parent: t,
2381
2420
  index: r
@@ -2384,7 +2423,7 @@ var Qn = {
2384
2423
  return { parent: t };
2385
2424
  }
2386
2425
  }]
2387
- }, sr = 12, cr = class {
2426
+ }, fr = 12, pr = class {
2388
2427
  canvas;
2389
2428
  eventBus;
2390
2429
  modeling;
@@ -2463,12 +2502,12 @@ var Qn = {
2463
2502
  if (e.button !== 0 || this.isChromeTarget(e)) return;
2464
2503
  e.preventDefault(), e.stopPropagation();
2465
2504
  let t = this.toCanvasPoint(e), n = this.points[0];
2466
- if (n && this.points.length >= 3 && lr(t, n) <= sr) {
2505
+ if (n && this.points.length >= 3 && mr(t, n) <= fr) {
2467
2506
  this.finishClosed();
2468
2507
  return;
2469
2508
  }
2470
2509
  let r = this.points[this.points.length - 1];
2471
- r && lr(t, r) <= sr ? this.points.length >= 2 && this.finish() : (this.points.push(t), this.renderPreview());
2510
+ r && mr(t, r) <= fr ? this.points.length >= 2 && this.finish() : (this.points.push(t), this.renderPreview());
2472
2511
  };
2473
2512
  onDblClick = (e) => {
2474
2513
  this.isChromeTarget(e) || (e.preventDefault(), e.stopPropagation(), this.finish());
@@ -2481,47 +2520,47 @@ var Qn = {
2481
2520
  };
2482
2521
  renderPreview() {
2483
2522
  if (this.clearPreview(), !this.points.length) return;
2484
- let e = this.canvas.getLayer("event-storming-draw-preview", 1e3), t = m("g"), n = this.cursor ? [...this.points, this.cursor] : this.points;
2485
- f(t, p(m("polyline"), {
2523
+ let e = this.canvas.getLayer("event-storming-draw-preview", 1e3), t = h("g"), n = this.cursor ? [...this.points, this.cursor] : this.points;
2524
+ p(t, m(h("polyline"), {
2486
2525
  points: n.map((e) => `${e.x},${e.y}`).join(" "),
2487
2526
  fill: "none",
2488
- stroke: R,
2527
+ stroke: I,
2489
2528
  "stroke-width": 2,
2490
2529
  "stroke-linecap": "round",
2491
2530
  "stroke-linejoin": "round",
2492
2531
  "stroke-dasharray": "5 4"
2493
2532
  }));
2494
2533
  let r = this.points[0];
2495
- if (f(t, p(m("circle"), {
2534
+ if (p(t, m(h("circle"), {
2496
2535
  cx: r.x,
2497
2536
  cy: r.y,
2498
2537
  r: this.points.length >= 3 ? 5 : 3,
2499
- fill: L.paper,
2500
- stroke: R,
2538
+ fill: F.paper,
2539
+ stroke: I,
2501
2540
  "stroke-width": 1.5
2502
2541
  })), this.points.length >= 2) {
2503
2542
  let e = this.points[this.points.length - 1];
2504
- f(t, p(m("circle"), {
2543
+ p(t, m(h("circle"), {
2505
2544
  cx: e.x,
2506
2545
  cy: e.y,
2507
2546
  r: 5,
2508
- fill: L.paper,
2509
- stroke: R,
2547
+ fill: F.paper,
2548
+ stroke: I,
2510
2549
  "stroke-width": 1.5
2511
2550
  }));
2512
2551
  }
2513
- f(e, t), this.layer = t;
2552
+ p(e, t), this.layer = t;
2514
2553
  }
2515
2554
  clearPreview() {
2516
- this.layer &&= (h(this.layer), null);
2555
+ this.layer &&= (g(this.layer), null);
2517
2556
  }
2518
2557
  };
2519
- function lr(e, t) {
2558
+ function mr(e, t) {
2520
2559
  return Math.hypot(e.x - t.x, e.y - t.y);
2521
2560
  }
2522
2561
  //#endregion
2523
2562
  //#region src/draw-tool/EventStormingDrawingHandles.ts
2524
- var ur = class {
2563
+ var hr = class {
2525
2564
  eventBus;
2526
2565
  canvas;
2527
2566
  modeling;
@@ -2538,7 +2577,7 @@ var ur = class {
2538
2577
  constructor(e, t, n, r) {
2539
2578
  this.eventBus = e, this.canvas = t, this.modeling = n, this.readOnly = r, e.on(K, () => this.render()), e.on("selection.changed", (e) => {
2540
2579
  let t = e.newSelection ?? [], n = t.length === 1 ? t[0] : null;
2541
- this.attach(k(n) ? n : null);
2580
+ this.attach(D(n) ? n : null);
2542
2581
  }), e.on("element.changed", (e) => {
2543
2582
  this.shape && e.element === this.shape && this.render();
2544
2583
  }), e.on(["diagram.clear", "diagram.destroy"], () => this.attach(null));
@@ -2555,19 +2594,19 @@ var ur = class {
2555
2594
  }
2556
2595
  render() {
2557
2596
  if (this.clear(), !this.shape || this.readOnly?.isReadOnly()) return;
2558
- let e = this.canvas.getLayer("event-storming-drawing-handles", 1100), t = m("g");
2597
+ let e = this.canvas.getLayer("event-storming-drawing-handles", 1100), t = h("g");
2559
2598
  this.absolutePoints().forEach((e, n) => {
2560
- let r = p(m("circle"), {
2599
+ let r = m(h("circle"), {
2561
2600
  cx: e.x,
2562
2601
  cy: e.y,
2563
2602
  r: 5,
2564
- fill: L.paper,
2565
- stroke: L.ink,
2603
+ fill: F.paper,
2604
+ stroke: F.ink,
2566
2605
  "stroke-width": 1.5,
2567
2606
  class: "event-storming-drawing-handle"
2568
2607
  });
2569
- r.addEventListener("mousedown", (e) => this.startDrag(e, n)), f(t, r);
2570
- }), f(e, t), this.group = t;
2608
+ r.addEventListener("mousedown", (e) => this.startDrag(e, n)), p(t, r);
2609
+ }), p(e, t), this.group = t;
2571
2610
  }
2572
2611
  startDrag(e, t) {
2573
2612
  if (e.button !== 0 || !this.shape) return;
@@ -2594,21 +2633,21 @@ var ur = class {
2594
2633
  }
2595
2634
  renderDragPreview(e, t) {
2596
2635
  this.clearDragPreview();
2597
- let n = this.canvas.getLayer("event-storming-drawing-handles", 1100), r = p(m(t ? "polygon" : "polyline"), {
2636
+ let n = this.canvas.getLayer("event-storming-drawing-handles", 1100), r = m(h(t ? "polygon" : "polyline"), {
2598
2637
  points: e.map((e) => `${e.x},${e.y}`).join(" "),
2599
2638
  fill: "none",
2600
- stroke: L.ink,
2639
+ stroke: F.ink,
2601
2640
  "stroke-width": 1.5,
2602
2641
  "stroke-dasharray": "5 4",
2603
2642
  "pointer-events": "none"
2604
2643
  });
2605
- f(n, r), this.dragPreview = r;
2644
+ p(n, r), this.dragPreview = r;
2606
2645
  }
2607
2646
  clearDragPreview() {
2608
- this.dragPreview &&= (h(this.dragPreview), null);
2647
+ this.dragPreview &&= (g(this.dragPreview), null);
2609
2648
  }
2610
2649
  clear() {
2611
- this.clearDragPreview(), this.group &&= (h(this.group), null);
2650
+ this.clearDragPreview(), this.group &&= (g(this.group), null);
2612
2651
  }
2613
2652
  toCanvasPoint(e) {
2614
2653
  let t = this.canvas.getContainer().getBoundingClientRect(), n = this.canvas.viewbox(), r = this.canvas.zoom();
@@ -2617,79 +2656,79 @@ var ur = class {
2617
2656
  y: (e.clientY - t.top) / r + n.y
2618
2657
  };
2619
2658
  }
2620
- }, dr = class {
2659
+ }, gr = class {
2621
2660
  static $inject = ["eventBus", "interactionEvents"];
2622
2661
  constructor(e, t) {
2623
2662
  e.on("interactionEvents.createHit", (e) => {
2624
- if (k(e.element) && e.gfx) return fr(e.element, e.gfx), !1;
2663
+ if (D(e.element) && e.gfx) return _r(e.element, e.gfx), !1;
2625
2664
  }), e.on("interactionEvents.updateHit", (e) => {
2626
- if (k(e.element) && e.gfx) return t.removeHits(e.gfx), fr(e.element, e.gfx), !1;
2665
+ if (D(e.element) && e.gfx) return t.removeHits(e.gfx), _r(e.element, e.gfx), !1;
2627
2666
  });
2628
2667
  }
2629
2668
  };
2630
- function fr(e, t) {
2631
- let n = e.drawingPoints ?? [], r = m(e.closed ? "polygon" : "polyline");
2632
- p(r, {
2669
+ function _r(e, t) {
2670
+ let n = e.drawingPoints ?? [], r = h(e.closed ? "polygon" : "polyline");
2671
+ m(r, {
2633
2672
  points: n.map((e) => `${e.x},${e.y}`).join(" "),
2634
2673
  class: "djs-hit djs-hit-stroke",
2635
2674
  fill: "none",
2636
2675
  stroke: "white",
2637
2676
  "stroke-width": 15,
2638
2677
  "stroke-opacity": 0
2639
- }), f(t, r);
2678
+ }), p(t, r);
2640
2679
  }
2641
2680
  //#endregion
2642
2681
  //#region src/draw-tool/index.ts
2643
- var pr = {
2682
+ var vr = {
2644
2683
  __init__: [
2645
2684
  "eventStormingDrawTool",
2646
2685
  "eventStormingDrawingHandles",
2647
2686
  "eventStormingDrawingHitProvider"
2648
2687
  ],
2649
- eventStormingDrawTool: ["type", cr],
2650
- eventStormingDrawingHandles: ["type", ur],
2651
- eventStormingDrawingHitProvider: ["type", dr]
2652
- }, mr = class {
2688
+ eventStormingDrawTool: ["type", pr],
2689
+ eventStormingDrawingHandles: ["type", hr],
2690
+ eventStormingDrawingHitProvider: ["type", gr]
2691
+ }, yr = class {
2653
2692
  static $inject = ["eventBus"];
2654
2693
  constructor(e) {
2655
2694
  e.on("resize.start", 1500, (e) => {
2656
2695
  let t = e.context;
2657
- we(t.shape) && (t.minDimensions = Pe);
2696
+ De(t.shape) && (t.minDimensions = Pe);
2658
2697
  });
2659
2698
  }
2660
- }, hr = {
2661
- __depends__: [_e],
2699
+ }, br = {
2700
+ __depends__: [xe],
2662
2701
  __init__: ["eventStormingResizeBehavior"],
2663
- eventStormingResizeBehavior: ["type", mr]
2664
- }, gr = class extends B {
2702
+ eventStormingResizeBehavior: ["type", yr]
2703
+ }, xr = class extends Bt {
2665
2704
  _getModules() {
2666
2705
  return [
2667
2706
  ...super._getModules(),
2668
- te,
2669
- ae,
2670
- y,
2671
- b,
2672
- ne,
2673
2707
  re,
2708
+ le,
2674
2709
  ie,
2710
+ ae,
2675
2711
  oe,
2676
2712
  se,
2677
- vn,
2713
+ ce,
2714
+ ue,
2715
+ de,
2716
+ Cn,
2717
+ nn,
2678
2718
  Ht,
2679
- kt,
2680
- qt,
2681
- Yt,
2719
+ cn,
2682
2720
  un,
2683
- xn,
2684
- Gn,
2685
- Qn,
2686
- mn,
2687
- nr,
2688
- ar,
2689
- Ut,
2690
- or,
2691
- pr,
2692
- hr
2721
+ hn,
2722
+ En,
2723
+ Xn,
2724
+ rr,
2725
+ yn,
2726
+ sr,
2727
+ ur,
2728
+ rn,
2729
+ dr,
2730
+ vr,
2731
+ br
2693
2732
  ];
2694
2733
  }
2695
2734
  undo() {
@@ -2704,28 +2743,29 @@ var pr = {
2704
2743
  canRedo() {
2705
2744
  return this.get("commandStack").canRedo();
2706
2745
  }
2707
- }, _r = "event-storming";
2708
- function vr(e = {}) {
2709
- return xr(new gr({
2710
- ...br(e),
2746
+ }, Sr = "event-storming";
2747
+ function Cr(e = {}) {
2748
+ return Er(new xr({
2749
+ ...Tr(e),
2711
2750
  undoRedoKeys: e.undoRedoKeys ?? !0,
2712
- freeRectInsets: e.freeRectInsets
2751
+ freeArea: z(e)
2713
2752
  }), !0);
2714
2753
  }
2715
- function yr(e = {}) {
2716
- return xr(new B(br(e)), !1);
2754
+ function wr(e = {}) {
2755
+ return Er(new Bt(Tr(e)), !1);
2717
2756
  }
2718
- function br(e) {
2757
+ function Tr(e) {
2719
2758
  return {
2720
2759
  width: "100%",
2721
2760
  height: "100%",
2722
- additionalModules: e.additionalModules ?? []
2761
+ additionalModules: e.additionalModules ?? [],
2762
+ fitOnImport: e.fitOnImport ?? !0
2723
2763
  };
2724
2764
  }
2725
- function xr(e, t) {
2765
+ function Er(e, t) {
2726
2766
  let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = /* @__PURE__ */ new Set(), s = 0, c = !1, l = "", u = {
2727
- notation: _r,
2728
- apiVersion: ve,
2767
+ notation: Sr,
2768
+ apiVersion: Se,
2729
2769
  editable: t
2730
2770
  };
2731
2771
  return t && n.on("commandStack.changed", () => {
@@ -2733,16 +2773,21 @@ function xr(e, t) {
2733
2773
  }), {
2734
2774
  meta: u,
2735
2775
  elements: {
2736
- list: () => c ? [] : i.getAll().filter(Sr).map((e) => wr(e)),
2776
+ list: () => c ? [] : i.getAll().filter(Y).map((e) => kr(e)),
2737
2777
  reveal(e) {
2738
2778
  if (c) return !1;
2739
2779
  let t = i.get(e);
2740
- return Sr(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
2780
+ return Y(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
2741
2781
  },
2742
- selection: () => c ? [] : Cr(a.get()),
2782
+ selection: () => c ? [] : Dr(a.get()),
2743
2783
  onSelection(e) {
2744
- let t = (t) => e(Cr(t.newSelection ?? []));
2784
+ let t = (t) => e(Dr(t.newSelection ?? []));
2745
2785
  return n.on("selection.changed", t), () => n.off("selection.changed", t);
2786
+ },
2787
+ bounds(e) {
2788
+ if (c) return;
2789
+ let t = i.get(e);
2790
+ return Y(t) ? Or(t) : void 0;
2746
2791
  }
2747
2792
  },
2748
2793
  diagram: e,
@@ -2754,7 +2799,7 @@ function xr(e, t) {
2754
2799
  s += 1;
2755
2800
  try {
2756
2801
  let { warnings: n } = await e.importDSL(t);
2757
- return { warnings: n.map(Tt) };
2802
+ return { warnings: n.map(Lt) };
2758
2803
  } finally {
2759
2804
  --s;
2760
2805
  }
@@ -2773,13 +2818,13 @@ function xr(e, t) {
2773
2818
  width: n,
2774
2819
  height: i
2775
2820
  };
2776
- return Tr(a) ? a : void 0;
2821
+ return Ar(a) ? a : void 0;
2777
2822
  } catch {
2778
2823
  return;
2779
2824
  }
2780
2825
  },
2781
2826
  setViewState(e) {
2782
- !c && Tr(e) && r.viewbox({
2827
+ !c && Ar(e) && r.viewbox({
2783
2828
  x: e.x,
2784
2829
  y: e.y,
2785
2830
  width: e.width,
@@ -2798,30 +2843,38 @@ function xr(e, t) {
2798
2843
  }
2799
2844
  };
2800
2845
  }
2801
- function Sr(e) {
2802
- return E(e);
2846
+ function Y(e) {
2847
+ return C(e);
2803
2848
  }
2804
- function Cr(e) {
2805
- return e.filter(Sr).map((e) => e.id);
2849
+ function Dr(e) {
2850
+ return e.filter(Y).map((e) => e.id);
2806
2851
  }
2807
- function wr(e) {
2852
+ function Or(e) {
2853
+ return {
2854
+ x: e.x,
2855
+ y: e.y,
2856
+ width: e.width,
2857
+ height: e.height
2858
+ };
2859
+ }
2860
+ function kr(e) {
2808
2861
  let t = e.eventStormingLabel;
2809
2862
  return t ? {
2810
2863
  id: e.id,
2811
2864
  name: t
2812
2865
  } : { id: e.id };
2813
2866
  }
2814
- function Tr(e) {
2867
+ function Ar(e) {
2815
2868
  if (typeof e != "object" || !e) return !1;
2816
2869
  let { x: t, y: n, width: r, height: i } = e;
2817
- return Y(t) && Y(n) && Y(r) && Y(i) && r > 0 && i > 0;
2870
+ return X(t) && X(n) && X(r) && X(i) && r > 0 && i > 0;
2818
2871
  }
2819
- function Y(e) {
2872
+ function X(e) {
2820
2873
  return typeof e == "number" && Number.isFinite(e);
2821
2874
  }
2822
2875
  //#endregion
2823
2876
  //#region src/board-menu/menu.ts
2824
- var Er = "Export as .storm", Dr = [
2877
+ var jr = "Export as .storm", Mr = [
2825
2878
  {
2826
2879
  value: "big-picture",
2827
2880
  label: "Big picture"
@@ -2835,10 +2888,10 @@ var Er = "Export as .storm", Dr = [
2835
2888
  label: "Software design"
2836
2889
  }
2837
2890
  ];
2838
- function Or(e) {
2839
- return Dr.some((t) => t.value === e);
2891
+ function Nr(e) {
2892
+ return Mr.some((t) => t.value === e);
2840
2893
  }
2841
- function X(e, t, n, r) {
2894
+ function Z(e, t, n, r) {
2842
2895
  return {
2843
2896
  kind: "action",
2844
2897
  id: e,
@@ -2848,20 +2901,20 @@ function X(e, t, n, r) {
2848
2901
  onSelect: () => n.onSelect()
2849
2902
  };
2850
2903
  }
2851
- function kr(e) {
2852
- let t = [X("export-png", "Export as PNG", e.png, "file-image"), X("export-svg", "Export as SVG", e.svg, "file-code-corner")];
2853
- return e.transparentPng && t.push(X("export-png-transparent", "Export as PNG (4×, transparent)", e.transparentPng)), e.json && t.push(X("export-json", "Export as JSON", e.json)), e.storm && t.push(X("export-storm", Er, e.storm)), t;
2904
+ function Pr(e) {
2905
+ let t = [Z("export-png", "Export as PNG", e.png, "file-image"), Z("export-svg", "Export as SVG", e.svg, "file-code-corner")];
2906
+ return e.transparentPng && t.push(Z("export-png-transparent", "Export as PNG (4×, transparent)", e.transparentPng)), e.json && t.push(Z("export-json", "Export as JSON", e.json)), e.storm && t.push(Z("export-storm", jr, e.storm)), t;
2854
2907
  }
2855
- function Ar(e) {
2908
+ function Fr(e) {
2856
2909
  return {
2857
2910
  model: [{
2858
2911
  kind: "radio",
2859
2912
  id: "level",
2860
2913
  label: "Level",
2861
- options: Dr,
2914
+ options: Mr,
2862
2915
  value: () => e.levels.getLevel(),
2863
2916
  onSelect: (t) => {
2864
- Or(t) && e.levels.setLevel(t);
2917
+ Nr(t) && e.levels.setLevel(t);
2865
2918
  }
2866
2919
  }, {
2867
2920
  kind: "checkbox",
@@ -2873,7 +2926,7 @@ function Ar(e) {
2873
2926
  e.typeCaptions.setTypeCaptionsVisible(t), e.onTypeCaptionsToggled?.(t);
2874
2927
  }
2875
2928
  }],
2876
- export: kr(e.exports),
2929
+ export: Pr(e.exports),
2877
2930
  help: [{
2878
2931
  kind: "dialog",
2879
2932
  id: "keyboard-shortcuts",
@@ -2885,23 +2938,23 @@ function Ar(e) {
2885
2938
  }
2886
2939
  //#endregion
2887
2940
  //#region src/board-menu/shortcuts.ts
2888
- var Z = [
2941
+ var Ir = [
2889
2942
  "←",
2890
2943
  "↑",
2891
2944
  "→",
2892
2945
  "↓"
2893
2946
  ];
2894
- function jr(e, t, n) {
2947
+ function Lr(e, t, n) {
2895
2948
  return t === "mac" ? `⌘${e}` : `${n.ctrl}+${e}`;
2896
2949
  }
2897
- function Mr(e) {
2950
+ function Rr(e) {
2898
2951
  try {
2899
2952
  return new Intl.NumberFormat(e, { style: "percent" }).format(1);
2900
2953
  } catch {
2901
2954
  return new Intl.NumberFormat("en", { style: "percent" }).format(1);
2902
2955
  }
2903
2956
  }
2904
- function Nr(e, t) {
2957
+ function zr(e, t) {
2905
2958
  if (e === "mac") return {
2906
2959
  zoomIn: "⌘+",
2907
2960
  zoomOut: "⌘−",
@@ -2916,7 +2969,7 @@ function Nr(e, t) {
2916
2969
  fit: `${r}+1`
2917
2970
  };
2918
2971
  }
2919
- function Pr(e, t) {
2972
+ function Br(e, t) {
2920
2973
  if (e === "mac") return {
2921
2974
  undo: ["⌘Z"],
2922
2975
  redo: ["⌘⇧Z"],
@@ -2925,7 +2978,7 @@ function Pr(e, t) {
2925
2978
  paste: ["⌘V"],
2926
2979
  duplicate: ["⌘D"],
2927
2980
  remove: ["⌫"],
2928
- coarseMove: Z.map((e) => `⇧${e}`),
2981
+ coarseMove: Ir.map((e) => `⇧${e}`),
2929
2982
  lassoDrag: ["⇧ Drag"]
2930
2983
  };
2931
2984
  let { ctrl: n, shift: r } = t;
@@ -2937,27 +2990,27 @@ function Pr(e, t) {
2937
2990
  paste: [`${n}+V`],
2938
2991
  duplicate: [`${n}+D`],
2939
2992
  remove: ["Del", "Backspace"],
2940
- coarseMove: Z.map((e) => `${r}+${e}`),
2993
+ coarseMove: Ir.map((e) => `${r}+${e}`),
2941
2994
  lassoDrag: [`${r}+Drag`]
2942
2995
  };
2943
2996
  }
2944
- function Fr(e) {
2997
+ function Vr(e) {
2945
2998
  let { platform: t, messages: n } = e;
2946
2999
  return {
2947
3000
  title: "File",
2948
3001
  rows: [{
2949
3002
  action: n.openFile ?? "Open…",
2950
- keys: [jr("O", t, n.keyNames)]
3003
+ keys: [Lr("O", t, n.keyNames)]
2951
3004
  }, {
2952
- action: Er,
2953
- keys: [jr("S", t, n.keyNames)]
3005
+ action: jr,
3006
+ keys: [Lr("S", t, n.keyNames)]
2954
3007
  }]
2955
3008
  };
2956
3009
  }
2957
- function Ir(e, t = {}) {
2958
- let { platform: n, messages: r } = e, i = Nr(n, r.keyNames), a = Pr(n, r.keyNames);
3010
+ function Hr(e, t = {}) {
3011
+ let { platform: n, messages: r } = e, i = zr(n, r.keyNames), a = Br(n, r.keyNames);
2959
3012
  return [
2960
- ...t.fileKeys ? [Fr(e)] : [],
3013
+ ...t.fileKeys ? [Vr(e)] : [],
2961
3014
  {
2962
3015
  title: "View",
2963
3016
  rows: [
@@ -2970,7 +3023,7 @@ function Ir(e, t = {}) {
2970
3023
  keys: [i.zoomOut]
2971
3024
  },
2972
3025
  {
2973
- action: r.zoomToActual(Mr(e.lang)),
3026
+ action: r.zoomToActual(Rr(e.lang)),
2974
3027
  keys: [i.zoomToActual]
2975
3028
  },
2976
3029
  {
@@ -3012,7 +3065,7 @@ function Ir(e, t = {}) {
3012
3065
  },
3013
3066
  {
3014
3067
  action: "Move selection",
3015
- keys: Z
3068
+ keys: Ir
3016
3069
  },
3017
3070
  {
3018
3071
  action: "Move selection in large steps",
@@ -3053,13 +3106,13 @@ function Ir(e, t = {}) {
3053
3106
  }
3054
3107
  //#endregion
3055
3108
  //#region src/board-menu/ShortcutsDialog.ts
3056
- var Q = "event-storming-shortcuts", Lr = "event-storming-shortcuts-title";
3109
+ var Q = "event-storming-shortcuts", Ur = "event-storming-shortcuts-title";
3057
3110
  function $(e, t, n) {
3058
3111
  let r = document.createElement(e);
3059
3112
  return r.className = t, n !== void 0 && (r.textContent = n), r;
3060
3113
  }
3061
- function Rr(e, t) {
3062
- let n = $("section", `${Q}-group`), r = `${Lr}-group-${t}`, i = $("h4", `${Q}-group-title`, e.title);
3114
+ function Wr(e, t) {
3115
+ let n = $("section", `${Q}-group`), r = `${Ur}-group-${t}`, i = $("h4", `${Q}-group-title`, e.title);
3063
3116
  i.id = r;
3064
3117
  let a = $("table", `${Q}-table`);
3065
3118
  a.setAttribute("aria-labelledby", r);
@@ -3073,19 +3126,19 @@ function Rr(e, t) {
3073
3126
  }
3074
3127
  return n.append(i, a), n;
3075
3128
  }
3076
- function zr(e, t, n) {
3129
+ function Gr(e, t, n) {
3077
3130
  let r = $("div", `${Q}-panel`), i = $("header", `${Q}-header`), a = $("h3", `${Q}-title`, "Keyboard shortcuts");
3078
- a.id = Lr;
3131
+ a.id = Ur;
3079
3132
  let o = $("button", `${Q}-close`);
3080
3133
  o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML = q("x"), o.addEventListener("click", n), i.append(a, o);
3081
3134
  let s = $("div", `${Q}-body`);
3082
- return s.append(...Ir(e, t).map(Rr)), r.append(i, s), r;
3135
+ return s.append(...Hr(e, t).map(Wr)), r.append(i, s), r;
3083
3136
  }
3084
- function Br(e, t = {}) {
3137
+ function Kr(e, t = {}) {
3085
3138
  let n;
3086
3139
  function r() {
3087
3140
  let n = $("dialog", Q);
3088
- return n.setAttribute("aria-labelledby", Lr), n.append(zr(e, t, () => n.close())), n.addEventListener("click", (e) => {
3141
+ return n.setAttribute("aria-labelledby", Ur), n.append(Gr(e, t, () => n.close())), n.addEventListener("click", (e) => {
3089
3142
  e.target === n && n.close();
3090
3143
  }), n.addEventListener("close", () => {
3091
3144
  e.menu.trigger.hidden || e.menu.trigger.focus({ preventScroll: !0 });
@@ -3106,11 +3159,11 @@ function Br(e, t = {}) {
3106
3159
  }
3107
3160
  //#endregion
3108
3161
  //#region src/draw/icons.ts
3109
- var Vr = "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z", Hr = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", Ur = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", Wr = "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z", Gr = "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z", Kr = "M4 7v2c0 .55-.45 1-1 1H2v2h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h1v-2H7c-.55 0-1-.45-1-1v-2c0-.84-.35-1.61-.92-2.18L4.85 12l.23-.82C5.65 10.61 6 9.84 6 9V7c0-.55.45-1 1-1h1V4H7C5.35 4 4 5.35 4 7zm16 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-1v2h1c.55 0 1 .45 1 1v2c0 .84.35 1.61.92 2.18l.23.82-.23.82c-.57.57-.92 1.34-.92 2.18v2c0 .55-.45 1-1 1h-1v2h1c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-2h-1z", qr = "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z", Jr = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", Yr = "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z", Xr = "M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z", Zr = "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z", Qr = "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z", $r = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", ei = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", ti = "M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z", ni = "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z";
3110
- function ri(e, t = 18) {
3162
+ var qr = "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z", Jr = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", Yr = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", Xr = "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z", Zr = "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z", Qr = "M4 7v2c0 .55-.45 1-1 1H2v2h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h1v-2H7c-.55 0-1-.45-1-1v-2c0-.84-.35-1.61-.92-2.18L4.85 12l.23-.82C5.65 10.61 6 9.84 6 9V7c0-.55.45-1 1-1h1V4H7C5.35 4 4 5.35 4 7zm16 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-1v2h1c.55 0 1 .45 1 1v2c0 .84.35 1.61.92 2.18l.23.82-.23.82c-.57.57-.92 1.34-.92 2.18v2c0 .55-.45 1-1 1h-1v2h1c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-2h-1z", $r = "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z", ei = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", ti = "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z", ni = "M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z", ri = "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z", ii = "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z", ai = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", oi = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", si = "M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z", ci = "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z";
3163
+ function li(e, t = 18) {
3111
3164
  return `<svg viewBox="0 0 24 24" width="${t}" height="${t}" fill="currentColor" aria-hidden="true"><path d="${e}"/></svg>`;
3112
3165
  }
3113
3166
  //#endregion
3114
- export { Dr as BOARD_LEVELS, Ve as BoardBounds, L as COLORS, _r as EVENT_STORMING_NOTATION, tr as EventStormingAppendBehavior, Ot as EventStormingAttachBehavior, De as EventStormingBaseViewer, ir as EventStormingColorPicker, Le as EventStormingElementFactory, pn as EventStormingElementSettingsProvider, Ct as EventStormingExporter, St as EventStormingImporter, Vn as EventStormingLabelEditing, Pt as EventStormingModeling, _n as EventStormingReadOnly, it as EventStormingRenderer, mr as EventStormingResizeBehavior, Kt as EventStormingRules, We as EventStormingViewOptions, ei as ICON_ADD, qr as ICON_CODE, Kr as ICON_DATA_OBJECT, Ur as ICON_DELETE, Jr as ICON_DOWNLOAD, Hr as ICON_EDIT, ni as ICON_EYE, ti as ICON_FIT, Xr as ICON_FOLDER_OPEN, Zr as ICON_IMAGE, $r as ICON_MENU, Qr as ICON_NEW, Vr as ICON_PERSON, Gr as ICON_REDO, Yr as ICON_SHARE, Wr as ICON_UNDO, A as MIRAGON, gr as Modeler, N as NOTE_STYLE, B as NavigatedViewer, G as POPUP_PROVIDER_ID, K as READ_ONLY_CHANGED_EVENT, x as ROOT_ID, w as STICKY_KINDS, M as STICKY_STYLES, Er as STORM_EXPORT_LABEL, Ue as VIEW_OPTIONS_CHANGED_EVENT, Dt as Viewer, He as boardBoundsModule, Ar as boardMenu, Ir as boardShortcuts, jr as commandKeyLabel, vr as createCollaborativeModeler, yr as createCollaborativeViewer, Br as createShortcutsDialog, Yt as elementSnappingModule, nr as eventStormingAppendModule, kt as eventStormingAttachModule, ar as eventStormingColorPickerModule, xn as eventStormingContextPadModule, yt as eventStormingDrawModule, Qn as eventStormingKeyboardModule, ze as eventStormingModelModule, Ht as eventStormingModelingModule, un as eventStormingPaletteModule, mn as eventStormingPopupModule, vn as eventStormingReadOnlyModule, hr as eventStormingResizeModule, qt as eventStormingRulesModule, Ge as eventStormingViewOptionsModule, ri as iconMarkup, Tt as importWarningText, Et as ioModule, D as isAttachableKind, Se as isAttachableSticky, C as isEventStormingConnection, S as isEventStormingShape, O as isHostKind, Ce as isHostSticky, E as isSticky, T as isStickyKind, Gn as labelEditingModule, j as parseNoteMarkdown, Ae as plainNoteText, be as saveSVG, ke as serializeNoteMarkdown };
3167
+ export { Mr as BOARD_LEVELS, nt as BoardBounds, F as COLORS, Sr as EVENT_STORMING_NOTATION, or as EventStormingAppendBehavior, Vt as EventStormingAttachBehavior, qe as EventStormingBaseViewer, lr as EventStormingColorPicker, Qe as EventStormingElementFactory, vn as EventStormingElementSettingsProvider, Ft as EventStormingExporter, Pt as EventStormingImporter, Kn as EventStormingLabelEditing, Jt as EventStormingModeling, Sn as EventStormingReadOnly, vt as EventStormingRenderer, yr as EventStormingResizeBehavior, sn as EventStormingRules, at as EventStormingViewOptions, oi as ICON_ADD, $r as ICON_CODE, Qr as ICON_DATA_OBJECT, Yr as ICON_DELETE, ei as ICON_DOWNLOAD, Jr as ICON_EDIT, ci as ICON_EYE, si as ICON_FIT, ni as ICON_FOLDER_OPEN, ri as ICON_IMAGE, ai as ICON_MENU, ii as ICON_NEW, qr as ICON_PERSON, Zr as ICON_REDO, ti as ICON_SHARE, Xr as ICON_UNDO, O as MIRAGON, xr as Modeler, j as NOTE_STYLE, Bt as NavigatedViewer, G as POPUP_PROVIDER_ID, K as READ_ONLY_CHANGED_EVENT, v as ROOT_ID, x as STICKY_KINDS, A as STICKY_STYLES, jr as STORM_EXPORT_LABEL, it as VIEW_OPTIONS_CHANGED_EVENT, zt as Viewer, rt as boardBoundsModule, Fr as boardMenu, Hr as boardShortcuts, Lr as commandKeyLabel, Cr as createCollaborativeModeler, wr as createCollaborativeViewer, Kr as createShortcutsDialog, un as elementSnappingModule, sr as eventStormingAppendModule, Ht as eventStormingAttachModule, ur as eventStormingColorPickerModule, En as eventStormingContextPadModule, jt as eventStormingDrawModule, rr as eventStormingKeyboardModule, et as eventStormingModelModule, nn as eventStormingModelingModule, hn as eventStormingPaletteModule, yn as eventStormingPopupModule, Cn as eventStormingReadOnlyModule, br as eventStormingResizeModule, cn as eventStormingRulesModule, H as eventStormingViewOptionsModule, li as iconMarkup, Lt as importWarningText, Rt as ioModule, w as isAttachableKind, Ee as isAttachableSticky, b as isEventStormingConnection, y as isEventStormingShape, T as isHostKind, E as isHostSticky, C as isSticky, S as isStickyKind, Xn as labelEditingModule, k as parseNoteMarkdown, Ae as plainNoteText, we as saveSVG, ke as serializeNoteMarkdown };
3115
3168
 
3116
3169
  //# sourceMappingURL=index.js.map