integration-modules 0.1.14 → 0.1.15

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 (34) hide show
  1. package/dist/chunks/EmojiBoardWidget-qFIIWsdw.js +274 -0
  2. package/dist/chunks/EmojiBoardWidget-qFIIWsdw.js.map +1 -0
  3. package/dist/chunks/EmojiBoardWidget-uWxNQwpF.js +2 -0
  4. package/dist/chunks/EmojiBoardWidget-uWxNQwpF.js.map +1 -0
  5. package/dist/chunks/ShapeBoardWidget-CYvTmNUV.js +2 -0
  6. package/dist/chunks/ShapeBoardWidget-CYvTmNUV.js.map +1 -0
  7. package/dist/chunks/ShapeBoardWidget-ChVcXBBP.js +1312 -0
  8. package/dist/chunks/ShapeBoardWidget-ChVcXBBP.js.map +1 -0
  9. package/dist/chunks/constants-D-rHISmr.js +23 -0
  10. package/dist/chunks/constants-D-rHISmr.js.map +1 -0
  11. package/dist/chunks/constants-pVjh1MjZ.js +612 -0
  12. package/dist/chunks/constants-pVjh1MjZ.js.map +1 -0
  13. package/dist/emoji/index.cjs +1 -1
  14. package/dist/emoji/index.js +2 -2
  15. package/dist/index.cjs +36 -1
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.mjs +17729 -85
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/integration-modules.css +1 -1
  20. package/dist/shape/index.cjs +1 -1
  21. package/dist/shape/index.js +1 -1
  22. package/package.json +1 -1
  23. package/dist/chunks/Board-CENI1zTY.js +0 -19484
  24. package/dist/chunks/Board-CENI1zTY.js.map +0 -1
  25. package/dist/chunks/Board-DBlzUx0o.js +0 -58
  26. package/dist/chunks/Board-DBlzUx0o.js.map +0 -1
  27. package/dist/chunks/EmojiBoardWidget-94JjolG3.js +0 -197
  28. package/dist/chunks/EmojiBoardWidget-94JjolG3.js.map +0 -1
  29. package/dist/chunks/EmojiBoardWidget-jQpQl320.js +0 -2
  30. package/dist/chunks/EmojiBoardWidget-jQpQl320.js.map +0 -1
  31. package/dist/chunks/ShapeBoardWidget-C9nNKwtj.js +0 -157
  32. package/dist/chunks/ShapeBoardWidget-C9nNKwtj.js.map +0 -1
  33. package/dist/chunks/ShapeBoardWidget-D1TcdWRO.js +0 -2
  34. package/dist/chunks/ShapeBoardWidget-D1TcdWRO.js.map +0 -1
