@miragon/event-storming-renderer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +55 -0
  2. package/dist/EventStormingBaseViewer.d.ts +56 -0
  3. package/dist/EventStormingBaseViewer.d.ts.map +1 -0
  4. package/dist/Modeler.d.ts +15 -0
  5. package/dist/Modeler.d.ts.map +1 -0
  6. package/dist/NavigatedViewer.d.ts +10 -0
  7. package/dist/NavigatedViewer.d.ts.map +1 -0
  8. package/dist/Viewer.d.ts +6 -0
  9. package/dist/Viewer.d.ts.map +1 -0
  10. package/dist/append/EventStormingAppendBehavior.d.ts +17 -0
  11. package/dist/append/EventStormingAppendBehavior.d.ts.map +1 -0
  12. package/dist/append/index.d.ts +9 -0
  13. package/dist/append/index.d.ts.map +1 -0
  14. package/dist/attach/EventStormingAttachBehavior.d.ts +17 -0
  15. package/dist/attach/EventStormingAttachBehavior.d.ts.map +1 -0
  16. package/dist/attach/index.d.ts +9 -0
  17. package/dist/attach/index.d.ts.map +1 -0
  18. package/dist/board-bounds/BoardBounds.d.ts +23 -0
  19. package/dist/board-bounds/BoardBounds.d.ts.map +1 -0
  20. package/dist/board-bounds/index.d.ts +6 -0
  21. package/dist/board-bounds/index.d.ts.map +1 -0
  22. package/dist/color-picker/EventStormingColorPicker.d.ts +23 -0
  23. package/dist/color-picker/EventStormingColorPicker.d.ts.map +1 -0
  24. package/dist/color-picker/index.d.ts +5 -0
  25. package/dist/color-picker/index.d.ts.map +1 -0
  26. package/dist/context-pad/EventStormingContextPadProvider.d.ts +26 -0
  27. package/dist/context-pad/EventStormingContextPadProvider.d.ts.map +1 -0
  28. package/dist/context-pad/index.d.ts +5 -0
  29. package/dist/context-pad/index.d.ts.map +1 -0
  30. package/dist/draw/EventStormingRenderer.d.ts +27 -0
  31. package/dist/draw/EventStormingRenderer.d.ts.map +1 -0
  32. package/dist/draw/icons.d.ts +43 -0
  33. package/dist/draw/icons.d.ts.map +1 -0
  34. package/dist/draw/index.d.ts +6 -0
  35. package/dist/draw/index.d.ts.map +1 -0
  36. package/dist/draw/note-markdown.d.ts +26 -0
  37. package/dist/draw/note-markdown.d.ts.map +1 -0
  38. package/dist/draw/palette-icons.d.ts +4 -0
  39. package/dist/draw/palette-icons.d.ts.map +1 -0
  40. package/dist/draw/styles.d.ts +98 -0
  41. package/dist/draw/styles.d.ts.map +1 -0
  42. package/dist/draw-tool/EventStormingDrawTool.d.ts +48 -0
  43. package/dist/draw-tool/EventStormingDrawTool.d.ts.map +1 -0
  44. package/dist/draw-tool/EventStormingDrawingHandles.d.ts +29 -0
  45. package/dist/draw-tool/EventStormingDrawingHandles.d.ts.map +1 -0
  46. package/dist/draw-tool/EventStormingDrawingHitProvider.d.ts +13 -0
  47. package/dist/draw-tool/EventStormingDrawingHitProvider.d.ts.map +1 -0
  48. package/dist/draw-tool/index.d.ts +6 -0
  49. package/dist/draw-tool/index.d.ts.map +1 -0
  50. package/dist/event-storming.css +2 -0
  51. package/dist/index.d.ts +31 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +2484 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/io/EventStormingExporter.d.ts +18 -0
  56. package/dist/io/EventStormingExporter.d.ts.map +1 -0
  57. package/dist/io/EventStormingImporter.d.ts +26 -0
  58. package/dist/io/EventStormingImporter.d.ts.map +1 -0
  59. package/dist/io/index.d.ts +8 -0
  60. package/dist/io/index.d.ts.map +1 -0
  61. package/dist/io/saveSvg.d.ts +17 -0
  62. package/dist/io/saveSvg.d.ts.map +1 -0
  63. package/dist/io/types.d.ts +12 -0
  64. package/dist/io/types.d.ts.map +1 -0
  65. package/dist/keyboard/EventStormingKeyboard.d.ts +20 -0
  66. package/dist/keyboard/EventStormingKeyboard.d.ts.map +1 -0
  67. package/dist/keyboard/index.d.ts +5 -0
  68. package/dist/keyboard/index.d.ts.map +1 -0
  69. package/dist/label-editing/EventStormingLabelEditing.d.ts +43 -0
  70. package/dist/label-editing/EventStormingLabelEditing.d.ts.map +1 -0
  71. package/dist/label-editing/index.d.ts +7 -0
  72. package/dist/label-editing/index.d.ts.map +1 -0
  73. package/dist/label-editing/note-editor-dom.d.ts +57 -0
  74. package/dist/label-editing/note-editor-dom.d.ts.map +1 -0
  75. package/dist/lasso/EventStormingLassoBehavior.d.ts +12 -0
  76. package/dist/lasso/EventStormingLassoBehavior.d.ts.map +1 -0
  77. package/dist/lasso/index.d.ts +5 -0
  78. package/dist/lasso/index.d.ts.map +1 -0
  79. package/dist/model/EventStormingElementFactory.d.ts +51 -0
  80. package/dist/model/EventStormingElementFactory.d.ts.map +1 -0
  81. package/dist/model/di-types.d.ts +62 -0
  82. package/dist/model/di-types.d.ts.map +1 -0
  83. package/dist/model/index.d.ts +6 -0
  84. package/dist/model/index.d.ts.map +1 -0
  85. package/dist/modeling/EventStormingCopyPaste.d.ts +43 -0
  86. package/dist/modeling/EventStormingCopyPaste.d.ts.map +1 -0
  87. package/dist/modeling/EventStormingModeling.d.ts +44 -0
  88. package/dist/modeling/EventStormingModeling.d.ts.map +1 -0
  89. package/dist/modeling/cmd/UpdatePropertiesHandler.d.ts +18 -0
  90. package/dist/modeling/cmd/UpdatePropertiesHandler.d.ts.map +1 -0
  91. package/dist/modeling/index.d.ts +6 -0
  92. package/dist/modeling/index.d.ts.map +1 -0
  93. package/dist/ordering/EventStormingOrderingProvider.d.ts +17 -0
  94. package/dist/ordering/EventStormingOrderingProvider.d.ts.map +1 -0
  95. package/dist/ordering/index.d.ts +5 -0
  96. package/dist/ordering/index.d.ts.map +1 -0
  97. package/dist/palette/EventStormingPaletteProvider.d.ts +19 -0
  98. package/dist/palette/EventStormingPaletteProvider.d.ts.map +1 -0
  99. package/dist/palette/index.d.ts +5 -0
  100. package/dist/palette/index.d.ts.map +1 -0
  101. package/dist/popup/EventStormingElementSettingsProvider.d.ts +17 -0
  102. package/dist/popup/EventStormingElementSettingsProvider.d.ts.map +1 -0
  103. package/dist/popup/index.d.ts +5 -0
  104. package/dist/popup/index.d.ts.map +1 -0
  105. package/dist/resize/EventStormingResizeBehavior.d.ts +12 -0
  106. package/dist/resize/EventStormingResizeBehavior.d.ts.map +1 -0
  107. package/dist/resize/index.d.ts +9 -0
  108. package/dist/resize/index.d.ts.map +1 -0
  109. package/dist/rules/EventStormingRules.d.ts +13 -0
  110. package/dist/rules/EventStormingRules.d.ts.map +1 -0
  111. package/dist/rules/index.d.ts +5 -0
  112. package/dist/rules/index.d.ts.map +1 -0
  113. package/dist/snapping/ElementSnapping.d.ts +15 -0
  114. package/dist/snapping/ElementSnapping.d.ts.map +1 -0
  115. package/dist/snapping/index.d.ts +5 -0
  116. package/dist/snapping/index.d.ts.map +1 -0
  117. package/dist/theme/index.d.ts +2 -0
  118. package/dist/theme/index.d.ts.map +1 -0
  119. package/dist/theme/palette.d.ts +56 -0
  120. package/dist/theme/palette.d.ts.map +1 -0
  121. package/dist/view-options/EventStormingViewOptions.d.ts +20 -0
  122. package/dist/view-options/EventStormingViewOptions.d.ts.map +1 -0
  123. package/dist/view-options/index.d.ts +9 -0
  124. package/dist/view-options/index.d.ts.map +1 -0
  125. package/package.json +53 -0