@@ -0,0 +1,1312 @@
1
+ import { j as s, u as z, D as kt } from "./constants-pVjh1MjZ.js";
2
+ import _t, { useRef as F, useState as L, useEffect as T, useMemo as bt } from "react";
3
+ import { useReactFlow as jt, NodeResizer as Et, Handle as nt, Position as rt } from "@xyflow/react";
4
+ const St = [
5
+ { id: "line", name: "Линия", defaultSize: { width: 80, height: 20 } },
6
+ { id: "arrow", name: "Стрелка", defaultSize: { width: 180, height: 60 } },
7
+ { id: "dblarrow", name: "Двойная стрелка", defaultSize: { width: 200, height: 60 } },
8
+ { id: "square", name: "Квадрат", defaultSize: { width: 140, height: 140 } },
9
+ { id: "circle", name: "Круг", defaultSize: { width: 140, height: 140 } },
10
+ { id: "triangle", name: "Треугольник", defaultSize: { width: 160, height: 150 } },
11
+ { id: "star", name: "Звезда", defaultSize: { width: 160, height: 160 } },
12
+ { id: "parallelogram", name: "Параллелограмм", defaultSize: { width: 200, height: 120 } },
13
+ { id: "stick", name: "Палка", defaultSize: { width: 20, height: 160 } },
14
+ { id: "roundedRect", name: "Скруглённый прямоугольник", defaultSize: { width: 160, height: 100 } },
15
+ { id: "capsule", name: "Капсула", defaultSize: { width: 160, height: 60 } },
16
+ { id: "pentagon", name: "Пятиугольник", defaultSize: { width: 140, height: 140 } },
17
+ { id: "chevron", name: "Галка", defaultSize: { width: 160, height: 80 } },
18
+ { id: "table3x3", name: "Таблица 3×3", defaultSize: { width: 180, height: 180 } },
19
+ { id: "pyramid", name: "Пирамида", defaultSize: { width: 160, height: 160 } },
20
+ { id: "circleArrow", name: "Круг со стрелкой", defaultSize: { width: 140, height: 140 } },
21
+ { id: "table3x3LeftMerge", name: "Таблица 3×3", defaultSize: { width: 180, height: 180 } }
22
+ ];
23
+ async function B(t) {
24
+ return await t.text() || `HTTP ${t.status}`;
25
+ }
26
+ const G = {
27
+ async getAll() {
28
+ const t = await fetch("/api/v1/shapes/get-all");
29
+ if (!t.ok)
30
+ throw new Error(await B(t));
31
+ const e = await t.json();
32
+ return Array.isArray(e) ? e : [];
33
+ },
34
+ async getById(t) {
35
+ const e = await fetch(`/api/v1/shapes/${t}`);
36
+ if (!e.ok)
37
+ throw new Error(await B(e));
38
+ return await e.json();
39
+ },
40
+ async addToBoard(t, e, n, i) {
41
+ const r = await fetch("/api/v1/shapes/board", {
42
+ method: "POST",
43
+ headers: { "Content-Type": "application/json" },
44
+ body: JSON.stringify({ shapeId: t, width: e, height: n, rotation: i })
45
+ });
46
+ if (!r.ok)
47
+ throw new Error(await B(r));
48
+ return await r.json();
49
+ },
50
+ async getBoard() {
51
+ const t = await fetch("/api/v1/shapes/board");
52
+ if (!t.ok)
53
+ throw new Error(await B(t));
54
+ const e = await t.json();
55
+ return Array.isArray(e) ? e : [];
56
+ },
57
+ async getBoardById(t) {
58
+ const e = await fetch(`/api/v1/shapes/board/${t}`);
59
+ if (!e.ok)
60
+ throw new Error(await B(e));
61
+ return await e.json();
62
+ },
63
+ async updateBoardTransform(t, e, n, i) {
64
+ const r = await fetch(`/api/v1/shapes/board/${t}/transform`, {
65
+ method: "PATCH",
66
+ headers: { "Content-Type": "application/json" },
67
+ body: JSON.stringify({ width: e, height: n, rotation: i })
68
+ });
69
+ if (!r.ok)
70
+ throw new Error(await B(r));
71
+ return await r.json();
72
+ },
73
+ async delete(t) {
74
+ const e = await fetch(`/api/v1/shapes/${t}`, { method: "DELETE" });
75
+ if (!e.ok) throw new Error(await B(e));
76
+ return !0;
77
+ }
78
+ }, it = {
79
+ line: ({ stroke: t, sw: e = 2 }) => /* @__PURE__ */ s.jsx("line", { x1: "0", y1: "50%", x2: "100%", y2: "50%", stroke: t || "#000", strokeWidth: e, vectorEffect: "non-scaling-stroke" }),
80
+ arrow: ({ stroke: t, sw: e = 2 }) => /* @__PURE__ */ s.jsxs("svg", { width: "100%", height: "100%", viewBox: "0 0 100 100", children: [
81
+ /* @__PURE__ */ s.jsx("defs", { children: /* @__PURE__ */ s.jsx(
82
+ "marker",
83
+ {
84
+ id: "arrowhead-end",
85
+ markerWidth: "10",
86
+ markerHeight: "10",
87
+ refX: "10",
88
+ refY: "5",
89
+ orient: "auto",
90
+ markerUnits: "strokeWidth",
91
+ children: /* @__PURE__ */ s.jsx("polygon", { points: "0 0, 10 5, 0 10", fill: t || "#000" })
92
+ }
93
+ ) }),
94
+ /* @__PURE__ */ s.jsx(
95
+ "line",
96
+ {
97
+ x1: "0",
98
+ y1: "50",
99
+ x2: "100",
100
+ y2: "50",
101
+ stroke: t || "#000",
102
+ strokeWidth: e,
103
+ markerEnd: "url(#arrowhead-end)",
104
+ vectorEffect: "non-scaling-stroke"
105
+ }
106
+ )
107
+ ] }),
108
+ dblarrow: ({ stroke: t, sw: e = 2 }) => /* @__PURE__ */ s.jsxs("svg", { width: "100%", height: "100%", viewBox: "0 0 100 100", children: [
109
+ /* @__PURE__ */ s.jsxs("defs", { children: [
110
+ /* @__PURE__ */ s.jsx(
111
+ "marker",
112
+ {
113
+ id: "arrowhead-end",
114
+ markerWidth: "10",
115
+ markerHeight: "10",
116
+ refX: "10",
117
+ refY: "5",
118
+ orient: "auto",
119
+ markerUnits: "strokeWidth",
120
+ children: /* @__PURE__ */ s.jsx("polygon", { points: "0 0, 10 5, 0 10", fill: t || "#000" })
121
+ }
122
+ ),
123
+ /* @__PURE__ */ s.jsx(
124
+ "marker",
125
+ {
126
+ id: "arrowhead-start",
127
+ markerWidth: "10",
128
+ markerHeight: "10",
129
+ refX: "0",
130
+ refY: "5",
131
+ orient: "auto",
132
+ markerUnits: "strokeWidth",
133
+ children: /* @__PURE__ */ s.jsx("polygon", { points: "10 0, 0 5, 10 10", fill: t || "#000" })
134
+ }
135
+ )
136
+ ] }),
137
+ /* @__PURE__ */ s.jsx(
138
+ "line",
139
+ {
140
+ x1: "0",
141
+ y1: "50",
142
+ x2: "100",
143
+ y2: "50",
144
+ stroke: t || "#000",
145
+ strokeWidth: e,
146
+ markerStart: "url(#arrowhead-start)",
147
+ markerEnd: "url(#arrowhead-end)",
148
+ vectorEffect: "non-scaling-stroke"
149
+ }
150
+ )
151
+ ] }),
152
+ square: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("rect", { width: "100%", height: "100%", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
153
+ circle: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("ellipse", { cx: "50%", cy: "50%", rx: "50%", ry: "50%", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
154
+ triangle: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("polygon", { points: "50,0 100,100 0,100", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
155
+ star: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("polygon", { points: "50,0 61,35 98,35 68,57 79,91 50,70 21,91 32,57 2,35 39,35", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
156
+ parallelogram: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("polygon", { points: "20,0 100,0 80,100 0,100", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
157
+ roundedRect: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("rect", { width: "100%", height: "100%", rx: "20", ry: "20", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
158
+ capsule: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("rect", { width: "100%", height: "100%", rx: "50", ry: "50", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
159
+ pentagon: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsx("polygon", { points: "50,0 100,38 82,100 18,100 0,38", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
160
+ chevron: ({ stroke: t, sw: e = 2 }) => /* @__PURE__ */ s.jsx("svg", { width: "100%", height: "100%", viewBox: "0 0 100 100", children: /* @__PURE__ */ s.jsx("polyline", { points: "0,0 50,100 100,0", fill: "none", stroke: t || "#000", strokeWidth: e, vectorEffect: "non-scaling-stroke" }) }),
161
+ table3x3: ({ fill: t, stroke: e, sw: n = 2, innerSw: i = 1 }) => /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
162
+ /* @__PURE__ */ s.jsx("rect", { width: "100%", height: "100%", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
163
+ /* @__PURE__ */ s.jsx("line", { x1: "0", y1: "33%", x2: "100%", y2: "33%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" }),
164
+ /* @__PURE__ */ s.jsx("line", { x1: "0", y1: "66%", x2: "100%", y2: "66%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" }),
165
+ /* @__PURE__ */ s.jsx("line", { x1: "33%", y1: "0", x2: "33%", y2: "100%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" }),
166
+ /* @__PURE__ */ s.jsx("line", { x1: "66%", y1: "0", x2: "66%", y2: "100%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" })
167
+ ] }),
168
+ table3x3LeftMerge: ({ fill: t, stroke: e, sw: n = 2, innerSw: i = 1 }) => /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
169
+ /* @__PURE__ */ s.jsx("rect", { width: "100%", height: "100%", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
170
+ /* @__PURE__ */ s.jsx("line", { x1: "33%", y1: "0", x2: "33%", y2: "100%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" }),
171
+ /* @__PURE__ */ s.jsx("line", { x1: "66%", y1: "0", x2: "66%", y2: "100%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" }),
172
+ /* @__PURE__ */ s.jsx("line", { x1: "33%", y1: "33%", x2: "100%", y2: "33%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" }),
173
+ /* @__PURE__ */ s.jsx("line", { x1: "33%", y1: "66%", x2: "100%", y2: "66%", stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" })
174
+ ] }),
175
+ pyramid: ({ fill: t, stroke: e, sw: n = 2, innerSw: i = 1 }) => /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
176
+ /* @__PURE__ */ s.jsx("polygon", { points: "50,0 100,100 0,100", fill: t || "transparent", stroke: e || "#000", strokeWidth: n, vectorEffect: "non-scaling-stroke" }),
177
+ [0.2, 0.4, 0.6, 0.8].map((r, o) => /* @__PURE__ */ s.jsx("line", { x1: 50 - 50 * r, y1: r * 100, x2: 50 + 50 * r, y2: r * 100, stroke: e || "#000", strokeWidth: i, vectorEffect: "non-scaling-stroke" }, o))
178
+ ] }),
179
+ circleArrow: ({ fill: t, stroke: e, sw: n = 2 }) => /* @__PURE__ */ s.jsxs("svg", { width: "100%", height: "100%", viewBox: "0 -30 100 130", preserveAspectRatio: "xMidYMid meet", children: [
180
+ /* @__PURE__ */ s.jsx("defs", { children: /* @__PURE__ */ s.jsx(
181
+ "marker",
182
+ {
183
+ id: "arrowhead-circle",
184
+ markerWidth: "8",
185
+ markerHeight: "8",
186
+ refX: "4",
187
+ refY: "4",
188
+ orient: "auto",
189
+ markerUnits: "strokeWidth",
190
+ children: /* @__PURE__ */ s.jsx("polygon", { points: "0 0, 8 4, 0 8", fill: e || "#000" })
191
+ }
192
+ ) }),
193
+ /* @__PURE__ */ s.jsx(
194
+ "circle",
195
+ {
196
+ cx: "50",
197
+ cy: "50",
198
+ r: "48",
199
+ fill: t || "transparent",
200
+ stroke: e || "#000",
201
+ strokeWidth: n,
202
+ vectorEffect: "non-scaling-stroke"
203
+ }
204
+ ),
205
+ /* @__PURE__ */ s.jsx(
206
+ "line",
207
+ {
208
+ x1: "50",
209
+ y1: "2",
210
+ x2: "50",
211
+ y2: "-20",
212
+ stroke: e || "#000",
213
+ strokeWidth: n,
214
+ markerEnd: "url(#arrowhead-circle)",
215
+ vectorEffect: "non-scaling-stroke"
216
+ }
217
+ )
218
+ ] })
219
+ };
220
+ var Q = "http://www.w3.org/1999/xhtml";
221
+ const st = {
222
+ svg: "http://www.w3.org/2000/svg",
223
+ xhtml: Q,
224
+ xlink: "http://www.w3.org/1999/xlink",
225
+ xml: "http://www.w3.org/XML/1998/namespace",
226
+ xmlns: "http://www.w3.org/2000/xmlns/"
227
+ };
228
+ function lt(t) {
229
+ var e = t += "", n = e.indexOf(":");
230
+ return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), st.hasOwnProperty(e) ? { space: st[e], local: t } : t;
231
+ }
232
+ function Wt(t) {
233
+ return function() {
234
+ var e = this.ownerDocument, n = this.namespaceURI;
235
+ return n === Q && e.documentElement.namespaceURI === Q ? e.createElement(t) : e.createElementNS(n, t);
236
+ };
237
+ }
238
+ function At(t) {
239
+ return function() {
240
+ return this.ownerDocument.createElementNS(t.space, t.local);
241
+ };
242
+ }
243
+ function ct(t) {
244
+ var e = lt(t);
245
+ return (e.local ? At : Wt)(e);
246
+ }
247
+ function Ct() {
248
+ }
249
+ function ht(t) {
250
+ return t == null ? Ct : function() {
251
+ return this.querySelector(t);
252
+ };
253
+ }
254
+ function Nt(t) {
255
+ typeof t != "function" && (t = ht(t));
256
+ for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
257
+ for (var o = e[r], a = o.length, l = i[r] = new Array(a), h, u, d = 0; d < a; ++d)
258
+ (h = o[d]) && (u = t.call(h, h.__data__, d, o)) && ("__data__" in h && (u.__data__ = h.__data__), l[d] = u);
259
+ return new E(i, this._parents);
260
+ }
261
+ function Bt(t) {
262
+ return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
263
+ }
264
+ function Rt() {
265
+ return [];
266
+ }
267
+ function zt(t) {
268
+ return t == null ? Rt : function() {
269
+ return this.querySelectorAll(t);
270
+ };
271
+ }
272
+ function Tt(t) {
273
+ return function() {
274
+ return Bt(t.apply(this, arguments));
275
+ };
276
+ }
277
+ function Mt(t) {
278
+ typeof t == "function" ? t = Tt(t) : t = zt(t);
279
+ for (var e = this._groups, n = e.length, i = [], r = [], o = 0; o < n; ++o)
280
+ for (var a = e[o], l = a.length, h, u = 0; u < l; ++u)
281
+ (h = a[u]) && (i.push(t.call(h, h.__data__, u, a)), r.push(h));
282
+ return new E(i, r);
283
+ }
284
+ function Pt(t) {
285
+ return function() {
286
+ return this.matches(t);
287
+ };
288
+ }
289
+ function ut(t) {
290
+ return function(e) {
291
+ return e.matches(t);
292
+ };
293
+ }
294
+ var It = Array.prototype.find;
295
+ function Ft(t) {
296
+ return function() {
297
+ return It.call(this.children, t);
298
+ };
299
+ }
300
+ function Lt() {
301
+ return this.firstElementChild;
302
+ }
303
+ function Ht(t) {
304
+ return this.select(t == null ? Lt : Ft(typeof t == "function" ? t : ut(t)));
305
+ }
306
+ var Dt = Array.prototype.filter;
307
+ function Ot() {
308
+ return Array.from(this.children);
309
+ }
310
+ function Vt(t) {
311
+ return function() {
312
+ return Dt.call(this.children, t);
313
+ };
314
+ }
315
+ function qt(t) {
316
+ return this.selectAll(t == null ? Ot : Vt(typeof t == "function" ? t : ut(t)));
317
+ }
318
+ function Xt(t) {
319
+ typeof t != "function" && (t = Pt(t));
320
+ for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
321
+ for (var o = e[r], a = o.length, l = i[r] = [], h, u = 0; u < a; ++u)
322
+ (h = o[u]) && t.call(h, h.__data__, u, o) && l.push(h);
323
+ return new E(i, this._parents);
324
+ }
325
+ function ft(t) {
326
+ return new Array(t.length);
327
+ }
328
+ function $t() {
329
+ return new E(this._enter || this._groups.map(ft), this._parents);
330
+ }
331
+ function Y(t, e) {
332
+ this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
333
+ }
334
+ Y.prototype = {
335
+ constructor: Y,
336
+ appendChild: function(t) {
337
+ return this._parent.insertBefore(t, this._next);
338
+ },
339
+ insertBefore: function(t, e) {
340
+ return this._parent.insertBefore(t, e);
341
+ },
342
+ querySelector: function(t) {
343
+ return this._parent.querySelector(t);
344
+ },
345
+ querySelectorAll: function(t) {
346
+ return this._parent.querySelectorAll(t);
347
+ }
348
+ };
349
+ function Ut(t) {
350
+ return function() {
351
+ return t;
352
+ };
353
+ }
354
+ function Yt(t, e, n, i, r, o) {
355
+ for (var a = 0, l, h = e.length, u = o.length; a < u; ++a)
356
+ (l = e[a]) ? (l.__data__ = o[a], i[a] = l) : n[a] = new Y(t, o[a]);
357
+ for (; a < h; ++a)
358
+ (l = e[a]) && (r[a] = l);
359
+ }
360
+ function Kt(t, e, n, i, r, o, a) {
361
+ var l, h, u = /* @__PURE__ */ new Map(), d = e.length, m = o.length, f = new Array(d), k;
362
+ for (l = 0; l < d; ++l)
363
+ (h = e[l]) && (f[l] = k = a.call(h, h.__data__, l, e) + "", u.has(k) ? r[l] = h : u.set(k, h));
364
+ for (l = 0; l < m; ++l)
365
+ k = a.call(t, o[l], l, o) + "", (h = u.get(k)) ? (i[l] = h, h.__data__ = o[l], u.delete(k)) : n[l] = new Y(t, o[l]);
366
+ for (l = 0; l < d; ++l)
367
+ (h = e[l]) && u.get(f[l]) === h && (r[l] = h);
368
+ }
369
+ function Jt(t) {
370
+ return t.__data__;
371
+ }
372
+ function Zt(t, e) {
373
+ if (!arguments.length) return Array.from(this, Jt);
374
+ var n = e ? Kt : Yt, i = this._parents, r = this._groups;
375
+ typeof t != "function" && (t = Ut(t));
376
+ for (var o = r.length, a = new Array(o), l = new Array(o), h = new Array(o), u = 0; u < o; ++u) {
377
+ var d = i[u], m = r[u], f = m.length, k = Gt(t.call(d, d && d.__data__, u, i)), _ = k.length, S = l[u] = new Array(_), W = a[u] = new Array(_), N = h[u] = new Array(f);
378
+ n(d, m, S, W, N, k, e);
379
+ for (var A = 0, j = 0, c, y; A < _; ++A)
380
+ if (c = S[A]) {
381
+ for (A >= j && (j = A + 1); !(y = W[j]) && ++j < _; ) ;
382
+ c._next = y || null;
383
+ }
384
+ }
385
+ return a = new E(a, i), a._enter = l, a._exit = h, a;
386
+ }
387
+ function Gt(t) {
388
+ return typeof t == "object" && "length" in t ? t : Array.from(t);
389
+ }
390
+ function Qt() {
391
+ return new E(this._exit || this._groups.map(ft), this._parents);
392
+ }
393
+ function te(t, e, n) {
394
+ var i = this.enter(), r = this, o = this.exit();
395
+ return typeof t == "function" ? (i = t(i), i && (i = i.selection())) : i = i.append(t + ""), e != null && (r = e(r), r && (r = r.selection())), n == null ? o.remove() : n(o), i && r ? i.merge(r).order() : r;
396
+ }
397
+ function ee(t) {
398
+ for (var e = t.selection ? t.selection() : t, n = this._groups, i = e._groups, r = n.length, o = i.length, a = Math.min(r, o), l = new Array(r), h = 0; h < a; ++h)
399
+ for (var u = n[h], d = i[h], m = u.length, f = l[h] = new Array(m), k, _ = 0; _ < m; ++_)
400
+ (k = u[_] || d[_]) && (f[_] = k);
401
+ for (; h < r; ++h)
402
+ l[h] = n[h];
403
+ return new E(l, this._parents);
404
+ }
405
+ function ne() {
406
+ for (var t = this._groups, e = -1, n = t.length; ++e < n; )
407
+ for (var i = t[e], r = i.length - 1, o = i[r], a; --r >= 0; )
408
+ (a = i[r]) && (o && a.compareDocumentPosition(o) ^ 4 && o.parentNode.insertBefore(a, o), o = a);
409
+ return this;
410
+ }
411
+ function re(t) {
412
+ t || (t = ie);
413
+ function e(m, f) {
414
+ return m && f ? t(m.__data__, f.__data__) : !m - !f;
415
+ }
416
+ for (var n = this._groups, i = n.length, r = new Array(i), o = 0; o < i; ++o) {
417
+ for (var a = n[o], l = a.length, h = r[o] = new Array(l), u, d = 0; d < l; ++d)
418
+ (u = a[d]) && (h[d] = u);
419
+ h.sort(e);
420
+ }
421
+ return new E(r, this._parents).order();
422
+ }
423
+ function ie(t, e) {
424
+ return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
425
+ }
426
+ function se() {
427
+ var t = arguments[0];
428
+ return arguments[0] = this, t.apply(null, arguments), this;
429
+ }
430
+ function oe() {
431
+ return Array.from(this);
432
+ }
433
+ function ae() {
434
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
435
+ for (var i = t[e], r = 0, o = i.length; r < o; ++r) {
436
+ var a = i[r];
437
+ if (a) return a;
438
+ }
439
+ return null;
440
+ }
441
+ function le() {
442
+ let t = 0;
443
+ for (const e of this) ++t;
444
+ return t;
445
+ }
446
+ function ce() {
447
+ return !this.node();
448
+ }
449
+ function he(t) {
450
+ for (var e = this._groups, n = 0, i = e.length; n < i; ++n)
451
+ for (var r = e[n], o = 0, a = r.length, l; o < a; ++o)
452
+ (l = r[o]) && t.call(l, l.__data__, o, r);
453
+ return this;
454
+ }
455
+ function ue(t) {
456
+ return function() {
457
+ this.removeAttribute(t);
458
+ };
459
+ }
460
+ function fe(t) {
461
+ return function() {
462
+ this.removeAttributeNS(t.space, t.local);
463
+ };
464
+ }
465
+ function de(t, e) {
466
+ return function() {
467
+ this.setAttribute(t, e);
468
+ };
469
+ }
470
+ function ge(t, e) {
471
+ return function() {
472
+ this.setAttributeNS(t.space, t.local, e);
473
+ };
474
+ }
475
+ function pe(t, e) {
476
+ return function() {
477
+ var n = e.apply(this, arguments);
478
+ n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
479
+ };
480
+ }
481
+ function ye(t, e) {
482
+ return function() {
483
+ var n = e.apply(this, arguments);
484
+ n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
485
+ };
486
+ }
487
+ function xe(t, e) {
488
+ var n = lt(t);
489
+ if (arguments.length < 2) {
490
+ var i = this.node();
491
+ return n.local ? i.getAttributeNS(n.space, n.local) : i.getAttribute(n);
492
+ }
493
+ return this.each((e == null ? n.local ? fe : ue : typeof e == "function" ? n.local ? ye : pe : n.local ? ge : de)(n, e));
494
+ }
495
+ function dt(t) {
496
+ return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
497
+ }
498
+ function we(t) {
499
+ return function() {
500
+ this.style.removeProperty(t);
501
+ };
502
+ }
503
+ function me(t, e, n) {
504
+ return function() {
505
+ this.style.setProperty(t, e, n);
506
+ };
507
+ }
508
+ function ve(t, e, n) {
509
+ return function() {
510
+ var i = e.apply(this, arguments);
511
+ i == null ? this.style.removeProperty(t) : this.style.setProperty(t, i, n);
512
+ };
513
+ }
514
+ function ke(t, e, n) {
515
+ return arguments.length > 1 ? this.each((e == null ? we : typeof e == "function" ? ve : me)(t, e, n ?? "")) : _e(this.node(), t);
516
+ }
517
+ function _e(t, e) {
518
+ return t.style.getPropertyValue(e) || dt(t).getComputedStyle(t, null).getPropertyValue(e);
519
+ }
520
+ function be(t) {
521
+ return function() {
522
+ delete this[t];
523
+ };
524
+ }
525
+ function je(t, e) {
526
+ return function() {
527
+ this[t] = e;
528
+ };
529
+ }
530
+ function Ee(t, e) {
531
+ return function() {
532
+ var n = e.apply(this, arguments);
533
+ n == null ? delete this[t] : this[t] = n;
534
+ };
535
+ }
536
+ function Se(t, e) {
537
+ return arguments.length > 1 ? this.each((e == null ? be : typeof e == "function" ? Ee : je)(t, e)) : this.node()[t];
538
+ }
539
+ function gt(t) {
540
+ return t.trim().split(/^|\s+/);
541
+ }
542
+ function et(t) {
543
+ return t.classList || new pt(t);
544
+ }
545
+ function pt(t) {
546
+ this._node = t, this._names = gt(t.getAttribute("class") || "");
547
+ }
548
+ pt.prototype = {
549
+ add: function(t) {
550
+ var e = this._names.indexOf(t);
551
+ e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
552
+ },
553
+ remove: function(t) {
554
+ var e = this._names.indexOf(t);
555
+ e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
556
+ },
557
+ contains: function(t) {
558
+ return this._names.indexOf(t) >= 0;
559
+ }
560
+ };
561
+ function yt(t, e) {
562
+ for (var n = et(t), i = -1, r = e.length; ++i < r; ) n.add(e[i]);
563
+ }
564
+ function xt(t, e) {
565
+ for (var n = et(t), i = -1, r = e.length; ++i < r; ) n.remove(e[i]);
566
+ }
567
+ function We(t) {
568
+ return function() {
569
+ yt(this, t);
570
+ };
571
+ }
572
+ function Ae(t) {
573
+ return function() {
574
+ xt(this, t);
575
+ };
576
+ }
577
+ function Ce(t, e) {
578
+ return function() {
579
+ (e.apply(this, arguments) ? yt : xt)(this, t);
580
+ };
581
+ }
582
+ function Ne(t, e) {
583
+ var n = gt(t + "");
584
+ if (arguments.length < 2) {
585
+ for (var i = et(this.node()), r = -1, o = n.length; ++r < o; ) if (!i.contains(n[r])) return !1;
586
+ return !0;
587
+ }
588
+ return this.each((typeof e == "function" ? Ce : e ? We : Ae)(n, e));
589
+ }
590
+ function Be() {
591
+ this.textContent = "";
592
+ }
593
+ function Re(t) {
594
+ return function() {
595
+ this.textContent = t;
596
+ };
597
+ }
598
+ function ze(t) {
599
+ return function() {
600
+ var e = t.apply(this, arguments);
601
+ this.textContent = e ?? "";
602
+ };
603
+ }
604
+ function Te(t) {
605
+ return arguments.length ? this.each(t == null ? Be : (typeof t == "function" ? ze : Re)(t)) : this.node().textContent;
606
+ }
607
+ function Me() {
608
+ this.innerHTML = "";
609
+ }
610
+ function Pe(t) {
611
+ return function() {
612
+ this.innerHTML = t;
613
+ };
614
+ }
615
+ function Ie(t) {
616
+ return function() {
617
+ var e = t.apply(this, arguments);
618
+ this.innerHTML = e ?? "";
619
+ };
620
+ }
621
+ function Fe(t) {
622
+ return arguments.length ? this.each(t == null ? Me : (typeof t == "function" ? Ie : Pe)(t)) : this.node().innerHTML;
623
+ }
624
+ function Le() {
625
+ this.nextSibling && this.parentNode.appendChild(this);
626
+ }
627
+ function He() {
628
+ return this.each(Le);
629
+ }
630
+ function De() {
631
+ this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
632
+ }
633
+ function Oe() {
634
+ return this.each(De);
635
+ }
636
+ function Ve(t) {
637
+ var e = typeof t == "function" ? t : ct(t);
638
+ return this.select(function() {
639
+ return this.appendChild(e.apply(this, arguments));
640
+ });
641
+ }
642
+ function qe() {
643
+ return null;
644
+ }
645
+ function Xe(t, e) {
646
+ var n = typeof t == "function" ? t : ct(t), i = e == null ? qe : typeof e == "function" ? e : ht(e);
647
+ return this.select(function() {
648
+ return this.insertBefore(n.apply(this, arguments), i.apply(this, arguments) || null);
649
+ });
650
+ }
651
+ function $e() {
652
+ var t = this.parentNode;
653
+ t && t.removeChild(this);
654
+ }
655
+ function Ue() {
656
+ return this.each($e);
657
+ }
658
+ function Ye() {
659
+ var t = this.cloneNode(!1), e = this.parentNode;
660
+ return e ? e.insertBefore(t, this.nextSibling) : t;
661
+ }
662
+ function Ke() {
663
+ var t = this.cloneNode(!0), e = this.parentNode;
664
+ return e ? e.insertBefore(t, this.nextSibling) : t;
665
+ }
666
+ function Je(t) {
667
+ return this.select(t ? Ke : Ye);
668
+ }
669
+ function Ze(t) {
670
+ return arguments.length ? this.property("__data__", t) : this.node().__data__;
671
+ }
672
+ function Ge(t) {
673
+ return function(e) {
674
+ t.call(this, e, this.__data__);
675
+ };
676
+ }
677
+ function Qe(t) {
678
+ return t.trim().split(/^|\s+/).map(function(e) {
679
+ var n = "", i = e.indexOf(".");
680
+ return i >= 0 && (n = e.slice(i + 1), e = e.slice(0, i)), { type: e, name: n };
681
+ });
682
+ }
683
+ function tn(t) {
684
+ return function() {
685
+ var e = this.__on;
686
+ if (e) {
687
+ for (var n = 0, i = -1, r = e.length, o; n < r; ++n)
688
+ o = e[n], (!t.type || o.type === t.type) && o.name === t.name ? this.removeEventListener(o.type, o.listener, o.options) : e[++i] = o;
689
+ ++i ? e.length = i : delete this.__on;
690
+ }
691
+ };
692
+ }
693
+ function en(t, e, n) {
694
+ return function() {
695
+ var i = this.__on, r, o = Ge(e);
696
+ if (i) {
697
+ for (var a = 0, l = i.length; a < l; ++a)
698
+ if ((r = i[a]).type === t.type && r.name === t.name) {
699
+ this.removeEventListener(r.type, r.listener, r.options), this.addEventListener(r.type, r.listener = o, r.options = n), r.value = e;
700
+ return;
701
+ }
702
+ }
703
+ this.addEventListener(t.type, o, n), r = { type: t.type, name: t.name, value: e, listener: o, options: n }, i ? i.push(r) : this.__on = [r];
704
+ };
705
+ }
706
+ function nn(t, e, n) {
707
+ var i = Qe(t + ""), r, o = i.length, a;
708
+ if (arguments.length < 2) {
709
+ var l = this.node().__on;
710
+ if (l) {
711
+ for (var h = 0, u = l.length, d; h < u; ++h)
712
+ for (r = 0, d = l[h]; r < o; ++r)
713
+ if ((a = i[r]).type === d.type && a.name === d.name)
714
+ return d.value;
715
+ }
716
+ return;
717
+ }
718
+ for (l = e ? en : tn, r = 0; r < o; ++r) this.each(l(i[r], e, n));
719
+ return this;
720
+ }
721
+ function wt(t, e, n) {
722
+ var i = dt(t), r = i.CustomEvent;
723
+ typeof r == "function" ? r = new r(e, n) : (r = i.document.createEvent("Event"), n ? (r.initEvent(e, n.bubbles, n.cancelable), r.detail = n.detail) : r.initEvent(e, !1, !1)), t.dispatchEvent(r);
724
+ }
725
+ function rn(t, e) {
726
+ return function() {
727
+ return wt(this, t, e);
728
+ };
729
+ }
730
+ function sn(t, e) {
731
+ return function() {
732
+ return wt(this, t, e.apply(this, arguments));
733
+ };
734
+ }
735
+ function on(t, e) {
736
+ return this.each((typeof e == "function" ? sn : rn)(t, e));
737
+ }
738
+ function* an() {
739
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
740
+ for (var i = t[e], r = 0, o = i.length, a; r < o; ++r)
741
+ (a = i[r]) && (yield a);
742
+ }
743
+ var ln = [null];
744
+ function E(t, e) {
745
+ this._groups = t, this._parents = e;
746
+ }
747
+ function cn() {
748
+ return this;
749
+ }
750
+ E.prototype = {
751
+ constructor: E,
752
+ select: Nt,
753
+ selectAll: Mt,
754
+ selectChild: Ht,
755
+ selectChildren: qt,
756
+ filter: Xt,
757
+ data: Zt,
758
+ enter: $t,
759
+ exit: Qt,
760
+ join: te,
761
+ merge: ee,
762
+ selection: cn,
763
+ order: ne,
764
+ sort: re,
765
+ call: se,
766
+ nodes: oe,
767
+ node: ae,
768
+ size: le,
769
+ empty: ce,
770
+ each: he,
771
+ attr: xe,
772
+ style: ke,
773
+ property: Se,
774
+ classed: Ne,
775
+ text: Te,
776
+ html: Fe,
777
+ raise: He,
778
+ lower: Oe,
779
+ append: Ve,
780
+ insert: Xe,
781
+ remove: Ue,
782
+ clone: Je,
783
+ datum: Ze,
784
+ on: nn,
785
+ dispatch: on,
786
+ [Symbol.iterator]: an
787
+ };
788
+ function H(t) {
789
+ return typeof t == "string" ? new E([[document.querySelector(t)]], [document.documentElement]) : new E([[t]], ln);
790
+ }
791
+ function hn(t) {
792
+ let e;
793
+ for (; e = t.sourceEvent; ) t = e;
794
+ return t;
795
+ }
796
+ function ot(t, e) {
797
+ if (t = hn(t), e === void 0 && (e = t.currentTarget), e) {
798
+ var n = e.ownerSVGElement || e;
799
+ if (n.createSVGPoint) {
800
+ var i = n.createSVGPoint();
801
+ return i.x = t.clientX, i.y = t.clientY, i = i.matrixTransform(e.getScreenCTM().inverse()), [i.x, i.y];
802
+ }
803
+ if (e.getBoundingClientRect) {
804
+ var r = e.getBoundingClientRect();
805
+ return [t.clientX - r.left - e.clientLeft, t.clientY - r.top - e.clientTop];
806
+ }
807
+ }
808
+ return [t.pageX, t.pageY];
809
+ }
810
+ const un = "data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0.75%200.75V6.75M0.75%206.75H6.75M0.75%206.75C3.07744%204.66141%205.23287%202.29676%208.49532%201.83779C10.4277%201.56593%2012.3961%201.92941%2014.1039%202.87343C15.8117%203.81746%2017.1664%205.29091%2017.9639%207.07177M18.75%2018.75V12.75M18.75%2012.75H12.75M18.75%2012.75C16.4225%2014.8386%2014.2671%2017.2032%2011.0047%2017.6622C9.07229%2017.9341%207.10391%2017.5706%205.3961%2016.6266C3.68829%2015.6825%202.33356%2014.2091%201.53604%2012.4282'%20stroke='%233367d9'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";
811
+ var fn = { value: () => {
812
+ } };
813
+ function mt() {
814
+ for (var t = 0, e = arguments.length, n = {}, i; t < e; ++t) {
815
+ if (!(i = arguments[t] + "") || i in n || /[\s.]/.test(i)) throw new Error("illegal type: " + i);
816
+ n[i] = [];
817
+ }
818
+ return new U(n);
819
+ }
820
+ function U(t) {
821
+ this._ = t;
822
+ }
823
+ function dn(t, e) {
824
+ return t.trim().split(/^|\s+/).map(function(n) {
825
+ var i = "", r = n.indexOf(".");
826
+ if (r >= 0 && (i = n.slice(r + 1), n = n.slice(0, r)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n);
827
+ return { type: n, name: i };
828
+ });
829
+ }
830
+ U.prototype = mt.prototype = {
831
+ constructor: U,
832
+ on: function(t, e) {
833
+ var n = this._, i = dn(t + "", n), r, o = -1, a = i.length;
834
+ if (arguments.length < 2) {
835
+ for (; ++o < a; ) if ((r = (t = i[o]).type) && (r = gn(n[r], t.name))) return r;
836
+ return;
837
+ }
838
+ if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
839
+ for (; ++o < a; )
840
+ if (r = (t = i[o]).type) n[r] = at(n[r], t.name, e);
841
+ else if (e == null) for (r in n) n[r] = at(n[r], t.name, null);
842
+ return this;
843
+ },
844
+ copy: function() {
845
+ var t = {}, e = this._;
846
+ for (var n in e) t[n] = e[n].slice();
847
+ return new U(t);
848
+ },
849
+ call: function(t, e) {
850
+ if ((r = arguments.length - 2) > 0) for (var n = new Array(r), i = 0, r, o; i < r; ++i) n[i] = arguments[i + 2];
851
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
852
+ for (o = this._[t], i = 0, r = o.length; i < r; ++i) o[i].value.apply(e, n);
853
+ },
854
+ apply: function(t, e, n) {
855
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
856
+ for (var i = this._[t], r = 0, o = i.length; r < o; ++r) i[r].value.apply(e, n);
857
+ }
858
+ };
859
+ function gn(t, e) {
860
+ for (var n = 0, i = t.length, r; n < i; ++n)
861
+ if ((r = t[n]).name === e)
862
+ return r.value;
863
+ }
864
+ function at(t, e, n) {
865
+ for (var i = 0, r = t.length; i < r; ++i)
866
+ if (t[i].name === e) {
867
+ t[i] = fn, t = t.slice(0, i).concat(t.slice(i + 1));
868
+ break;
869
+ }
870
+ return n != null && t.push({ name: e, value: n }), t;
871
+ }
872
+ const pn = { passive: !1 }, D = { capture: !0, passive: !1 };
873
+ function Z(t) {
874
+ t.stopImmediatePropagation();
875
+ }
876
+ function M(t) {
877
+ t.preventDefault(), t.stopImmediatePropagation();
878
+ }
879
+ function yn(t) {
880
+ var e = t.document.documentElement, n = H(t).on("dragstart.drag", M, D);
881
+ "onselectstart" in e ? n.on("selectstart.drag", M, D) : (e.__noselect = e.style.MozUserSelect, e.style.MozUserSelect = "none");
882
+ }
883
+ function xn(t, e) {
884
+ var n = t.document.documentElement, i = H(t).on("dragstart.drag", null);
885
+ e && (i.on("click.drag", M, D), setTimeout(function() {
886
+ i.on("click.drag", null);
887
+ }, 0)), "onselectstart" in n ? i.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
888
+ }
889
+ const X = (t) => () => t;
890
+ function tt(t, {
891
+ sourceEvent: e,
892
+ subject: n,
893
+ target: i,
894
+ identifier: r,
895
+ active: o,
896
+ x: a,
897
+ y: l,
898
+ dx: h,
899
+ dy: u,
900
+ dispatch: d
901
+ }) {
902
+ Object.defineProperties(this, {
903
+ type: { value: t, enumerable: !0, configurable: !0 },
904
+ sourceEvent: { value: e, enumerable: !0, configurable: !0 },
905
+ subject: { value: n, enumerable: !0, configurable: !0 },
906
+ target: { value: i, enumerable: !0, configurable: !0 },
907
+ identifier: { value: r, enumerable: !0, configurable: !0 },
908
+ active: { value: o, enumerable: !0, configurable: !0 },
909
+ x: { value: a, enumerable: !0, configurable: !0 },
910
+ y: { value: l, enumerable: !0, configurable: !0 },
911
+ dx: { value: h, enumerable: !0, configurable: !0 },
912
+ dy: { value: u, enumerable: !0, configurable: !0 },
913
+ _: { value: d }
914
+ });
915
+ }
916
+ tt.prototype.on = function() {
917
+ var t = this._.on.apply(this._, arguments);
918
+ return t === this._ ? this : t;
919
+ };
920
+ function wn(t) {
921
+ return !t.ctrlKey && !t.button;
922
+ }
923
+ function mn() {
924
+ return this.parentNode;
925
+ }
926
+ function vn(t, e) {
927
+ return e ?? { x: t.x, y: t.y };
928
+ }
929
+ function kn() {
930
+ return navigator.maxTouchPoints || "ontouchstart" in this;
931
+ }
932
+ function _n() {
933
+ var t = wn, e = mn, n = vn, i = kn, r = {}, o = mt("start", "drag", "end"), a = 0, l, h, u, d, m = 0;
934
+ function f(c) {
935
+ c.on("mousedown.drag", k).filter(i).on("touchstart.drag", W).on("touchmove.drag", N, pn).on("touchend.drag touchcancel.drag", A).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
936
+ }
937
+ function k(c, y) {
938
+ if (!(d || !t.call(this, c, y))) {
939
+ var g = j(this, e.call(this, c, y), c, y, "mouse");
940
+ g && (H(c.view).on("mousemove.drag", _, D).on("mouseup.drag", S, D), yn(c.view), Z(c), u = !1, l = c.clientX, h = c.clientY, g("start", c));
941
+ }
942
+ }
943
+ function _(c) {
944
+ if (M(c), !u) {
945
+ var y = c.clientX - l, g = c.clientY - h;
946
+ u = y * y + g * g > m;
947
+ }
948
+ r.mouse("drag", c);
949
+ }
950
+ function S(c) {
951
+ H(c.view).on("mousemove.drag mouseup.drag", null), xn(c.view, u), M(c), r.mouse("end", c);
952
+ }
953
+ function W(c, y) {
954
+ if (t.call(this, c, y)) {
955
+ var g = c.changedTouches, p = e.call(this, c, y), x = g.length, w, b;
956
+ for (w = 0; w < x; ++w)
957
+ (b = j(this, p, c, y, g[w].identifier, g[w])) && (Z(c), b("start", c, g[w]));
958
+ }
959
+ }
960
+ function N(c) {
961
+ var y = c.changedTouches, g = y.length, p, x;
962
+ for (p = 0; p < g; ++p)
963
+ (x = r[y[p].identifier]) && (M(c), x("drag", c, y[p]));
964
+ }
965
+ function A(c) {
966
+ var y = c.changedTouches, g = y.length, p, x;
967
+ for (d && clearTimeout(d), d = setTimeout(function() {
968
+ d = null;
969
+ }, 500), p = 0; p < g; ++p)
970
+ (x = r[y[p].identifier]) && (Z(c), x("end", c, y[p]));
971
+ }
972
+ function j(c, y, g, p, x, w) {
973
+ var b = o.copy(), v = ot(w || g, y), C, O, R;
974
+ if ((R = n.call(c, new tt("beforestart", {
975
+ sourceEvent: g,
976
+ target: f,
977
+ identifier: x,
978
+ active: a,
979
+ x: v[0],
980
+ y: v[1],
981
+ dx: 0,
982
+ dy: 0,
983
+ dispatch: b
984
+ }), p)) != null)
985
+ return C = R.x - v[0] || 0, O = R.y - v[1] || 0, function K(V, P, q) {
986
+ var I = v, J;
987
+ switch (V) {
988
+ case "start":
989
+ r[x] = K, J = a++;
990
+ break;
991
+ case "end":
992
+ delete r[x], --a;
993
+ case "drag":
994
+ v = ot(q || P, y), J = a;
995
+ break;
996
+ }
997
+ b.call(
998
+ V,
999
+ c,
1000
+ new tt(V, {
1001
+ sourceEvent: P,
1002
+ subject: R,
1003
+ target: f,
1004
+ identifier: x,
1005
+ active: J,
1006
+ x: v[0] + C,
1007
+ y: v[1] + O,
1008
+ dx: v[0] - I[0],
1009
+ dy: v[1] - I[1],
1010
+ dispatch: b
1011
+ }),
1012
+ p
1013
+ );
1014
+ };
1015
+ }
1016
+ return f.filter = function(c) {
1017
+ return arguments.length ? (t = typeof c == "function" ? c : X(!!c), f) : t;
1018
+ }, f.container = function(c) {
1019
+ return arguments.length ? (e = typeof c == "function" ? c : X(c), f) : e;
1020
+ }, f.subject = function(c) {
1021
+ return arguments.length ? (n = typeof c == "function" ? c : X(c), f) : n;
1022
+ }, f.touchable = function(c) {
1023
+ return arguments.length ? (i = typeof c == "function" ? c : X(!!c), f) : i;
1024
+ }, f.on = function() {
1025
+ var c = o.on.apply(o, arguments);
1026
+ return c === o ? f : c;
1027
+ }, f.clickDistance = function(c) {
1028
+ return arguments.length ? (m = (c = +c) * c, f) : Math.sqrt(m);
1029
+ }, f;
1030
+ }
1031
+ const vt = ({ id: t, data: e, style: n, shapeOpen: i }) => {
1032
+ const r = z(
1033
+ (g) => g.stickers.find((p) => p.id === e.stickerId)
1034
+ ), o = z((g) => g.updateSticker), a = z((g) => g.bringToFront), l = z((g) => g.selectSticker), h = z((g) => g.selectedId), { setNodes: u } = jt(), d = F(null), m = F(0), f = F({ width: 0, height: 0 }), [k, _] = L(0), [S, W] = L({ width: 140, height: 140 }), [N, A] = L(!1), j = h === (r == null ? void 0 : r.id);
1035
+ T(() => {
1036
+ if (!r) return;
1037
+ const g = Number(r.width) || 140, p = Number(r.height) || 140, x = Number(r.rotation) || 0;
1038
+ W({ width: g, height: p }), f.current = { width: g, height: p }, m.current = x, _(x);
1039
+ }, [r]), T(() => {
1040
+ m.current = k;
1041
+ }, [k]), T(() => {
1042
+ if (!r || !j) return;
1043
+ const g = d.current;
1044
+ if (!g) return;
1045
+ const p = H(g), x = _n().on("start", (w) => {
1046
+ var b, v;
1047
+ (v = (b = w.sourceEvent) == null ? void 0 : b.stopPropagation) == null || v.call(b), A(!0);
1048
+ }).on("drag", (w) => {
1049
+ var q, I;
1050
+ const b = (I = (q = w.sourceEvent) == null ? void 0 : q.target) == null ? void 0 : I.parentElement;
1051
+ if (!b) return;
1052
+ const v = b.getBoundingClientRect(), C = v.left + v.width / 2, O = v.top + v.height / 2, R = w.sourceEvent.clientX - C, K = w.sourceEvent.clientY - O, P = Math.atan2(K, R) * (180 / Math.PI) + 90;
1053
+ m.current = P, _(P);
1054
+ }).on("end", () => {
1055
+ A(!1);
1056
+ const w = Number(m.current) || 0;
1057
+ o(r.id, { rotation: w });
1058
+ });
1059
+ return p.call(x), () => p.on(".drag", null);
1060
+ }, [j, r, o]);
1061
+ const c = bt(() => {
1062
+ if (!r) return null;
1063
+ const g = it[r.shapeId];
1064
+ return g ? g(r) : it.square(r);
1065
+ }, [r]), y = (g) => {
1066
+ g.stopPropagation(), r && (a(r.id), l(r.id));
1067
+ };
1068
+ return r ? /* @__PURE__ */ s.jsx(s.Fragment, { children: /* @__PURE__ */ s.jsxs(
1069
+ "div",
1070
+ {
1071
+ onClick: y,
1072
+ style: {
1073
+ ...n,
1074
+ position: "relative",
1075
+ zIndex: r.zIndex,
1076
+ cursor: N ? "grabbing" : "grab",
1077
+ width: S.width,
1078
+ height: S.height,
1079
+ transform: `rotate(${k}deg)`,
1080
+ transformOrigin: "50% 50%",
1081
+ pointerEvents: "auto"
1082
+ },
1083
+ "data-drag-disabled": N,
1084
+ children: [
1085
+ /* @__PURE__ */ s.jsx(
1086
+ Et,
1087
+ {
1088
+ isVisible: j,
1089
+ minWidth: 30,
1090
+ minHeight: 30,
1091
+ resizeHandles: ["top", "right", "bottom", "left", "topRight", "topLeft", "bottomRight", "bottomLeft"],
1092
+ onResize: (g, p) => {
1093
+ const x = Number(p.width) || 1, w = Number(p.height) || 1;
1094
+ W({ width: x, height: w }), f.current = { width: x, height: w };
1095
+ },
1096
+ onResizeEnd: async (g, p) => {
1097
+ const x = Math.max(1, Math.round(p.width)), w = Math.max(1, Math.round(p.height)), b = Number(m.current) || 0;
1098
+ W({ width: x, height: w }), f.current = { width: x, height: w }, u(
1099
+ (v) => v.map((C) => C.id === t ? { ...C, style: { ...C.style, width: x, height: w } } : C)
1100
+ ), o(r.id, { width: x, height: w });
1101
+ try {
1102
+ await G.updateBoardTransform(t, x, w, b);
1103
+ } catch (v) {
1104
+ console.warn("Не удалось сохранить размеры фигуры", v);
1105
+ }
1106
+ }
1107
+ }
1108
+ ),
1109
+ /* @__PURE__ */ s.jsx(
1110
+ "svg",
1111
+ {
1112
+ width: S.width,
1113
+ height: S.height,
1114
+ viewBox: "0 0 100 100",
1115
+ preserveAspectRatio: "none",
1116
+ children: c
1117
+ }
1118
+ ),
1119
+ j && /* @__PURE__ */ s.jsx(
1120
+ "div",
1121
+ {
1122
+ ref: d,
1123
+ className: "nodrag nopan",
1124
+ style: {
1125
+ position: "absolute",
1126
+ width: 15,
1127
+ height: 15,
1128
+ top: -24,
1129
+ right: -8,
1130
+ cursor: "grab",
1131
+ zIndex: 1e3,
1132
+ pointerEvents: "auto",
1133
+ transform: `translateX(-50%) rotate(${k}deg)`,
1134
+ transition: N ? "none" : "transform 0.15s ease-out"
1135
+ },
1136
+ children: /* @__PURE__ */ s.jsx(
1137
+ "img",
1138
+ {
1139
+ src: un,
1140
+ alt: "Rotate",
1141
+ draggable: !1,
1142
+ style: {
1143
+ width: "100%",
1144
+ height: "100%",
1145
+ objectFit: "contain"
1146
+ }
1147
+ }
1148
+ )
1149
+ }
1150
+ ),
1151
+ /* @__PURE__ */ s.jsx(nt, { type: "target", position: rt.Left, className: "z-100000" }),
1152
+ /* @__PURE__ */ s.jsx(nt, { type: "source", position: rt.Right, className: "z-100000" })
1153
+ ]
1154
+ }
1155
+ ) }) : null;
1156
+ }, bn = {
1157
+ square: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ s.jsx("rect", { x: "4", y: "4", width: "32", height: "32", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1158
+ circle: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ s.jsx("circle", { cx: "20", cy: "20", r: "14", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1159
+ triangle: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ s.jsx("polygon", { points: "20,6 34,34 6,34", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1160
+ star: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ s.jsx(
1161
+ "polygon",
1162
+ {
1163
+ points: "20,4 25,16 38,16 27,24 32,36 20,28 8,36 13,24 2,16 15,16",
1164
+ stroke: "black",
1165
+ fill: "none",
1166
+ strokeWidth: "2"
1167
+ }
1168
+ ) }),
1169
+ stick: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ s.jsx("rect", { x: "16", y: "4", width: "8", height: "32", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1170
+ line: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", children: /* @__PURE__ */ s.jsx("line", { x1: "4", y1: "20", x2: "36", y2: "20", stroke: "black", strokeWidth: "2" }) }),
1171
+ arrow: /* @__PURE__ */ s.jsxs("svg", { width: "40", height: "40", children: [
1172
+ /* @__PURE__ */ s.jsx("line", { x1: "4", y1: "20", x2: "30", y2: "20", stroke: "black", strokeWidth: "2" }),
1173
+ /* @__PURE__ */ s.jsx("polygon", { points: "30,14 38,20 30,26", fill: "black" })
1174
+ ] }),
1175
+ dblarrow: /* @__PURE__ */ s.jsxs("svg", { width: "40", height: "40", children: [
1176
+ /* @__PURE__ */ s.jsx("polygon", { points: "4,20 12,14 12,26", fill: "black" }),
1177
+ /* @__PURE__ */ s.jsx("line", { x1: "12", y1: "20", x2: "28", y2: "20", stroke: "black", strokeWidth: "2" }),
1178
+ /* @__PURE__ */ s.jsx("polygon", { points: "28,14 36,20 28,26", fill: "black" })
1179
+ ] }),
1180
+ parallelogram: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: /* @__PURE__ */ s.jsx("polygon", { points: "8,8 34,8 26,32 0,32", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1181
+ roundedRect: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: /* @__PURE__ */ s.jsx("rect", { x: "6", y: "10", width: "28", height: "20", rx: "4", ry: "4", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1182
+ capsule: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: /* @__PURE__ */ s.jsx("rect", { x: "6", y: "14", width: "28", height: "12", rx: "6", ry: "6", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1183
+ pentagon: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: /* @__PURE__ */ s.jsx("polygon", { points: "20,6 34,15 28,32 12,32 6,15", stroke: "black", fill: "none", strokeWidth: "2" }) }),
1184
+ chevron: /* @__PURE__ */ s.jsx("svg", { width: "40", height: "40", viewBox: "0 0 100 100", children: /* @__PURE__ */ s.jsx(
1185
+ "polyline",
1186
+ {
1187
+ points: "0,0 50,100 100,0",
1188
+ fill: "none",
1189
+ stroke: "black",
1190
+ strokeWidth: "5"
1191
+ }
1192
+ ) }),
1193
+ table3x3: /* @__PURE__ */ s.jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: [
1194
+ /* @__PURE__ */ s.jsx("rect", { x: "4", y: "4", width: "32", height: "32", stroke: "black", fill: "none", strokeWidth: "2" }),
1195
+ /* @__PURE__ */ s.jsx("line", { x1: "14", y1: "4", x2: "14", y2: "36", stroke: "black", strokeWidth: "2" }),
1196
+ /* @__PURE__ */ s.jsx("line", { x1: "26", y1: "4", x2: "26", y2: "36", stroke: "black", strokeWidth: "2" }),
1197
+ /* @__PURE__ */ s.jsx("line", { x1: "4", y1: "14", x2: "36", y2: "14", stroke: "black", strokeWidth: "2" }),
1198
+ /* @__PURE__ */ s.jsx("line", { x1: "4", y1: "26", x2: "36", y2: "26", stroke: "black", strokeWidth: "2" })
1199
+ ] }),
1200
+ pyramid: /* @__PURE__ */ s.jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: [
1201
+ /* @__PURE__ */ s.jsx("polygon", { points: "20,4 36,36 4,36", stroke: "black", fill: "none", strokeWidth: "2" }),
1202
+ /* @__PURE__ */ s.jsx("line", { x1: "15", y1: "12", x2: "25", y2: "12", stroke: "black", strokeWidth: "2" }),
1203
+ /* @__PURE__ */ s.jsx("line", { x1: "11", y1: "20", x2: "28", y2: "20", stroke: "black", strokeWidth: "2" }),
1204
+ /* @__PURE__ */ s.jsx("line", { x1: "7", y1: "28", x2: "32", y2: "28", stroke: "black", strokeWidth: "2" })
1205
+ ] }),
1206
+ circleArrow: /* @__PURE__ */ s.jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: [
1207
+ /* @__PURE__ */ s.jsx("circle", { cx: "20", cy: "20", r: "14", stroke: "black", fill: "none", strokeWidth: "2" }),
1208
+ /* @__PURE__ */ s.jsx("line", { x1: "20", y1: "6", x2: "20", y2: "0", stroke: "black", strokeWidth: "2" }),
1209
+ /* @__PURE__ */ s.jsx("polygon", { points: "18,2 22,2 20,0", fill: "black" })
1210
+ ] }),
1211
+ table3x3LeftMerge: /* @__PURE__ */ s.jsxs("svg", { width: "40", height: "40", viewBox: "0 0 40 40", children: [
1212
+ /* @__PURE__ */ s.jsx("rect", { x: "4", y: "4", width: "32", height: "32", stroke: "black", fill: "none", strokeWidth: "2" }),
1213
+ /* @__PURE__ */ s.jsx("line", { x1: "14", y1: "4", x2: "14", y2: "36", stroke: "black", strokeWidth: "2" }),
1214
+ /* @__PURE__ */ s.jsx("line", { x1: "26", y1: "4", x2: "26", y2: "36", stroke: "black", strokeWidth: "2" }),
1215
+ /* @__PURE__ */ s.jsx("line", { x1: "14", y1: "16", x2: "36", y2: "16", stroke: "black", strokeWidth: "2" }),
1216
+ /* @__PURE__ */ s.jsx("line", { x1: "14", y1: "28", x2: "36", y2: "28", stroke: "black", strokeWidth: "2" })
1217
+ ] })
1218
+ }, jn = "data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='black'%20stroke-width='3'/%3e%3c/svg%3e", En = "data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%201.5H47C47.8284%201.5%2048.5%202.17157%2048.5%203V47C48.5%2047.8284%2047.8284%2048.5%2047%2048.5H3C2.17157%2048.5%201.5%2047.8284%201.5%2047V3C1.5%202.17157%202.17157%201.5%203%201.5Z'%20stroke='%230000FF'%20stroke-width='3'/%3e%3c/svg%3e", Sn = () => {
1219
+ const [t, e] = L(!1), n = F(null), i = (o) => {
1220
+ o.stopPropagation(), e((a) => !a);
1221
+ };
1222
+ T(() => {
1223
+ if (!t) return;
1224
+ const o = (a) => {
1225
+ n.current && !n.current.contains(a.target) && e(!1);
1226
+ };
1227
+ return window.addEventListener("pointerdown", o), () => window.removeEventListener("pointerdown", o);
1228
+ }, [t]);
1229
+ const r = (o) => (a) => {
1230
+ a.stopPropagation(), a.dataTransfer.setData(kt, JSON.stringify({ shapeId: o.id })), a.dataTransfer.effectAllowed = "copy";
1231
+ };
1232
+ return /* @__PURE__ */ s.jsxs("div", { className: "left-toolbar-container", ref: n, onClick: (o) => o.stopPropagation(), children: [
1233
+ /* @__PURE__ */ s.jsx("div", { className: `toolbar-card ${t ? "toolbar-card--open" : ""}`, children: /* @__PURE__ */ s.jsx("button", { onClick: i, className: `toolbar-btn toolbar-btn--icon toolbar-btn--shape ${t ? "toolbar-btn--active" : ""}`, children: /* @__PURE__ */ s.jsx("div", { className: `toolbar-shape-plate ${t ? "toolbar-shape-plate--active" : ""}`, children: /* @__PURE__ */ s.jsx("img", { src: t ? En : jn, alt: "Фигуры", draggable: !1 }) }) }) }),
1234
+ t && /* @__PURE__ */ s.jsx("div", { className: "palette-wrapper", onClick: (o) => o.stopPropagation(), children: /* @__PURE__ */ s.jsx("div", { className: "shape-panel", children: /* @__PURE__ */ s.jsx("div", { className: "shape-grid", children: St.map((o) => /* @__PURE__ */ s.jsx(
1235
+ "button",
1236
+ {
1237
+ className: "shape-item",
1238
+ draggable: !0,
1239
+ onDragStart: r(o),
1240
+ title: o.name,
1241
+ children: bn[o.id]
1242
+ },
1243
+ o.id
1244
+ )) }) }) }),
1245
+ /* @__PURE__ */ s.jsx(vt, { shapeOpen: t })
1246
+ ] });
1247
+ }, Wn = {
1248
+ shape: vt
1249
+ }, $ = ({ children: t }) => /* @__PURE__ */ s.jsx("div", { children: t }), Bn = ({ nodeTypes: t }) => {
1250
+ const e = z((o) => o.setStickers);
1251
+ F(null);
1252
+ const [n, i] = L(() => $);
1253
+ ({
1254
+ ...Wn,
1255
+ ...t || {}
1256
+ }, T(() => {
1257
+ (async () => {
1258
+ try {
1259
+ const [a, l] = await Promise.all([
1260
+ G.getAll(),
1261
+ G.getBoard()
1262
+ ]), h = new Map(a.map((f) => [String(f.id), f.shapeId]));
1263
+ let u = 30, d = 30;
1264
+ const m = [];
1265
+ for (const f of l) {
1266
+ const k = f.width ?? 140, _ = f.height ?? 140, S = f.rotation ?? 0, W = h.get(String(f.shapeId)) ?? "square";
1267
+ m.push({
1268
+ id: f.id,
1269
+ stickerId: f.id,
1270
+ type: "shape",
1271
+ shapeId: W,
1272
+ shapeDbId: f.shapeId,
1273
+ x: u,
1274
+ y: d,
1275
+ width: k,
1276
+ height: _,
1277
+ rotation: S,
1278
+ zIndex: 1,
1279
+ fill: "transparent",
1280
+ stroke: "#000"
1281
+ }), u += 24, d += 24;
1282
+ }
1283
+ e(m);
1284
+ } catch (a) {
1285
+ console.warn("Не удалось загрузить доску для фигур:", a);
1286
+ }
1287
+ })();
1288
+ }, [e])), T(() => {
1289
+ let o = !0;
1290
+ return import("@xyflow/react").then((a) => {
1291
+ if (!o)
1292
+ return;
1293
+ const l = (a && (a.Widget || a.default || (a == null ? void 0 : a.widget) || (a == null ? void 0 : a.XyflowWidget))) ?? null;
1294
+ typeof l == "function" || _t.isValidElement(l) ? i(() => l) : i(() => $);
1295
+ }).catch(() => {
1296
+ o && i(() => $);
1297
+ }), () => {
1298
+ o = !1;
1299
+ };
1300
+ }, []);
1301
+ const r = n || $;
1302
+ return /* @__PURE__ */ s.jsx(r, { children: /* @__PURE__ */ s.jsx("div", { className: "relative flex h-screen w-screen bg-gray-100", children: /* @__PURE__ */ s.jsx(Sn, {}) }) });
1303
+ };
1304
+ export {
1305
+ Bn as S,
1306
+ St as a,
1307
+ G as b,
1308
+ vt as c,
1309
+ Sn as d,
1310
+ Wn as s
1311
+ };
1312
+ //# sourceMappingURL=ShapeBoardWidget-ChVcXBBP.js.map