package/dist/index.js ADDED
@@ -0,0 +1,2484 @@
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 y from "diagram-js/lib/features/keyboard";
11
+ import b from "diagram-js/lib/features/modeling";
12
+ import x from "diagram-js/lib/features/move";
13
+ import ee from "diagram-js/lib/features/create";
14
+ import te from "diagram-js/lib/features/connect";
15
+ import ne from "diagram-js/lib/features/context-pad";
16
+ import re from "diagram-js/lib/features/palette";
17
+ import ie from "diagram-js/lib/features/rules";
18
+ import ae from "diagram-js/lib/features/outline";
19
+ import oe from "diagram-js/lib/features/popup-menu";
20
+ import se from "diagram-js/lib/features/attach-support";
21
+ import ce from "diagram-js/lib/command/CommandInterceptor";
22
+ import le from "diagram-js/lib/features/mouse";
23
+ import ue from "diagram-js/lib/features/lasso-tool";
24
+ import de from "diagram-js/lib/features/rules/RuleProvider";
25
+ import fe from "diagram-js/lib/features/connection-preview";
26
+ import pe from "diagram-js/lib/features/ordering/OrderingProvider";
27
+ import me from "diagram-js/lib/features/resize";
28
+ //#region src/io/saveSvg.ts
29
+ function he(e, t) {
30
+ let n = e.getContainer().querySelector("svg");
31
+ if (!n) throw Error("No SVG found in the canvas container.");
32
+ let r = n.cloneNode(!0), i = t ?? {
33
+ x: 0,
34
+ y: 0,
35
+ ...o
36
+ };
37
+ 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));
38
+ let a = r.querySelector(".viewport");
39
+ return a && a.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(r) };
40
+ }
41
+ //#endregion
42
+ //#region src/EventStormingBaseViewer.ts
43
+ function ge(e) {
44
+ return typeof e == "number" ? `${e}px` : e;
45
+ }
46
+ var _e = class {
47
+ _diagram;
48
+ _container;
49
+ _options;
50
+ constructor(e = {}) {
51
+ this._options = e, this._container = this._createContainer(e);
52
+ }
53
+ _createContainer(e) {
54
+ let t = e.container ?? document.createElement("div");
55
+ return t.classList.add("event-storming-container"), t.style.width = ge(e.width ?? "100%"), t.style.height = ge(e.height ?? (e.container ? "100%" : "600px")), t;
56
+ }
57
+ _ensureDiagram() {
58
+ if (!this._diagram) {
59
+ let t = [...this._getModules(), ...this._options.additionalModules ?? []];
60
+ this._diagram = new e({
61
+ canvas: { container: this._container },
62
+ modules: t
63
+ });
64
+ }
65
+ return this._diagram;
66
+ }
67
+ get(e) {
68
+ return this._ensureDiagram().get(e);
69
+ }
70
+ on(e, t, n = 1e3) {
71
+ this.get("eventBus").on(e, n, t);
72
+ }
73
+ off(e, t) {
74
+ this.get("eventBus").off(e, t);
75
+ }
76
+ async importMap(e) {
77
+ let t = this._ensureDiagram(), n = t.get("eventBus"), r = t.get("eventStormingImporter");
78
+ r.clear();
79
+ let i = r.import(e);
80
+ return this._applyStyleClass(e.config.style), t.get("commandStack").clear(), n.fire("import.done", { warnings: i }), { warnings: i };
81
+ }
82
+ _applyStyleClass(e) {
83
+ let t = this._container.classList;
84
+ for (let e of ["classic", "dark"]) t.remove(`event-storming-${e}`);
85
+ e && e !== "classic" && t.add(`event-storming-${e}`);
86
+ }
87
+ async importDSL(e) {
88
+ let n = this._ensureDiagram().get("eventBus");
89
+ n.fire("import.parse.start", { text: e });
90
+ let { board: r, diagnostics: i } = t(e);
91
+ n.fire("import.parse.done", {
92
+ board: r,
93
+ diagnostics: i
94
+ });
95
+ let { warnings: a } = await this.importMap(r);
96
+ return { warnings: [...i.map((e) => ({ message: `Line ${e.line}: ${e.message} — "${e.text}"` })), ...a] };
97
+ }
98
+ exportMap() {
99
+ return this.get("eventStormingExporter").export();
100
+ }
101
+ exportDSL() {
102
+ return n(this.exportMap());
103
+ }
104
+ async saveSVG() {
105
+ return he(this.get("canvas"), this.get("boardBounds").contentBounds());
106
+ }
107
+ attachTo(e) {
108
+ e.appendChild(this._container), this.get("canvas").resized();
109
+ }
110
+ detach() {
111
+ this._container.remove();
112
+ }
113
+ clear() {
114
+ this._ensureDiagram().clear();
115
+ }
116
+ destroy() {
117
+ this._diagram &&= (this._diagram.destroy(), void 0), this._container.remove();
118
+ }
119
+ get container() {
120
+ return this._container;
121
+ }
122
+ }, S = {
123
+ blau: "#335DE5",
124
+ blauLink: "#2B50D4",
125
+ blauHell: "#6B8AFF",
126
+ gruen: "#00E676",
127
+ grau: "#F9F7F7",
128
+ schwarz: "#1D1D1D",
129
+ weiss: "#FFFFFF",
130
+ success: "#0B7A55",
131
+ warning: "#92610A",
132
+ danger: "#C92A2A",
133
+ info: "#2B50D4",
134
+ navy: "#080A20",
135
+ gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
136
+ };
137
+ S.grau, S.schwarz, S.weiss, S.blau, S.gruen, S.danger, S.schwarz, S.navy, S.grau;
138
+ //#endregion
139
+ //#region src/draw/note-markdown.ts
140
+ var ve = [
141
+ {
142
+ marker: "***",
143
+ bold: !0,
144
+ italic: !0
145
+ },
146
+ {
147
+ marker: "**",
148
+ bold: !0,
149
+ italic: !1
150
+ },
151
+ {
152
+ marker: "*",
153
+ bold: !1,
154
+ italic: !0
155
+ }
156
+ ];
157
+ function C(e) {
158
+ return e.split("\n").map((e) => {
159
+ let t = e.startsWith("- ");
160
+ return {
161
+ bullet: t,
162
+ runs: xe(t ? e.slice(2) : e)
163
+ };
164
+ });
165
+ }
166
+ function ye(e) {
167
+ return e.map((e) => {
168
+ let t = Ce(e.runs).map((e) => {
169
+ let t = e.bold && e.italic ? "***" : e.bold ? "**" : e.italic ? "*" : "";
170
+ return t + e.text + t;
171
+ }).join("");
172
+ return (e.bullet ? "- " : "") + t;
173
+ }).join("\n");
174
+ }
175
+ function be(e) {
176
+ return C(e).map((e) => (e.bullet ? "• " : "") + e.runs.map((e) => e.text).join("")).join("\n");
177
+ }
178
+ function xe(e) {
179
+ let t = [], n = "", r = () => {
180
+ n && t.push({
181
+ text: n,
182
+ bold: !1,
183
+ italic: !1
184
+ }), n = "";
185
+ }, i = 0;
186
+ for (; i < e.length;) {
187
+ let a = e[i] === "*" ? Se(e, i) : void 0;
188
+ if (!a) {
189
+ n += e[i], i++;
190
+ continue;
191
+ }
192
+ r(), t.push({
193
+ text: a.content,
194
+ bold: a.bold,
195
+ italic: a.italic
196
+ }), i = a.end;
197
+ }
198
+ return r(), Ce(t);
199
+ }
200
+ function Se(e, t) {
201
+ for (let { marker: n, bold: r, italic: i } of ve) {
202
+ if (!e.startsWith(n, t)) continue;
203
+ let a = e.indexOf(n, t + n.length);
204
+ if (!(a <= t + n.length)) return {
205
+ content: e.slice(t + n.length, a),
206
+ bold: r,
207
+ italic: i,
208
+ end: a + n.length
209
+ };
210
+ }
211
+ }
212
+ function Ce(e) {
213
+ let t = [];
214
+ for (let n of e) {
215
+ if (!n.text) continue;
216
+ let e = t[t.length - 1];
217
+ e && e.bold === n.bold && e.italic === n.italic ? e.text += n.text : t.push({
218
+ text: n.text,
219
+ bold: n.bold,
220
+ italic: n.italic
221
+ });
222
+ }
223
+ return t;
224
+ }
225
+ //#endregion
226
+ //#region src/draw/styles.ts
227
+ var w = {
228
+ event: {
229
+ label: "Domain Event",
230
+ width: 130,
231
+ height: 90,
232
+ fill: "#FFB84D",
233
+ stroke: "#E89A2E"
234
+ },
235
+ command: {
236
+ label: "Command",
237
+ width: 130,
238
+ height: 90,
239
+ fill: "#7EC8F0",
240
+ stroke: "#4FA8D8"
241
+ },
242
+ actor: {
243
+ label: "Actor",
244
+ width: 100,
245
+ height: 65,
246
+ fill: "#FFF9B1",
247
+ stroke: "#E6DB7A"
248
+ },
249
+ aggregate: {
250
+ label: "Aggregate",
251
+ width: 180,
252
+ height: 110,
253
+ fill: "#FFE066",
254
+ stroke: "#E0BE3F"
255
+ },
256
+ policy: {
257
+ label: "Policy",
258
+ width: 180,
259
+ height: 110,
260
+ fill: "#C9A0DC",
261
+ stroke: "#A97CC4"
262
+ },
263
+ readmodel: {
264
+ label: "Read Model",
265
+ width: 130,
266
+ height: 90,
267
+ fill: "#A8D08D",
268
+ stroke: "#7FB35D"
269
+ },
270
+ external: {
271
+ label: "External System",
272
+ width: 180,
273
+ height: 110,
274
+ fill: "#F4A6C0",
275
+ stroke: "#DE7EA2"
276
+ },
277
+ hotspot: {
278
+ label: "Hotspot",
279
+ width: 130,
280
+ height: 90,
281
+ fill: "#E85D75",
282
+ stroke: "#C43B55"
283
+ }
284
+ }, T = {
285
+ label: "Note",
286
+ fill: "#ECECEC",
287
+ stroke: "#C4C4C4"
288
+ }, E = {
289
+ width: 60,
290
+ height: 40
291
+ }, D = 7.5, we = {
292
+ width: w.aggregate.width,
293
+ height: w.aggregate.height
294
+ };
295
+ function O(e) {
296
+ let t = be(e), n = (t && t.length ? t : "note").split("\n"), r = Math.max(1, ...n.map((e) => e.length));
297
+ return {
298
+ lines: n,
299
+ width: Math.max(we.width, Math.round(r * D) + 16),
300
+ height: Math.max(we.height, n.length * 17 + 16)
301
+ };
302
+ }
303
+ function Te(e, t) {
304
+ let n = O(e);
305
+ return t.width !== n.width || t.height !== n.height;
306
+ }
307
+ var k = {
308
+ paper: S.grau,
309
+ ink: S.schwarz,
310
+ inkSoft: "#5B5B5B",
311
+ surface: S.weiss,
312
+ stroke: S.schwarz,
313
+ arrow: "#9E9E9E",
314
+ accent: S.blau,
315
+ accentSoft: "rgba(51,93,229,0.12)",
316
+ stickyText: "#333333"
317
+ }, A = `var(--event-storming-drawing-ink, ${S.schwarz})`, j = {
318
+ family: "'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
319
+ label: 13
320
+ }, Ee = "event-storming-root";
321
+ function De(e) {
322
+ return typeof e == "object" && !!e;
323
+ }
324
+ function M(e) {
325
+ return De(e) && typeof e.eventStormingType == "string" && !("waypoints" in e);
326
+ }
327
+ function N(e) {
328
+ return De(e) && typeof e.eventStormingType == "string" && "waypoints" in e;
329
+ }
330
+ var P = [
331
+ "event",
332
+ "command",
333
+ "actor",
334
+ "aggregate",
335
+ "policy",
336
+ "readmodel",
337
+ "external",
338
+ "hotspot"
339
+ ];
340
+ function F(e) {
341
+ return P.includes(e);
342
+ }
343
+ function I(e) {
344
+ return M(e) && F(e.eventStormingType);
345
+ }
346
+ function L(e) {
347
+ return r.includes(e);
348
+ }
349
+ function R(e) {
350
+ return s.includes(e);
351
+ }
352
+ function Oe(e) {
353
+ return M(e) && L(e.eventStormingType);
354
+ }
355
+ function z(e) {
356
+ return M(e) && R(e.eventStormingType);
357
+ }
358
+ function B(e) {
359
+ return M(e) && e.eventStormingType === "drawing";
360
+ }
361
+ function ke(e) {
362
+ return M(e) && e.eventStormingType === "note";
363
+ }
364
+ //#endregion
365
+ //#region src/model/EventStormingElementFactory.ts
366
+ var Ae = {
367
+ event: "event",
368
+ command: "cmd",
369
+ actor: "actor",
370
+ aggregate: "agg",
371
+ policy: "policy",
372
+ readmodel: "read",
373
+ external: "ext",
374
+ hotspot: "hot",
375
+ note: "note",
376
+ drawing: "draw"
377
+ }, je = class {
378
+ elementFactory;
379
+ elementRegistry;
380
+ static $inject = ["elementFactory", "elementRegistry"];
381
+ constructor(e, t) {
382
+ this.elementFactory = e, this.elementRegistry = t;
383
+ }
384
+ uniqueLabel(e) {
385
+ let t = /* @__PURE__ */ new Set();
386
+ for (let e of this.elementRegistry.getAll()) {
387
+ let n = e.eventStormingLabel;
388
+ typeof n == "string" && t.add(n);
389
+ }
390
+ if (!t.has(e)) return e;
391
+ let n = 2;
392
+ for (; t.has(`${e} ${n}`);) n++;
393
+ return `${e} ${n}`;
394
+ }
395
+ allocateId(e, t) {
396
+ let n = Ae[e];
397
+ for (let e = 1;; e++) {
398
+ let r = `${n}_${e}`;
399
+ if (!this.elementRegistry.get(r) && !t?.has(r)) return r;
400
+ }
401
+ }
402
+ createSticky(e) {
403
+ if (!F(e.elementType)) throw Error(`not a sticky kind: ${e.elementType}`);
404
+ let { width: t, height: n } = w[e.elementType];
405
+ return this.elementFactory.createShape({
406
+ id: e.id,
407
+ x: e.position.x - t / 2,
408
+ y: e.position.y - n / 2,
409
+ width: t,
410
+ height: n,
411
+ eventStormingType: e.elementType,
412
+ eventStormingLabel: e.label,
413
+ businessObject: e,
414
+ ...e.color ? { color: e.color } : {}
415
+ });
416
+ }
417
+ createNote(e) {
418
+ let { width: t, height: n } = e.size ?? O(e.label), r = e.align?.horizontal, i = e.align?.vertical;
419
+ return this.elementFactory.createShape({
420
+ id: e.id,
421
+ x: e.position.x - t / 2,
422
+ y: e.position.y - n / 2,
423
+ width: t,
424
+ height: n,
425
+ eventStormingType: "note",
426
+ eventStormingLabel: e.label,
427
+ businessObject: e,
428
+ ...e.color ? { color: e.color } : {},
429
+ ...r && r !== "left" ? { alignHorizontal: r } : {},
430
+ ...i && i !== "top" ? { alignVertical: i } : {}
431
+ });
432
+ }
433
+ createDrawing(e) {
434
+ return this.drawingFromCanvasPoints([...e.points], {
435
+ id: e.id,
436
+ ...e.closed ? { closed: !0 } : {},
437
+ ...e.strokeStyle ? { strokeStyle: e.strokeStyle } : {},
438
+ ...e.color ? { color: e.color } : {},
439
+ businessObject: e
440
+ });
441
+ }
442
+ drawingFromCanvasPoints(e, t = {}) {
443
+ let n = e.map((e) => e.x), r = e.map((e) => e.y), i = Math.min(...n), a = Math.min(...r), o = Math.max(Math.max(...n) - i, 4), s = Math.max(Math.max(...r) - a, 4);
444
+ return this.elementFactory.createShape({
445
+ id: t.id ?? this.allocateId("drawing"),
446
+ x: i,
447
+ y: a,
448
+ width: o,
449
+ height: s,
450
+ eventStormingType: "drawing",
451
+ eventStormingLabel: "",
452
+ drawingPoints: e.map((e) => ({
453
+ x: e.x - i,
454
+ y: e.y - a
455
+ })),
456
+ ...t.closed ? { closed: !0 } : {},
457
+ ...t.strokeStyle ? { strokeStyle: t.strokeStyle } : {},
458
+ ...t.color ? { color: t.color } : {},
459
+ ...t.businessObject ? { businessObject: t.businessObject } : {}
460
+ });
461
+ }
462
+ createNew(e, t) {
463
+ let n = this.uniqueLabel(t), { width: r, height: i } = F(e) ? w[e] : O(n);
464
+ return this.elementFactory.createShape({
465
+ id: this.allocateId(e),
466
+ width: r,
467
+ height: i,
468
+ eventStormingType: e,
469
+ eventStormingLabel: n
470
+ });
471
+ }
472
+ createProvisional() {
473
+ let { width: e, height: t } = w.event;
474
+ return this.elementFactory.createShape({
475
+ id: this.allocateId("event"),
476
+ width: e,
477
+ height: t,
478
+ eventStormingType: "event",
479
+ eventStormingLabel: "",
480
+ provisional: !0
481
+ });
482
+ }
483
+ createArrow(e, t, n) {
484
+ return this.elementFactory.createConnection({
485
+ id: e.id,
486
+ source: t,
487
+ target: n,
488
+ waypoints: [Me(t), Me(n)],
489
+ eventStormingType: "arrow",
490
+ ...e.label ? { linkLabel: e.label } : {},
491
+ businessObject: e
492
+ });
493
+ }
494
+ };
495
+ function Me(e) {
496
+ return {
497
+ x: e.x + e.width / 2,
498
+ y: e.y + e.height / 2
499
+ };
500
+ }
501
+ //#endregion
502
+ //#region src/model/index.ts
503
+ var Ne = { eventStormingElementFactory: ["type", je] };
504
+ //#endregion
505
+ //#region src/board-bounds/BoardBounds.ts
506
+ function Pe(e) {
507
+ return e.id !== "event-storming-root" && !e.waypoints && typeof e.x == "number" && typeof e.y == "number" && typeof e.width == "number" && typeof e.height == "number";
508
+ }
509
+ var Fe = class {
510
+ elementRegistry;
511
+ static $inject = ["elementRegistry"];
512
+ constructor(e) {
513
+ this.elementRegistry = e;
514
+ }
515
+ contentBounds(e = 120) {
516
+ let t = this.elementRegistry.getAll().filter(Pe);
517
+ if (!t.length) return {
518
+ x: 0,
519
+ y: 0,
520
+ ...o
521
+ };
522
+ 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));
523
+ return {
524
+ x: n - e,
525
+ y: r - e,
526
+ width: i - n + 2 * e,
527
+ height: a - r + 2 * e
528
+ };
529
+ }
530
+ }, Ie = { boardBounds: ["type", Fe] }, Le = "eventStorming.viewOptions.changed", Re = class {
531
+ eventBus;
532
+ elementRegistry;
533
+ static $inject = ["eventBus", "elementRegistry"];
534
+ _typeCaptionsVisible = !0;
535
+ constructor(e, t) {
536
+ this.eventBus = e, this.elementRegistry = t;
537
+ }
538
+ typeCaptionsVisible() {
539
+ return this._typeCaptionsVisible;
540
+ }
541
+ setTypeCaptionsVisible(e) {
542
+ if (e === this._typeCaptionsVisible) return;
543
+ this._typeCaptionsVisible = e, this.eventBus.fire(Le, { typeCaptionsVisible: e });
544
+ let t = this.elementRegistry.filter(I);
545
+ t.length && this.eventBus.fire("elements.changed", { elements: t });
546
+ }
547
+ }, V = {
548
+ __depends__: [u],
549
+ eventStormingViewOptions: ["type", Re]
550
+ }, ze = 1500, Be = -3, Ve = "event-storming-kind-caption", He = 9, Ue = 300, We = "#606060", Ge = 7, Ke = "#FBFBFB", qe = "#B9B9B9", Je = "6 4", Ye = "event-storming-sticky-shadow";
551
+ function Xe(e) {
552
+ let t = e.closest("svg");
553
+ if (!t) return !1;
554
+ if (t.querySelector("#event-storming-sticky-shadow")) return !0;
555
+ let n = p(m("feDropShadow"), {
556
+ dx: 0,
557
+ dy: 5,
558
+ stdDeviation: 5,
559
+ "flood-color": "#000000",
560
+ "flood-opacity": .2
561
+ }), r = p(m("filter"), {
562
+ id: Ye,
563
+ x: "-40%",
564
+ y: "-40%",
565
+ width: "180%",
566
+ height: "180%"
567
+ });
568
+ f(r, n);
569
+ let i = m("defs");
570
+ return f(i, r), t.insertBefore(i, t.firstChild), !0;
571
+ }
572
+ var Ze = class extends d {
573
+ viewOptions;
574
+ static $inject = ["eventBus", "eventStormingViewOptions"];
575
+ constructor(e, t) {
576
+ super(e, ze), this.viewOptions = t;
577
+ }
578
+ canRender(e) {
579
+ return M(e) || N(e);
580
+ }
581
+ drawShape(e, t) {
582
+ let n = t;
583
+ return n.eventStormingType === "drawing" ? this.drawDrawing(e, n) : this.drawSticky(e, n);
584
+ }
585
+ drawDrawing(e, t) {
586
+ let n = t.drawingPoints ?? [], r = t.strokeStyle === "dashed" ? "8 5" : t.strokeStyle === "dotted" ? "2 4" : void 0, i = p(m(t.closed ? "polygon" : "polyline"), {
587
+ points: n.map((e) => `${e.x},${e.y}`).join(" "),
588
+ fill: "none",
589
+ stroke: t.color ?? A,
590
+ "stroke-width": 2,
591
+ "stroke-linecap": "round",
592
+ "stroke-linejoin": "round",
593
+ ...r ? { "stroke-dasharray": r } : {}
594
+ });
595
+ return f(e, i), i;
596
+ }
597
+ drawSticky(e, t) {
598
+ let n = t.eventStormingType, r = F(n) ? w[n] : T, i = t.provisional === !0, a = e;
599
+ if (n === "hotspot") {
600
+ let n = p(m("g"), { transform: `rotate(${Be} ${t.width / 2} ${t.height / 2})` });
601
+ f(e, n), a = n;
602
+ }
603
+ let o = p(m("rect"), {
604
+ x: 0,
605
+ y: 0,
606
+ width: Math.max(t.width, 1),
607
+ height: Math.max(t.height, 1),
608
+ rx: 0,
609
+ fill: i ? Ke : t.color ?? r.fill,
610
+ stroke: i ? qe : r.stroke,
611
+ "stroke-width": 1.5,
612
+ ...i ? { "stroke-dasharray": Je } : {}
613
+ });
614
+ if (Xe(e) && o.setAttribute("filter", `url(#${Ye})`), f(a, o), i) return o;
615
+ if (n === "note" ? nt(a, t) : $e(a, t), F(n) && this.viewOptions.typeCaptionsVisible()) {
616
+ let e = H(w[n].label, t.width / 2, t.height - Ge, {
617
+ "text-anchor": "middle",
618
+ "font-size": He,
619
+ fill: We
620
+ });
621
+ e.setAttribute("class", Ve), e.setAttribute("font-weight", String(Ue)), f(a, e);
622
+ }
623
+ return o;
624
+ }
625
+ drawConnection(e, t) {
626
+ let n = t, [r, i] = lt(n), a = p(m("polyline"), {
627
+ points: `${r.x},${r.y} ${i.x},${i.y}`,
628
+ fill: "none",
629
+ stroke: k.arrow,
630
+ "stroke-width": 1.5,
631
+ "stroke-linecap": "round"
632
+ });
633
+ if (f(e, a), f(e, st(r, i, k.arrow, 11, 5)), n.linkLabel) {
634
+ let t = (r.x + i.x) / 2, a = (r.y + i.y) / 2;
635
+ f(e, H(n.linkLabel, t, a - 5, {
636
+ "text-anchor": "middle",
637
+ "font-size": 11,
638
+ "font-style": "italic",
639
+ fill: k.inkSoft
640
+ }));
641
+ }
642
+ return a;
643
+ }
644
+ getShapePath(e) {
645
+ let { x: t, y: n, width: r, height: i } = e;
646
+ return `M${t},${n}l${r},0l0,${i}l${-r},0z`;
647
+ }
648
+ getConnectionPath(e) {
649
+ let [t, ...n] = e.waypoints;
650
+ return t ? `M${t.x},${t.y}` + n.map((e) => `L${e.x},${e.y}`).join("") : "";
651
+ }
652
+ };
653
+ function Qe(e, t) {
654
+ let n = e.split(/\s+/).filter((e) => e.length);
655
+ if (!n.length) return [""];
656
+ let r = [], i = "";
657
+ for (let e of n) {
658
+ if (e.length > t) {
659
+ i && r.push(i);
660
+ let n = e;
661
+ for (; n.length > t;) r.push(n.slice(0, t)), n = n.slice(t);
662
+ i = n;
663
+ continue;
664
+ }
665
+ let n = i ? `${i} ${e}` : e;
666
+ n.length <= t || !i ? i = n : (r.push(i), i = e);
667
+ }
668
+ return r.push(i), r;
669
+ }
670
+ function $e(e, t) {
671
+ let n = t.width - 16, r = Math.max(1, Math.floor(n / D)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = (t.eventStormingLabel ?? "").split("\n").flatMap((e) => Qe(e, r)).slice(0, i), o = t.width / 2, s = t.height / 2 - (a.length - 1) * 17 / 2 + 4;
672
+ a.forEach((t, n) => {
673
+ f(e, H(t, o, s + n * 17, {
674
+ "text-anchor": "middle",
675
+ fill: k.stickyText
676
+ }));
677
+ });
678
+ }
679
+ var et = 2, tt = 12.5;
680
+ function nt(e, t) {
681
+ let n = t.width - 16, r = Math.max(1, Math.floor(n / D)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = C(t.eventStormingLabel ?? "").flatMap((e) => rt(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;
682
+ a.forEach((n, r) => {
683
+ let i = o === "left" ? 8 + (n.indent ? 12 : 0) : o === "center" ? t.width / 2 : t.width - 8, a = p(m("text"), {
684
+ x: i,
685
+ y: u + r * 17 + tt,
686
+ "font-family": j.family,
687
+ "font-size": j.label,
688
+ fill: k.stickyText,
689
+ "text-anchor": c
690
+ }), s = n.marker ? [{
691
+ text: "• ",
692
+ bold: !1,
693
+ italic: !1
694
+ }, ...n.runs] : n.runs;
695
+ for (let e of s) {
696
+ let t = m("tspan");
697
+ t.textContent = e.text, e.bold && t.setAttribute("font-weight", "600"), e.italic && t.setAttribute("font-style", "italic"), f(a, t);
698
+ }
699
+ f(e, a);
700
+ });
701
+ }
702
+ function rt(e, t) {
703
+ let n = Math.max(1, t - (e.bullet ? et : 0));
704
+ return it(e.runs, n).map((t, n) => ({
705
+ runs: t,
706
+ marker: e.bullet && n === 0,
707
+ indent: e.bullet && n > 0
708
+ }));
709
+ }
710
+ function it(e, t) {
711
+ let n = e.map((e) => e.text).join("");
712
+ return n.length <= t ? [e] : at(n, t).map(([t, n]) => ot(e, t, n));
713
+ }
714
+ function at(e, t) {
715
+ let n = [...e.matchAll(/\S+/g)];
716
+ if (!n.length) return [[0, 0]];
717
+ let r = [], i = -1, a = -1, o = () => {
718
+ i >= 0 && r.push([i, a]), i = a = -1;
719
+ };
720
+ for (let e of n) {
721
+ let n = e.index, s = n + e[0].length;
722
+ if (e[0].length > t) {
723
+ for (o(); s - n > t;) r.push([n, n + t]), n += t;
724
+ i = n, a = s;
725
+ continue;
726
+ }
727
+ if (i < 0 || s - i <= t) {
728
+ i < 0 && (i = n), a = s;
729
+ continue;
730
+ }
731
+ o(), i = n, a = s;
732
+ }
733
+ return o(), r;
734
+ }
735
+ function ot(e, t, n) {
736
+ let r = [], i = 0;
737
+ for (let a of e) {
738
+ let e = i;
739
+ i += a.text.length;
740
+ let o = Math.max(t, e), s = Math.min(n, i);
741
+ o >= s || r.push({
742
+ text: a.text.slice(o - e, s - e),
743
+ bold: a.bold,
744
+ italic: a.italic
745
+ });
746
+ }
747
+ return r;
748
+ }
749
+ function H(e, t, n, r = {}) {
750
+ let i = p(m("text"), {
751
+ x: t,
752
+ y: n,
753
+ "font-family": j.family,
754
+ "font-size": j.label,
755
+ fill: k.ink,
756
+ ...r
757
+ });
758
+ return i.textContent = e, i;
759
+ }
760
+ function st(e, t, n, r = 10, i = 5) {
761
+ 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)}`;
762
+ return p(m("polygon"), {
763
+ points: c,
764
+ fill: n
765
+ });
766
+ }
767
+ function U(e) {
768
+ return {
769
+ x: e.x + e.width / 2,
770
+ y: e.y + e.height / 2
771
+ };
772
+ }
773
+ function ct(e, t) {
774
+ let n = U(e), r = t.x - n.x, i = t.y - n.y;
775
+ if (r === 0 && i === 0) return n;
776
+ 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));
777
+ return {
778
+ x: n.x + r * s,
779
+ y: n.y + i * s
780
+ };
781
+ }
782
+ function lt(e) {
783
+ let t = e.source, n = e.target, r = e.waypoints;
784
+ if (!t || !n) {
785
+ let e = r[0] ?? {
786
+ x: 0,
787
+ y: 0
788
+ };
789
+ return [e, r[r.length - 1] ?? e];
790
+ }
791
+ let i = U(t), a = U(n), o = ct(t, a), s = ct(n, i);
792
+ return (a.x - i.x) * (s.x - o.x) + (a.y - i.y) * (s.y - o.y) <= 0 ? [i, a] : [o, s];
793
+ }
794
+ //#endregion
795
+ //#region src/draw/index.ts
796
+ var ut = {
797
+ __depends__: [V],
798
+ __init__: ["eventStormingRenderer"],
799
+ eventStormingRenderer: ["type", Ze]
800
+ }, dt = { drawing: 0 }, ft = class {
801
+ canvas;
802
+ elementFactory;
803
+ factory;
804
+ boardBounds;
805
+ eventBus;
806
+ elementRegistry;
807
+ static $inject = [
808
+ "canvas",
809
+ "elementFactory",
810
+ "eventStormingElementFactory",
811
+ "boardBounds",
812
+ "eventBus",
813
+ "elementRegistry"
814
+ ];
815
+ constructor(e, t, n, r, i, a) {
816
+ this.canvas = e, this.elementFactory = t, this.factory = n, this.boardBounds = r, this.eventBus = i, this.elementRegistry = a;
817
+ }
818
+ import(e) {
819
+ let t = [];
820
+ this.eventBus.fire("import.render.start", { board: e });
821
+ let n = {
822
+ config: e.config,
823
+ ...e.rawPassthrough ? { rawPassthrough: e.rawPassthrough } : {}
824
+ }, r;
825
+ try {
826
+ r = this.canvas.getRootElement();
827
+ } catch {
828
+ r = void 0;
829
+ }
830
+ let i;
831
+ r && r.id === "event-storming-root" ? i = r : (i = this.elementFactory.createRoot({ id: Ee }), this.canvas.setRootElement(i)), i.businessObject = n;
832
+ let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (dt[e.elementType] ?? 9) - (dt[t.elementType] ?? 9)), s = o.filter((e) => e.elementType === "drawing"), c = o.filter((e) => e.elementType !== "drawing");
833
+ for (let e of s) {
834
+ let t = this.createShape(e);
835
+ this.canvas.addShape(t, i), a.set(e.id, t);
836
+ }
837
+ for (let e of c) {
838
+ let t = this.createShape(e);
839
+ this.canvas.addShape(t, i), a.set(e.id, t);
840
+ }
841
+ for (let e of c) {
842
+ let n = "attachedTo" in e ? e.attachedTo : void 0;
843
+ if (!n) continue;
844
+ let r = a.get(n);
845
+ if (!r || !z(r)) {
846
+ t.push({
847
+ message: `Element ${e.id}: attachedTo host "${n}" missing.`,
848
+ elementId: e.id
849
+ });
850
+ continue;
851
+ }
852
+ a.get(e.id).host = r;
853
+ }
854
+ for (let n of e.edges) {
855
+ let e = a.get(n.from), r = a.get(n.to);
856
+ if (!e || !r) {
857
+ t.push({
858
+ message: `Edge ${n.id}: endpoint missing.`,
859
+ elementId: n.id
860
+ });
861
+ continue;
862
+ }
863
+ let o = this.factory.createArrow(n, e, r);
864
+ this.canvas.addConnection(o, i, s.length);
865
+ }
866
+ return this.canvas.viewbox(this.boardBounds.contentBounds()), this.eventBus.fire("import.render.done", { warnings: t }), t;
867
+ }
868
+ createShape(e) {
869
+ switch (e.elementType) {
870
+ case "note": return this.factory.createNote(e);
871
+ case "drawing": return this.factory.createDrawing(e);
872
+ default: return this.factory.createSticky(e);
873
+ }
874
+ }
875
+ clear() {
876
+ for (let e of [...this.elementRegistry.getAll()]) {
877
+ let t = e;
878
+ if (t.id !== "event-storming-root") try {
879
+ t.waypoints ? this.canvas.removeConnection(t.id) : this.canvas.removeShape(t.id);
880
+ } catch {}
881
+ }
882
+ }
883
+ }, pt = class {
884
+ elementRegistry;
885
+ canvas;
886
+ static $inject = ["elementRegistry", "canvas"];
887
+ constructor(e, t) {
888
+ this.elementRegistry = e, this.canvas = t;
889
+ }
890
+ export() {
891
+ let e = this.canvas.getRootElement().businessObject, t = e?.config ?? { title: "Untitled Board" }, n = [], r = [];
892
+ for (let e of this.elementRegistry.getAll()) if (e.id !== "event-storming-root") {
893
+ if (N(e)) r.push({
894
+ id: e.id,
895
+ edgeType: "arrow",
896
+ from: e.source?.id ?? "",
897
+ to: e.target?.id ?? "",
898
+ ...e.linkLabel ? { label: e.linkLabel } : {}
899
+ });
900
+ else if (M(e)) {
901
+ let t = this.buildElement(e);
902
+ t && n.push(t);
903
+ }
904
+ }
905
+ let a = {
906
+ schemaVersion: i,
907
+ config: t,
908
+ elements: n,
909
+ edges: r,
910
+ ...e?.rawPassthrough ? { rawPassthrough: e.rawPassthrough } : {}
911
+ };
912
+ return l(a);
913
+ }
914
+ buildElement(e) {
915
+ if (e.eventStormingType === "drawing") {
916
+ let t = (e.drawingPoints ?? []).map((t) => ({
917
+ x: e.x + t.x,
918
+ y: e.y + t.y
919
+ }));
920
+ return t.length < 2 ? void 0 : {
921
+ id: e.id,
922
+ elementType: "drawing",
923
+ label: "",
924
+ position: t[0],
925
+ points: t,
926
+ ...e.closed ? { closed: !0 } : {},
927
+ ...e.strokeStyle ? { strokeStyle: e.strokeStyle } : {},
928
+ ...e.color ? { color: e.color } : {}
929
+ };
930
+ }
931
+ let t = e.eventStormingType === "note" && Te(e.eventStormingLabel, e) ? {
932
+ width: e.width,
933
+ height: e.height
934
+ } : void 0, n = e.eventStormingType === "note" ? mt(e) : void 0;
935
+ return {
936
+ id: e.id,
937
+ elementType: e.eventStormingType,
938
+ label: e.eventStormingLabel,
939
+ position: {
940
+ x: e.x + e.width / 2,
941
+ y: e.y + e.height / 2
942
+ },
943
+ ...e.color ? { color: e.color } : {},
944
+ ...t ? { size: t } : {},
945
+ ...n ? { align: n } : {},
946
+ ...e.host ? { attachedTo: e.host.id } : {}
947
+ };
948
+ }
949
+ };
950
+ function mt(e) {
951
+ let t = e.alignHorizontal && e.alignHorizontal !== "left" ? e.alignHorizontal : void 0, n = e.alignVertical && e.alignVertical !== "top" ? e.alignVertical : void 0;
952
+ if (!(!t && !n)) return {
953
+ ...t ? { horizontal: t } : {},
954
+ ...n ? { vertical: n } : {}
955
+ };
956
+ }
957
+ //#endregion
958
+ //#region src/io/index.ts
959
+ var ht = {
960
+ eventStormingImporter: ["type", ft],
961
+ eventStormingExporter: ["type", pt]
962
+ }, gt = class extends _e {
963
+ _getModules() {
964
+ return [
965
+ Ne,
966
+ Ie,
967
+ V,
968
+ ut,
969
+ ht
970
+ ];
971
+ }
972
+ }, _t = class extends gt {
973
+ _getModules() {
974
+ return [
975
+ ...super._getModules(),
976
+ g,
977
+ _,
978
+ v,
979
+ y
980
+ ];
981
+ }
982
+ }, vt = class extends ce {
983
+ static $inject = ["eventBus", "modeling"];
984
+ constructor(e, t) {
985
+ super(e), this.preExecute("element.updateProperties", (e) => {
986
+ let { element: n, properties: r } = e.context, i = r.eventStormingType;
987
+ if (typeof i != "string") return;
988
+ let a = n;
989
+ if (a.host && !L(i) && t.updateAttachment(a, void 0), a.attachers?.length && !R(i)) for (let e of [...a.attachers]) t.updateAttachment(e, void 0);
990
+ });
991
+ }
992
+ }, yt = {
993
+ __depends__: [se],
994
+ __init__: ["eventStormingAttachBehavior"],
995
+ eventStormingAttachBehavior: ["type", vt]
996
+ };
997
+ //#endregion
998
+ //#region src/modeling/cmd/UpdatePropertiesHandler.ts
999
+ function bt(e, t, n) {
1000
+ n === void 0 ? delete e[t] : e[t] = n;
1001
+ }
1002
+ var xt = [
1003
+ "x",
1004
+ "y",
1005
+ "width",
1006
+ "height"
1007
+ ];
1008
+ function St(e, t) {
1009
+ if (!t.some((e) => xt.includes(e))) return [e];
1010
+ let n = e;
1011
+ return [
1012
+ e,
1013
+ ...n.incoming ?? [],
1014
+ ...n.outgoing ?? []
1015
+ ];
1016
+ }
1017
+ var Ct = class {
1018
+ execute(e) {
1019
+ let { element: t, properties: n } = e, r = t, i = {};
1020
+ for (let e of Object.keys(n)) i[e] = r[e], bt(r, e, n[e]);
1021
+ return e.oldProperties = i, St(t, Object.keys(n));
1022
+ }
1023
+ revert(e) {
1024
+ let { element: t, oldProperties: n } = e, r = t;
1025
+ if (n) for (let e of Object.keys(n)) bt(r, e, n[e]);
1026
+ return St(t, Object.keys(n ?? {}));
1027
+ }
1028
+ }, W = "element.updateProperties", wt = class {
1029
+ commandStack;
1030
+ canvas;
1031
+ elementRegistry;
1032
+ static $inject = [
1033
+ "commandStack",
1034
+ "canvas",
1035
+ "elementRegistry"
1036
+ ];
1037
+ constructor(e, t, n) {
1038
+ this.commandStack = e, this.canvas = t, this.elementRegistry = n, e.registerHandler(W, Ct);
1039
+ }
1040
+ updateProperties(e, t) {
1041
+ this.commandStack.execute(W, {
1042
+ element: e,
1043
+ properties: t
1044
+ });
1045
+ }
1046
+ updateLabel(e, t) {
1047
+ if (e.eventStormingType === "note" && !Te(e.eventStormingLabel, e)) {
1048
+ let { width: n, height: r } = O(t), i = e.x + e.width / 2, a = e.y + e.height / 2;
1049
+ this.updateProperties(e, {
1050
+ eventStormingLabel: t,
1051
+ width: n,
1052
+ height: r,
1053
+ x: i - n / 2,
1054
+ y: a - r / 2
1055
+ });
1056
+ return;
1057
+ }
1058
+ this.updateProperties(e, { eventStormingLabel: t });
1059
+ }
1060
+ setStickyKind(e, t) {
1061
+ if (!F(e.eventStormingType) || !F(t)) throw Error("setStickyKind: only sticky kinds can be retyped");
1062
+ if (e.eventStormingType === t && !e.provisional) return;
1063
+ let { width: n, height: r } = w[t], i = e.x + e.width / 2, a = e.y + e.height / 2;
1064
+ this.updateProperties(e, {
1065
+ eventStormingType: t,
1066
+ ...e.provisional ? { provisional: void 0 } : {},
1067
+ width: n,
1068
+ height: r,
1069
+ x: i - n / 2,
1070
+ y: a - r / 2
1071
+ });
1072
+ }
1073
+ setColor(e, t) {
1074
+ this.updateProperties(e, { color: t });
1075
+ }
1076
+ setStrokeStyle(e, t) {
1077
+ this.updateProperties(e, { strokeStyle: t });
1078
+ }
1079
+ getLevel() {
1080
+ return this.elementRegistry.get("event-storming-root")?.businessObject?.config.level ?? a;
1081
+ }
1082
+ setLevel(e) {
1083
+ if (this.getLevel() === e) return;
1084
+ let t = this.root(), n = t.businessObject ?? { config: { title: "Untitled Board" } };
1085
+ this.commandStack.execute(W, {
1086
+ element: t,
1087
+ properties: { businessObject: {
1088
+ ...n,
1089
+ config: {
1090
+ ...n.config,
1091
+ level: e
1092
+ }
1093
+ } }
1094
+ });
1095
+ }
1096
+ root() {
1097
+ return this.elementRegistry.get("event-storming-root") ?? this.canvas.getRootElement();
1098
+ }
1099
+ }, Tt = 24, Et = [
1100
+ "eventStormingType",
1101
+ "color",
1102
+ "drawingPoints",
1103
+ "closed",
1104
+ "strokeStyle",
1105
+ "alignHorizontal",
1106
+ "alignVertical"
1107
+ ], Dt = ["eventStormingType", "linkLabel"];
1108
+ function Ot(e, t) {
1109
+ let n = {};
1110
+ for (let r of t) {
1111
+ let t = e[r];
1112
+ t !== void 0 && (n[r] = structuredClone(t));
1113
+ }
1114
+ return n;
1115
+ }
1116
+ var kt = class {
1117
+ selection;
1118
+ modeling;
1119
+ elementFactory;
1120
+ esFactory;
1121
+ canvas;
1122
+ create;
1123
+ mouse;
1124
+ static $inject = [
1125
+ "selection",
1126
+ "modeling",
1127
+ "elementFactory",
1128
+ "eventStormingElementFactory",
1129
+ "canvas",
1130
+ "create",
1131
+ "mouse"
1132
+ ];
1133
+ clipboard = null;
1134
+ pasteCount = 0;
1135
+ constructor(e, t, n, r, i, a, o) {
1136
+ this.selection = e, this.modeling = t, this.elementFactory = n, this.esFactory = r, this.canvas = i, this.create = a, this.mouse = o;
1137
+ }
1138
+ copy() {
1139
+ let e = this.selection.get().filter((e) => M(e));
1140
+ if (!e.length) return !1;
1141
+ let t = new Map(e.map((e, t) => [e, t])), n = [], r = /* @__PURE__ */ new Set();
1142
+ for (let i of e) for (let e of [...i.incoming ?? [], ...i.outgoing ?? []]) {
1143
+ if (!N(e) || r.has(e)) continue;
1144
+ let i = t.get(e.source), a = t.get(e.target);
1145
+ i !== void 0 && a !== void 0 && (r.add(e), n.push({
1146
+ sourceIdx: i,
1147
+ targetIdx: a,
1148
+ props: Ot(e, Dt)
1149
+ }));
1150
+ }
1151
+ return this.clipboard = {
1152
+ shapes: e.map((e) => {
1153
+ let n = e.host ? t.get(e.host) : void 0;
1154
+ return {
1155
+ props: Ot(e, Et),
1156
+ x: e.x,
1157
+ y: e.y,
1158
+ width: e.width,
1159
+ height: e.height,
1160
+ label: e.eventStormingLabel ?? "",
1161
+ ...n === void 0 ? {} : { hostIdx: n }
1162
+ };
1163
+ }),
1164
+ connections: n
1165
+ }, this.pasteCount = 0, !0;
1166
+ }
1167
+ paste() {
1168
+ if (!this.clipboard?.shapes.length) return !1;
1169
+ let e = this.buildClones(), t = this.mouse.getLastMoveEvent();
1170
+ return t ? (this.create.start(t, [...e.shapes, ...e.connections]), !0) : this.insertWithOffset(e);
1171
+ }
1172
+ duplicate() {
1173
+ return this.copy() ? this.insertWithOffset(this.buildClones()) : !1;
1174
+ }
1175
+ buildClones() {
1176
+ let e = this.clipboard, t = /* @__PURE__ */ new Set(), n = e.shapes.map((e) => {
1177
+ let n = this.esFactory.allocateId(e.props.eventStormingType, t);
1178
+ return t.add(n), this.elementFactory.createShape({
1179
+ ...structuredClone(e.props),
1180
+ id: n,
1181
+ x: e.x,
1182
+ y: e.y,
1183
+ width: e.width,
1184
+ height: e.height,
1185
+ eventStormingLabel: e.label
1186
+ });
1187
+ });
1188
+ return e.shapes.forEach((e, t) => {
1189
+ e.hostIdx !== void 0 && (n[t].host = n[e.hostIdx]);
1190
+ }), {
1191
+ shapes: n,
1192
+ connections: e.connections.map((e) => this.elementFactory.createConnection({
1193
+ ...structuredClone(e.props),
1194
+ source: n[e.sourceIdx],
1195
+ target: n[e.targetIdx],
1196
+ waypoints: [At(n[e.sourceIdx]), At(n[e.targetIdx])]
1197
+ }))
1198
+ };
1199
+ }
1200
+ insertWithOffset(e) {
1201
+ this.pasteCount++;
1202
+ let t = Tt * this.pasteCount, n = jt(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
1203
+ x: n.cx + t,
1204
+ y: n.cy + t
1205
+ }, this.canvas.getRootElement());
1206
+ return this.selection.select(r), !0;
1207
+ }
1208
+ };
1209
+ function At(e) {
1210
+ return {
1211
+ x: e.x + e.width / 2,
1212
+ y: e.y + e.height / 2
1213
+ };
1214
+ }
1215
+ function jt(e) {
1216
+ 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));
1217
+ return {
1218
+ cx: (t + r) / 2,
1219
+ cy: (n + i) / 2
1220
+ };
1221
+ }
1222
+ //#endregion
1223
+ //#region src/modeling/index.ts
1224
+ var Mt = {
1225
+ __depends__: [le, ee],
1226
+ __init__: ["eventStormingModeling"],
1227
+ eventStormingModeling: ["type", wt],
1228
+ eventStormingCopyPaste: ["type", kt]
1229
+ }, Nt = {
1230
+ __depends__: [ue],
1231
+ __init__: ["eventStormingLassoBehavior"],
1232
+ eventStormingLassoBehavior: ["type", class {
1233
+ static $inject = [
1234
+ "eventBus",
1235
+ "canvas",
1236
+ "lassoTool"
1237
+ ];
1238
+ constructor(e, t, n) {
1239
+ e.on("element.mousedown", 1500, (e) => {
1240
+ let r = e.originalEvent;
1241
+ if (!r?.shiftKey) return;
1242
+ let i;
1243
+ try {
1244
+ i = t.getRootElement();
1245
+ } catch {
1246
+ return;
1247
+ }
1248
+ if (e.element === i) return n.activateLasso(r), !1;
1249
+ });
1250
+ }
1251
+ }]
1252
+ };
1253
+ //#endregion
1254
+ //#region src/rules/EventStormingRules.ts
1255
+ function Pt(e, t) {
1256
+ return (e.outgoing ?? []).some((e) => e.target === t);
1257
+ }
1258
+ function Ft(e, t) {
1259
+ return e.length !== 1 || !Oe(e[0]) || !z(t) ? !1 : "attach";
1260
+ }
1261
+ var It = class extends de {
1262
+ static $inject = ["eventBus"];
1263
+ constructor(e) {
1264
+ super(e);
1265
+ }
1266
+ init() {
1267
+ this.addRule("connection.start", (e) => I(e.source)), this.addRule("connection.create", (e) => {
1268
+ let { source: t, target: n } = e;
1269
+ return !I(t) || !I(n) || t === n || Pt(t, n) ? !1 : { eventStormingType: "arrow" };
1270
+ }), this.addRule(["shape.move", "elements.move"], (e) => Ft(e.shapes ?? (e.shape ? [e.shape] : []), e.target) || !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => {
1271
+ if (!ke(e.shape)) return !1;
1272
+ let { newBounds: t } = e;
1273
+ return !t || t.width >= E.width && t.height >= E.height;
1274
+ });
1275
+ }
1276
+ }, Lt = {
1277
+ __init__: ["eventStormingRules"],
1278
+ eventStormingRules: ["type", It]
1279
+ }, Rt = 8, zt = {
1280
+ __init__: ["elementSnapping"],
1281
+ elementSnapping: ["type", class {
1282
+ static $inject = ["eventBus", "elementRegistry"];
1283
+ constructor(e, t) {
1284
+ let n = (e) => t.getAll().filter((t) => M(t) && t.eventStormingType !== "drawing" && !e.has(t.id)).map((e) => ({
1285
+ x: e.x + e.width / 2,
1286
+ y: e.y + e.height / 2
1287
+ })), r = (e, t) => {
1288
+ let n, r = 9;
1289
+ for (let i of t) {
1290
+ let t = Math.abs(i - e);
1291
+ t <= Rt && t < r && (n = i, r = t);
1292
+ }
1293
+ return n;
1294
+ };
1295
+ e.on(["shape.move.move", "shape.move.end"], 1500, (e) => {
1296
+ if (e.originalEvent?.shiftKey || typeof e.x != "number" || typeof e.dx != "number" || typeof e.y != "number" || typeof e.dy != "number") return;
1297
+ let t = e.context?.shape;
1298
+ if (!t) return;
1299
+ let i = new Set((e.context?.shapes ?? [t]).map((e) => e.id ?? "").filter(Boolean)), a = n(i), o = t.x + t.width / 2 + e.dx, s = t.y + t.height / 2 + e.dy, c = r(o, a.map((e) => e.x));
1300
+ if (c !== void 0) {
1301
+ let t = c - o;
1302
+ e.dx += t, e.x += t;
1303
+ }
1304
+ let l = r(s, a.map((e) => e.y));
1305
+ if (l !== void 0) {
1306
+ let t = l - s;
1307
+ e.dy += t, e.y += t;
1308
+ }
1309
+ }), e.on(["create.move", "create.end"], 1500, (e) => {
1310
+ if (e.originalEvent?.shiftKey) return;
1311
+ let t = n(/* @__PURE__ */ new Set());
1312
+ if (typeof e.x == "number") {
1313
+ let n = r(e.x, t.map((e) => e.x));
1314
+ n !== void 0 && (typeof e.dx == "number" && (e.dx += n - e.x), e.x = n);
1315
+ }
1316
+ if (typeof e.y == "number") {
1317
+ let n = r(e.y, t.map((e) => e.y));
1318
+ n !== void 0 && (typeof e.dy == "number" && (e.dy += n - e.y), e.y = n);
1319
+ }
1320
+ });
1321
+ }
1322
+ }]
1323
+ }, G = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="event-storming-palette-svg">${e}</svg>`, Bt = (e, t, n = 0) => G(`<rect x="4" y="5" width="16" height="14" fill="${e}" stroke="${t}" stroke-width="1.5"${n ? ` transform="rotate(${n} 12 12)"` : ""}/>`), K = {
1324
+ draw: G(`<polyline points="3,18 8.5,7 14,14 21,4" fill="none" stroke="${k.ink}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><circle cx="3" cy="18" r="2.2" fill="${k.surface}" stroke="${k.ink}" stroke-width="1.4"/>`),
1325
+ lasso: G(`<rect x="3" y="3" width="13" height="13" rx="2" fill="none" stroke="${k.ink}" stroke-width="1.5" stroke-dasharray="3 2.5"/><path d="M13.5 13.5l7 2.7-3 1.3-1.3 3z" fill="${k.ink}"/>`),
1326
+ note: Bt(T.fill, T.stroke)
1327
+ };
1328
+ for (let e of P) {
1329
+ let t = w[e];
1330
+ K[e] = Bt(t.fill, t.stroke, e === "hotspot" ? -6 : 0);
1331
+ }
1332
+ function Vt(e, t) {
1333
+ 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>`;
1334
+ }
1335
+ //#endregion
1336
+ //#region src/palette/EventStormingPaletteProvider.ts
1337
+ var q = "stickies-1", J = "stickies-2", Ht = "stickies-3", Ut = [
1338
+ {
1339
+ key: "event",
1340
+ type: "event",
1341
+ label: w.event.label,
1342
+ title: "Domain Event — E",
1343
+ group: q
1344
+ },
1345
+ {
1346
+ key: "command",
1347
+ type: "command",
1348
+ label: w.command.label,
1349
+ title: "Command — C",
1350
+ group: q
1351
+ },
1352
+ {
1353
+ key: "actor",
1354
+ type: "actor",
1355
+ label: w.actor.label,
1356
+ title: "Actor",
1357
+ group: q
1358
+ },
1359
+ {
1360
+ key: "aggregate",
1361
+ type: "aggregate",
1362
+ label: w.aggregate.label,
1363
+ title: "Aggregate",
1364
+ group: q
1365
+ },
1366
+ {
1367
+ key: "policy",
1368
+ type: "policy",
1369
+ label: w.policy.label,
1370
+ title: "Policy",
1371
+ group: J
1372
+ },
1373
+ {
1374
+ key: "readmodel",
1375
+ type: "readmodel",
1376
+ label: w.readmodel.label,
1377
+ title: "Read Model",
1378
+ group: J
1379
+ },
1380
+ {
1381
+ key: "external",
1382
+ type: "external",
1383
+ label: w.external.label,
1384
+ title: "External System",
1385
+ group: J
1386
+ },
1387
+ {
1388
+ key: "hotspot",
1389
+ type: "hotspot",
1390
+ label: w.hotspot.label,
1391
+ title: "Hotspot",
1392
+ group: Ht
1393
+ },
1394
+ {
1395
+ key: "note",
1396
+ type: "note",
1397
+ label: T.label,
1398
+ title: "Note",
1399
+ group: Ht
1400
+ }
1401
+ ], Wt = {
1402
+ __init__: ["eventStormingPaletteProvider"],
1403
+ eventStormingPaletteProvider: ["type", class {
1404
+ create;
1405
+ factory;
1406
+ lassoTool;
1407
+ drawTool;
1408
+ eventStormingModeling;
1409
+ static $inject = [
1410
+ "palette",
1411
+ "create",
1412
+ "eventStormingElementFactory",
1413
+ "lassoTool",
1414
+ "eventStormingDrawTool",
1415
+ "eventStormingModeling",
1416
+ "eventBus"
1417
+ ];
1418
+ constructor(e, t, n, r, i, a, o) {
1419
+ this.create = t, this.factory = n, this.lassoTool = r, this.drawTool = i, this.eventStormingModeling = a, e.registerProvider(this);
1420
+ let s = () => e._rebuild();
1421
+ o.on("import.done", s), o.on(["commandStack.element.updateProperties.postExecuted", "commandStack.element.updateProperties.reverted"], (e) => {
1422
+ e.context.element.id === "event-storming-root" && s();
1423
+ });
1424
+ }
1425
+ getPaletteEntries() {
1426
+ let e = {};
1427
+ e["lasso-tool"] = {
1428
+ group: "tools",
1429
+ title: "Selection tool — L (or Shift+drag)",
1430
+ html: `<div class="entry event-storming-palette-entry" title="Selection tool — L (or Shift+drag)">${K.lasso}</div>`,
1431
+ action: { click: (e) => this.lassoTool.activateSelection(e) }
1432
+ }, e["draw-tool"] = {
1433
+ group: "tools",
1434
+ title: "Draw — click point by point, double-click/Enter finishes, click the start point to close",
1435
+ html: `<div class="entry event-storming-palette-entry" title="Draw — click point by point, double-click/Enter finishes, click the start point to close">${K.draw}</div>`,
1436
+ action: { click: () => this.drawTool.toggle() }
1437
+ };
1438
+ let t = c[this.eventStormingModeling.getLevel()];
1439
+ for (let n of Ut) {
1440
+ if (n.type !== "note" && !t.includes(n.type)) continue;
1441
+ let r = (e) => {
1442
+ let t = this.factory.createNew(n.type, n.label);
1443
+ this.create.start(e, t);
1444
+ };
1445
+ e[`create.${n.key}`] = {
1446
+ group: n.group,
1447
+ title: n.title,
1448
+ html: `<div class="entry event-storming-palette-entry" draggable="true" title="${n.title}">${K[n.key]}</div>`,
1449
+ action: {
1450
+ dragstart: r,
1451
+ click: r
1452
+ }
1453
+ };
1454
+ }
1455
+ return e;
1456
+ }
1457
+ }]
1458
+ }, Y = "event-storming-element-settings", Gt = {
1459
+ id: "kind",
1460
+ name: "Change type"
1461
+ };
1462
+ function Kt(e, t) {
1463
+ return e ? `✓ ${t}` : t;
1464
+ }
1465
+ var qt = class {
1466
+ modeling;
1467
+ static $inject = ["popupMenu", "eventStormingModeling"];
1468
+ constructor(e, t) {
1469
+ this.modeling = t, e.registerProvider(Y, this);
1470
+ }
1471
+ getPopupMenuEntries(e) {
1472
+ let t = Array.isArray(e) ? e[0] : e;
1473
+ return I(t) ? this.kindEntries(t) : {};
1474
+ }
1475
+ kindEntries(e) {
1476
+ let t = {}, n = e.provisional === !0, r = c[this.modeling.getLevel()];
1477
+ for (let i of P) {
1478
+ if (!r.includes(i) && (n || i !== e.eventStormingType)) continue;
1479
+ let a = w[i];
1480
+ t[`kind-${i}`] = {
1481
+ label: n ? a.label : Kt(e.eventStormingType === i, a.label),
1482
+ imageHtml: Vt(a.fill, a.stroke),
1483
+ group: Gt,
1484
+ action: () => this.modeling.setStickyKind(e, i)
1485
+ };
1486
+ }
1487
+ return t;
1488
+ }
1489
+ }, Jt = {
1490
+ __init__: ["eventStormingElementSettings"],
1491
+ eventStormingElementSettings: ["type", qt]
1492
+ }, Yt = "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", Xt = "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z", X = "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", Z = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", Zt = "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", Qt = "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", $t = "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", en = "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", tn = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", nn = "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", rn = "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", an = "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", on = "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", sn = "M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 8 6.5 8 8 8.67 8 9.5 7.33 11 6.5 11zm3-4C8.67 7 8 6.33 8 5.5S8.67 4 9.5 4s1.5.67 1.5 1.5S10.33 7 9.5 7zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 4 14.5 4s1.5.67 1.5 1.5S15.33 7 14.5 7zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 8 17.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z", cn = "M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z", ln = "M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z", un = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", dn = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", fn = "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", pn = "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";
1493
+ function Q(e, t = 18) {
1494
+ return `<svg viewBox="0 0 24 24" width="${t}" height="${t}" fill="currentColor" aria-hidden="true"><path d="${e}"/></svg>`;
1495
+ }
1496
+ //#endregion
1497
+ //#region src/context-pad/EventStormingContextPadProvider.ts
1498
+ var mn = "Append sticky (auto-connect, choose the type after placing)";
1499
+ function $(e, t, n = !1) {
1500
+ return `<div class="entry event-storming-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${Q(e)}</div>`;
1501
+ }
1502
+ //#endregion
1503
+ //#region src/context-pad/index.ts
1504
+ var hn = {
1505
+ __init__: ["eventStormingContextPadProvider"],
1506
+ eventStormingContextPadProvider: ["type", class {
1507
+ modeling;
1508
+ connect;
1509
+ create;
1510
+ popupMenu;
1511
+ eventStormingModeling;
1512
+ labelEditing;
1513
+ factory;
1514
+ colorPicker;
1515
+ static $inject = [
1516
+ "contextPad",
1517
+ "modeling",
1518
+ "connect",
1519
+ "create",
1520
+ "popupMenu",
1521
+ "eventStormingModeling",
1522
+ "eventStormingLabelEditing",
1523
+ "eventStormingElementFactory",
1524
+ "eventStormingColorPicker"
1525
+ ];
1526
+ constructor(e, t, n, r, i, a, o, s, c) {
1527
+ this.modeling = t, this.connect = n, this.create = r, this.popupMenu = i, this.eventStormingModeling = a, this.labelEditing = o, this.factory = s, this.colorPicker = c, e.registerProvider(this);
1528
+ }
1529
+ getContextPadEntries(e) {
1530
+ if (N(e)) {
1531
+ let t = e;
1532
+ return {
1533
+ "edit-label": {
1534
+ group: "edit",
1535
+ title: "Edit arrow label",
1536
+ html: $(X, "Edit arrow label"),
1537
+ action: { click: () => this.labelEditing.activateConnection(t) }
1538
+ },
1539
+ delete: {
1540
+ group: "edit",
1541
+ title: "Delete connection",
1542
+ html: $(Z, "Delete connection"),
1543
+ action: { click: () => this.modeling.removeElements([e]) }
1544
+ }
1545
+ };
1546
+ }
1547
+ if (!M(e)) return {};
1548
+ let t = e, n = {}, r = t.eventStormingType;
1549
+ if (F(r)) {
1550
+ let e = (e) => {
1551
+ let n = this.factory.createProvisional();
1552
+ this.create.start(e, n, { source: t });
1553
+ };
1554
+ n.append = {
1555
+ group: "append",
1556
+ title: mn,
1557
+ html: $(dn, mn, !0),
1558
+ action: {
1559
+ click: e,
1560
+ dragstart: e
1561
+ }
1562
+ };
1563
+ let r = (e) => {
1564
+ this.connect.start(e, t);
1565
+ };
1566
+ n.connect = {
1567
+ group: "edit",
1568
+ title: "Connect to existing sticky",
1569
+ html: $(Xt, "Connect to existing sticky", !0),
1570
+ action: {
1571
+ click: r,
1572
+ dragstart: r
1573
+ }
1574
+ }, n["change-kind"] = {
1575
+ group: "sticky",
1576
+ title: "Change type",
1577
+ html: $(ln, "Change type"),
1578
+ action: { click: (e) => {
1579
+ let n = e;
1580
+ this.popupMenu.open(t, Y, {
1581
+ x: n.clientX,
1582
+ y: n.clientY
1583
+ });
1584
+ } }
1585
+ };
1586
+ }
1587
+ if (r === "drawing") {
1588
+ let e = t.strokeStyle === "dashed" ? "dotted" : t.strokeStyle === "dotted" ? void 0 : "dashed", r = `Line style: ${t.strokeStyle ?? "solid"} (click to change)`;
1589
+ n["stroke-style"] = {
1590
+ group: "sticky",
1591
+ title: r,
1592
+ html: $(cn, r),
1593
+ action: { click: () => this.eventStormingModeling.setStrokeStyle(t, e) }
1594
+ };
1595
+ }
1596
+ return r === "drawing" && (n.color = {
1597
+ group: "sticky",
1598
+ title: "Color",
1599
+ html: $(sn, "Color"),
1600
+ action: { click: (e) => {
1601
+ let n = e;
1602
+ this.colorPicker.open(t, n.clientX, n.clientY);
1603
+ } }
1604
+ }), r !== "drawing" && (n["edit-label"] = {
1605
+ group: "edit",
1606
+ title: "Edit label",
1607
+ html: $(X, "Edit label"),
1608
+ action: { click: () => this.labelEditing.activate(t) }
1609
+ }), n.delete = {
1610
+ group: "edit",
1611
+ title: "Delete",
1612
+ html: $(Z, "Delete"),
1613
+ action: { click: () => this.modeling.removeElements([t]) }
1614
+ }, n;
1615
+ }
1616
+ }]
1617
+ }, gn = "bullet", _n = [
1618
+ "left",
1619
+ "center",
1620
+ "right"
1621
+ ], vn = [
1622
+ "top",
1623
+ "middle",
1624
+ "bottom"
1625
+ ];
1626
+ function yn(e, t) {
1627
+ return e[(e.indexOf(t) + 1) % e.length];
1628
+ }
1629
+ function bn(e, t) {
1630
+ let n = e.ownerDocument;
1631
+ e.textContent = "";
1632
+ for (let r of C(t)) {
1633
+ let t = n.createElement("div");
1634
+ r.bullet && (t.className = gn);
1635
+ for (let e of r.runs) {
1636
+ let r = n.createTextNode(e.text);
1637
+ e.italic && (r = xn(n, "i", r)), e.bold && (r = xn(n, "b", r)), t.appendChild(r);
1638
+ }
1639
+ r.runs.length === 0 && t.appendChild(n.createElement("br")), e.appendChild(t);
1640
+ }
1641
+ }
1642
+ function xn(e, t, n) {
1643
+ let r = e.createElement(t);
1644
+ return r.appendChild(n), r;
1645
+ }
1646
+ function Sn(e) {
1647
+ let t = [], n = null, r = (e) => (n = {
1648
+ bullet: e,
1649
+ runs: []
1650
+ }, t.push(n), n), i = (e, t, o) => {
1651
+ if (e.nodeType === Node.TEXT_NODE) {
1652
+ (e.nodeValue ?? "").split("\n").forEach((e, i) => {
1653
+ i > 0 && r(!1), (n ?? r(!1)).runs.push({
1654
+ text: e,
1655
+ bold: t,
1656
+ italic: o
1657
+ });
1658
+ });
1659
+ return;
1660
+ }
1661
+ if (e.nodeType !== Node.ELEMENT_NODE) return;
1662
+ let s = e;
1663
+ if (s.tagName === "BR") {
1664
+ s.nextSibling && r(!1);
1665
+ return;
1666
+ }
1667
+ if (Cn(s.tagName)) {
1668
+ a(s);
1669
+ return;
1670
+ }
1671
+ let c = wn(s, t, o);
1672
+ for (let e of s.childNodes) i(e, c.bold, c.italic);
1673
+ }, a = (e) => {
1674
+ r(e.classList.contains("bullet") || e.tagName === "LI");
1675
+ for (let t of e.childNodes) i(t, !1, !1);
1676
+ n = null;
1677
+ };
1678
+ for (let t of e.childNodes) i(t, !1, !1);
1679
+ return ye(t);
1680
+ }
1681
+ function Cn(e) {
1682
+ return e === "DIV" || e === "P" || e === "LI";
1683
+ }
1684
+ function wn(e, t, n) {
1685
+ let r = e.tagName;
1686
+ (r === "B" || r === "STRONG") && (t = !0), (r === "I" || r === "EM") && (n = !0);
1687
+ let i = e.style.fontWeight;
1688
+ i && (t = i === "bold" || i === "bolder" || Number.parseInt(i, 10) >= 600);
1689
+ let a = e.style.fontStyle;
1690
+ return a && (n = a === "italic" || a === "oblique"), {
1691
+ bold: t,
1692
+ italic: n
1693
+ };
1694
+ }
1695
+ function Tn(e) {
1696
+ let t = e.ownerDocument, n = t.getSelection();
1697
+ if (!n) return;
1698
+ let r = t.createRange();
1699
+ r.selectNodeContents(e), n.removeAllRanges(), n.addRange(r);
1700
+ }
1701
+ function En(e, t) {
1702
+ let n = e.ownerDocument;
1703
+ if (typeof n.execCommand == "function" && n.execCommand("insertText", !1, t)) return;
1704
+ let r = n.getSelection();
1705
+ if (!r || r.rangeCount === 0) return;
1706
+ let i = r.getRangeAt(0);
1707
+ if (!e.contains(i.commonAncestorContainer)) return;
1708
+ i.deleteContents();
1709
+ let a = n.createTextNode(t);
1710
+ i.insertNode(a), i.setStartAfter(a), i.collapse(!0), r.removeAllRanges(), r.addRange(i);
1711
+ }
1712
+ function Dn(e) {
1713
+ let t = e.ownerDocument.getSelection();
1714
+ if (!t || t.rangeCount === 0) return [];
1715
+ let n = t.getRangeAt(0);
1716
+ return e.contains(n.commonAncestorContainer) ? Array.from(e.children).filter((e) => n.intersectsNode(e)) : [];
1717
+ }
1718
+ function On(e) {
1719
+ kn(e);
1720
+ let t = Dn(e);
1721
+ if (t.length === 0) return;
1722
+ let n = t.every((e) => e.classList.contains(gn));
1723
+ for (let e of t) e.classList.toggle(gn, !n);
1724
+ }
1725
+ function kn(e) {
1726
+ let t = e.ownerDocument, n = null;
1727
+ for (let r of Array.from(e.childNodes)) {
1728
+ if (r.nodeType === Node.ELEMENT_NODE && Cn(r.tagName)) {
1729
+ n = null;
1730
+ continue;
1731
+ }
1732
+ n || (n = t.createElement("div"), e.insertBefore(n, r)), n.appendChild(r);
1733
+ }
1734
+ }
1735
+ var An = {
1736
+ horizontal: {
1737
+ left: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z",
1738
+ center: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z",
1739
+ right: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"
1740
+ },
1741
+ vertical: {
1742
+ top: "M8 11h3v10h2V11h3l-4-4-4 4zM4 3v2h16V3H4z",
1743
+ middle: "M8 19h3v4h2v-4h3l-4-4-4 4zm8-14h-3V1h-2v4H8l4 4 4-4zM4 11v2h16v-2H4z",
1744
+ bottom: "M16 13h-3V3h-2v10H8l4 4 4-4zM4 19v2h16v-2H4z"
1745
+ }
1746
+ };
1747
+ function jn(e, t) {
1748
+ let n = e.createElement("div");
1749
+ n.className = "event-storming-note-toolbar";
1750
+ let r = (r, i, a) => {
1751
+ let o = e.createElement("button");
1752
+ o.type = "button", o.setAttribute("data-action", r), o.title = i, o.innerHTML = a, o.addEventListener("mousedown", (e) => e.preventDefault()), o.addEventListener("click", () => t(r)), n.appendChild(o);
1753
+ };
1754
+ r("note-bold", "Bold (Cmd/Ctrl+B)", "<b>B</b>"), r("note-italic", "Italic (Cmd/Ctrl+I)", "<i>I</i>"), r("note-bullet", "Bullet list", "•");
1755
+ let i = e.createElement("span");
1756
+ 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;
1757
+ }
1758
+ function Mn(e, t, n) {
1759
+ e.innerHTML = Q(An[t][n] ?? "", 16), e.title = t === "horizontal" ? `Horizontal alignment: ${n} (click to cycle)` : `Vertical alignment: ${n} (click to cycle)`;
1760
+ }
1761
+ function Nn(e, t) {
1762
+ e.style.textAlign = t.horizontal, e.style.justifyContent = t.vertical === "top" ? "flex-start" : t.vertical === "middle" ? "center" : "flex-end";
1763
+ }
1764
+ //#endregion
1765
+ //#region src/label-editing/EventStormingLabelEditing.ts
1766
+ function Pn(e) {
1767
+ return e.replace(/(?<!:)\/\//g, "∕∕").replace(/\/\*/g, "∕*").replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
1768
+ }
1769
+ var Fn = class {
1770
+ canvas;
1771
+ modeling;
1772
+ static $inject = [
1773
+ "eventBus",
1774
+ "canvas",
1775
+ "eventStormingModeling"
1776
+ ];
1777
+ active = null;
1778
+ constructor(e, t, n) {
1779
+ this.canvas = t, this.modeling = n, e.on("element.dblclick", (e) => {
1780
+ M(e.element) ? this.activate(e.element) : N(e.element) && this.activateConnection(e.element);
1781
+ }), e.on([
1782
+ "element.mousedown",
1783
+ "drag.init",
1784
+ "canvas.viewbox.changing"
1785
+ ], () => this.active?.commit());
1786
+ }
1787
+ activate(e) {
1788
+ if (this.active?.commit(), e.eventStormingType === "drawing") return;
1789
+ if (e.eventStormingType === "note") {
1790
+ this.activateNote(e);
1791
+ return;
1792
+ }
1793
+ 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");
1794
+ 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();
1795
+ let s = !1, c = () => {
1796
+ s || (s = !0, o.removeEventListener("keydown", u), o.removeEventListener("blur", d), o.remove(), this.active = null);
1797
+ }, l = () => {
1798
+ if (s) return;
1799
+ let t = Pn(o.value), n = t && t !== e.eventStormingLabel;
1800
+ c(), n && this.modeling.updateLabel(e, t);
1801
+ }, u = (e) => {
1802
+ if (e.key === "Escape") {
1803
+ e.preventDefault(), c();
1804
+ return;
1805
+ }
1806
+ if (e.key === "Enter") {
1807
+ if (!(e.metaKey || e.ctrlKey)) return;
1808
+ e.preventDefault(), l();
1809
+ }
1810
+ }, d = () => l();
1811
+ o.addEventListener("keydown", u), o.addEventListener("blur", d), this.active = {
1812
+ field: o,
1813
+ commit: l,
1814
+ cleanup: c
1815
+ };
1816
+ }
1817
+ activateNote(e) {
1818
+ 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");
1819
+ 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`, bn(o, e.eventStormingLabel ?? "");
1820
+ let s = {
1821
+ horizontal: e.alignHorizontal ?? "left",
1822
+ vertical: e.alignVertical ?? "top"
1823
+ };
1824
+ Nn(o, s);
1825
+ let c = jn(document, (e) => m(e));
1826
+ 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(), Tn(o);
1827
+ let l = (e) => c.querySelector(`[data-action="${e}"]`), u = (e, t) => {
1828
+ let n = l(e);
1829
+ n?.classList.toggle("active", t), n?.setAttribute("aria-pressed", String(t));
1830
+ }, d = () => {
1831
+ u("note-bold", Ln("bold")), u("note-italic", Ln("italic"));
1832
+ let e = Dn(o);
1833
+ u("note-bullet", e.length > 0 && e.every((e) => e.classList.contains("bullet")));
1834
+ let t = l("note-align-horizontal");
1835
+ t && Mn(t, "horizontal", s.horizontal);
1836
+ let n = l("note-align-vertical");
1837
+ n && Mn(n, "vertical", s.vertical);
1838
+ }, f = (e) => {
1839
+ typeof document.execCommand == "function" && document.execCommand(e, !1), d();
1840
+ }, p = (e) => {
1841
+ e === "horizontal" ? s.horizontal = yn(_n, s.horizontal) : s.vertical = yn(vn, s.vertical), Nn(o, s), d();
1842
+ }, m = (e) => {
1843
+ e === "note-bold" ? f("bold") : e === "note-italic" ? f("italic") : e === "note-bullet" ? (On(o), d()) : p(e === "note-align-horizontal" ? "horizontal" : "vertical");
1844
+ }, h = () => d();
1845
+ document.addEventListener("selectionchange", h);
1846
+ let g = !1, _ = () => {
1847
+ g || (g = !0, document.removeEventListener("selectionchange", h), o.removeEventListener("keydown", y), o.removeEventListener("blur", b), o.removeEventListener("paste", x), o.remove(), c.remove(), this.active = null);
1848
+ }, v = () => {
1849
+ if (g) return;
1850
+ let t = In(e, Pn(Sn(o)), s);
1851
+ _(), t && this.modeling.updateProperties(e, t);
1852
+ }, y = (e) => {
1853
+ if (e.key === "Escape") {
1854
+ e.preventDefault(), _();
1855
+ return;
1856
+ }
1857
+ if (e.key === "Enter") {
1858
+ if (!(e.metaKey || e.ctrlKey)) return;
1859
+ e.preventDefault(), v();
1860
+ return;
1861
+ }
1862
+ let t = e.key.toLowerCase();
1863
+ (e.metaKey || e.ctrlKey) && (t === "b" || t === "i") && (e.preventDefault(), f(t === "b" ? "bold" : "italic"));
1864
+ }, b = (e) => {
1865
+ e.relatedTarget instanceof Node && c.contains(e.relatedTarget) || v();
1866
+ }, x = (e) => {
1867
+ e.preventDefault();
1868
+ let t = e.clipboardData?.getData("text/plain") ?? "";
1869
+ t && En(o, t);
1870
+ };
1871
+ o.addEventListener("keydown", y), o.addEventListener("blur", b), o.addEventListener("paste", x), d(), this.active = {
1872
+ field: o,
1873
+ commit: v,
1874
+ cleanup: _
1875
+ };
1876
+ }
1877
+ activateConnection(e) {
1878
+ this.active?.commit();
1879
+ let t = this.canvas.getContainer(), n = this.canvas.zoom(), r = this.canvas.viewbox(), i = e.waypoints[0], a = e.waypoints[e.waypoints.length - 1];
1880
+ if (!i || !a) return;
1881
+ let o = document.createElement("input");
1882
+ 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();
1883
+ let s = !1, c = () => {
1884
+ s || (s = !0, o.removeEventListener("keydown", u), o.removeEventListener("blur", d), o.remove(), this.active = null);
1885
+ }, l = () => {
1886
+ if (s) return;
1887
+ let t = Pn(o.value), n = e.linkLabel ?? "";
1888
+ c(), t !== n && this.modeling.updateProperties(e, { linkLabel: t || void 0 });
1889
+ }, u = (e) => {
1890
+ e.key === "Escape" ? (e.preventDefault(), c()) : e.key === "Enter" && (e.preventDefault(), l());
1891
+ }, d = () => l();
1892
+ o.addEventListener("keydown", u), o.addEventListener("blur", d), this.active = {
1893
+ field: o,
1894
+ commit: l,
1895
+ cleanup: c
1896
+ };
1897
+ }
1898
+ cancel() {
1899
+ this.active?.cleanup();
1900
+ }
1901
+ };
1902
+ function In(e, t, n) {
1903
+ let r = !!t && t !== e.eventStormingLabel, i = n.horizontal !== (e.alignHorizontal ?? "left") || n.vertical !== (e.alignVertical ?? "top");
1904
+ if (!r && !i) return null;
1905
+ let a = {};
1906
+ if (r && (a.eventStormingLabel = t, !Te(e.eventStormingLabel, e))) {
1907
+ let { width: n, height: r } = O(t);
1908
+ a.width = n, a.height = r, a.x = e.x + e.width / 2 - n / 2, a.y = e.y + e.height / 2 - r / 2;
1909
+ }
1910
+ return i && (a.alignHorizontal = n.horizontal === "left" ? void 0 : n.horizontal, a.alignVertical = n.vertical === "top" ? void 0 : n.vertical), a;
1911
+ }
1912
+ function Ln(e) {
1913
+ if (typeof document.queryCommandState != "function") return !1;
1914
+ try {
1915
+ return document.queryCommandState(e);
1916
+ } catch {
1917
+ return !1;
1918
+ }
1919
+ }
1920
+ //#endregion
1921
+ //#region src/label-editing/index.ts
1922
+ var Rn = {
1923
+ __init__: ["eventStormingLabelEditing"],
1924
+ eventStormingLabelEditing: ["type", Fn]
1925
+ }, zn = 2, Bn = 10, Vn = {
1926
+ arrowleft: {
1927
+ x: -1,
1928
+ y: 0
1929
+ },
1930
+ arrowright: {
1931
+ x: 1,
1932
+ y: 0
1933
+ },
1934
+ arrowup: {
1935
+ x: 0,
1936
+ y: -1
1937
+ },
1938
+ arrowdown: {
1939
+ x: 0,
1940
+ y: 1
1941
+ }
1942
+ }, Hn = class {
1943
+ static $inject = [
1944
+ "canvas",
1945
+ "commandStack",
1946
+ "selection",
1947
+ "modeling",
1948
+ "eventStormingCopyPaste",
1949
+ "eventStormingElementFactory",
1950
+ "create",
1951
+ "mouse",
1952
+ "lassoTool",
1953
+ "eventBus"
1954
+ ];
1955
+ constructor(e, t, n, r, i, a, o, s, c, l) {
1956
+ let u = e.getContainer();
1957
+ u.hasAttribute("tabindex") || u.setAttribute("tabindex", "0");
1958
+ let d = (e) => {
1959
+ if (Un(e.target)) return;
1960
+ let l = e.ctrlKey || e.metaKey, u = e.key.toLowerCase();
1961
+ if (l && u === "z" && !e.shiftKey) e.preventDefault(), t.undo();
1962
+ else if (l && u === "z" && e.shiftKey || l && u === "y") e.preventDefault(), t.redo();
1963
+ else if (l && u === "c") i.copy() && e.preventDefault();
1964
+ else if (l && u === "v") i.paste() && e.preventDefault();
1965
+ else if (l && u === "d") e.preventDefault(), i.duplicate();
1966
+ else if (u === "delete" || u === "backspace") {
1967
+ let t = n.get();
1968
+ t.length && (e.preventDefault(), r.removeElements(t));
1969
+ } else if (!l && !e.altKey && (u === "e" || u === "c")) {
1970
+ let t = s.getLastMoveEvent();
1971
+ if (t) {
1972
+ e.preventDefault();
1973
+ let n = u === "e" ? a.createNew("event", w.event.label) : a.createNew("command", w.command.label);
1974
+ o.start(t, n);
1975
+ }
1976
+ } else if (!l && !e.altKey && u === "l") {
1977
+ e.preventDefault();
1978
+ let t = s.getLastMoveEvent();
1979
+ c.activateSelection(t ?? e, !!t);
1980
+ } else if (u in Vn && !l) {
1981
+ let t = n.get();
1982
+ if (t.length) {
1983
+ e.preventDefault();
1984
+ let n = e.shiftKey ? Bn : zn, i = Vn[u];
1985
+ r.moveElements(t, {
1986
+ x: i.x * n,
1987
+ y: i.y * n
1988
+ });
1989
+ }
1990
+ }
1991
+ };
1992
+ document.addEventListener("keydown", d), l.on("diagram.destroy", () => document.removeEventListener("keydown", d));
1993
+ }
1994
+ };
1995
+ function Un(e) {
1996
+ if (!(e instanceof HTMLElement)) return !1;
1997
+ let t = e.tagName;
1998
+ return t === "INPUT" || t === "TEXTAREA" || e.isContentEditable;
1999
+ }
2000
+ //#endregion
2001
+ //#region src/keyboard/index.ts
2002
+ var Wn = {
2003
+ __init__: ["eventStormingKeyboard"],
2004
+ eventStormingKeyboard: ["type", Hn]
2005
+ }, Gn = 500, Kn = 6, qn = class {
2006
+ static $inject = ["injector", "eventBus"];
2007
+ constructor(e, t) {
2008
+ 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;
2009
+ t.on("diagram.destroy", () => {
2010
+ s = !0;
2011
+ }), n && (t.on("create.move", (e) => {
2012
+ let { context: t } = e, r = t.source;
2013
+ if (!r) return;
2014
+ let i = t.canExecute && t.canExecute.connect;
2015
+ n.drawPreview(t, i ?? !1, {
2016
+ source: r,
2017
+ connectionStart: {
2018
+ x: r.x + r.width / 2,
2019
+ y: r.y + r.height / 2
2020
+ },
2021
+ connectionEnd: {
2022
+ x: e.x,
2023
+ y: e.y
2024
+ }
2025
+ });
2026
+ }), t.on([
2027
+ "create.end",
2028
+ "create.cancel",
2029
+ "create.cleanup"
2030
+ ], (e) => {
2031
+ n.cleanUp(e.context);
2032
+ }));
2033
+ let c = (e) => {
2034
+ if (s || !e.parent || !i || !a || !o) return;
2035
+ let n = o.getAbsoluteBBox(e), c = o.getContainer().getBoundingClientRect();
2036
+ if (i.open(e, Y, {
2037
+ x: c.left + n.x,
2038
+ y: c.top + n.y + n.height + Kn
2039
+ }), !i.isOpen()) {
2040
+ a.removeElements([e]);
2041
+ return;
2042
+ }
2043
+ t.once("popupMenu.close", () => {
2044
+ setTimeout(() => {
2045
+ if (!s) {
2046
+ if (e.provisional) {
2047
+ e.parent && a.removeElements([e]);
2048
+ return;
2049
+ }
2050
+ r?.activate(e);
2051
+ }
2052
+ }, 0);
2053
+ });
2054
+ };
2055
+ t.on("create.end", Gn, (e) => {
2056
+ let { context: t } = e;
2057
+ if (!t.source || !t.canExecute || !t.shape) return;
2058
+ let n = t.shape;
2059
+ if (n.provisional && i && a && o) {
2060
+ if (e.originalEvent?.type === "mousedown") {
2061
+ let e = () => {
2062
+ document.removeEventListener("click", e, !0), clearTimeout(t), setTimeout(() => c(n), 0);
2063
+ };
2064
+ document.addEventListener("click", e, !0);
2065
+ let t = setTimeout(e, 300);
2066
+ return;
2067
+ }
2068
+ setTimeout(() => c(n), 0);
2069
+ return;
2070
+ }
2071
+ r && setTimeout(() => r.activate(n), 0);
2072
+ });
2073
+ }
2074
+ }, Jn = {
2075
+ __depends__: [fe],
2076
+ __init__: ["eventStormingAppendBehavior"],
2077
+ eventStormingAppendBehavior: ["type", qn]
2078
+ }, Yn = P.map((e) => ({
2079
+ value: w[e].fill,
2080
+ title: w[e].label
2081
+ })), Xn = class {
2082
+ canvas;
2083
+ modeling;
2084
+ static $inject = [
2085
+ "canvas",
2086
+ "eventBus",
2087
+ "eventStormingModeling"
2088
+ ];
2089
+ popover;
2090
+ onDocPointer = (e) => {
2091
+ this.popover && !this.popover.contains(e.target) && this.close();
2092
+ };
2093
+ onKey = (e) => {
2094
+ e.key === "Escape" && this.close();
2095
+ };
2096
+ constructor(e, t, n) {
2097
+ this.canvas = e, this.modeling = n, t.on([
2098
+ "canvas.viewbox.changing",
2099
+ "drag.init",
2100
+ "diagram.clear"
2101
+ ], () => this.close());
2102
+ }
2103
+ open(e, t, n) {
2104
+ this.close();
2105
+ let r = this.canvas.getContainer(), i = r.getBoundingClientRect(), a = document.createElement("div");
2106
+ a.className = "event-storming-color-picker";
2107
+ let o = [{
2108
+ value: void 0,
2109
+ title: "No color",
2110
+ cls: "event-storming-cp-none"
2111
+ }, ...Yn.map((e) => ({
2112
+ value: e.value,
2113
+ title: e.title,
2114
+ cls: ""
2115
+ }))];
2116
+ for (let t of o) {
2117
+ let n = document.createElement("button");
2118
+ n.type = "button", n.className = `event-storming-cp-swatch ${t.cls}`.trim(), n.title = t.title, t.value && (n.style.background = t.value), (e.color ?? void 0) === t.value && n.classList.add("event-storming-cp-active"), n.addEventListener("click", (n) => {
2119
+ n.stopPropagation(), this.modeling.setColor(e, t.value), this.close();
2120
+ }), a.append(n);
2121
+ }
2122
+ r.appendChild(a);
2123
+ let s = r.clientWidth, c = r.clientHeight, l = a.offsetWidth, u = a.offsetHeight, d = Math.max(4, Math.min(t - i.left, s - l - 4)), f = Math.max(4, Math.min(n - i.top, c - u - 4));
2124
+ a.style.left = `${d}px`, a.style.top = `${f}px`, this.popover = a, setTimeout(() => {
2125
+ document.addEventListener("click", this.onDocPointer, !0), document.addEventListener("keydown", this.onKey, !0);
2126
+ }, 0);
2127
+ }
2128
+ close() {
2129
+ this.popover && (this.popover.remove(), this.popover = void 0, document.removeEventListener("click", this.onDocPointer, !0), document.removeEventListener("keydown", this.onKey, !0));
2130
+ }
2131
+ }, Zn = {
2132
+ __init__: ["eventStormingColorPicker"],
2133
+ eventStormingColorPicker: ["type", Xn]
2134
+ }, Qn = {
2135
+ __init__: ["eventStormingOrderingProvider"],
2136
+ eventStormingOrderingProvider: ["type", class extends pe {
2137
+ static $inject = ["eventBus"];
2138
+ constructor(e) {
2139
+ super(e);
2140
+ }
2141
+ getOrdering(e, t) {
2142
+ for (; t.parent;) t = t.parent;
2143
+ let n = t.children ?? [];
2144
+ if (N(e)) {
2145
+ let r = n.filter((t) => t !== e && (B(t) || N(t))).length;
2146
+ return {
2147
+ parent: t,
2148
+ index: r
2149
+ };
2150
+ }
2151
+ if (B(e)) {
2152
+ let r = n.filter((t) => t !== e && B(t)).length;
2153
+ return {
2154
+ parent: t,
2155
+ index: r
2156
+ };
2157
+ }
2158
+ return { parent: t };
2159
+ }
2160
+ }]
2161
+ }, $n = 12, er = class {
2162
+ canvas;
2163
+ eventBus;
2164
+ modeling;
2165
+ selection;
2166
+ factory;
2167
+ static $inject = [
2168
+ "canvas",
2169
+ "eventBus",
2170
+ "modeling",
2171
+ "selection",
2172
+ "eventStormingElementFactory"
2173
+ ];
2174
+ active = !1;
2175
+ points = [];
2176
+ cursor = null;
2177
+ layer = null;
2178
+ constructor(e, t, n, r, i) {
2179
+ this.canvas = e, this.eventBus = t, this.modeling = n, this.selection = r, this.factory = i, t.on("diagram.destroy", () => this.cancel());
2180
+ }
2181
+ isActive() {
2182
+ return this.active;
2183
+ }
2184
+ toggle() {
2185
+ this.active ? this.cancel() : this.activate();
2186
+ }
2187
+ outerContainer() {
2188
+ let e = this.canvas.getContainer();
2189
+ return e.closest(".event-storming-container") ?? e;
2190
+ }
2191
+ activate() {
2192
+ if (this.active) return;
2193
+ this.active = !0, this.points = [], this.cursor = null;
2194
+ let e = this.canvas.getContainer();
2195
+ this.outerContainer().classList.add("event-storming-draw-mode"), e.addEventListener("mousedown", this.onMouseDown, !0), e.addEventListener("dblclick", this.onDblClick, !0), e.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("keydown", this.onKeyDown, !0), this.eventBus.fire("tool-manager.update", { tool: "draw" });
2196
+ }
2197
+ finish() {
2198
+ let e = [...this.points];
2199
+ if (this.deactivate(), e.length < 2) return;
2200
+ let t = this.factory.drawingFromCanvasPoints(e), n = this.modeling.createShape(t, {
2201
+ x: t.x + t.width / 2,
2202
+ y: t.y + t.height / 2
2203
+ }, this.canvas.getRootElement());
2204
+ this.selection.select(n);
2205
+ }
2206
+ finishClosed() {
2207
+ let e = [...this.points];
2208
+ if (this.deactivate(), e.length < 3) return;
2209
+ let t = this.factory.drawingFromCanvasPoints(e, { closed: !0 }), n = this.modeling.createShape(t, {
2210
+ x: t.x + t.width / 2,
2211
+ y: t.y + t.height / 2
2212
+ }, this.canvas.getRootElement());
2213
+ this.selection.select(n);
2214
+ }
2215
+ cancel() {
2216
+ this.deactivate();
2217
+ }
2218
+ deactivate() {
2219
+ if (!this.active) return;
2220
+ this.active = !1;
2221
+ let e = this.canvas.getContainer();
2222
+ this.outerContainer().classList.remove("event-storming-draw-mode"), e.removeEventListener("mousedown", this.onMouseDown, !0), e.removeEventListener("dblclick", this.onDblClick, !0), e.removeEventListener("mousemove", this.onMouseMove, !0), document.removeEventListener("keydown", this.onKeyDown, !0), this.points = [], this.cursor = null, this.clearPreview(), this.eventBus.fire("tool-manager.update", { tool: null });
2223
+ }
2224
+ toCanvasPoint(e) {
2225
+ let t = this.canvas.getContainer().getBoundingClientRect(), n = this.canvas.viewbox(), r = this.canvas.zoom();
2226
+ return {
2227
+ x: (e.clientX - t.left) / r + n.x,
2228
+ y: (e.clientY - t.top) / r + n.y
2229
+ };
2230
+ }
2231
+ isChromeTarget(e) {
2232
+ return !!e.target?.closest(".djs-palette, .djs-context-pad, .event-storming-color-picker");
2233
+ }
2234
+ onMouseDown = (e) => {
2235
+ if (e.button !== 0 || this.isChromeTarget(e)) return;
2236
+ e.preventDefault(), e.stopPropagation();
2237
+ let t = this.toCanvasPoint(e), n = this.points[0];
2238
+ if (n && this.points.length >= 3 && tr(t, n) <= $n) {
2239
+ this.finishClosed();
2240
+ return;
2241
+ }
2242
+ let r = this.points[this.points.length - 1];
2243
+ if (r && tr(t, r) <= $n) {
2244
+ this.points.length >= 2 && this.finish();
2245
+ return;
2246
+ }
2247
+ this.points.push(t), this.renderPreview();
2248
+ };
2249
+ onDblClick = (e) => {
2250
+ this.isChromeTarget(e) || (e.preventDefault(), e.stopPropagation(), this.finish());
2251
+ };
2252
+ onMouseMove = (e) => {
2253
+ this.points.length && (this.cursor = this.toCanvasPoint(e), this.renderPreview());
2254
+ };
2255
+ onKeyDown = (e) => {
2256
+ e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), this.points.length >= 2 ? this.finish() : this.cancel()) : e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), this.finish());
2257
+ };
2258
+ renderPreview() {
2259
+ if (this.clearPreview(), !this.points.length) return;
2260
+ let e = this.canvas.getLayer("event-storming-draw-preview", 1e3), t = m("g"), n = this.cursor ? [...this.points, this.cursor] : this.points;
2261
+ f(t, p(m("polyline"), {
2262
+ points: n.map((e) => `${e.x},${e.y}`).join(" "),
2263
+ fill: "none",
2264
+ stroke: A,
2265
+ "stroke-width": 2,
2266
+ "stroke-linecap": "round",
2267
+ "stroke-linejoin": "round",
2268
+ "stroke-dasharray": "5 4"
2269
+ }));
2270
+ let r = this.points[0];
2271
+ if (f(t, p(m("circle"), {
2272
+ cx: r.x,
2273
+ cy: r.y,
2274
+ r: this.points.length >= 3 ? 5 : 3,
2275
+ fill: k.paper,
2276
+ stroke: A,
2277
+ "stroke-width": 1.5
2278
+ })), this.points.length >= 2) {
2279
+ let e = this.points[this.points.length - 1];
2280
+ f(t, p(m("circle"), {
2281
+ cx: e.x,
2282
+ cy: e.y,
2283
+ r: 5,
2284
+ fill: k.paper,
2285
+ stroke: A,
2286
+ "stroke-width": 1.5
2287
+ }));
2288
+ }
2289
+ f(e, t), this.layer = t;
2290
+ }
2291
+ clearPreview() {
2292
+ this.layer &&= (h(this.layer), null);
2293
+ }
2294
+ };
2295
+ function tr(e, t) {
2296
+ return Math.hypot(e.x - t.x, e.y - t.y);
2297
+ }
2298
+ //#endregion
2299
+ //#region src/draw-tool/EventStormingDrawingHandles.ts
2300
+ var nr = class {
2301
+ eventBus;
2302
+ canvas;
2303
+ modeling;
2304
+ static $inject = [
2305
+ "eventBus",
2306
+ "canvas",
2307
+ "eventStormingModeling"
2308
+ ];
2309
+ shape = null;
2310
+ group = null;
2311
+ dragPreview = null;
2312
+ constructor(e, t, n) {
2313
+ this.eventBus = e, this.canvas = t, this.modeling = n, e.on("selection.changed", (e) => {
2314
+ let t = e.newSelection ?? [], n = t.length === 1 ? t[0] : null;
2315
+ this.attach(B(n) ? n : null);
2316
+ }), e.on("element.changed", (e) => {
2317
+ this.shape && e.element === this.shape && this.render();
2318
+ }), e.on(["diagram.clear", "diagram.destroy"], () => this.attach(null));
2319
+ }
2320
+ attach(e) {
2321
+ this.shape = e, this.render();
2322
+ }
2323
+ absolutePoints() {
2324
+ let e = this.shape;
2325
+ return (e.drawingPoints ?? []).map((t) => ({
2326
+ x: e.x + t.x,
2327
+ y: e.y + t.y
2328
+ }));
2329
+ }
2330
+ render() {
2331
+ if (this.clear(), !this.shape) return;
2332
+ let e = this.canvas.getLayer("event-storming-drawing-handles", 1100), t = m("g");
2333
+ this.absolutePoints().forEach((e, n) => {
2334
+ let r = p(m("circle"), {
2335
+ cx: e.x,
2336
+ cy: e.y,
2337
+ r: 5,
2338
+ fill: k.paper,
2339
+ stroke: k.ink,
2340
+ "stroke-width": 1.5,
2341
+ class: "event-storming-drawing-handle"
2342
+ });
2343
+ r.addEventListener("mousedown", (e) => this.startDrag(e, n)), f(t, r);
2344
+ }), f(e, t), this.group = t;
2345
+ }
2346
+ startDrag(e, t) {
2347
+ if (e.button !== 0 || !this.shape) return;
2348
+ e.preventDefault(), e.stopPropagation();
2349
+ let n = this.shape, r = this.absolutePoints(), i = (e) => {
2350
+ r[t] = this.toCanvasPoint(e), this.renderDragPreview(r, !!n.closed);
2351
+ }, a = (e) => {
2352
+ document.removeEventListener("mousemove", i, !0), document.removeEventListener("mouseup", a, !0), r[t] = this.toCanvasPoint(e), this.clearDragPreview(), this.commit(n, r);
2353
+ };
2354
+ document.addEventListener("mousemove", i, !0), document.addEventListener("mouseup", a, !0);
2355
+ }
2356
+ commit(e, t) {
2357
+ let n = t.map((e) => e.x), r = t.map((e) => e.y), i = Math.min(...n), a = Math.min(...r);
2358
+ this.modeling.updateProperties(e, {
2359
+ x: i,
2360
+ y: a,
2361
+ width: Math.max(Math.max(...n) - i, 4),
2362
+ height: Math.max(Math.max(...r) - a, 4),
2363
+ drawingPoints: t.map((e) => ({
2364
+ x: e.x - i,
2365
+ y: e.y - a
2366
+ }))
2367
+ }), this.render();
2368
+ }
2369
+ renderDragPreview(e, t) {
2370
+ this.clearDragPreview();
2371
+ let n = this.canvas.getLayer("event-storming-drawing-handles", 1100), r = p(m(t ? "polygon" : "polyline"), {
2372
+ points: e.map((e) => `${e.x},${e.y}`).join(" "),
2373
+ fill: "none",
2374
+ stroke: k.ink,
2375
+ "stroke-width": 1.5,
2376
+ "stroke-dasharray": "5 4",
2377
+ "pointer-events": "none"
2378
+ });
2379
+ f(n, r), this.dragPreview = r;
2380
+ }
2381
+ clearDragPreview() {
2382
+ this.dragPreview &&= (h(this.dragPreview), null);
2383
+ }
2384
+ clear() {
2385
+ this.clearDragPreview(), this.group &&= (h(this.group), null);
2386
+ }
2387
+ toCanvasPoint(e) {
2388
+ let t = this.canvas.getContainer().getBoundingClientRect(), n = this.canvas.viewbox(), r = this.canvas.zoom();
2389
+ return {
2390
+ x: (e.clientX - t.left) / r + n.x,
2391
+ y: (e.clientY - t.top) / r + n.y
2392
+ };
2393
+ }
2394
+ }, rr = class {
2395
+ static $inject = ["eventBus", "interactionEvents"];
2396
+ constructor(e, t) {
2397
+ e.on("interactionEvents.createHit", (e) => {
2398
+ if (!(!B(e.element) || !e.gfx)) return ir(e.element, e.gfx), !1;
2399
+ }), e.on("interactionEvents.updateHit", (e) => {
2400
+ if (!(!B(e.element) || !e.gfx)) return t.removeHits(e.gfx), ir(e.element, e.gfx), !1;
2401
+ });
2402
+ }
2403
+ };
2404
+ function ir(e, t) {
2405
+ let n = e.drawingPoints ?? [], r = m(e.closed ? "polygon" : "polyline");
2406
+ p(r, {
2407
+ points: n.map((e) => `${e.x},${e.y}`).join(" "),
2408
+ class: "djs-hit djs-hit-stroke",
2409
+ fill: "none",
2410
+ stroke: "white",
2411
+ "stroke-width": 15,
2412
+ "stroke-opacity": 0
2413
+ }), f(t, r);
2414
+ }
2415
+ //#endregion
2416
+ //#region src/draw-tool/index.ts
2417
+ var ar = {
2418
+ __init__: [
2419
+ "eventStormingDrawTool",
2420
+ "eventStormingDrawingHandles",
2421
+ "eventStormingDrawingHitProvider"
2422
+ ],
2423
+ eventStormingDrawTool: ["type", er],
2424
+ eventStormingDrawingHandles: ["type", nr],
2425
+ eventStormingDrawingHitProvider: ["type", rr]
2426
+ }, or = class {
2427
+ static $inject = ["eventBus"];
2428
+ constructor(e) {
2429
+ e.on("resize.start", 1500, (e) => {
2430
+ let t = e.context;
2431
+ ke(t.shape) && (t.minDimensions = E);
2432
+ });
2433
+ }
2434
+ }, sr = {
2435
+ __depends__: [me],
2436
+ __init__: ["eventStormingResizeBehavior"],
2437
+ eventStormingResizeBehavior: ["type", or]
2438
+ }, cr = class extends _t {
2439
+ _getModules() {
2440
+ return [
2441
+ ...super._getModules(),
2442
+ b,
2443
+ ie,
2444
+ x,
2445
+ ee,
2446
+ te,
2447
+ ne,
2448
+ re,
2449
+ ae,
2450
+ oe,
2451
+ Mt,
2452
+ yt,
2453
+ Lt,
2454
+ zt,
2455
+ Wt,
2456
+ hn,
2457
+ Rn,
2458
+ Wn,
2459
+ Jt,
2460
+ Jn,
2461
+ Zn,
2462
+ Nt,
2463
+ Qn,
2464
+ ar,
2465
+ sr
2466
+ ];
2467
+ }
2468
+ undo() {
2469
+ this.get("commandStack").undo();
2470
+ }
2471
+ redo() {
2472
+ this.get("commandStack").redo();
2473
+ }
2474
+ canUndo() {
2475
+ return this.get("commandStack").canUndo();
2476
+ }
2477
+ canRedo() {
2478
+ return this.get("commandStack").canRedo();
2479
+ }
2480
+ };
2481
+ //#endregion
2482
+ export { Fe as BoardBounds, k as COLORS, qn as EventStormingAppendBehavior, vt as EventStormingAttachBehavior, _e as EventStormingBaseViewer, Xn as EventStormingColorPicker, je as EventStormingElementFactory, qt as EventStormingElementSettingsProvider, pt as EventStormingExporter, ft as EventStormingImporter, Fn as EventStormingLabelEditing, wt as EventStormingModeling, Ze as EventStormingRenderer, or as EventStormingResizeBehavior, It as EventStormingRules, Re as EventStormingViewOptions, dn as ICON_ADD, en as ICON_CODE, $t as ICON_DATA_OBJECT, Z as ICON_DELETE, tn as ICON_DOWNLOAD, X as ICON_EDIT, pn as ICON_EYE, fn as ICON_FIT, rn as ICON_FOLDER_OPEN, an as ICON_IMAGE, un as ICON_MENU, on as ICON_NEW, Yt as ICON_PERSON, Qt as ICON_REDO, nn as ICON_SHARE, Zt as ICON_UNDO, S as MIRAGON, cr as Modeler, T as NOTE_STYLE, _t as NavigatedViewer, Y as POPUP_PROVIDER_ID, Ee as ROOT_ID, P as STICKY_KINDS, w as STICKY_STYLES, Le as VIEW_OPTIONS_CHANGED_EVENT, gt as Viewer, Ie as boardBoundsModule, zt as elementSnappingModule, Jn as eventStormingAppendModule, yt as eventStormingAttachModule, Zn as eventStormingColorPickerModule, hn as eventStormingContextPadModule, ut as eventStormingDrawModule, Wn as eventStormingKeyboardModule, Ne as eventStormingModelModule, Mt as eventStormingModelingModule, Wt as eventStormingPaletteModule, Jt as eventStormingPopupModule, sr as eventStormingResizeModule, Lt as eventStormingRulesModule, V as eventStormingViewOptionsModule, Q as iconMarkup, ht as ioModule, L as isAttachableKind, Oe as isAttachableSticky, N as isEventStormingConnection, M as isEventStormingShape, R as isHostKind, z as isHostSticky, I as isSticky, F as isStickyKind, Rn as labelEditingModule, C as parseNoteMarkdown, be as plainNoteText, he as saveSVG, ye as serializeNoteMarkdown };
2483
+
2484
+ //# sourceMappingURL=index.js.map