@cntrl-site/components 1.0.100 → 1.0.102

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 (130) hide show
  1. package/README.md +25 -1
  2. package/dist/Burger-C6jI6C1c.js +661 -0
  3. package/dist/Burger-EMSn7TPB.mjs +1807 -0
  4. package/dist/ClickGallerie-D_O1XhAO.mjs +270 -0
  5. package/dist/ClickGallerie-M9xdGR1G.js +36 -0
  6. package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
  7. package/dist/Components/ClickGallerie/ClickGallerieComponent.d.ts +0 -1
  8. package/dist/Components/FAQ/FAQComponent.d.ts +0 -1
  9. package/dist/Components/Form/FormComponent.d.ts +0 -1
  10. package/dist/Components/Grid/GridComponent.d.ts +0 -1
  11. package/dist/Components/Helix/HelixComponent.d.ts +0 -1
  12. package/dist/Components/Hive/HiveComponent.d.ts +0 -1
  13. package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +0 -1
  14. package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +0 -1
  15. package/dist/Components/List/ListComponent.d.ts +0 -1
  16. package/dist/Components/Marquee/MarqueeComponent.d.ts +0 -1
  17. package/dist/Components/MarqueeText/MarqueeTextComponent.d.ts +0 -1
  18. package/dist/Components/Mercury/MercuryComponent.d.ts +0 -1
  19. package/dist/Components/OnelinerForm/OnelinerFormComponent.d.ts +0 -1
  20. package/dist/Components/Pretext/PretextComponent.d.ts +0 -1
  21. package/dist/Components/Scale/ScaleComponent.d.ts +0 -1
  22. package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +0 -1
  23. package/dist/Components/Slider20/Slider20Component.d.ts +0 -1
  24. package/dist/Components/TestimonialGrid/TestimonialGridComponent.d.ts +0 -1
  25. package/dist/Components/TestimonialSingle/TestimonialSingleComponent.d.ts +0 -1
  26. package/dist/Components/Waterfall/WaterfallComponent.d.ts +0 -1
  27. package/dist/ControlSlider-SiOt22l_.js +1 -0
  28. package/dist/ControlSlider-pZv7H6BU.mjs +334 -0
  29. package/dist/FAQ-C7823fyi.js +166 -0
  30. package/dist/FAQ-CZ39u4m8.mjs +588 -0
  31. package/dist/Form-BX5_41nb.mjs +472 -0
  32. package/dist/Form-Dn-6A1He.js +153 -0
  33. package/dist/Grid-CemGhf3F.js +374 -0
  34. package/dist/Grid-cfQsXW3b.mjs +1553 -0
  35. package/dist/Helix-2Vr-9WBa.js +43 -0
  36. package/dist/Helix-BmkAKT1G.mjs +315 -0
  37. package/dist/Hive-BC6zQBsv.js +321 -0
  38. package/dist/Hive-BGMWinrW.mjs +1425 -0
  39. package/dist/HiveLightboxTitles-DhEeFKWs.mjs +507 -0
  40. package/dist/HiveLightboxTitles-DlyptAaK.js +1 -0
  41. package/dist/ImageRevealSlider-BBWtFjUF.js +1 -0
  42. package/dist/ImageRevealSlider-BdFGyVEP.mjs +184 -0
  43. package/dist/Lightbox-CIss_nOG.js +1 -0
  44. package/dist/Lightbox-eP9qAZzL.mjs +665 -0
  45. package/dist/LightboxJournal-D59ex6wH.mjs +1613 -0
  46. package/dist/LightboxJournal-DAEZOPDi.js +523 -0
  47. package/dist/LightboxStrip-BDjI1jyH.js +386 -0
  48. package/dist/LightboxStrip-YspzBP8N.mjs +1574 -0
  49. package/dist/List-C32WImI3.js +377 -0
  50. package/dist/List-DW7fyJbf.mjs +1891 -0
  51. package/dist/Marquee-BYClHHws.mjs +551 -0
  52. package/dist/Marquee-vmHaTGIP.js +133 -0
  53. package/dist/MarqueeText-4Rip_sQX.mjs +515 -0
  54. package/dist/MarqueeText-E6OubMOG.js +132 -0
  55. package/dist/Mercury-BwF_XW2w.js +267 -0
  56. package/dist/Mercury-DuKJQ1Zo.mjs +1701 -0
  57. package/dist/OnelinerForm-BEu7_sho.mjs +434 -0
  58. package/dist/OnelinerForm-C2Y_XMCY.js +194 -0
  59. package/dist/Pretext-10CcyP1E.mjs +2762 -0
  60. package/dist/Pretext-DvQ3xsni.js +231 -0
  61. package/dist/PretextComponent-C3YFICy8.js +1 -0
  62. package/dist/PretextComponent-Ct0newmn.mjs +11624 -0
  63. package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
  64. package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
  65. package/dist/Scale-976sjO8e.js +111 -0
  66. package/dist/Scale-rLNT4KAk.mjs +345 -0
  67. package/dist/SimpleButton-C-o2W9bS.mjs +451 -0
  68. package/dist/SimpleButton-nGEcO2gB.js +243 -0
  69. package/dist/Slider20-C9o2REDl.js +272 -0
  70. package/dist/Slider20-Dm8BeCli.mjs +851 -0
  71. package/dist/SvgImage-B5mR9y6q.mjs +51 -0
  72. package/dist/SvgImage-DFlmxAoL.js +1 -0
  73. package/dist/TestimonialGrid-CPu4qQ6B.mjs +492 -0
  74. package/dist/TestimonialGrid-D4ieiz9e.js +90 -0
  75. package/dist/TestimonialSingle-CVu15ZtV.js +125 -0
  76. package/dist/TestimonialSingle-DLdnAVF7.mjs +391 -0
  77. package/dist/Waterfall-A0FjM2my.mjs +1400 -0
  78. package/dist/Waterfall-DnPDHbCL.js +287 -0
  79. package/dist/buildColorVars-CE2D5cQV.js +1 -0
  80. package/dist/buildColorVars-CLyWQm5K.mjs +21 -0
  81. package/dist/components-OE3ac1dr.js +1 -0
  82. package/dist/components-w-jHX-2U.mjs +2053 -0
  83. package/dist/components.css +1 -1
  84. package/dist/elements.d.ts +7 -0
  85. package/dist/elements.js +1 -0
  86. package/dist/elements.mjs +63 -0
  87. package/dist/elements.node.d.ts +6 -0
  88. package/dist/elements.node.js +1 -0
  89. package/dist/elements.node.mjs +21 -0
  90. package/dist/forking.d.ts +1 -0
  91. package/dist/formFieldValidation-DZl2KVaF.js +1 -0
  92. package/dist/formFieldValidation-DvihFrq5.mjs +21 -0
  93. package/dist/getColorAlpha-BVBY0N5x.mjs +39 -0
  94. package/dist/getColorAlpha-CoSseoCn.js +1 -0
  95. package/dist/getImageRect-BQhQXvT8.js +1 -0
  96. package/dist/getImageRect-CBMhFNHM.mjs +109 -0
  97. package/dist/index.d.ts +1 -0
  98. package/dist/index.js +1 -28866
  99. package/dist/index.mjs +16 -62477
  100. package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
  101. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
  102. package/dist/panelAvailability-D179wwJx.mjs +27 -0
  103. package/dist/panelAvailability-DnOe0rQ4.js +1 -0
  104. package/dist/react-splide.esm-CabaEmHi.js +6 -0
  105. package/dist/react-splide.esm-DQqds4PL.mjs +1750 -0
  106. package/dist/readTestimonialTextMeasure-BIXpGFEt.mjs +13 -0
  107. package/dist/readTestimonialTextMeasure-CEPaB4Sy.js +1 -0
  108. package/dist/scalingValue-C9JH5L6O.mjs +6 -0
  109. package/dist/scalingValue-CSHYgTZl.js +1 -0
  110. package/dist/sources.d.ts +1 -0
  111. package/dist/sources.js +23753 -0
  112. package/dist/sources.mjs +23779 -0
  113. package/dist/textStylesToCss-05Mn6I_2.mjs +32 -0
  114. package/dist/textStylesToCss-CNN3zZTV.js +1 -0
  115. package/dist/types/Component.d.ts +0 -1
  116. package/dist/useLightboxScrollLock-Hf16Eq4g.js +1 -0
  117. package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +18 -0
  118. package/dist/useLightboxSwipeDismiss-Br9uE5G0.js +1 -0
  119. package/dist/useLightboxSwipeDismiss-SGv6Ra33.mjs +95 -0
  120. package/dist/useScopedStyles-Bf6yohVQ.js +1 -0
  121. package/dist/useScopedStyles-DhBG3557.mjs +11 -0
  122. package/dist/utils-033j3qNL.js +1 -0
  123. package/dist/utils-FxC9rcxw.mjs +247 -0
  124. package/dist/utils.js +1 -1
  125. package/dist/utils.mjs +17 -11
  126. package/package.json +31 -2
  127. package/dist/index-2JTNRDR1.js +0 -1
  128. package/dist/index-DA8t6EZ4.mjs +0 -255
  129. package/dist/panelAvailability-CgSic84c.mjs +0 -126
  130. package/dist/panelAvailability-D8c7cdbu.js +0 -1
@@ -0,0 +1,2762 @@
1
+ import { jsxs as It, jsx as P, Fragment as vn } from "react/jsx-runtime";
2
+ import { useState as yt, useEffect as At, useRef as St, useId as oo, useCallback as _t, useMemo as B, useLayoutEffect as Ao } from "react";
3
+ import { s as wn } from "./scalingValue-C9JH5L6O.mjs";
4
+ import { u as Lo } from "./useScopedStyles-DhBG3557.mjs";
5
+ import { n as ro } from "./textStylesToCss-05Mn6I_2.mjs";
6
+ import { createPortal as Eo } from "react-dom";
7
+ const Re = 120, _e = 3, ko = 0.12, Ce = { x: 0, y: 0, width: 100, height: 100 };
8
+ function Fn(t, n) {
9
+ return t.map((e) => e.map((o) => ({
10
+ x: (o.x - n.x) / n.width,
11
+ y: (o.y - n.y) / n.height
12
+ })));
13
+ }
14
+ function Gn(t) {
15
+ return t < 0 ? 0 : t > 1 ? 1 : t;
16
+ }
17
+ function De(t, n) {
18
+ return t.filter((e) => e.length > 0).map((e) => `M ${e.map((o) => `${o.x * n.width} ${o.y * n.height}`).join(" L ")} Z`).join(" ");
19
+ }
20
+ function No(t, n) {
21
+ let e = 1 / 0, o = 1 / 0, i = -1 / 0, r = -1 / 0;
22
+ for (const s of t)
23
+ for (const d of s) {
24
+ const h = d.x * n.width, E = d.y * n.height;
25
+ h < e && (e = h), h > i && (i = h), E < o && (o = E), E > r && (r = E);
26
+ }
27
+ const c = i - e, l = r - o;
28
+ return !isFinite(c) || !isFinite(l) || c <= 0 || l <= 0 ? null : { x: e, y: o, width: c, height: l };
29
+ }
30
+ function bo(t) {
31
+ return t.map(([n, e]) => ({ x: n, y: e }));
32
+ }
33
+ function te(t) {
34
+ let n = 1 / 0, e = 1 / 0, o = -1 / 0, i = -1 / 0;
35
+ for (const l of t)
36
+ for (const s of l)
37
+ s.x < n && (n = s.x), s.x > o && (o = s.x), s.y < e && (e = s.y), s.y > i && (i = s.y);
38
+ const r = o - n, c = i - e;
39
+ return !isFinite(r) || !isFinite(c) || r <= 0 || c <= 0 ? t : t.map((l) => l.map((s) => ({
40
+ x: (s.x - n) / r,
41
+ y: (s.y - e) / c
42
+ })));
43
+ }
44
+ function Xo(t, n) {
45
+ const e = [];
46
+ for (const i of t)
47
+ for (let r = 0; r < i.length; r += 1) {
48
+ const c = i[r], l = i[(r + 1) % i.length];
49
+ (c.y <= n && l.y > n || l.y <= n && c.y > n) && e.push(c.x + (n - c.y) / (l.y - c.y) * (l.x - c.x));
50
+ }
51
+ e.sort((i, r) => i - r);
52
+ const o = [];
53
+ for (let i = 0; i + 1 < e.length; i += 2) {
54
+ const r = Gn(e[i]), c = Gn(e[i + 1]);
55
+ c > r && o.push({ x0: r, x1: c });
56
+ }
57
+ return Ro(o);
58
+ }
59
+ function Ro(t) {
60
+ if (t.length < 2) return t;
61
+ const n = [...t].sort((o, i) => o.x0 - i.x0), e = [n[0]];
62
+ for (let o = 1; o < n.length; o += 1) {
63
+ const i = e[e.length - 1], r = n[o];
64
+ r.x0 <= i.x1 ? i.x1 = Math.max(i.x1, r.x1) : e.push({ ...r });
65
+ }
66
+ return e;
67
+ }
68
+ function _o(t, n) {
69
+ const e = [];
70
+ let o = 0, i = 0;
71
+ for (; o < t.length && i < n.length; ) {
72
+ const r = Math.max(t[o].x0, n[i].x0), c = Math.min(t[o].x1, n[i].x1);
73
+ c > r && e.push({ x0: r, x1: c }), t[o].x1 < n[i].x1 ? o += 1 : i += 1;
74
+ }
75
+ return e;
76
+ }
77
+ function Do(t) {
78
+ const n = [];
79
+ let e = 0;
80
+ for (const o of t)
81
+ o.x0 > e && n.push({ x0: e, x1: o.x0 }), e = Math.max(e, o.x1);
82
+ return e < 1 && n.push({ x0: e, x1: 1 }), n;
83
+ }
84
+ function Yo(t, n) {
85
+ const e = [];
86
+ for (const o of t) {
87
+ if (n.x1 <= o.x0 || n.x0 >= o.x1) {
88
+ e.push(o);
89
+ continue;
90
+ }
91
+ n.x0 > o.x0 && e.push({ x0: o.x0, x1: n.x0 }), n.x1 < o.x1 && e.push({ x0: n.x1, x1: o.x1 });
92
+ }
93
+ return e;
94
+ }
95
+ function To(t, n, e, o) {
96
+ let i = null;
97
+ for (let r = 0; r < _e; r += 1) {
98
+ const c = Gn(n + (e - n) * r / Math.max(1, _e - 1)), l = Xo(t, c), s = o === "avoid" ? Do(l) : l;
99
+ if (i = i === null ? s : _o(i, s), i.length === 0) return [];
100
+ }
101
+ return i ?? [];
102
+ }
103
+ function Ye(t, n = "stretch", e = Ce) {
104
+ const o = t.trim();
105
+ if (!o) return null;
106
+ if (/^[Mm]/.test(o)) {
107
+ const c = sn(o), l = bn(c);
108
+ if (l.length)
109
+ return n === "viewbox" ? Fn(l, e) : te(l);
110
+ if (typeof document > "u") return null;
111
+ const s = o.split(/(?=[Mm])/).map((E) => E.trim()).filter(Boolean), d = document.createElementNS("http://www.w3.org/2000/svg", "svg"), h = [];
112
+ for (const E of s) {
113
+ const b = document.createElementNS("http://www.w3.org/2000/svg", "path");
114
+ b.setAttribute("d", E), d.appendChild(b);
115
+ let $ = 0;
116
+ try {
117
+ $ = b.getTotalLength();
118
+ } catch {
119
+ $ = 0;
120
+ }
121
+ if (!$) continue;
122
+ const y = [];
123
+ for (let R = 0; R < Re; R += 1) {
124
+ const I = b.getPointAtLength(R / Re * $);
125
+ y.push({ x: I.x, y: I.y });
126
+ }
127
+ h.push(y);
128
+ }
129
+ return h.length ? n === "viewbox" ? Fn(h, e) : te(h) : null;
130
+ }
131
+ const i = o.split(/[\s,]+/).map(Number).filter((c) => !Number.isNaN(c));
132
+ if (i.length < 6) return null;
133
+ const r = [];
134
+ for (let c = 0; c + 1 < i.length; c += 2)
135
+ r.push({ x: i[c], y: i[c + 1] });
136
+ return n === "viewbox" ? Fn([r], e) : te([r]);
137
+ }
138
+ const Se = {
139
+ bobbin: "M57.63,0 L57.63,37.24 L74.66,37.24 L74.66,56.07 L57.63,100 L33.84,100 L16.81,56.07 L16.81,37.24 L33.84,37.24 L33.84,0 Z",
140
+ circle: "M50,0 C77.61,0 100,22.39 100,50 C100,77.61 77.61,100 50,100 C22.39,100 0,77.61 0,50 C0,22.39 22.39,0 50,0 Z",
141
+ shield: "M0,0 L100,0 L100,50 L50,100 L0,50 Z",
142
+ vase: "M25.37,0 L91.55,0 C91.55,0 74.8,25.14 83.07,50.03 C91.34,74.92 74.61,100 74.61,100 L8.43,100 C8.43,100 32.3,75.08 23.9,50 C15.5,24.92 25.37,0 25.37,0 Z",
143
+ parallelogram: "M25.37,0 L91.55,0 L74.61,100 L8.43,100 Z",
144
+ diamond: "M50,0 L80,50 L50,100 L20,50 Z"
145
+ }, se = "0 0 100 100", Vn = 100, le = 16, Po = 12, Ho = 16, ne = /([MmZzLlHhVvCcSsQqTtAa])([^MmZzLlHhVvCcSsQqTtAa]*)/g, Oo = /[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g, Te = Math.PI / 4, zo = 8, Wo = Math.PI / 18, vo = 8, Cn = 24, Sn = [];
146
+ function Go() {
147
+ return [{
148
+ closed: !0,
149
+ nodes: [
150
+ { p: { x: 0, y: 0 }, in: null, out: null },
151
+ { p: { x: 1, y: 0 }, in: null, out: null },
152
+ { p: { x: 1, y: 1 }, in: null, out: null },
153
+ { p: { x: 0, y: 1 }, in: null, out: null }
154
+ ]
155
+ }];
156
+ }
157
+ function ee(t, n) {
158
+ return kt(t, (e) => ({
159
+ x: (e.x - n.x) / n.width,
160
+ y: (e.y - n.y) / n.height
161
+ }));
162
+ }
163
+ function Vo(t) {
164
+ const n = an(t), e = n.maxX - n.minX, o = n.maxY - n.minY;
165
+ return !isFinite(e) || !isFinite(o) || e <= 0 || o <= 0 ? t : kt(t, (i) => ({
166
+ x: (i.x - n.minX) / e,
167
+ y: (i.y - n.minY) / o
168
+ }));
169
+ }
170
+ function jo(t, n) {
171
+ if (!(n.width > 0) || !(n.height > 0)) return t;
172
+ const e = Math.min(n.width, n.height), o = (n.width - e) / 2, i = (n.height - e) / 2;
173
+ return kt(t, (r) => ({
174
+ x: (o + r.x * e) / n.width,
175
+ y: (i + r.y * e) / n.height
176
+ }));
177
+ }
178
+ function Pe(t, n, e, o, i, r) {
179
+ let c = [];
180
+ if (n && n.length)
181
+ c = ee(n, o);
182
+ else {
183
+ const l = t.trim();
184
+ if (l && /^[Mm]/.test(l)) {
185
+ const s = sn(l);
186
+ s.length && (c = e === "viewbox" ? ee(s, o) : Vo(s));
187
+ }
188
+ if (!c.length) {
189
+ const s = i !== "custom" ? Se[i] : void 0;
190
+ s ? c = ee(sn(s), Ce) : c = Go();
191
+ }
192
+ }
193
+ return i === "circle" ? jo(c, r) : c;
194
+ }
195
+ function He(t, n) {
196
+ return !(n.width > 0) || !(n.height > 0) || !t.length ? "" : In(kt(t, (e) => ({
197
+ x: e.x * n.width,
198
+ y: e.y * n.height
199
+ })));
200
+ }
201
+ function he(t) {
202
+ const n = t === "rectangle" || t === "custom" ? void 0 : Se[t];
203
+ return n ? Fn(bn(sn(n)), Ce) : [bo([[0, 0], [1, 0], [1, 1], [0, 1]])];
204
+ }
205
+ function Ko(t) {
206
+ const n = t.match(Oo);
207
+ return n ? n.map(Number).filter((e) => !Number.isNaN(e)) : [];
208
+ }
209
+ function Vt(t, n, e) {
210
+ return { x: t.x + (n.x - t.x) * e, y: t.y + (n.y - t.y) * e };
211
+ }
212
+ function ue(t, n) {
213
+ return { x: n.x * 2 - t.x, y: n.y * 2 - t.y };
214
+ }
215
+ function Dt(t) {
216
+ return { x: t.x, y: t.y };
217
+ }
218
+ function Zo(t) {
219
+ return {
220
+ p: Dt(t.p),
221
+ in: t.in ? Dt(t.in) : null,
222
+ out: t.out ? Dt(t.out) : null
223
+ };
224
+ }
225
+ function nn(t) {
226
+ return t.map((n) => ({ closed: n.closed, nodes: n.nodes.map(Zo) }));
227
+ }
228
+ function kt(t, n) {
229
+ return t.map((e) => ({
230
+ closed: e.closed,
231
+ nodes: e.nodes.map((o) => ({
232
+ p: n(o.p),
233
+ in: o.in ? n(o.in) : null,
234
+ out: o.out ? n(o.out) : null
235
+ }))
236
+ }));
237
+ }
238
+ function Oe(t, n, e, o = e) {
239
+ return kt(t, (i) => ({
240
+ x: n.x + (i.x - n.x) * e,
241
+ y: n.y + (i.y - n.y) * o
242
+ }));
243
+ }
244
+ function qo(t, n, e, o, i, r, c) {
245
+ let l = Math.abs(n), s = Math.abs(e);
246
+ if (!l || !s || t.x === c.x && t.y === c.y)
247
+ return [{ c1: Dt(t), c2: Dt(c), p: Dt(c) }];
248
+ const d = o * Math.PI / 180, h = Math.cos(d), E = Math.sin(d), b = (t.x - c.x) / 2, $ = (t.y - c.y) / 2, y = h * b + E * $, R = -E * b + h * $, I = y * y / (l * l) + R * R / (s * s);
249
+ if (I > 1) {
250
+ const O = Math.sqrt(I);
251
+ l *= O, s *= O;
252
+ }
253
+ const H = i === r ? -1 : 1, m = l * l * R * R + s * s * y * y, _ = Math.max(0, l * l * s * s - m), A = m === 0 ? 0 : H * Math.sqrt(_ / m), q = A * l * R / s, mt = -A * s * y / l, ht = h * q - E * mt + (t.x + c.x) / 2, ut = E * q + h * mt + (t.y + c.y) / 2, rt = Math.atan2((R - mt) / s, (y - q) / l);
254
+ let L = Math.atan2((-R - mt) / s, (-y - q) / l) - rt;
255
+ !r && L > 0 && (L -= Math.PI * 2), r && L < 0 && (L += Math.PI * 2);
256
+ const gt = Math.max(1, Math.ceil(Math.abs(L) / (Math.PI / 2))), C = L / gt, x = 4 / 3 * Math.tan(C / 4), M = (O, X) => ({
257
+ x: ht + h * l * O - E * s * X,
258
+ y: ut + E * l * O + h * s * X
259
+ }), D = [];
260
+ let W = rt;
261
+ for (let O = 0; O < gt; O += 1) {
262
+ const X = W + C, u = Math.cos(W), K = Math.sin(W), Z = Math.cos(X), it = Math.sin(X);
263
+ D.push({
264
+ c1: M(u - x * K, K + x * u),
265
+ c2: M(Z + x * it, it - x * Z),
266
+ p: O === gt - 1 ? Dt(c) : M(Z, it)
267
+ }), W = X;
268
+ }
269
+ return D;
270
+ }
271
+ function sn(t) {
272
+ const n = (t ?? "").trim();
273
+ if (!n) return [];
274
+ const e = [];
275
+ let o = [], i = !1, r = { x: 0, y: 0 }, c = { x: 0, y: 0 }, l = null, s = null;
276
+ const d = () => {
277
+ if (i && o.length > 2) {
278
+ const $ = o[0], y = o[o.length - 1];
279
+ Math.abs($.p.x - y.p.x) < 1e-6 && Math.abs($.p.y - y.p.y) < 1e-6 && ($.in = y.in ?? $.in, o.pop());
280
+ }
281
+ o.length > 1 && e.push({ nodes: o, closed: i }), o = [], i = !1;
282
+ }, h = ($, y) => {
283
+ o.push({ p: $, in: en(y ?? null, $), out: null }), r = $;
284
+ }, E = ($) => {
285
+ if (!o.length) return;
286
+ const y = o[o.length - 1];
287
+ y.out = en($, y.p);
288
+ };
289
+ ne.lastIndex = 0;
290
+ let b = ne.exec(n);
291
+ for (; b !== null; ) {
292
+ const $ = b[1], y = $.toUpperCase(), R = $ !== y, I = Ko(b[2]), H = (m) => R ? { x: r.x + I[m], y: r.y + I[m + 1] } : { x: I[m], y: I[m + 1] };
293
+ if (y === "Z")
294
+ i = !0, d(), r = Dt(c), l = null, s = null;
295
+ else if (y === "M") {
296
+ for (let m = 0; m + 1 < I.length; m += 2) {
297
+ const _ = H(m);
298
+ m === 0 && (d(), c = Dt(_)), h(_);
299
+ }
300
+ l = null, s = null;
301
+ } else if (y === "L") {
302
+ for (let m = 0; m + 1 < I.length; m += 2) h(H(m));
303
+ l = null, s = null;
304
+ } else if (y === "H") {
305
+ for (const m of I) h({ x: R ? r.x + m : m, y: r.y });
306
+ l = null, s = null;
307
+ } else if (y === "V") {
308
+ for (const m of I) h({ x: r.x, y: R ? r.y + m : m });
309
+ l = null, s = null;
310
+ } else if (y === "C") {
311
+ for (let m = 0; m + 5 < I.length; m += 6) {
312
+ const _ = H(m), A = H(m + 2), q = H(m + 4);
313
+ E(_), h(q, A), l = A;
314
+ }
315
+ s = null;
316
+ } else if (y === "S") {
317
+ for (let m = 0; m + 3 < I.length; m += 4) {
318
+ const _ = l ? ue(l, r) : Dt(r), A = H(m), q = H(m + 2);
319
+ E(_), h(q, A), l = A;
320
+ }
321
+ s = null;
322
+ } else if (y === "Q")
323
+ for (let m = 0; m + 3 < I.length; m += 4) {
324
+ const _ = H(m), A = H(m + 2);
325
+ E(Vt(r, _, 2 / 3)), h(A, Vt(A, _, 2 / 3)), s = _, l = null;
326
+ }
327
+ else if (y === "T")
328
+ for (let m = 0; m + 1 < I.length; m += 2) {
329
+ const _ = s ? ue(s, r) : Dt(r), A = H(m);
330
+ E(Vt(r, _, 2 / 3)), h(A, Vt(A, _, 2 / 3)), s = _, l = null;
331
+ }
332
+ else if (y === "A")
333
+ for (let m = 0; m + 6 < I.length; m += 7) {
334
+ const _ = R ? { x: r.x + I[m + 5], y: r.y + I[m + 6] } : { x: I[m + 5], y: I[m + 6] };
335
+ for (const A of qo(r, I[m], I[m + 1], I[m + 2], I[m + 3] !== 0, I[m + 4] !== 0, _))
336
+ E(A.c1), h(A.p, A.c2);
337
+ l = null, s = null;
338
+ }
339
+ b = ne.exec(n);
340
+ }
341
+ return d(), e;
342
+ }
343
+ function Bt(t) {
344
+ return `${Number(t.toFixed(2))}`;
345
+ }
346
+ function en(t, n) {
347
+ return !t || Math.abs(t.x - n.x) < 1e-6 && Math.abs(t.y - n.y) < 1e-6 ? null : t;
348
+ }
349
+ function io(t) {
350
+ return !!(en(t.in, t.p) || en(t.out, t.p));
351
+ }
352
+ function An(t, n) {
353
+ return !en(t.out, t.p) && !en(n.in, n.p);
354
+ }
355
+ function ze(t, n) {
356
+ if (An(t, n))
357
+ return `L${Bt(n.p.x)},${Bt(n.p.y)}`;
358
+ const e = en(t.out, t.p) ?? t.p, o = en(n.in, n.p) ?? n.p;
359
+ return `C${Bt(e.x)},${Bt(e.y)} ${Bt(o.x)},${Bt(o.y)} ${Bt(n.p.x)},${Bt(n.p.y)}`;
360
+ }
361
+ function In(t) {
362
+ const n = [];
363
+ for (const e of t) {
364
+ if (e.nodes.length < 2) continue;
365
+ const [o, ...i] = e.nodes;
366
+ n.push(`M${Bt(o.p.x)},${Bt(o.p.y)}`);
367
+ let r = o;
368
+ for (const c of i)
369
+ n.push(ze(r, c)), r = c;
370
+ if (e.closed) {
371
+ const c = ze(r, o);
372
+ c.charAt(0) === "C" && n.push(c), n.push("Z");
373
+ }
374
+ }
375
+ return n.join(" ");
376
+ }
377
+ function co(t) {
378
+ const n = [];
379
+ for (let e = 0; e + 1 < t.nodes.length; e += 1)
380
+ n.push({ from: t.nodes[e], to: t.nodes[e + 1], index: e });
381
+ if (t.closed && t.nodes.length > 2) {
382
+ const e = t.nodes.length - 1;
383
+ n.push({ from: t.nodes[e], to: t.nodes[0], index: e });
384
+ }
385
+ return n;
386
+ }
387
+ function de(t, n, e) {
388
+ if (An(t, n)) return Vt(t.p, n.p, e);
389
+ const o = t.out ?? t.p, i = n.in ?? n.p, r = 1 - e, c = r * r * r, l = 3 * r * r * e, s = 3 * r * e * e, d = e * e * e;
390
+ return {
391
+ x: c * t.p.x + l * o.x + s * i.x + d * n.p.x,
392
+ y: c * t.p.y + l * o.y + s * i.y + d * n.p.y
393
+ };
394
+ }
395
+ function bn(t) {
396
+ const n = [];
397
+ for (const e of t) {
398
+ if (e.nodes.length < 2) continue;
399
+ const o = [];
400
+ for (const i of co(e)) {
401
+ if (An(i.from, i.to)) {
402
+ o.push(Dt(i.from.p));
403
+ continue;
404
+ }
405
+ for (let r = 0; r < le; r += 1)
406
+ o.push(de(i.from, i.to, r / le));
407
+ }
408
+ e.closed || o.push(Dt(e.nodes[e.nodes.length - 1].p)), o.length > 2 && n.push(o);
409
+ }
410
+ return n;
411
+ }
412
+ function an(t) {
413
+ let n = 1 / 0, e = 1 / 0, o = -1 / 0, i = -1 / 0;
414
+ for (const r of bn(t))
415
+ for (const c of r)
416
+ c.x < n && (n = c.x), c.x > o && (o = c.x), c.y < e && (e = c.y), c.y > i && (i = c.y);
417
+ return { minX: n, minY: e, maxX: o, maxY: i };
418
+ }
419
+ function Qo(t) {
420
+ const n = an(t);
421
+ return !isFinite(n.minX) || !isFinite(n.maxX) || !isFinite(n.minY) || !isFinite(n.maxY) ? null : { x: (n.minX + n.maxX) / 2, y: (n.minY + n.maxY) / 2 };
422
+ }
423
+ function ao(t, n, e) {
424
+ const o = { x: (e.x - t.x) / 6, y: (e.y - t.y) / 6 };
425
+ return {
426
+ in: { x: n.x - o.x, y: n.y - o.y },
427
+ out: { x: n.x + o.x, y: n.y + o.y }
428
+ };
429
+ }
430
+ function so(t) {
431
+ return t.filter((n) => n.length > 2).map((n) => {
432
+ if (n.length <= Po)
433
+ return { closed: !0, nodes: n.map((r) => ({ p: Dt(r), in: null, out: null })) };
434
+ const e = Math.max(1, Math.round(n.length / Ho)), o = [];
435
+ for (let r = 0; r < n.length; r += e) o.push(n[r]);
436
+ const i = o.length;
437
+ return {
438
+ closed: !0,
439
+ nodes: o.map((r, c) => ({
440
+ p: Dt(r),
441
+ ...ao(o[(c - 1 + i) % i], r, o[(c + 1) % i])
442
+ }))
443
+ };
444
+ });
445
+ }
446
+ function lo(t, n, e = 1) {
447
+ if (!t.length) return !1;
448
+ const o = an(t);
449
+ if (!isFinite(o.minX) || !isFinite(o.maxX)) return !1;
450
+ const i = o.maxX - o.minX, r = o.maxY - o.minY;
451
+ if (i <= n.width * 2.5 && r <= n.height * 2.5)
452
+ return !1;
453
+ const c = Math.max(e, n.width * 0.5), l = Math.max(e, n.height * 0.5);
454
+ return o.minX < n.x - c || o.minY < n.y - l || o.maxX > n.x + n.width + c || o.maxY > n.y + n.height + l;
455
+ }
456
+ function Jo(t, n, e, o, i, r, c) {
457
+ const l = n.width > 0 ? e.width / n.width : 1, s = n.height > 0 ? e.height / n.height : 1;
458
+ return !(r > 0) || !(c > 0) || !(l > 0) || !(s > 0) ? t : kt(t, (d) => {
459
+ const h = o + (d.x - n.x) * r, E = i + (d.y - n.y) * c;
460
+ return {
461
+ x: n.x + h / l,
462
+ y: n.y + E / s
463
+ };
464
+ });
465
+ }
466
+ function Uo(t, n) {
467
+ if (!t.length) return t;
468
+ const e = an(t), o = e.maxX - e.minX, i = e.maxY - e.minY;
469
+ if (!(o > 0) || !(i > 0) || e.minX >= n.x - 1e-6 && e.minY >= n.y - 1e-6 && e.maxX <= n.x + n.width + 1e-6 && e.maxY <= n.y + n.height + 1e-6) return t;
470
+ const c = Math.min(n.width / o, n.height / i), l = n.x + (n.width - o * c) / 2, s = n.y + (n.height - i * c) / 2;
471
+ return kt(t, (d) => ({
472
+ x: l + (d.x - e.minX) * c,
473
+ y: s + (d.y - e.minY) * c
474
+ }));
475
+ }
476
+ function ci(t) {
477
+ const n = { x: 0, y: 0, width: Vn, height: Vn }, e = t !== "custom" ? Se[t] : void 0, o = e ? kt(
478
+ sn(e),
479
+ (r) => ({
480
+ x: r.x / 100 * n.width + n.x,
481
+ y: r.y / 100 * n.height + n.y
482
+ })
483
+ ) : kt(
484
+ so(he("rectangle")),
485
+ (r) => ({ x: r.x * n.width + n.x, y: r.y * n.height + n.y })
486
+ ), i = Uo(o, n);
487
+ return {
488
+ shape: t,
489
+ customPath: In(i),
490
+ pathFit: "viewbox",
491
+ pathViewBox: se
492
+ };
493
+ }
494
+ function Tn(t, n) {
495
+ return n > 0 ? Math.round(t / n) * n : t;
496
+ }
497
+ function Bo(t, n, e, o) {
498
+ var d;
499
+ const i = (d = t[n]) == null ? void 0 : d.nodes[e];
500
+ if (!i) return t;
501
+ const r = o.x - i.p.x, c = o.y - i.p.y, l = nn(t), s = l[n].nodes[e];
502
+ return s.p = { x: i.p.x + r, y: i.p.y + c }, s.in && (s.in = { x: s.in.x + r, y: s.in.y + c }), s.out && (s.out = { x: s.out.x + r, y: s.out.y + c }), l;
503
+ }
504
+ function We(t, n, e, o) {
505
+ var r;
506
+ if (!n.length) return t;
507
+ const i = nn(t);
508
+ for (const { contour: c, node: l } of n) {
509
+ const s = (r = i[c]) == null ? void 0 : r.nodes[l];
510
+ s && (s.p = { x: s.p.x + e, y: s.p.y + o }, s.in && (s.in = { x: s.in.x + e, y: s.in.y + o }), s.out && (s.out = { x: s.out.x + e, y: s.out.y + o }));
511
+ }
512
+ return i;
513
+ }
514
+ function tr(t, n) {
515
+ const e = /* @__PURE__ */ new Map();
516
+ for (const { contour: i, node: r } of n) {
517
+ const c = e.get(i) ?? [];
518
+ c.push(r), e.set(i, c);
519
+ }
520
+ let o = t;
521
+ return e.forEach((i, r) => {
522
+ const c = [...i].sort((l, s) => s - l);
523
+ for (const l of c)
524
+ o = ho(o, r, l);
525
+ }), o;
526
+ }
527
+ function nr(t, n, e, o, i, r) {
528
+ var d;
529
+ if (!((d = t[n]) == null ? void 0 : d.nodes[e])) return t;
530
+ const l = nn(t), s = l[n].nodes[e];
531
+ if (s[o] = Dt(i), r) {
532
+ const h = o === "in" ? "out" : "in";
533
+ s[h] = ue(i, s.p);
534
+ }
535
+ return l;
536
+ }
537
+ function er(t, n, e, o) {
538
+ var c;
539
+ const i = (c = t[n]) == null ? void 0 : c.nodes[e];
540
+ if (!i || !i[o]) return t;
541
+ const r = nn(t);
542
+ return r[n].nodes[e][o] = null, r;
543
+ }
544
+ function or(t, n, e, o) {
545
+ const i = t[n];
546
+ if (!i) return { contours: t, nodeIndex: -1 };
547
+ const r = i.nodes[e], c = i.nodes[(e + 1) % i.nodes.length];
548
+ if (!r || !c) return { contours: t, nodeIndex: -1 };
549
+ const l = nn(t), s = l[n].nodes, d = e + 1;
550
+ if (An(r, c))
551
+ return s.splice(d, 0, { p: Vt(r.p, c.p, o), in: null, out: null }), { contours: l, nodeIndex: d };
552
+ const h = r.out ?? r.p, E = c.in ?? c.p, b = Vt(r.p, h, o), $ = Vt(h, E, o), y = Vt(E, c.p, o), R = Vt(b, $, o), I = Vt($, y, o), H = Vt(R, I, o), m = (e + 1) % i.nodes.length;
553
+ return s[e].out = b, s[m].in = y, s.splice(d, 0, { p: H, in: R, out: I }), { contours: l, nodeIndex: d };
554
+ }
555
+ function ho(t, n, e) {
556
+ const o = t[n];
557
+ if (!o || o.nodes.length <= 3) return t;
558
+ const i = nn(t);
559
+ return i[n].nodes.splice(e, 1), i;
560
+ }
561
+ function ve(t, n, e) {
562
+ const o = t[n];
563
+ if (!(o == null ? void 0 : o.nodes[e])) return t;
564
+ const r = nn(t), c = r[n].nodes, l = c[e], s = c.length, d = (e - 1 + s) % s, h = (e + 1) % s, E = !!en(c[d].out, c[d].p), b = !!en(c[h].in, c[h].p);
565
+ if (io(l) || E || b)
566
+ return l.in = null, l.out = null, c[d].out = null, c[h].in = null, r;
567
+ const $ = ao(c[d].p, l.p, c[h].p);
568
+ return l.in = $.in, l.out = $.out, r;
569
+ }
570
+ function rr(t, n, e) {
571
+ const o = e.x - n.x, i = e.y - n.y, r = o * o + i * i, c = r === 0 ? 0 : Math.max(0, Math.min(1, ((t.x - n.x) * o + (t.y - n.y) * i) / r)), l = { x: n.x + o * c, y: n.y + i * c };
572
+ return { t: c, distance: Math.hypot(t.x - l.x, t.y - l.y), point: l };
573
+ }
574
+ function Ge(t, n) {
575
+ let e = null;
576
+ return t.forEach((o, i) => {
577
+ for (const r of co(o)) {
578
+ const c = An(r.from, r.to) ? 1 : le;
579
+ for (let l = 0; l < c; l += 1) {
580
+ const s = l / c, d = (l + 1) / c, h = rr(n, de(r.from, r.to, s), de(r.from, r.to, d));
581
+ (!e || h.distance < e.distance) && (e = {
582
+ contour: i,
583
+ segment: r.index,
584
+ t: s + (d - s) * h.t,
585
+ distance: h.distance,
586
+ point: h.point
587
+ });
588
+ }
589
+ }
590
+ }), e;
591
+ }
592
+ function ir(t, n) {
593
+ const e = [];
594
+ return t.forEach((o, i) => {
595
+ o.nodes.forEach((r, c) => {
596
+ i === n.contour && c === n.node || e.push(r.p);
597
+ });
598
+ }), e;
599
+ }
600
+ function Ve(t, n, e) {
601
+ const o = n.filter((r, c) => isFinite(r) && n.findIndex((l) => Math.abs(l - r) < 1e-6) === c), i = o.map((r) => ({ value: r, axis: r, from: null }));
602
+ for (const r of t) i.push({ value: r[e], axis: null, from: r });
603
+ for (const r of o)
604
+ for (const c of t) i.push({ value: r * 2 - c[e], axis: r, from: c });
605
+ return i;
606
+ }
607
+ function je(t, n, e, o, i) {
608
+ const r = o(n)[e];
609
+ let c = null, l = 1 / 0;
610
+ for (const s of t) {
611
+ const d = e === "x" ? { x: s.value, y: n.y } : { x: n.x, y: s.value }, h = Math.abs(o(d)[e] - r);
612
+ h > i || c && h >= l || (c = s, l = h);
613
+ }
614
+ return c;
615
+ }
616
+ function cr(t, n) {
617
+ return t.length === n.length && t.every((e, o) => e.kind === n[o].kind && e.a.x === n[o].a.x && e.a.y === n[o].a.y && e.b.x === n[o].b.x && e.b.y === n[o].b.y);
618
+ }
619
+ function ar(t) {
620
+ const n = Math.PI * 2;
621
+ return ((t + Math.PI) % n + n) % n - Math.PI;
622
+ }
623
+ function fe(t, n) {
624
+ const e = n.x - t.x, o = n.y - t.y, i = Math.hypot(e, o);
625
+ return i < 1e-6 ? null : { x: e / i, y: o / i };
626
+ }
627
+ function sr(t, n) {
628
+ const e = fe(t, n);
629
+ return e ? {
630
+ kind: "align",
631
+ a: { x: t.x - e.x * Cn, y: t.y - e.y * Cn },
632
+ b: { x: n.x + e.x * Cn, y: n.y + e.y * Cn }
633
+ } : { kind: "align", a: t, b: n };
634
+ }
635
+ function pe(t, n, e) {
636
+ return n === "x" ? { kind: "center", a: { x: t, y: 0 }, b: { x: t, y: e.height } } : { kind: "center", a: { x: 0, y: t }, b: { x: e.width, y: t } };
637
+ }
638
+ function Ke(t, n, e, o, i) {
639
+ if (t.axis === null) return sr(e, i(t.from ?? e));
640
+ const r = n === "x" ? { x: t.axis, y: 0 } : { x: 0, y: t.axis };
641
+ return pe(i(r)[n], n, o);
642
+ }
643
+ function lr(t, n, e, o, i) {
644
+ const r = [], c = i(t);
645
+ return n && t.x === n.value && r.push(Ke(n, "x", c, o, i)), e && t.y === e.value && r.push(Ke(e, "y", c, o, i)), r;
646
+ }
647
+ function hr(t, n, e, o) {
648
+ const i = t == null ? void 0 : t.nodes[n];
649
+ if (!t || !i) return null;
650
+ const r = o(i.p), c = e === "in" ? i.out : i.in;
651
+ if (c) return fe(o(c), r);
652
+ const l = t.nodes.length, s = n + (e === "in" ? 1 : -1);
653
+ if (!t.closed && (s < 0 || s >= l)) return null;
654
+ const d = t.nodes[(s + l) % l];
655
+ if (!d) return null;
656
+ const h = (e === "in" ? d.in : d.out) ?? d.p;
657
+ return fe(o(h), r);
658
+ }
659
+ function ur(t, n, e, o, i, r, c) {
660
+ const l = r(n), s = r(t), d = s.x - l.x, h = s.y - l.y, E = Math.hypot(d, h);
661
+ if (E < 1e-6) return { point: t, guides: Sn };
662
+ const b = Math.atan2(h, d), $ = Math.round(b / Te) * Te;
663
+ let y = i ? $ : null, R = !1;
664
+ if (!i) {
665
+ const mt = [];
666
+ e && mt.push({ angle: Math.atan2(e.y, e.x), smooth: !0 }), mt.push({ angle: $, smooth: !1 });
667
+ for (const ht of mt) {
668
+ const ut = ar(ht.angle - b);
669
+ if (!(Math.abs(ut) > Wo) && !(Math.abs(Math.sin(ut)) * E > zo)) {
670
+ y = ht.angle, R = ht.smooth;
671
+ break;
672
+ }
673
+ }
674
+ }
675
+ const I = o !== null && o > 0 && Math.abs(E - o) <= vo;
676
+ if (y === null && !I) return { point: t, guides: Sn };
677
+ const H = y ?? b, m = I ? o : E, _ = { x: Math.cos(H), y: Math.sin(H) }, A = m + (y === null ? 0 : Cn), q = I ? m : R ? Cn : 0;
678
+ return {
679
+ point: c({ x: l.x + _.x * m, y: l.y + _.y * m }),
680
+ guides: [{
681
+ kind: "angle",
682
+ a: { x: l.x - _.x * q, y: l.y - _.y * q },
683
+ b: { x: l.x + _.x * A, y: l.y + _.y * A }
684
+ }]
685
+ };
686
+ }
687
+ const me = 0.1, ye = 8, dr = 4, Ze = 10, jn = (t, n) => {
688
+ switch (n) {
689
+ case "nw":
690
+ return { x: t.minX, y: t.minY };
691
+ case "ne":
692
+ return { x: t.maxX, y: t.minY };
693
+ case "se":
694
+ return { x: t.maxX, y: t.maxY };
695
+ case "sw":
696
+ return { x: t.minX, y: t.maxY };
697
+ }
698
+ }, uo = (t) => {
699
+ switch (t) {
700
+ case "nw":
701
+ return "se";
702
+ case "ne":
703
+ return "sw";
704
+ case "se":
705
+ return "nw";
706
+ case "sw":
707
+ return "ne";
708
+ }
709
+ }, xe = (t, n) => {
710
+ const e = jn(t, n), o = n === "nw" || n === "sw" ? -1 : 1, i = n === "nw" || n === "ne" ? -1 : 1;
711
+ return {
712
+ x: e.x + o * Ze,
713
+ y: e.y + i * Ze
714
+ };
715
+ }, ge = (t, n) => !(n.width > 0) || !(n.height > 0) || !(t.width > 0) || !(t.height > 0) ? 1 : Math.max(t.width / n.width, t.height / n.height), fn = (t, n, e) => {
716
+ const o = ge(t, n) * e;
717
+ return { width: n.width * o, height: n.height * o };
718
+ }, tn = (t, n, e) => (t - n) * e, $n = (t, n, e, o) => {
719
+ const i = t - n;
720
+ if (Math.abs(i) < 1e-6) return 0.5;
721
+ const r = e / i;
722
+ return (o == null ? void 0 : o.clamp) === !1 ? r : Math.abs(i) < dr ? 0.5 : Gn(r);
723
+ }, fr = (t, n, e, o, i, r) => {
724
+ const c = fn(t, e, r), l = t.x + tn(t.width, c.width, o), s = t.y + tn(t.height, c.height, i), d = ge(t, e), h = ge(n, e), E = Math.min(
725
+ ye,
726
+ Math.max(me, h > 0 ? r * (d / h) : r)
727
+ ), b = fn(n, e, E);
728
+ return {
729
+ focalX: $n(n.width, b.width, l - n.x, { clamp: !1 }),
730
+ focalY: $n(n.height, b.height, s - n.y, { clamp: !1 }),
731
+ scale: E
732
+ };
733
+ }, pr = 6, mr = 3, yr = 2, oe = "­", xr = new RegExp("\\p{L}", "gu"), qe = 20, gr = {
734
+ arb: "ar",
735
+ azj: "az",
736
+ bel: "be",
737
+ bos: "bs",
738
+ bul: "bg",
739
+ ces: "cs",
740
+ deu: "de",
741
+ eng: "en",
742
+ fas: "fa",
743
+ fra: "fr",
744
+ hau: "ha",
745
+ hin: "hi",
746
+ hrv: "hr",
747
+ hun: "hu",
748
+ ibo: "ig",
749
+ ind: "id",
750
+ ita: "it",
751
+ jav: "jv",
752
+ kaz: "kk",
753
+ kin: "rw",
754
+ lin: "ln",
755
+ mar: "mr",
756
+ nep: "ne",
757
+ nld: "nl",
758
+ nya: "ny",
759
+ pol: "pl",
760
+ por: "pt",
761
+ ron: "ro",
762
+ run: "rn",
763
+ rus: "ru",
764
+ som: "so",
765
+ spa: "es",
766
+ srp: "sr",
767
+ sun: "su",
768
+ swe: "sv",
769
+ swh: "sw",
770
+ tgl: "tl",
771
+ tur: "tr",
772
+ ukr: "uk",
773
+ urd: "ur",
774
+ uzn: "uz",
775
+ vie: "vi",
776
+ yor: "yo",
777
+ zlm: "ms",
778
+ zul: "zu"
779
+ }, we = {
780
+ be: () => import("./index-B0n2O6vm.mjs").then((t) => t.i),
781
+ bg: () => import("./index-C-Y61Lcr.mjs").then((t) => t.i),
782
+ cs: () => import("./index-Bq8huKYW.mjs").then((t) => t.i),
783
+ de: () => import("./index-B_Fyqx22.mjs").then((t) => t.i),
784
+ en: () => import("./index-By2pnaap.mjs").then((t) => t.i),
785
+ "en-gb": () => import("./index-C7aqOvnk.mjs").then((t) => t.i),
786
+ es: () => import("./index-CcAPGjN3.mjs").then((t) => t.i),
787
+ fr: () => import("./index-CBQfJnR5.mjs").then((t) => t.i),
788
+ hi: () => import("./index-DVS4MiPy.mjs").then((t) => t.i),
789
+ hr: () => import("./index-DmSeFq2X.mjs").then((t) => t.i),
790
+ hu: () => import("./index-6Pkh3skU.mjs").then((t) => t.i),
791
+ id: () => import("./index-CbVelYDh.mjs").then((t) => t.i),
792
+ it: () => import("./index-BA25un1c.mjs").then((t) => t.i),
793
+ mr: () => import("./index-C0IKjloI.mjs").then((t) => t.i),
794
+ nl: () => import("./index-DtWVe73G.mjs").then((t) => t.i),
795
+ pl: () => import("./index-DGU-dfFs.mjs").then((t) => t.i),
796
+ pt: () => import("./index-C2kp589t.mjs").then((t) => t.i),
797
+ ro: () => import("./index-D6ylLL_6.mjs").then((t) => t.i),
798
+ ru: () => import("./index-D5u4q2ir.mjs").then((t) => t.i),
799
+ sr: () => import("./index-7g44aFH6.mjs").then((t) => t.i),
800
+ sv: () => import("./index-DEtZMhOE.mjs").then((t) => t.i),
801
+ tr: () => import("./index-CNGjgoL-.mjs").then((t) => t.i),
802
+ uk: () => import("./index-B-0_dAcP.mjs").then((t) => t.i)
803
+ }, fo = (t, n) => {
804
+ const e = t;
805
+ return n(e) ?? n(e.default) ?? null;
806
+ };
807
+ let re = null;
808
+ const wr = () => (re ?? (re = import("franc-min").then((t) => fo(t, (n) => typeof n == "function" ? n : void 0)).catch((t) => (console.warn("Pretext: failed to load franc-min, using the page language for hyphenation", t), re = null, null))), re), ie = /* @__PURE__ */ new Map(), Mr = (t) => {
809
+ let n = ie.get(t);
810
+ return n || (n = we[t]().then((e) => fo(e, (o) => o == null ? void 0 : o.hyphenateSync)).catch((e) => (console.warn(`Pretext: failed to load "${t}" hyphenation patterns`, e), ie.delete(t), null)), ie.set(t, n)), n;
811
+ }, Qe = (t) => {
812
+ if (!t) return null;
813
+ const n = t.toLowerCase();
814
+ if (we[n]) return n;
815
+ const e = n.split("-")[0];
816
+ return we[e] ? e : null;
817
+ }, Cr = (t, n) => {
818
+ const e = n.trim();
819
+ if (e.length < qe) return;
820
+ const o = t(e, { minLength: qe });
821
+ if (o !== "und")
822
+ return gr[o] ?? o;
823
+ }, Sr = { hyphenateSync: null };
824
+ function $r(t, n) {
825
+ const [e, o] = yt(null);
826
+ return At(() => {
827
+ if (!t) return;
828
+ let i = !1;
829
+ return wr().then(async (r) => {
830
+ const c = r ? Cr(r, n) : void 0, l = typeof document < "u" ? document.documentElement.lang : "", s = Qe(c) ?? Qe(l) ?? "en", d = await Mr(s);
831
+ i || o({ lang: c, hyphenateSync: d });
832
+ }), () => {
833
+ i = !0;
834
+ };
835
+ }, [t, n]), t && e ? e : Sr;
836
+ }
837
+ const Je = (t) => {
838
+ var n;
839
+ return ((n = t.match(xr)) == null ? void 0 : n.length) ?? 0;
840
+ };
841
+ function Fr(t, n) {
842
+ if (t.length < 2 || t.includes(oe)) return;
843
+ const e = /* @__PURE__ */ new Set();
844
+ if (n) {
845
+ const i = n(t, { hyphenChar: oe, minWordLength: pr });
846
+ let r = 0;
847
+ for (let c = 0; c < i.length; c += 1)
848
+ i[c] === oe ? e.add(r) : r += 1;
849
+ }
850
+ for (let i = 1; i < t.length - 1; i += 1)
851
+ t[i - 1] === "-" && e.add(i);
852
+ const o = [...e].filter((i) => {
853
+ const r = t[i - 1] === "-";
854
+ return i > 0 && i < t.length && Je(t.slice(0, i)) >= (r ? 1 : mr) && Je(t.slice(i)) >= (r ? 1 : yr);
855
+ }).sort((i, r) => i - r);
856
+ return o.length ? o : void 0;
857
+ }
858
+ const Ue = 1.08, Pn = 14, Hn = 8;
859
+ function Ir({ P: t, box: n, bounds: e, natural: o, imageUrl: i, maskPath: r, stage: c, onStageChange: l, focalX: s, focalY: d, scale: h, onChange: E, onCommit: b }) {
860
+ const $ = St(null), y = `pretext-image-ghost-${oo().replace(/:/g, "")}`, R = St(null), I = St(null), H = St({ focalX: s, focalY: d, scale: h });
861
+ H.current = { focalX: s, focalY: d, scale: h };
862
+ const m = c === "image";
863
+ At(() => {
864
+ var C;
865
+ m && ((C = $.current) == null || C.focus({ preventScroll: !0 }));
866
+ }, [m]);
867
+ const _ = _t((C, x) => {
868
+ var D;
869
+ const M = (D = $.current) == null ? void 0 : D.getBoundingClientRect();
870
+ return !M || M.width <= 0 || M.height <= 0 ? { x: 0, y: 0 } : {
871
+ x: (C - M.left) / M.width * n.width,
872
+ y: (x - M.top) / M.height * n.height
873
+ };
874
+ }, [n.width, n.height]), A = (C) => {
875
+ var M, D;
876
+ if (!o) return;
877
+ C.stopPropagation(), C.preventDefault(), (M = $.current) == null || M.focus({ preventScroll: !0 });
878
+ const x = fn(e, o, h);
879
+ R.current = {
880
+ pointerId: C.pointerId,
881
+ origin: _(C.clientX, C.clientY),
882
+ startX: tn(e.width, x.width, s),
883
+ startY: tn(e.height, x.height, d),
884
+ width: x.width,
885
+ height: x.height,
886
+ moved: !1
887
+ }, (D = $.current) == null || D.setPointerCapture(C.pointerId);
888
+ }, q = (C, x) => {
889
+ var Z, it;
890
+ if (!o) return;
891
+ C.stopPropagation(), C.preventDefault(), (Z = $.current) == null || Z.focus({ preventScroll: !0 });
892
+ const M = fn(e, o, h), D = tn(e.width, M.width, s), W = tn(e.height, M.height, d), O = { minX: D, minY: W, maxX: D + M.width, maxY: W + M.height }, X = jn(O, uo(x)), u = jn(O, x), K = Math.hypot(u.x - X.x, u.y - X.y);
893
+ !isFinite(K) || K <= 0 || (I.current = {
894
+ pointerId: C.pointerId,
895
+ anchor: X,
896
+ startDistance: K,
897
+ startScale: h,
898
+ startX: D,
899
+ startY: W,
900
+ moved: !1
901
+ }, (it = $.current) == null || it.setPointerCapture(C.pointerId));
902
+ }, mt = (C) => {
903
+ if (!o) return;
904
+ const x = I.current;
905
+ if (x && C.pointerId === x.pointerId) {
906
+ C.stopPropagation(), C.preventDefault();
907
+ const D = _(C.clientX, C.clientY), W = { x: D.x - e.x, y: D.y - e.y }, O = Math.hypot(W.x - x.anchor.x, W.y - x.anchor.y), X = Math.min(
908
+ ye,
909
+ Math.max(me, x.startScale * (O / x.startDistance))
910
+ );
911
+ if (!x.moved && Math.abs(X - x.startScale) < 1e-4) return;
912
+ x.moved = !0;
913
+ const u = X / x.startScale, K = x.anchor.x + (x.startX - x.anchor.x) * u, Z = x.anchor.y + (x.startY - x.anchor.y) * u, it = fn(e, o, X);
914
+ E({
915
+ focalX: $n(e.width, it.width, K),
916
+ focalY: $n(e.height, it.height, Z),
917
+ scale: X
918
+ });
919
+ return;
920
+ }
921
+ const M = R.current;
922
+ if (M && C.pointerId === M.pointerId) {
923
+ C.stopPropagation(), C.preventDefault();
924
+ const D = _(C.clientX, C.clientY), W = D.x - M.origin.x, O = D.y - M.origin.y;
925
+ if (!M.moved && W === 0 && O === 0) return;
926
+ M.moved = !0, E({
927
+ focalX: $n(e.width, M.width, M.startX + W),
928
+ focalY: $n(e.height, M.height, M.startY + O),
929
+ scale: h
930
+ });
931
+ }
932
+ }, ht = (C) => {
933
+ var D, W;
934
+ const x = R.current;
935
+ if (x && C.pointerId === x.pointerId) {
936
+ R.current = null, C.stopPropagation(), (D = $.current) != null && D.hasPointerCapture(x.pointerId) && $.current.releasePointerCapture(x.pointerId), x.moved && b(H.current);
937
+ return;
938
+ }
939
+ const M = I.current;
940
+ M && C.pointerId === M.pointerId && (I.current = null, C.stopPropagation(), (W = $.current) != null && W.hasPointerCapture(M.pointerId) && $.current.releasePointerCapture(M.pointerId), M.moved && b(H.current));
941
+ }, ut = (C) => {
942
+ if (C.key === "Escape") {
943
+ C.stopPropagation(), l("none");
944
+ return;
945
+ }
946
+ if (C.key === "=" || C.key === "+" || C.key === "-" || C.key === "_") {
947
+ C.preventDefault(), C.stopPropagation();
948
+ const x = C.key === "=" || C.key === "+", M = Math.min(ye, Math.max(me, h * (x ? Ue : 1 / Ue))), D = { focalX: s, focalY: d, scale: M };
949
+ E(D), b(D);
950
+ }
951
+ }, rt = ["nw", "ne", "se", "sw"], xt = { minX: e.x, minY: e.y, maxX: e.x + e.width, maxY: e.y + e.height }, L = B(() => {
952
+ const C = o ?? { width: e.width, height: e.height }, x = fn(e, C, h);
953
+ return !(x.width > 0) || !(x.height > 0) ? null : {
954
+ x: e.x + tn(e.width, x.width, s),
955
+ y: e.y + tn(e.height, x.height, d),
956
+ width: x.width,
957
+ height: x.height
958
+ };
959
+ }, [o, e.x, e.y, e.width, e.height, s, d, h]), gt = L ? {
960
+ minX: L.x,
961
+ minY: L.y,
962
+ maxX: L.x + L.width,
963
+ maxY: L.y + L.height
964
+ } : xt;
965
+ return /* @__PURE__ */ It(
966
+ "svg",
967
+ {
968
+ ref: $,
969
+ className: `${t}-editor${m ? ` ${t}-editor-armed` : ""}`,
970
+ width: n.width,
971
+ height: n.height,
972
+ viewBox: `0 0 ${n.width} ${n.height}`,
973
+ tabIndex: 0,
974
+ onKeyDown: ut,
975
+ onPointerMove: mt,
976
+ onPointerUp: ht,
977
+ onPointerCancel: ht,
978
+ onLostPointerCapture: ht,
979
+ "data-pretext-image-editor": !0,
980
+ children: [
981
+ /* @__PURE__ */ P(
982
+ "rect",
983
+ {
984
+ className: `${t}-editor-surface`,
985
+ width: n.width,
986
+ height: n.height,
987
+ onPointerDown: () => l("none")
988
+ }
989
+ ),
990
+ m && i && L && r && /* @__PURE__ */ It(vn, { children: [
991
+ /* @__PURE__ */ P("defs", { children: /* @__PURE__ */ It("mask", { id: y, maskUnits: "userSpaceOnUse", x: L.x, y: L.y, width: L.width, height: L.height, children: [
992
+ /* @__PURE__ */ P("rect", { x: L.x, y: L.y, width: L.width, height: L.height, fill: "#FFFFFF" }),
993
+ /* @__PURE__ */ P("path", { d: r, fillRule: "evenodd", fill: "#000000" })
994
+ ] }) }),
995
+ /* @__PURE__ */ P(
996
+ "image",
997
+ {
998
+ className: `${t}-editor-ghost`,
999
+ href: i ?? void 0,
1000
+ x: L.x,
1001
+ y: L.y,
1002
+ width: L.width,
1003
+ height: L.height,
1004
+ preserveAspectRatio: "none",
1005
+ mask: `url(#${y})`
1006
+ }
1007
+ ),
1008
+ /* @__PURE__ */ P(
1009
+ "rect",
1010
+ {
1011
+ className: `${t}-editor-image-bounds`,
1012
+ x: L.x,
1013
+ y: L.y,
1014
+ width: L.width,
1015
+ height: L.height
1016
+ }
1017
+ )
1018
+ ] }),
1019
+ m && /* @__PURE__ */ It(vn, { children: [
1020
+ /* @__PURE__ */ P(
1021
+ "rect",
1022
+ {
1023
+ className: `${t}-editor-bbox`,
1024
+ x: e.x,
1025
+ y: e.y,
1026
+ width: e.width,
1027
+ height: e.height
1028
+ }
1029
+ ),
1030
+ /* @__PURE__ */ P(
1031
+ "rect",
1032
+ {
1033
+ className: `${t}-editor-body`,
1034
+ x: e.x,
1035
+ y: e.y,
1036
+ width: e.width,
1037
+ height: e.height,
1038
+ onPointerDown: A
1039
+ }
1040
+ ),
1041
+ rt.map((C) => {
1042
+ const x = xe(gt, C), M = C === "ne" || C === "sw";
1043
+ return /* @__PURE__ */ It("g", { children: [
1044
+ /* @__PURE__ */ P(
1045
+ "rect",
1046
+ {
1047
+ className: `${t}-editor-scale`,
1048
+ x: x.x - Hn / 2,
1049
+ y: x.y - Hn / 2,
1050
+ width: Hn,
1051
+ height: Hn
1052
+ }
1053
+ ),
1054
+ /* @__PURE__ */ P(
1055
+ "rect",
1056
+ {
1057
+ className: `${t}-editor-scale-grab${M ? ` ${t}-editor-scale-grab-nesw` : ""}`,
1058
+ x: x.x - Pn / 2,
1059
+ y: x.y - Pn / 2,
1060
+ width: Pn,
1061
+ height: Pn,
1062
+ onPointerDown: (D) => q(D, C)
1063
+ }
1064
+ )
1065
+ ] }, C);
1066
+ })
1067
+ ] })
1068
+ ]
1069
+ }
1070
+ );
1071
+ }
1072
+ const Me = 10, Ar = Me * 2, Ut = 7, Lr = 4, Mn = 9, Er = 3.5, Be = 1.08, kr = 0.05, On = 14, Nr = 1, zn = 14, Wn = 8;
1073
+ function br({ P: t, box: n, viewBox: e, contours: o, snap: i, stretchToBox: r, uniformStretch: c = !1, stage: l, onStageChange: s, onSelectionChange: d, onChange: h, onCommit: E }) {
1074
+ const b = St(null), $ = St(null), y = St(o);
1075
+ y.current = o;
1076
+ const R = St(null), I = St(null), H = St(null), m = St(null), [_, A] = yt([]), [q, mt] = yt(Sn), [ht, ut] = yt(null), rt = _t((a) => {
1077
+ mt((w) => cr(w, a) ? w : a);
1078
+ }, []), xt = l === "shape";
1079
+ At(() => {
1080
+ var a;
1081
+ xt && ((a = b.current) == null || a.focus({ preventScroll: !0 }));
1082
+ }, [xt]), At(() => {
1083
+ xt || A((a) => a.length ? [] : a);
1084
+ }, [xt]);
1085
+ const L = _.length > 0;
1086
+ At(() => {
1087
+ d == null || d(L);
1088
+ }, [L, d]), At(() => () => d == null ? void 0 : d(!1), [d]);
1089
+ const gt = e.width > 0 ? n.width / e.width : 1, C = e.height > 0 ? n.height / e.height : 1, x = Math.min(gt, C), M = r && c ? x : gt, D = r && c ? x : C, W = r && c ? (n.width - e.width * x) / 2 : 0, O = r && c ? (n.height - e.height * x) / 2 : 0, X = _t((a) => r ? {
1090
+ x: W + (a.x - e.x) * M,
1091
+ y: O + (a.y - e.y) * D
1092
+ } : {
1093
+ x: a.x - e.x,
1094
+ y: a.y - e.y
1095
+ }, [r, e, M, D, W, O]), u = _t((a) => r ? {
1096
+ x: e.x + (M > 0 ? (a.x - W) / M : 0),
1097
+ y: e.y + (D > 0 ? (a.y - O) / D : 0)
1098
+ } : {
1099
+ x: e.x + a.x,
1100
+ y: e.y + a.y
1101
+ }, [r, e, M, D, W, O]), K = B(() => u({ x: n.width / 2, y: n.height / 2 }), [u, n.width, n.height]), Z = _t((a, w) => {
1102
+ var k;
1103
+ const g = (k = b.current) == null ? void 0 : k.getBoundingClientRect();
1104
+ if (!g || g.width <= 0 || g.height <= 0) return { x: 0, y: 0 };
1105
+ if (r) {
1106
+ const N = (a - g.left) / g.width * n.width, p = (w - g.top) / g.height * n.height;
1107
+ return {
1108
+ x: e.x + (M > 0 ? (N - W) / M : 0),
1109
+ y: e.y + (D > 0 ? (p - O) / D : 0)
1110
+ };
1111
+ }
1112
+ return {
1113
+ x: e.x + (a - g.left),
1114
+ y: e.y + (w - g.top)
1115
+ };
1116
+ }, [r, e, n.width, n.height, M, D, W, O]), it = _t((a, w) => {
1117
+ var k;
1118
+ const g = (k = b.current) == null ? void 0 : k.getBoundingClientRect();
1119
+ return !g || g.width <= 0 || g.height <= 0 ? { x: 0, y: 0 } : {
1120
+ x: (a - g.left) / g.width * n.width,
1121
+ y: (w - g.top) / g.height * n.height
1122
+ };
1123
+ }, [n.width, n.height]), et = _t((a, w) => {
1124
+ const g = c && !(w != null && w.preserveShape) ? Jo(
1125
+ a,
1126
+ e,
1127
+ n,
1128
+ W,
1129
+ O,
1130
+ M,
1131
+ D
1132
+ ) : a;
1133
+ E(g, w);
1134
+ }, [E, c, e, n, W, O, M, D]), dt = _t(() => {
1135
+ ut(null);
1136
+ }, []), v = _t((a, w, g) => {
1137
+ if (!g || R.current || I.current || H.current || m.current) {
1138
+ dt();
1139
+ return;
1140
+ }
1141
+ const k = it(a, w), N = kt(y.current, X);
1142
+ for (const Y of N)
1143
+ for (const U of Y.nodes)
1144
+ if (Math.hypot(U.p.x - k.x, U.p.y - k.y) <= Mn) {
1145
+ dt();
1146
+ return;
1147
+ }
1148
+ const p = Ge(N, k);
1149
+ if (!p || p.distance > Me) {
1150
+ dt();
1151
+ return;
1152
+ }
1153
+ const T = N[p.contour], z = T == null ? void 0 : T.nodes[p.segment], tt = T == null ? void 0 : T.nodes[(p.segment + 1) % ((T == null ? void 0 : T.nodes.length) ?? 1)], S = !!(z && tt && !An(z, tt));
1154
+ ut((Y) => Y && Y.curved === S && Math.hypot(Y.point.x - p.point.x, Y.point.y - p.point.y) < 0.25 ? Y : { point: p.point, curved: S });
1155
+ }, [it, X, dt]), $t = (a) => {
1156
+ var zt;
1157
+ const w = a.metaKey || a.ctrlKey, g = H.current;
1158
+ if (g && a.pointerId === g.pointerId) {
1159
+ if (a.stopPropagation(), a.preventDefault(), g.startDistance <= 0) return;
1160
+ const lt = Z(a.clientX, a.clientY), G = Math.hypot(lt.x - g.origin.x, lt.y - g.origin.y), ct = Math.max(kr, G / g.startDistance);
1161
+ if (!g.moved && Math.abs(ct - 1) < 1e-4) return;
1162
+ g.moved = !0, h(Oe(g.startContours, g.origin, ct));
1163
+ return;
1164
+ }
1165
+ const k = I.current;
1166
+ if (k && a.pointerId === k.pointerId) {
1167
+ a.stopPropagation(), a.preventDefault();
1168
+ const lt = Z(a.clientX, a.clientY), { bbox: G } = k, ct = G.maxX - G.minX, Mt = G.maxY - G.minY, Qt = lt.x - k.origin.x, Ot = lt.y - k.origin.y;
1169
+ let vt = Qt, Zt = Ot;
1170
+ if (isFinite(ct) && isFinite(Mt))
1171
+ if (r) {
1172
+ let Et = e.x, bt = e.x + e.width, rn = e.y, Xt = e.y + e.height;
1173
+ c && (M > 0 && (Et = e.x + (0 - W) / M, bt = e.x + (n.width - W) / M), D > 0 && (rn = e.y + (0 - O) / D, Xt = e.y + (n.height - O) / D));
1174
+ const pn = Math.min(Et, bt - ct), mn = Math.max(Et, bt - ct), Ln = Math.min(rn, Xt - Mt), Jt = Math.max(rn, Xt - Mt), hn = Math.min(mn, Math.max(pn, G.minX + Qt)), at = Math.min(Jt, Math.max(Ln, G.minY + Ot));
1175
+ vt = hn - G.minX, Zt = at - G.minY;
1176
+ } else {
1177
+ const Et = G.minX - e.x, bt = G.minY - e.y, rn = Math.min(0, n.width - ct), Xt = Math.max(0, n.width - ct), pn = Math.min(0, n.height - Mt), mn = Math.max(0, n.height - Mt), Ln = Math.min(Xt, Math.max(rn, Et + Qt)), Jt = Math.min(mn, Math.max(pn, bt + Ot));
1178
+ vt = Ln - Et, Zt = Jt - bt;
1179
+ }
1180
+ const ln = [];
1181
+ if (!w && isFinite(ct) && isFinite(Mt)) {
1182
+ const Et = X({ x: G.minX + ct / 2 + vt, y: G.minY + Mt / 2 + Zt }), bt = { x: n.width / 2, y: n.height / 2 };
1183
+ Math.abs(Et.x - bt.x) <= On && (vt = K.x - G.minX - ct / 2, ln.push(pe(bt.x, "x", n))), Math.abs(Et.y - bt.y) <= On && (Zt = K.y - G.minY - Mt / 2, ln.push(pe(bt.y, "y", n)));
1184
+ }
1185
+ if (!k.moved && vt === 0 && Zt === 0) return;
1186
+ k.moved = !0, rt(ln.length ? ln : Sn), h(
1187
+ kt(k.startContours, (Et) => ({ x: Et.x + vt, y: Et.y + Zt })),
1188
+ { carryImage: !0 }
1189
+ );
1190
+ return;
1191
+ }
1192
+ const N = m.current;
1193
+ if (N && a.pointerId === N.pointerId) {
1194
+ a.stopPropagation(), a.preventDefault();
1195
+ const lt = Z(a.clientX, a.clientY);
1196
+ let G = lt.x - N.origin.x, ct = lt.y - N.origin.y;
1197
+ if (a.shiftKey && (Math.abs(G) > Math.abs(ct) ? ct = 0 : G = 0), !N.moved && G === 0 && ct === 0) return;
1198
+ N.moved = !0, h(We(N.startContours, N.selection, G, ct));
1199
+ return;
1200
+ }
1201
+ const p = R.current;
1202
+ if (!p || a.pointerId !== p.pointerId) {
1203
+ v(a.clientX, a.clientY, _.length > 0 || xt);
1204
+ return;
1205
+ }
1206
+ dt(), a.stopPropagation(), a.preventDefault();
1207
+ const T = Z(a.clientX, a.clientY);
1208
+ if (p.kind === "anchor") {
1209
+ const lt = {
1210
+ x: p.anchor.x + (T.x - p.origin.x),
1211
+ y: p.anchor.y + (T.y - p.origin.y)
1212
+ }, G = w ? [] : ir(y.current, { contour: p.contour, node: p.node }), ct = w || !p.center ? [] : [p.center], Mt = je(Ve(G, ct.map((vt) => vt.x), "x"), lt, "x", X, On), Qt = je(Ve(G, ct.map((vt) => vt.y), "y"), lt, "y", X, On), Ot = w ? lt : {
1213
+ x: (Mt == null ? void 0 : Mt.value) ?? Tn(lt.x, i),
1214
+ y: (Qt == null ? void 0 : Qt.value) ?? Tn(lt.y, i)
1215
+ };
1216
+ if (a.shiftKey && (Math.abs(Ot.x - p.anchor.x) > Math.abs(Ot.y - p.anchor.y) ? Ot.y = p.anchor.y : Ot.x = p.anchor.x), !p.moved && Ot.x === p.anchor.x && Ot.y === p.anchor.y) return;
1217
+ p.moved = !0, rt(lr(Ot, Mt, Qt, n, X)), h(Bo(y.current, p.contour, p.node, Ot));
1218
+ return;
1219
+ }
1220
+ const z = (zt = y.current[p.contour]) == null ? void 0 : zt.nodes[p.node], tt = p.mirror && !a.altKey, S = tt || w ? null : p.kind === "in" ? z == null ? void 0 : z.out : z == null ? void 0 : z.in, Y = z ? X(z.p) : null, U = S ? X(S) : null, wt = z && (!w || a.shiftKey) ? ur(
1221
+ T,
1222
+ z.p,
1223
+ tt || w ? null : hr(y.current[p.contour], p.node, p.kind, X),
1224
+ Y && U ? Math.hypot(U.x - Y.x, U.y - Y.y) : null,
1225
+ a.shiftKey,
1226
+ X,
1227
+ u
1228
+ ) : { point: T, guides: Sn }, nt = wt.guides.length ? wt.point : w ? T : { x: Tn(T.x, i), y: Tn(T.y, i) }, Ht = p.kind === "in" ? z == null ? void 0 : z.in : z == null ? void 0 : z.out;
1229
+ !p.moved && Ht && nt.x === Ht.x && nt.y === Ht.y || (p.moved = !0, rt(wt.guides), h(nr(y.current, p.contour, p.node, p.kind, nt, tt)));
1230
+ }, Tt = (a) => {
1231
+ rt(Sn);
1232
+ const w = H.current;
1233
+ if (w && a.pointerId === w.pointerId) {
1234
+ H.current = null, a.stopPropagation();
1235
+ const S = b.current;
1236
+ S != null && S.hasPointerCapture(w.pointerId) && S.releasePointerCapture(w.pointerId), w.moved && et(y.current, { preserveShape: !0 });
1237
+ return;
1238
+ }
1239
+ const g = I.current;
1240
+ if (g && a.pointerId === g.pointerId) {
1241
+ I.current = null, a.stopPropagation();
1242
+ const S = b.current;
1243
+ S != null && S.hasPointerCapture(g.pointerId) && S.releasePointerCapture(g.pointerId), g.moved ? et(y.current, { preserveShape: !0 }) : A([]);
1244
+ return;
1245
+ }
1246
+ const k = m.current;
1247
+ if (k && a.pointerId === k.pointerId) {
1248
+ m.current = null, a.stopPropagation();
1249
+ const S = b.current;
1250
+ S != null && S.hasPointerCapture(k.pointerId) && S.releasePointerCapture(k.pointerId), k.moved && et(y.current);
1251
+ return;
1252
+ }
1253
+ const N = R.current;
1254
+ if (!N || a.pointerId !== N.pointerId) return;
1255
+ R.current = null, a.stopPropagation();
1256
+ const p = b.current;
1257
+ p != null && p.hasPointerCapture(N.pointerId) && p.releasePointerCapture(N.pointerId);
1258
+ const T = Math.hypot(a.clientX - N.clientOrigin.x, a.clientY - N.clientOrigin.y);
1259
+ if (N.moved || T > Lr) {
1260
+ N.moved && et(y.current);
1261
+ return;
1262
+ }
1263
+ if (!N.toggleOnRelease || a.type !== "pointerup") return;
1264
+ const tt = ve(y.current, N.contour, N.node);
1265
+ tt !== y.current && (h(tt), et(tt));
1266
+ }, qt = (a) => {
1267
+ a.stopPropagation();
1268
+ }, Wt = (a) => {
1269
+ var w, g;
1270
+ a.stopPropagation(), a.preventDefault(), dt(), (w = b.current) == null || w.focus({ preventScroll: !0 }), I.current = {
1271
+ pointerId: a.pointerId,
1272
+ origin: Z(a.clientX, a.clientY),
1273
+ startContours: nn(o),
1274
+ bbox: an(o),
1275
+ moved: !1
1276
+ }, (g = b.current) == null || g.setPointerCapture(a.pointerId);
1277
+ }, ft = (a, w) => {
1278
+ var T, z;
1279
+ a.stopPropagation(), a.preventDefault(), dt(), (T = b.current) == null || T.focus({ preventScroll: !0 }), A([]), s("shape");
1280
+ const g = an(o), k = jn(g, uo(w)), N = xe(g, w), p = Math.hypot(N.x - k.x, N.y - k.y);
1281
+ !isFinite(p) || p <= 0 || (H.current = {
1282
+ pointerId: a.pointerId,
1283
+ corner: w,
1284
+ origin: k,
1285
+ startDistance: p,
1286
+ startContours: nn(o),
1287
+ moved: !1
1288
+ }, (z = b.current) == null || z.setPointerCapture(a.pointerId));
1289
+ }, Ft = (a, w, g, k) => {
1290
+ var T, z, tt, S;
1291
+ a.stopPropagation(), a.preventDefault(), dt(), (T = b.current) == null || T.focus({ preventScroll: !0 });
1292
+ const N = (z = o[g]) == null ? void 0 : z.nodes[k];
1293
+ if (!N) return;
1294
+ if (a.altKey) {
1295
+ const Y = w === "anchor" ? ho(o, g, k) : er(o, g, k, w);
1296
+ if (Y === o) return;
1297
+ A(w === "anchor" ? [] : [{ contour: g, node: k }]), h(Y), et(Y);
1298
+ return;
1299
+ }
1300
+ const p = a.metaKey || a.ctrlKey;
1301
+ if (w === "anchor" && a.shiftKey && !p) {
1302
+ A((Y) => Y.some((U) => U.contour === g && U.node === k) ? Y.filter((U) => !(U.contour === g && U.node === k)) : [...Y, { contour: g, node: k }]);
1303
+ return;
1304
+ }
1305
+ if (w === "anchor" && !p && _.length > 1 && _.some((Y) => Y.contour === g && Y.node === k)) {
1306
+ m.current = {
1307
+ pointerId: a.pointerId,
1308
+ origin: Z(a.clientX, a.clientY),
1309
+ startContours: nn(o),
1310
+ selection: _,
1311
+ moved: !1
1312
+ }, (tt = b.current) == null || tt.setPointerCapture(a.pointerId);
1313
+ return;
1314
+ }
1315
+ A([{ contour: g, node: k }]), R.current = {
1316
+ kind: w,
1317
+ contour: g,
1318
+ node: k,
1319
+ pointerId: a.pointerId,
1320
+ origin: Z(a.clientX, a.clientY),
1321
+ clientOrigin: { x: a.clientX, y: a.clientY },
1322
+ anchor: N.p,
1323
+ center: Qo(o),
1324
+ mirror: w !== "anchor" && !!(N.in && N.out),
1325
+ toggleOnRelease: p,
1326
+ moved: !1
1327
+ }, (S = b.current) == null || S.setPointerCapture(a.pointerId);
1328
+ }, Nt = (a) => {
1329
+ a.stopPropagation(), a.preventDefault(), dt();
1330
+ const w = kt(o, X), g = Ge(w, it(a.clientX, a.clientY));
1331
+ if (!g || g.distance > Me) return;
1332
+ const { contours: k, nodeIndex: N } = or(o, g.contour, g.segment, g.t);
1333
+ N < 0 || (A([{ contour: g.contour, node: N }]), h(k), et(k));
1334
+ }, pt = (a) => {
1335
+ if (a.key === "=" || a.key === "+" || a.key === "-" || a.key === "_") {
1336
+ a.preventDefault(), a.stopPropagation();
1337
+ const p = an(o);
1338
+ if (!isFinite(p.minX) || !isFinite(p.maxX)) return;
1339
+ const T = { x: (p.minX + p.maxX) / 2, y: (p.minY + p.maxY) / 2 }, tt = a.key === "=" || a.key === "+" ? Be : 1 / Be, S = Oe(o, T, tt);
1340
+ h(S), et(S, { preserveShape: !0 });
1341
+ return;
1342
+ }
1343
+ if (a.key === "Escape") {
1344
+ a.stopPropagation(), A([]), s("none");
1345
+ return;
1346
+ }
1347
+ if (!_.length) return;
1348
+ if (a.key === "Backspace" || a.key === "Delete") {
1349
+ a.preventDefault(), a.stopPropagation();
1350
+ const p = tr(o, _);
1351
+ if (p === o) return;
1352
+ A([]), h(p), et(p);
1353
+ return;
1354
+ }
1355
+ const w = i > 0 ? i : Nr, g = a.shiftKey ? w * 10 : w, k = { ArrowLeft: [-g, 0], ArrowRight: [g, 0], ArrowUp: [0, -g], ArrowDown: [0, g] }[a.key];
1356
+ if (!k) return;
1357
+ a.preventDefault(), a.stopPropagation();
1358
+ const N = We(o, _, k[0], k[1]);
1359
+ h(N), et(N);
1360
+ }, Q = B(() => In(kt(o, X)), [o, X]), ot = B(() => an(o), [o]), Lt = X({ x: ot.minX, y: ot.minY }), jt = {
1361
+ width: X({ x: ot.maxX, y: ot.minY }).x - Lt.x,
1362
+ height: X({ x: ot.minX, y: ot.maxY }).y - Lt.y
1363
+ }, Kt = xt && _.length === 0 && isFinite(ot.minX) && isFinite(ot.maxX) && ot.maxX > ot.minX && ot.maxY > ot.minY, Pt = _.length > 0 || xt, st = Pt;
1364
+ return /* @__PURE__ */ It(
1365
+ "svg",
1366
+ {
1367
+ ref: b,
1368
+ className: `${t}-editor${Pt ? ` ${t}-editor-armed` : ""}`,
1369
+ width: n.width,
1370
+ height: n.height,
1371
+ viewBox: `0 0 ${n.width} ${n.height}`,
1372
+ tabIndex: 0,
1373
+ onKeyDown: pt,
1374
+ onPointerDown: () => {
1375
+ var a;
1376
+ return (a = b.current) == null ? void 0 : a.focus({ preventScroll: !0 });
1377
+ },
1378
+ onPointerMove: $t,
1379
+ onPointerLeave: dt,
1380
+ onPointerUp: Tt,
1381
+ onPointerCancel: Tt,
1382
+ onLostPointerCapture: Tt,
1383
+ onContextMenu: (a) => {
1384
+ a.preventDefault();
1385
+ },
1386
+ "data-pretext-path-editor": !0,
1387
+ "data-selection": "none",
1388
+ children: [
1389
+ /* @__PURE__ */ P(
1390
+ "rect",
1391
+ {
1392
+ className: `${t}-editor-surface`,
1393
+ width: n.width,
1394
+ height: n.height,
1395
+ onPointerDown: () => {
1396
+ A([]), s("none");
1397
+ },
1398
+ onClick: Nt
1399
+ }
1400
+ ),
1401
+ st && /* @__PURE__ */ P("path", { className: `${t}-editor-outline`, d: Q }),
1402
+ st && q.map((a, w) => /* @__PURE__ */ P(
1403
+ "line",
1404
+ {
1405
+ className: `${t}-editor-snap ${t}-editor-snap-${a.kind}`,
1406
+ x1: a.a.x,
1407
+ y1: a.a.y,
1408
+ x2: a.b.x,
1409
+ y2: a.b.y
1410
+ },
1411
+ `${a.kind}-${w}`
1412
+ )),
1413
+ /* @__PURE__ */ P(
1414
+ "path",
1415
+ {
1416
+ ref: $,
1417
+ className: `${t}-editor-body`,
1418
+ d: Q,
1419
+ fillRule: "evenodd",
1420
+ onPointerDown: Wt,
1421
+ onClick: Nt
1422
+ }
1423
+ ),
1424
+ st && /* @__PURE__ */ P(
1425
+ "path",
1426
+ {
1427
+ className: `${t}-editor-hit`,
1428
+ d: Q,
1429
+ style: { strokeWidth: Ar },
1430
+ onClick: Nt
1431
+ }
1432
+ ),
1433
+ st && ht && /* @__PURE__ */ P(
1434
+ "rect",
1435
+ {
1436
+ className: `${t}-editor-add-preview`,
1437
+ x: ht.point.x - Ut / 2,
1438
+ y: ht.point.y - Ut / 2,
1439
+ width: Ut,
1440
+ height: Ut,
1441
+ rx: ht.curved ? Ut / 2 : 0
1442
+ }
1443
+ ),
1444
+ st && o.map((a, w) => a.nodes.map((g, k) => {
1445
+ const N = _.some((T) => T.contour === w && T.node === k), p = X(g.p);
1446
+ return /* @__PURE__ */ It("g", { children: [
1447
+ N && _.length === 1 && ["in", "out"].map((T) => {
1448
+ const z = g[T];
1449
+ if (!z) return null;
1450
+ const tt = X(z);
1451
+ return /* @__PURE__ */ It("g", { children: [
1452
+ /* @__PURE__ */ P("line", { className: `${t}-editor-handle-line`, x1: p.x, y1: p.y, x2: tt.x, y2: tt.y }),
1453
+ /* @__PURE__ */ P("circle", { className: `${t}-editor-handle`, cx: tt.x, cy: tt.y, r: Er }),
1454
+ /* @__PURE__ */ P(
1455
+ "circle",
1456
+ {
1457
+ className: `${t}-editor-grab`,
1458
+ cx: tt.x,
1459
+ cy: tt.y,
1460
+ r: Mn,
1461
+ onPointerDown: (S) => Ft(S, T, w, k),
1462
+ onClick: qt
1463
+ }
1464
+ )
1465
+ ] }, T);
1466
+ }),
1467
+ /* @__PURE__ */ P(
1468
+ "rect",
1469
+ {
1470
+ className: `${t}-editor-anchor${N ? ` ${t}-editor-anchor-selected` : ""}`,
1471
+ x: p.x - Ut / 2,
1472
+ y: p.y - Ut / 2,
1473
+ width: Ut,
1474
+ height: Ut,
1475
+ rx: io(g) ? Ut / 2 : 0
1476
+ }
1477
+ ),
1478
+ /* @__PURE__ */ P(
1479
+ "rect",
1480
+ {
1481
+ className: `${t}-editor-grab`,
1482
+ x: p.x - Mn,
1483
+ y: p.y - Mn,
1484
+ width: Mn * 2,
1485
+ height: Mn * 2,
1486
+ onPointerDown: (T) => Ft(T, "anchor", w, k),
1487
+ onClick: qt,
1488
+ onDoubleClick: (T) => {
1489
+ T.stopPropagation(), T.preventDefault();
1490
+ const z = ve(o, w, k);
1491
+ h(z), et(z);
1492
+ }
1493
+ }
1494
+ )
1495
+ ] }, `${w}-${k}`);
1496
+ })),
1497
+ Kt && /* @__PURE__ */ It("g", { children: [
1498
+ /* @__PURE__ */ P(
1499
+ "rect",
1500
+ {
1501
+ className: `${t}-editor-bbox`,
1502
+ x: Lt.x,
1503
+ y: Lt.y,
1504
+ width: jt.width,
1505
+ height: jt.height
1506
+ }
1507
+ ),
1508
+ ["nw", "ne", "se", "sw"].map((a) => {
1509
+ const w = X(xe(ot, a)), g = a === "ne" || a === "sw";
1510
+ return /* @__PURE__ */ It("g", { children: [
1511
+ /* @__PURE__ */ P(
1512
+ "rect",
1513
+ {
1514
+ className: `${t}-editor-scale`,
1515
+ x: w.x - Wn / 2,
1516
+ y: w.y - Wn / 2,
1517
+ width: Wn,
1518
+ height: Wn
1519
+ }
1520
+ ),
1521
+ /* @__PURE__ */ P(
1522
+ "rect",
1523
+ {
1524
+ className: `${t}-editor-scale-grab${g ? ` ${t}-editor-scale-grab-nesw` : ""}`,
1525
+ x: w.x - zn / 2,
1526
+ y: w.y - zn / 2,
1527
+ width: zn,
1528
+ height: zn,
1529
+ onPointerDown: (k) => ft(k, a),
1530
+ onClick: qt
1531
+ }
1532
+ )
1533
+ ] }, a);
1534
+ })
1535
+ ] })
1536
+ ]
1537
+ }
1538
+ );
1539
+ }
1540
+ const Xr = 4e3, Rr = /^(?:https?:|mailto:|tel:)/i;
1541
+ function po(t) {
1542
+ return !!t && typeof t == "object" && t.type === "link";
1543
+ }
1544
+ function _r(t) {
1545
+ if (!t) return;
1546
+ const n = t.replace(/\s+/g, "");
1547
+ if (!(/^[a-z][a-z0-9+.-]*:/i.test(n) && !Rr.test(n)))
1548
+ return n;
1549
+ }
1550
+ function Dr(t) {
1551
+ const n = [];
1552
+ return t.forEach((e, o) => {
1553
+ const i = (r, c, l) => {
1554
+ for (const s of r) {
1555
+ if (po(s)) {
1556
+ i(s.children ?? [], _r(s.value), s.target);
1557
+ continue;
1558
+ }
1559
+ const d = s, h = (d == null ? void 0 : d.text) ?? "";
1560
+ if (h.trim())
1561
+ for (const E of h.split(/\s+/))
1562
+ E && n.push({ text: E, leaf: d, href: c, target: l, para: o });
1563
+ }
1564
+ };
1565
+ i((e == null ? void 0 : e.children) ?? []);
1566
+ }), n;
1567
+ }
1568
+ function to(t) {
1569
+ return {
1570
+ ...t.fontFamily && { fontFamily: ro(t.fontFamily) },
1571
+ ...t.fontWeight && { fontWeight: t.fontWeight },
1572
+ ...t.fontStyle && { fontStyle: t.fontStyle },
1573
+ ...t.textDecoration && { textDecoration: t.textDecoration },
1574
+ ...t.textTransform && { textTransform: t.textTransform },
1575
+ ...t.fontVariant && { fontVariant: t.fontVariant },
1576
+ ...t.verticalAlign && { verticalAlign: t.verticalAlign, lineHeight: "0px" }
1577
+ };
1578
+ }
1579
+ function Yr(t) {
1580
+ return t.map((n) => {
1581
+ const e = [], o = (i) => {
1582
+ for (const r of i) {
1583
+ if (po(r)) {
1584
+ o(r.children ?? []);
1585
+ continue;
1586
+ }
1587
+ e.push((r == null ? void 0 : r.text) ?? "");
1588
+ }
1589
+ };
1590
+ return o((n == null ? void 0 : n.children) ?? []), e.join("");
1591
+ });
1592
+ }
1593
+ function Tr(t, n, e, o, i) {
1594
+ if (n <= 0 || !t.length || e <= 0 || o <= 0) return t;
1595
+ const r = i === "avoid" ? 1 : -1;
1596
+ return t.map((c) => {
1597
+ if (!c.length) return c;
1598
+ let l = 1 / 0, s = -1 / 0, d = 1 / 0, h = -1 / 0;
1599
+ for (const $ of c) {
1600
+ const y = $.x * e, R = $.y * o;
1601
+ y < l && (l = y), y > s && (s = y), R < d && (d = R), R > h && (h = R);
1602
+ }
1603
+ const E = (l + s) / 2, b = (d + h) / 2;
1604
+ return c.map(($) => {
1605
+ const y = $.x * e, R = $.y * o, I = y - E, H = R - b, m = Math.sqrt(I * I + H * H);
1606
+ if (m < 1e-6) return $;
1607
+ const A = Math.max(0, m + r * n) / m;
1608
+ return { x: (E + I * A) / e, y: (b + H * A) / o };
1609
+ });
1610
+ });
1611
+ }
1612
+ const Pr = 0.75;
1613
+ function no(t, n, e, o, i, r) {
1614
+ if (t.kind === "fragment" || !n) return null;
1615
+ const c = t.token.text, l = t.offset > 0 ? n[t.offset - 1] : 0, s = e ? e.map((d) => d - t.offset).filter((d) => d >= (t.offset > 0 ? 2 : 1) && d < c.length) : Array.from({ length: c.length - 1 }, (d, h) => h + 1);
1616
+ for (let d = s.length - 1; d >= 0; d -= 1) {
1617
+ const h = s[d];
1618
+ if (t.offset + h > n.length) continue;
1619
+ const E = !!e && c[h - 1] !== "-", b = n[t.offset + h - 1] - l, $ = b + (E ? r : 0);
1620
+ if (!($ * i > o))
1621
+ return {
1622
+ chars: h,
1623
+ fragmentText: E ? `${c.slice(0, h)}-` : c.slice(0, h),
1624
+ remainderText: c.slice(h),
1625
+ fragmentWidth: $,
1626
+ remainderWidth: Math.max(0, t.width - b)
1627
+ };
1628
+ }
1629
+ return null;
1630
+ }
1631
+ function eo(t) {
1632
+ const {
1633
+ tokens: n,
1634
+ widths: e,
1635
+ rings: o,
1636
+ mode: i,
1637
+ align: r,
1638
+ scale: c,
1639
+ width: l,
1640
+ height: s,
1641
+ allowOverflow: d,
1642
+ capInset: h,
1643
+ capLines: E
1644
+ } = t, b = !!t.hyphenate, $ = t.charWidths ?? [], y = t.hyphenPoints ?? [], R = t.hyphenWidth ?? 0, I = t.lineHeight * c, H = t.spaceWidth * c, m = Math.max(0, t.shapeMargin ?? 0), _ = [], A = n.map((X, u) => ({
1645
+ token: X,
1646
+ originalIndex: u,
1647
+ width: e[u],
1648
+ kind: "whole",
1649
+ offset: 0
1650
+ }));
1651
+ if (!A.length || l <= 0 || I <= 0)
1652
+ return { segments: _, placed: 0, height: 0, capLeft: 0, capTop: 0, renderTokens: n };
1653
+ const q = Math.max(1, H * 0.5), mt = I * ko, ht = Tr(o, m, l, s, i), ut = Math.max(1, Math.floor(t.columns ?? 1)), rt = ut > 1 ? Math.max(0, t.columnGap ?? 0) : 0, xt = (l - rt * (ut - 1)) / ut;
1654
+ let L = 0, gt = 0, C = 0, x = 0, M = 0, D = null;
1655
+ const W = (X, u, K) => To(ht, (X + mt) / s, (X + I - mt) / s, i).map((Z) => ({ x0: Math.max(u, Z.x0 * l), x1: Math.min(K, Z.x1 * l) })).filter((Z) => Z.x1 > Z.x0);
1656
+ for (let X = 0; X < ut && L < A.length && xt > 0; X += 1) {
1657
+ const u = X * (xt + rt), K = u + xt, Z = d && X === ut - 1;
1658
+ let it = 0;
1659
+ for (let v = 0; v + I <= s; v += I)
1660
+ for (const $t of W(v, u, K))
1661
+ it = Math.max(it, $t.x1 - $t.x0);
1662
+ let et = A[L].token.para, dt = 0;
1663
+ for (; L < A.length && C < Xr; ) {
1664
+ const v = dt + I > s;
1665
+ if (v && !Z) break;
1666
+ const $t = A[L].token.para;
1667
+ if ($t > et + 1) {
1668
+ dt += I * ($t - et - 1), et = $t - 1, C += 1;
1669
+ continue;
1670
+ }
1671
+ let Tt = v ? [{ x0: u, x1: K }] : W(dt, u, K);
1672
+ h > 0 && E > 0 && X === 0 && !v && Tt.length && (D === null && (D = C, x = Tt[0].x0, M = dt), C - D < E && (Tt = Yo(Tt, { x0: x, x1: x + h })));
1673
+ const qt = Tt.reduce((Wt, ft) => Math.max(Wt, ft.x1 - ft.x0), 0);
1674
+ for (const Wt of Tt) {
1675
+ const ft = Wt.x1 - Wt.x0;
1676
+ if (ft < q) continue;
1677
+ if (L >= A.length || A[L].token.para !== $t) break;
1678
+ const Ft = L;
1679
+ let Nt = 0;
1680
+ for (; L < A.length && A[L].token.para === $t; ) {
1681
+ const pt = A[L], Q = L === Ft, ot = pt.width * c, Lt = Q ? ot : H + ot;
1682
+ if (Nt + Lt <= ft) {
1683
+ Nt += Lt, L += 1;
1684
+ continue;
1685
+ }
1686
+ const jt = ft - Nt - (Q ? 0 : H), Kt = Q && ot > xt - 0.5, Pt = ft >= qt - 0.5 && ft >= it * Pr, st = $[pt.originalIndex], a = y[pt.originalIndex], w = (b && a ? no(pt, st, a, jt, c, R) : null) ?? (Kt && Pt ? no(pt, st, void 0, jt, c, R) : null);
1687
+ if (w) {
1688
+ const g = {
1689
+ token: { ...pt.token, text: w.fragmentText },
1690
+ originalIndex: pt.originalIndex,
1691
+ width: w.fragmentWidth,
1692
+ kind: "fragment",
1693
+ offset: pt.offset
1694
+ }, k = {
1695
+ token: { ...pt.token, text: w.remainderText },
1696
+ originalIndex: pt.originalIndex,
1697
+ width: w.remainderWidth,
1698
+ kind: "remainder",
1699
+ offset: pt.offset + w.chars
1700
+ };
1701
+ A.splice(L, 1, g, k), Nt += (Q ? 0 : H) + w.fragmentWidth * c, L += 1;
1702
+ break;
1703
+ }
1704
+ if (Kt && ut === 1 && ft >= it - 0.5) {
1705
+ Nt += Lt, L += 1;
1706
+ continue;
1707
+ }
1708
+ break;
1709
+ }
1710
+ if (L > Ft) {
1711
+ const pt = L >= A.length || A[L].token.para !== $t;
1712
+ _.push({
1713
+ top: dt,
1714
+ left: Wt.x0,
1715
+ width: ft,
1716
+ from: Ft,
1717
+ to: L,
1718
+ justify: r === "justify" && !pt
1719
+ });
1720
+ }
1721
+ if (L >= A.length || A[L].token.para !== $t) break;
1722
+ }
1723
+ et = $t, dt += I, C += 1;
1724
+ }
1725
+ gt = Math.max(gt, dt);
1726
+ }
1727
+ let O = 0;
1728
+ if (L > 0) {
1729
+ const X = A[L - 1];
1730
+ O = X.kind === "fragment" ? X.originalIndex : X.originalIndex + 1;
1731
+ }
1732
+ return {
1733
+ segments: _,
1734
+ placed: O,
1735
+ height: _.length ? gt : 0,
1736
+ capLeft: x,
1737
+ capTop: M,
1738
+ renderTokens: A.map((X) => X.token)
1739
+ };
1740
+ }
1741
+ const Hr = 0.12, Or = 2, zr = 10, ce = 0.25, Wr = (t) => {
1742
+ const n = t.getBoundingClientRect();
1743
+ return { top: n.top, left: n.left, width: n.width, height: n.height };
1744
+ }, vr = (t, n) => Math.abs(t.top - n.top) < 0.5 && Math.abs(t.left - n.left) < 0.5 && Math.abs(t.width - n.width) < 0.5 && Math.abs(t.height - n.height) < 0.5, Gr = (t, n) => {
1745
+ const [e, o] = yt(null);
1746
+ return At(() => {
1747
+ if (!t || !n) {
1748
+ o(null);
1749
+ return;
1750
+ }
1751
+ let i = 0, r = null;
1752
+ const c = () => {
1753
+ const l = Wr(t);
1754
+ (!r || !vr(r, l)) && (r = l, o(l)), i = requestAnimationFrame(c);
1755
+ };
1756
+ return c(), () => cancelAnimationFrame(i);
1757
+ }, [t, n]), e;
1758
+ }, ae = (t, n) => {
1759
+ if (!(n.width > 0) || !(n.height > 0)) return t;
1760
+ const e = Math.min(n.width, n.height), o = (n.width - e) / 2, i = (n.height - e) / 2;
1761
+ return t.map((r) => r.map((c) => ({
1762
+ x: (o + c.x * e) / n.width,
1763
+ y: (i + c.y * e) / n.height
1764
+ })));
1765
+ }, Nn = typeof window > "u" ? At : Ao;
1766
+ function Vr() {
1767
+ return typeof document > "u" ? null : document.body;
1768
+ }
1769
+ function jr({
1770
+ P: t,
1771
+ item: n,
1772
+ shape: e,
1773
+ customPath: o,
1774
+ pathFit: i,
1775
+ viewBox: r,
1776
+ mode: c,
1777
+ align: l,
1778
+ allowOverflow: s,
1779
+ fitEnabled: d,
1780
+ scale: h,
1781
+ onFitScale: E,
1782
+ padding: b,
1783
+ columns: $,
1784
+ gutter: y,
1785
+ hyphenate: R,
1786
+ showOverflowIndicator: I,
1787
+ dropCapLines: H,
1788
+ dropCapSize: m,
1789
+ showGuides: _,
1790
+ typography: A,
1791
+ imageUrl: q,
1792
+ imageFocalX: mt,
1793
+ imageFocalY: ht,
1794
+ imageScale: ut,
1795
+ imageCustomPath: rt,
1796
+ imagePathEdited: xt,
1797
+ pathDragActive: L,
1798
+ pathCarryImage: gt,
1799
+ onCarryImageConsumed: C,
1800
+ pathEditor: x,
1801
+ imageEditor: M
1802
+ }) {
1803
+ var Ie, Ae;
1804
+ const D = `pretext-shape-image-${oo().replace(/:/g, "")}`, [W, O] = yt(null), X = St(null), [u, K] = yt({ width: 0, height: 0 }), [Z, it] = yt(0), [et, dt] = yt(0), [v, $t] = yt(null), [Tt, qt] = yt(0), [Wt, ft] = yt("none");
1805
+ At(() => {
1806
+ !x && !M && ft("none");
1807
+ }, [x, M]);
1808
+ const [Ft, Nt] = yt(null);
1809
+ At(() => {
1810
+ if (!q || typeof Image > "u") {
1811
+ Nt(null);
1812
+ return;
1813
+ }
1814
+ let f = !1;
1815
+ const F = new Image();
1816
+ return F.onload = () => {
1817
+ f || Nt({ width: F.naturalWidth, height: F.naturalHeight });
1818
+ }, F.src = q, () => {
1819
+ f = !0;
1820
+ };
1821
+ }, [q]);
1822
+ const pt = B(() => Array.isArray(n == null ? void 0 : n.text) ? n.text : [], [n]), Q = B(() => Dr(pt), [pt]), ot = B(() => Yr(pt), [pt]), Lt = B(() => ot.join(`
1823
+ `), [ot]), { lang: jt, hyphenateSync: Kt } = $r(R, Lt), Pt = B(
1824
+ () => R ? Q.map((f) => Fr(f.text, Kt)) : [],
1825
+ [R, Q, Kt]
1826
+ ), st = H > 0 && m > 1 ? ((Ae = (Ie = Q[0]) == null ? void 0 : Ie.text) == null ? void 0 : Ae.charAt(0)) ?? "" : "", a = (x == null ? void 0 : x.contours) ?? null, w = B(() => {
1827
+ let f = [];
1828
+ if (a) {
1829
+ const F = bn(a);
1830
+ F.length && (f = Fn(F, r));
1831
+ }
1832
+ if (!f.length) {
1833
+ const F = o.trim(), V = F ? Ye(F, i, r) : null;
1834
+ V && V.length ? f = V : f = he(e === "custom" ? "rectangle" : e);
1835
+ }
1836
+ return e === "circle" ? ae(f, u) : f;
1837
+ }, [a, e, o, i, r, u.width, u.height]), g = x == null ? void 0 : x.onConvert, k = (x == null ? void 0 : x.needsConversion) ?? !1, N = B(() => {
1838
+ if (e === "circle") return !1;
1839
+ const f = a ?? (o.trim() ? sn(o) : null);
1840
+ return !!(f && lo(f, r));
1841
+ }, [a, o, r, e]), [p, T] = yt(null);
1842
+ Nn(() => {
1843
+ if (!N) {
1844
+ p && T(null);
1845
+ return;
1846
+ }
1847
+ !p && u.width > 0 && u.height > 0 && T({ width: u.width, height: u.height });
1848
+ }, [N, u.width, u.height, p]);
1849
+ const z = B(() => {
1850
+ if (!N || u.width <= 0 || u.height <= 0) return w;
1851
+ const f = p ?? u, F = r.width / f.width, V = r.height / f.height;
1852
+ return w.map((J) => J.map((j) => ({ x: j.x * F, y: j.y * V })));
1853
+ }, [w, N, p, r.width, r.height, u.width, u.height]), tt = B(() => {
1854
+ if (a) {
1855
+ const J = bn(a);
1856
+ if (J.length) {
1857
+ const j = Fn(J, r);
1858
+ return e === "circle" ? ae(j, u) : j;
1859
+ }
1860
+ }
1861
+ const f = rt.trim(), F = f ? Ye(f, i, r) : null, V = F && F.length ? F : he(e === "custom" ? "rectangle" : e);
1862
+ return e === "circle" ? ae(V, u) : V;
1863
+ }, [a, e, rt, i, r, u.width, u.height]), S = B(() => {
1864
+ if (!N || u.width <= 0 || u.height <= 0) return tt;
1865
+ const f = p ?? u, F = r.width / f.width, V = r.height / f.height;
1866
+ return tt.map((J) => J.map((j) => ({ x: j.x * F, y: j.y * V })));
1867
+ }, [tt, N, p, r.width, r.height, u.width, u.height]), Y = St(null), U = St(!1);
1868
+ At(() => {
1869
+ if (!(!g || u.width <= 0 || u.height <= 0)) {
1870
+ if (N) {
1871
+ if (Y.current === o) return;
1872
+ const f = a ?? (o.trim() ? sn(o) : null);
1873
+ if (!(f != null && f.length)) return;
1874
+ const F = kt(f, (V) => ({
1875
+ x: r.x + (V.x - r.x) / u.width * r.width,
1876
+ y: r.y + (V.y - r.y) / u.height * r.height
1877
+ }));
1878
+ Y.current = In(F), g(F);
1879
+ return;
1880
+ }
1881
+ !k || !w.length || U.current || (U.current = !0, g(kt(so(w), (f) => ({ x: f.x * Vn, y: f.y * Vn }))));
1882
+ }
1883
+ }, [
1884
+ k,
1885
+ N,
1886
+ g,
1887
+ w,
1888
+ a,
1889
+ o,
1890
+ r,
1891
+ u.width,
1892
+ u.height
1893
+ ]);
1894
+ const wt = _t(() => {
1895
+ const f = W;
1896
+ if (!f) return;
1897
+ const F = f.getBoundingClientRect(), V = window.getComputedStyle(f), J = parseFloat(V.paddingTop) || 0;
1898
+ it((Ct) => Math.abs(Ct - J) < 0.5 ? Ct : J);
1899
+ const j = parseFloat(V.columnGap) || 0;
1900
+ dt((Ct) => Math.abs(Ct - j) < 0.5 ? Ct : j);
1901
+ const Rt = { width: F.width, height: F.height };
1902
+ K((Ct) => Math.abs(Ct.width - Rt.width) < 0.5 && Math.abs(Ct.height - Rt.height) < 0.5 ? Ct : Rt);
1903
+ }, [W]);
1904
+ Nn(() => {
1905
+ const f = W;
1906
+ if (!f || typeof ResizeObserver > "u") return;
1907
+ wt();
1908
+ const F = new ResizeObserver(wt);
1909
+ return F.observe(f), () => F.disconnect();
1910
+ }, [W, wt]), Nn(() => {
1911
+ wt();
1912
+ }, [b, y, wt]), At(() => {
1913
+ const f = typeof document < "u" ? document.fonts : void 0;
1914
+ f != null && f.ready && f.ready.then(() => {
1915
+ qt((F) => F + 1);
1916
+ });
1917
+ }, []), Nn(() => {
1918
+ const f = X.current;
1919
+ if (!f) return;
1920
+ if (!Q.length) {
1921
+ $t(null);
1922
+ return;
1923
+ }
1924
+ const F = [], V = document.createDocumentFragment();
1925
+ for (const Yt of Q) {
1926
+ const dn = document.createElement("span");
1927
+ Object.assign(dn.style, to(Yt.leaf)), dn.textContent = Yt.text, V.appendChild(dn), F.push(dn);
1928
+ }
1929
+ const J = document.createElement("span");
1930
+ J.textContent = " ", V.appendChild(J);
1931
+ const j = document.createElement("span");
1932
+ j.textContent = "-", V.appendChild(j);
1933
+ const Rt = st || "H", Ct = document.createElement("span");
1934
+ Ct.textContent = Rt, Ct.style.lineHeight = "1", V.appendChild(Ct), f.replaceChildren(V);
1935
+ const cn = window.getComputedStyle(f), un = parseFloat(cn.fontSize) || 16, Rn = parseFloat(cn.lineHeight), mo = Number.isNaN(Rn) ? un * 1.2 : Rn, _n = Math.max(mo, un), yn = document.createElement("span");
1936
+ yn.textContent = Rt, yn.style.lineHeight = `${_n}px`;
1937
+ const Jn = document.createElement("span");
1938
+ Jn.style.cssText = "display:inline-block;width:0;height:0;vertical-align:baseline", yn.appendChild(Jn), f.appendChild(yn);
1939
+ const yo = yn.getBoundingClientRect().top, xo = Jn.getBoundingClientRect().top, Le = Math.max(1, xo - yo);
1940
+ yn.remove();
1941
+ let Dn = Le * 0.8;
1942
+ const xn = document.createElement("canvas").getContext("2d"), Ee = (Yt) => `${cn.fontStyle} ${cn.fontWeight} ${Yt}px ${cn.fontFamily}`;
1943
+ if (xn) {
1944
+ xn.font = Ee(un);
1945
+ const Yt = xn.measureText(Rt).actualBoundingBoxAscent;
1946
+ Yt > 0 && (Dn = Yt);
1947
+ }
1948
+ const ke = m > 1 ? (m - 1) * _n + Dn : Dn;
1949
+ let gn = un * (ke / Dn);
1950
+ if (xn) {
1951
+ xn.font = Ee(gn);
1952
+ const Yt = xn.measureText(Rt).actualBoundingBoxAscent;
1953
+ Yt > 0 && (gn = gn * (ke / Yt));
1954
+ }
1955
+ Ct.style.fontSize = `${gn}px`, Ct.style.lineHeight = `${gn}px`;
1956
+ const Yn = document.createElement("span");
1957
+ Yn.style.cssText = "display:inline-block;width:0;height:0;vertical-align:baseline", Ct.appendChild(Yn);
1958
+ const go = Math.max(1, Yn.getBoundingClientRect().top - Ct.getBoundingClientRect().top);
1959
+ Yn.remove();
1960
+ const wo = (m - 1) * _n + Le - go, Ne = F.map((Yt) => Yt.getBoundingClientRect().width), Mo = J.getBoundingClientRect().width, Co = j.getBoundingClientRect().width, So = st ? Ct.getBoundingClientRect().width : 0, $o = (u.width - et * ($ - 1)) / $, Fo = F.map((Yt, dn) => {
1961
+ var Xe;
1962
+ const kn = Yt.firstChild;
1963
+ if (!(kn instanceof Text) || kn.data.length < 2 || !(Ne[dn] > $o - 0.5) && !((Xe = Pt[dn]) != null && Xe.length)) return;
1964
+ const Un = document.createRange(), Io = Yt.getBoundingClientRect().left, be = [];
1965
+ for (let Bn = 1; Bn <= kn.data.length; Bn += 1)
1966
+ Un.setStart(kn, 0), Un.setEnd(kn, Bn), be.push(Un.getBoundingClientRect().right - Io);
1967
+ return be;
1968
+ });
1969
+ f.replaceChildren(), $t({
1970
+ widths: Ne,
1971
+ spaceWidth: Mo,
1972
+ dashWidth: Co,
1973
+ charWidths: Fo,
1974
+ lineHeight: _n,
1975
+ capWidth: So,
1976
+ dropCapFontSize: gn,
1977
+ dropCapTopAdjust: wo
1978
+ });
1979
+ }, [Q, A, st, H, m, Tt, u.width, R, Pt, $, et]);
1980
+ const nt = v && st ? v.capWidth + v.lineHeight * Hr : 0, Ht = Math.max(H, Math.ceil(m)), zt = B(() => {
1981
+ if (!v || !Q.length || u.width <= 0 || u.height <= 0 || !d) return 1;
1982
+ const f = (J) => eo({
1983
+ tokens: Q,
1984
+ widths: v.widths,
1985
+ spaceWidth: v.spaceWidth,
1986
+ lineHeight: v.lineHeight,
1987
+ width: u.width,
1988
+ height: u.height,
1989
+ rings: z,
1990
+ mode: c,
1991
+ align: l,
1992
+ scale: J,
1993
+ allowOverflow: !1,
1994
+ capInset: nt * J,
1995
+ capLines: st ? Ht : 0,
1996
+ hyphenate: R,
1997
+ charWidths: v.charWidths,
1998
+ hyphenPoints: Pt,
1999
+ hyphenWidth: v.dashWidth,
2000
+ shapeMargin: Z,
2001
+ columns: $,
2002
+ columnGap: et
2003
+ });
2004
+ if (f(1).placed >= Q.length) return 1;
2005
+ if (f(ce).placed < Q.length) return ce;
2006
+ let F = ce, V = 1;
2007
+ for (let J = 0; J < zr; J += 1) {
2008
+ const j = (F + V) / 2;
2009
+ f(j).placed >= Q.length ? F = j : V = j;
2010
+ }
2011
+ return F;
2012
+ }, [v, Q, u.width, u.height, z, c, l, d, nt, st, Ht, R, Pt, Z, $, et]);
2013
+ At(() => {
2014
+ E(zt);
2015
+ }, [zt, E]);
2016
+ const lt = d ? Math.min(h, zt) : 1, G = B(() => !v || !Q.length || u.width <= 0 || u.height <= 0 ? { segments: [], placed: 0, height: 0, capLeft: 0, capTop: 0, renderTokens: Q } : eo({
2017
+ tokens: Q,
2018
+ widths: v.widths,
2019
+ spaceWidth: v.spaceWidth,
2020
+ lineHeight: v.lineHeight,
2021
+ width: u.width,
2022
+ height: u.height,
2023
+ rings: z,
2024
+ mode: c,
2025
+ align: l,
2026
+ scale: lt,
2027
+ allowOverflow: s,
2028
+ capInset: nt * lt,
2029
+ capLines: st ? Ht : 0,
2030
+ hyphenate: R,
2031
+ charWidths: v.charWidths,
2032
+ hyphenPoints: Pt,
2033
+ hyphenWidth: v.dashWidth,
2034
+ shapeMargin: Z,
2035
+ columns: $,
2036
+ columnGap: et
2037
+ }), [v, Q, u.width, u.height, z, c, l, lt, s, nt, st, Ht, R, Pt, Z, $, et]), ct = I && Q.length > 0 && G.placed < Q.length, Mt = v ? v.dropCapFontSize * lt : 0, Qt = v ? v.dropCapTopAdjust * lt : 0, Ot = l === "justify" ? "left" : l, vt = v ? v.lineHeight * lt : 0, Zt = G.segments.length ? G.segments[G.segments.length - 1] : null, ln = Zt ? { top: Zt.top + vt, left: Zt.left + Zt.width / 2 } : { top: u.height, left: u.width / 2 }, Et = !!(x && a && u.width > 0 && u.height > 0), bt = !!M, rn = (Et || bt) && u.width > 0 && u.height > 0, Xt = Gr(W, rn), pn = rn && Xt ? Vr() : null, mn = St(!1), Ln = _t((f) => {
2038
+ mn.current = f;
2039
+ }, []);
2040
+ At(() => {
2041
+ if (!Et && !bt) return;
2042
+ const f = (F) => {
2043
+ const V = W;
2044
+ if (!V) return;
2045
+ const J = V.getBoundingClientRect();
2046
+ F.clientX >= J.left && F.clientX <= J.right && F.clientY >= J.top && F.clientY <= J.bottom && (F.preventDefault(), F.stopPropagation(), ft((Rt) => Rt === "shape" && mn.current ? Rt : Rt === "shape" && bt ? "image" : Et ? "shape" : "image"));
2047
+ };
2048
+ return document.addEventListener("dblclick", f, !0), () => document.removeEventListener("dblclick", f, !0);
2049
+ }, [Et, bt, W]);
2050
+ const Jt = B(
2051
+ () => q && u.width > 0 && u.height > 0 ? No(S, u) : null,
2052
+ [q, S, u.width, u.height]
2053
+ ), hn = St(null), at = (() => {
2054
+ const f = hn.current;
2055
+ return gt || !xt || !M || !Ft || !Jt || !f || rt === f.customPath || f.shape !== e && e !== "custom" ? null : fr(
2056
+ f.bounds,
2057
+ Jt,
2058
+ Ft,
2059
+ f.focalX,
2060
+ f.focalY,
2061
+ f.scale
2062
+ );
2063
+ })();
2064
+ Nn(() => {
2065
+ if (!M) {
2066
+ hn.current = null;
2067
+ return;
2068
+ }
2069
+ if (L || !Ft || !Jt) return;
2070
+ const f = hn.current, F = !!(f && rt !== f.customPath);
2071
+ F && at && M.onCommit(at), F && gt && (C == null || C()), hn.current = {
2072
+ rings: S,
2073
+ bounds: Jt,
2074
+ focalX: (at == null ? void 0 : at.focalX) ?? mt,
2075
+ focalY: (at == null ? void 0 : at.focalY) ?? ht,
2076
+ scale: (at == null ? void 0 : at.scale) ?? ut,
2077
+ customPath: rt,
2078
+ shape: e
2079
+ };
2080
+ }, [
2081
+ L,
2082
+ gt,
2083
+ rt,
2084
+ e,
2085
+ S,
2086
+ Jt,
2087
+ M,
2088
+ Ft,
2089
+ mt,
2090
+ ht,
2091
+ ut,
2092
+ at,
2093
+ C
2094
+ ]);
2095
+ const on = hn.current, Xn = !!(L && !gt && on && !at), Kn = Xn && on ? on.focalX : (at == null ? void 0 : at.focalX) ?? mt, Zn = Xn && on ? on.focalY : (at == null ? void 0 : at.focalY) ?? ht, qn = Xn && on ? on.scale : (at == null ? void 0 : at.scale) ?? ut, Gt = Xn && on ? on.bounds : Jt, $e = B(() => {
2096
+ if (!(u.width > 0) || !(u.height > 0)) return "";
2097
+ let f = Pe(o, a, i, r, e, u);
2098
+ if (N) {
2099
+ const F = p ?? u, V = r.width / F.width, J = r.height / F.height;
2100
+ f = kt(f, (j) => ({ x: j.x * V, y: j.y * J }));
2101
+ }
2102
+ return He(f, u) || De(z, u);
2103
+ }, [
2104
+ o,
2105
+ a,
2106
+ i,
2107
+ r,
2108
+ e,
2109
+ u.width,
2110
+ u.height,
2111
+ N,
2112
+ p,
2113
+ z
2114
+ ]), Qn = B(() => {
2115
+ if (!q || !(u.width > 0) || !(u.height > 0)) return "";
2116
+ let f = Pe(rt, a, i, r, e, u);
2117
+ if (N) {
2118
+ const F = p ?? u, V = r.width / F.width, J = r.height / F.height;
2119
+ f = kt(f, (j) => ({ x: j.x * V, y: j.y * J }));
2120
+ }
2121
+ return He(f, u) || De(S, u);
2122
+ }, [
2123
+ q,
2124
+ rt,
2125
+ a,
2126
+ i,
2127
+ r,
2128
+ e,
2129
+ u.width,
2130
+ u.height,
2131
+ N,
2132
+ p,
2133
+ S
2134
+ ]), Fe = `${D}-clip`, En = B(() => {
2135
+ if (!Gt) return null;
2136
+ const f = Ft ?? { width: Gt.width, height: Gt.height }, F = fn(Gt, f, qn);
2137
+ return {
2138
+ x: tn(Gt.width, F.width, Kn),
2139
+ y: tn(Gt.height, F.height, Zn),
2140
+ width: F.width,
2141
+ height: F.height
2142
+ };
2143
+ }, [Gt, Ft, Kn, Zn, qn]);
2144
+ return /* @__PURE__ */ It("div", { className: `${t}-column`, style: { padding: b, columnGap: y }, lang: jt, ref: O, children: [
2145
+ $e ? /* @__PURE__ */ It(
2146
+ "svg",
2147
+ {
2148
+ className: `${t}-shape-fill`,
2149
+ style: { top: 0, left: 0, width: u.width, height: u.height },
2150
+ viewBox: `0 0 ${u.width} ${u.height}`,
2151
+ preserveAspectRatio: "none",
2152
+ "aria-hidden": !0,
2153
+ children: [
2154
+ /* @__PURE__ */ P("path", { className: `${t}-shape-fill-path`, d: $e, fillRule: "evenodd" }),
2155
+ q && Qn && Gt && En ? /* @__PURE__ */ It(vn, { children: [
2156
+ /* @__PURE__ */ P("defs", { children: /* @__PURE__ */ P("clipPath", { id: Fe, clipPathUnits: "userSpaceOnUse", children: /* @__PURE__ */ P("path", { d: Qn, fillRule: "evenodd" }) }) }),
2157
+ /* @__PURE__ */ P(
2158
+ "image",
2159
+ {
2160
+ href: q,
2161
+ x: Gt.x + En.x,
2162
+ y: Gt.y + En.y,
2163
+ width: En.width,
2164
+ height: En.height,
2165
+ preserveAspectRatio: "none",
2166
+ clipPath: `url(#${Fe})`
2167
+ }
2168
+ )
2169
+ ] }) : null
2170
+ ]
2171
+ }
2172
+ ) : null,
2173
+ /* @__PURE__ */ It(
2174
+ "div",
2175
+ {
2176
+ className: `${t}-flow${s ? "" : ` ${t}-clip`}`,
2177
+ style: {
2178
+ ...A,
2179
+ ["--" + t + "-fit"]: lt,
2180
+ top: 0,
2181
+ left: 0,
2182
+ width: u.width,
2183
+ height: u.height
2184
+ },
2185
+ children: [
2186
+ /* @__PURE__ */ P("div", { className: `${t}-measure`, ref: X, style: A, "aria-hidden": !0 }),
2187
+ G.segments.map((f, F) => {
2188
+ const V = G.renderTokens.slice(f.from, f.to), J = F === 0;
2189
+ return /* @__PURE__ */ P(
2190
+ "div",
2191
+ {
2192
+ className: `${t}-line${f.justify ? ` ${t}-line-justify` : ""}`,
2193
+ "aria-hidden": !0,
2194
+ style: {
2195
+ top: `${f.top}px`,
2196
+ left: `${f.left}px`,
2197
+ width: `${f.width}px`,
2198
+ textAlign: f.justify ? void 0 : Ot
2199
+ },
2200
+ children: V.map((j, Rt) => {
2201
+ const cn = st && J && f.from === 0 && Rt === 0 ? j.text.slice(1) : j.text, un = to(j.leaf), Rn = j.href ? /* @__PURE__ */ P("a", { className: `${t}-link`, href: j.href, target: j.target, rel: j.target ? "noopener noreferrer" : void 0, style: un, children: cn }) : /* @__PURE__ */ P("span", { style: un, children: cn });
2202
+ return /* @__PURE__ */ It("span", { children: [
2203
+ !f.justify && Rt > 0 ? " " : null,
2204
+ Rn
2205
+ ] }, Rt);
2206
+ })
2207
+ },
2208
+ `${f.from}-${f.to}-${F}`
2209
+ );
2210
+ }),
2211
+ _ && !a && /* @__PURE__ */ P("svg", { className: `${t}-guides`, viewBox: "0 0 1 1", preserveAspectRatio: "none", "aria-hidden": !0, children: z.map((f, F) => /* @__PURE__ */ P("polygon", { points: f.map((V) => `${V.x},${V.y}`).join(" ") }, F)) })
2212
+ ]
2213
+ }
2214
+ ),
2215
+ st && v && /* @__PURE__ */ P(
2216
+ "div",
2217
+ {
2218
+ className: `${t}-drop-cap`,
2219
+ "aria-hidden": !0,
2220
+ style: {
2221
+ ...A,
2222
+ top: `${G.capTop + Qt}px`,
2223
+ left: `${G.capLeft}px`,
2224
+ fontSize: `${Mt}px`,
2225
+ lineHeight: `${Mt}px`
2226
+ },
2227
+ children: st
2228
+ }
2229
+ ),
2230
+ pn && Xt && (a && x || M) && Eo(
2231
+ /* @__PURE__ */ It(
2232
+ "div",
2233
+ {
2234
+ "data-selection": "none",
2235
+ style: {
2236
+ position: "fixed",
2237
+ top: Xt.top,
2238
+ left: Xt.left,
2239
+ width: Xt.width,
2240
+ height: Xt.height,
2241
+ zIndex: Or,
2242
+ pointerEvents: "none"
2243
+ },
2244
+ children: [
2245
+ a && x && /* @__PURE__ */ P(
2246
+ br,
2247
+ {
2248
+ P: t,
2249
+ box: { width: Xt.width, height: Xt.height },
2250
+ viewBox: r,
2251
+ contours: a,
2252
+ snap: x.snap,
2253
+ stretchToBox: !N,
2254
+ uniformStretch: e === "circle",
2255
+ stage: Wt,
2256
+ onStageChange: ft,
2257
+ onSelectionChange: Ln,
2258
+ onChange: x.onChange,
2259
+ onCommit: x.onCommit
2260
+ }
2261
+ ),
2262
+ M && Gt && /* @__PURE__ */ P(
2263
+ Ir,
2264
+ {
2265
+ P: t,
2266
+ box: { width: Xt.width, height: Xt.height },
2267
+ bounds: Gt,
2268
+ natural: Ft,
2269
+ imageUrl: q,
2270
+ maskPath: Qn,
2271
+ stage: Wt,
2272
+ onStageChange: ft,
2273
+ focalX: Kn,
2274
+ focalY: Zn,
2275
+ scale: qn,
2276
+ onChange: M.onChange,
2277
+ onCommit: M.onCommit
2278
+ }
2279
+ )
2280
+ ]
2281
+ }
2282
+ ),
2283
+ pn
2284
+ ),
2285
+ /* @__PURE__ */ P("div", { className: `${t}-a11y`, children: ot.map((f, F) => /* @__PURE__ */ P("p", { children: f }, F)) }),
2286
+ ct && /* @__PURE__ */ It(
2287
+ "svg",
2288
+ {
2289
+ className: `${t}-overflow-icon`,
2290
+ width: "33",
2291
+ height: "24",
2292
+ viewBox: "0 0 33 24",
2293
+ style: {
2294
+ top: ln.top,
2295
+ left: ln.left
2296
+ },
2297
+ "aria-hidden": !0,
2298
+ children: [
2299
+ /* @__PURE__ */ P("path", { d: "M12.8,4 L20.2,4 C24.68042,4 26.9206301,4 28.631924,4.87194781 C31.3123488,6.23769248 33,8.99168887 33,12 C33,15.0083111 31.3123488,17.7623075 28.631924,19.1280522 C26.9206301,20 24.68042,20 20.2,20 L12.8,20 C8.31957995,20 6.07936993,20 4.368076,19.1280522 C1.68765116,17.7623075 0,15.0083111 0,12 C0,8.99168887 1.68765116,6.23769248 4.368076,4.87194781 C6.07936993,4 8.31957995,4 12.8,4 Z", fill: "#FF4400" }),
2300
+ /* @__PURE__ */ P(
2301
+ "path",
2302
+ {
2303
+ transform: "translate(5, 0)",
2304
+ fill: "#FFFFFF",
2305
+ d: "M12,5.625 C12.3846269,5.625 12.7016304,5.91453014 12.7449542,6.28753416 L12.75,6.375 L12.75,11.25 L17.625,11.25 C18.0392136,11.25 18.375,11.5857864 18.375,12 C18.375,12.3846269 18.0854699,12.7016304 17.7124658,12.7449542 L17.625,12.75 L12.75,12.75 L12.75,17.625 C12.75,18.0392136 12.4142136,18.375 12,18.375 C11.6153731,18.375 11.2983696,18.0854699 11.2550458,17.7124658 L11.25,17.625 L11.25,12.75 L6.375,12.75 C5.96078644,12.75 5.625,12.4142136 5.625,12 C5.625,11.6153731 5.91453014,11.2983696 6.28753416,11.2550458 L6.375,11.25 L11.25,11.25 L11.25,6.375 C11.25,5.96078644 11.5857864,5.625 12,5.625 Z"
2306
+ }
2307
+ )
2308
+ ]
2309
+ }
2310
+ )
2311
+ ] });
2312
+ }
2313
+ const ai = [
2314
+ "diamond",
2315
+ "parallelogram",
2316
+ "vase",
2317
+ "circle",
2318
+ "shield",
2319
+ "bobbin",
2320
+ "custom"
2321
+ ], Kr = { x: 0, y: 0, width: 100, height: 100 }, Zr = (t) => {
2322
+ const n = (t ?? "").trim().split(/[\s,]+/).map(Number).filter((e) => !Number.isNaN(e));
2323
+ return n.length < 4 || n[2] <= 0 || n[3] <= 0 ? Kr : { x: n[0], y: n[1], width: n[2], height: n[3] };
2324
+ }, qr = (t) => `
2325
+ .${t}-wrapper {
2326
+ box-sizing: border-box;
2327
+ display: flex;
2328
+ flex-direction: row;
2329
+ align-items: stretch;
2330
+ width: 100%;
2331
+ height: 100%;
2332
+ min-height: 1px;
2333
+ color: var(--${t}-text-color, #000000);
2334
+ }
2335
+ .${t}-column {
2336
+ box-sizing: border-box;
2337
+ position: relative;
2338
+ flex: 1 1 0;
2339
+ min-width: 0;
2340
+ height: 100%;
2341
+ }
2342
+ .${t}-overflow-icon {
2343
+ position: absolute;
2344
+ transform: translate(-50%, -50%);
2345
+ pointer-events: none;
2346
+ z-index: 1;
2347
+ }
2348
+ .${t}-shape-fill {
2349
+ position: absolute;
2350
+ pointer-events: none;
2351
+ overflow: hidden;
2352
+ }
2353
+ .${t}-shape-fill-path {
2354
+ fill: var(--${t}-background-color, transparent);
2355
+ }
2356
+ .${t}-flow {
2357
+ position: absolute;
2358
+ }
2359
+ .${t}-clip {
2360
+ overflow: hidden;
2361
+ }
2362
+ .${t}-line {
2363
+ position: absolute;
2364
+ white-space: pre;
2365
+ box-sizing: border-box;
2366
+ }
2367
+ .${t}-line-justify {
2368
+ display: flex;
2369
+ flex-direction: row;
2370
+ flex-wrap: nowrap;
2371
+ justify-content: space-between;
2372
+ align-items: baseline;
2373
+ }
2374
+ .${t}-link {
2375
+ color: var(--${t}-link-color, inherit);
2376
+ text-decoration: underline;
2377
+ }
2378
+ .${t}-drop-cap {
2379
+ position: absolute;
2380
+ top: 0;
2381
+ left: 0;
2382
+ white-space: pre;
2383
+ pointer-events: none;
2384
+ }
2385
+ .${t}-measure {
2386
+ position: absolute;
2387
+ top: 0;
2388
+ left: 0;
2389
+ visibility: hidden;
2390
+ pointer-events: none;
2391
+ white-space: pre;
2392
+ width: max-content;
2393
+ --${t}-fit: 1;
2394
+ }
2395
+ .${t}-measure > span {
2396
+ display: inline-block;
2397
+ }
2398
+ .${t}-guides {
2399
+ position: absolute;
2400
+ inset: 0;
2401
+ width: 100%;
2402
+ height: 100%;
2403
+ pointer-events: none;
2404
+ overflow: visible;
2405
+ }
2406
+ .${t}-guides polygon {
2407
+ fill: none;
2408
+ stroke: #FF5C02;
2409
+ stroke-width: 1;
2410
+ vector-effect: non-scaling-stroke;
2411
+ }
2412
+ .${t}-editor {
2413
+ position: absolute;
2414
+ top: 0;
2415
+ left: 0;
2416
+ z-index: 10;
2417
+ overflow: visible;
2418
+ pointer-events: none;
2419
+ touch-action: none;
2420
+ outline: none;
2421
+ }
2422
+ .${t}-editor-armed {
2423
+ pointer-events: auto;
2424
+ }
2425
+ .${t}-editor-surface {
2426
+ fill: transparent;
2427
+ cursor: default;
2428
+ pointer-events: none;
2429
+ }
2430
+ .${t}-editor-armed .${t}-editor-surface {
2431
+ pointer-events: auto;
2432
+ }
2433
+ .${t}-editor-hit {
2434
+ fill: none;
2435
+ stroke: transparent;
2436
+ pointer-events: none;
2437
+ }
2438
+ .${t}-editor-armed .${t}-editor-hit {
2439
+ pointer-events: stroke;
2440
+ }
2441
+ .${t}-editor-add-preview {
2442
+ fill: #FFFFFF;
2443
+ stroke: #FF5C02;
2444
+ stroke-width: 1.5;
2445
+ pointer-events: none;
2446
+ opacity: 0.85;
2447
+ }
2448
+ .${t}-editor-grab {
2449
+ fill: transparent;
2450
+ stroke: none;
2451
+ pointer-events: auto;
2452
+ cursor: grab;
2453
+ }
2454
+ .${t}-editor-grab:active {
2455
+ cursor: grabbing;
2456
+ }
2457
+ .${t}-editor-outline {
2458
+ fill: none;
2459
+ stroke: #FF5C02;
2460
+ stroke-width: 1;
2461
+ pointer-events: none;
2462
+ }
2463
+ .${t}-editor-body {
2464
+ fill: transparent;
2465
+ pointer-events: none;
2466
+ cursor: move;
2467
+ }
2468
+ .${t}-editor-armed .${t}-editor-body {
2469
+ pointer-events: fill;
2470
+ }
2471
+ .${t}-editor-body:active {
2472
+ cursor: grabbing;
2473
+ }
2474
+ .${t}-editor-bbox {
2475
+ fill: none;
2476
+ stroke: #FF5C02;
2477
+ stroke-width: 1;
2478
+ stroke-dasharray: 4 3;
2479
+ opacity: 0.55;
2480
+ pointer-events: none;
2481
+ }
2482
+ .${t}-editor-scale {
2483
+ fill: #FFFFFF;
2484
+ stroke: #FF5C02;
2485
+ stroke-width: 1.5;
2486
+ pointer-events: none;
2487
+ }
2488
+ .${t}-editor-scale-grab {
2489
+ fill: transparent;
2490
+ stroke: none;
2491
+ pointer-events: auto;
2492
+ cursor: nwse-resize;
2493
+ }
2494
+ .${t}-editor-scale-grab-nesw {
2495
+ cursor: nesw-resize;
2496
+ }
2497
+ .${t}-editor-snap {
2498
+ stroke: #00B2FF;
2499
+ stroke-width: 1;
2500
+ pointer-events: none;
2501
+ }
2502
+ .${t}-editor-snap-angle {
2503
+ stroke-dasharray: 4 3;
2504
+ }
2505
+ .${t}-editor-snap-center {
2506
+ stroke-dasharray: 2 4;
2507
+ opacity: 0.8;
2508
+ }
2509
+ .${t}-editor-handle-line {
2510
+ stroke: #FF5C02;
2511
+ stroke-width: 1;
2512
+ opacity: 0.5;
2513
+ pointer-events: none;
2514
+ }
2515
+ .${t}-editor-handle {
2516
+ fill: #FF5C02;
2517
+ stroke: #FFFFFF;
2518
+ stroke-width: 1;
2519
+ pointer-events: none;
2520
+ }
2521
+ .${t}-editor-anchor {
2522
+ fill: #FFFFFF;
2523
+ stroke: #FF5C02;
2524
+ stroke-width: 1.5;
2525
+ pointer-events: none;
2526
+ }
2527
+ .${t}-editor-anchor-selected {
2528
+ fill: #FF5C02;
2529
+ }
2530
+ .${t}-editor-ghost {
2531
+ opacity: 0.3;
2532
+ pointer-events: none;
2533
+ }
2534
+ .${t}-editor-image-bounds {
2535
+ fill: none;
2536
+ stroke: #FF5C02;
2537
+ stroke-width: 1;
2538
+ opacity: 0.7;
2539
+ pointer-events: none;
2540
+ }
2541
+ .${t}-a11y {
2542
+ position: absolute;
2543
+ width: 1px;
2544
+ height: 1px;
2545
+ margin: -1px;
2546
+ padding: 0;
2547
+ border: 0;
2548
+ overflow: hidden;
2549
+ clip: rect(0 0 0 0);
2550
+ clip-path: inset(50%);
2551
+ white-space: nowrap;
2552
+ }
2553
+ `, Qr = 1;
2554
+ function si({ settings: t, content: n, isEditor: e, isPreviewMode: o, isEditMode: i, isSelected: r, isUIHidden: c, onUpdateSettings: l }) {
2555
+ const { prefix: s } = Lo(), d = B(() => qr(s), [s]), h = e ?? !1, E = !!r || !!i, b = B(
2556
+ () => Array.isArray(n) ? n[0] ?? {} : {},
2557
+ [n]
2558
+ ), $ = (t == null ? void 0 : t.shape) ?? "custom", y = (t == null ? void 0 : t.customPath) ?? "", R = (t == null ? void 0 : t.pathFit) ?? "stretch", I = B(() => Zr(t == null ? void 0 : t.pathViewBox), [t == null ? void 0 : t.pathViewBox]), H = (t == null ? void 0 : t.shapeMode) === "B" ? "avoid" : "contain", m = (t == null ? void 0 : t.textAlign) ?? "left", _ = ((t == null ? void 0 : t.overflowMode) ?? "clip") === "visible", A = ((t == null ? void 0 : t.fitText) ?? "off") === "on", q = ((t == null ? void 0 : t.hyphenate) ?? "off") === "on", mt = wn((t == null ? void 0 : t.padding) ?? 0, h), ht = Math.max(1, Math.round((t == null ? void 0 : t.columns) ?? 1)), ut = wn((t == null ? void 0 : t.columnGutter) ?? 0, h), rt = (t == null ? void 0 : t.dropCapSize) ?? Qr, xt = Math.max(1, Math.round((t == null ? void 0 : t.dropCapLines) ?? rt)), L = h && E && !o, gt = h && !o && !c, [C, x] = yt(!1);
2559
+ At(() => {
2560
+ if (!h || !E) {
2561
+ x(!1);
2562
+ return;
2563
+ }
2564
+ const S = () => x(!0), Y = () => x(!1), U = [
2565
+ "ArticleEditor.Item:drag-start",
2566
+ "ArticleEditor.Selection:resize-start",
2567
+ "ArticleEditor.Selection:move-start"
2568
+ ], wt = [
2569
+ "ArticleEditor.Item:drag-end",
2570
+ "ArticleEditor.Selection:resize-end",
2571
+ "ArticleEditor.Selection:move-end"
2572
+ ];
2573
+ for (const nt of U) window.addEventListener(nt, S);
2574
+ for (const nt of wt) window.addEventListener(nt, Y);
2575
+ return () => {
2576
+ for (const nt of U) window.removeEventListener(nt, S);
2577
+ for (const nt of wt) window.removeEventListener(nt, Y);
2578
+ };
2579
+ }, [h, E]);
2580
+ const M = h && E && !o && typeof l == "function", D = !C && !c, W = Math.max(0, (t == null ? void 0 : t.pathSnap) ?? 0), O = St(t ?? {}), X = St(""), u = [
2581
+ t == null ? void 0 : t.customPath,
2582
+ t == null ? void 0 : t.shape,
2583
+ t == null ? void 0 : t.pathFit,
2584
+ t == null ? void 0 : t.pathViewBox,
2585
+ t == null ? void 0 : t.imageScale,
2586
+ t == null ? void 0 : t.imageFocalX,
2587
+ t == null ? void 0 : t.imageFocalY,
2588
+ t == null ? void 0 : t.image
2589
+ ].join("\0");
2590
+ if (u !== X.current)
2591
+ X.current = u, O.current = t ?? {};
2592
+ else if (t) {
2593
+ const {
2594
+ customPath: S,
2595
+ shape: Y,
2596
+ pathFit: U,
2597
+ pathViewBox: wt,
2598
+ imageScale: nt,
2599
+ imageFocalX: Ht,
2600
+ imageFocalY: zt,
2601
+ image: lt,
2602
+ ...G
2603
+ } = t, ct = O.current;
2604
+ for (const Mt of Object.keys(G))
2605
+ if (ct[Mt] !== G[Mt]) {
2606
+ O.current = { ...ct, ...G };
2607
+ break;
2608
+ }
2609
+ }
2610
+ const [K, Z] = yt(null), [it, et] = yt(!1), [dt, v] = yt(!1), $t = _t(() => v(!1), []), Tt = O.current.shape ?? $, qt = !!(K && (K.base === y || K.serialized === y)), Wt = qt && K ? K.serialized : y;
2611
+ At(() => {
2612
+ M || (et(!1), v(!1));
2613
+ }, [M]), At(() => {
2614
+ !K || it || K.serialized === y && Z(null);
2615
+ }, [K, y, it]);
2616
+ const ft = B(() => {
2617
+ if (!M) return null;
2618
+ if (K && (K.base === y || K.serialized === y)) return K.contours;
2619
+ const S = sn(y);
2620
+ return S.length ? S : null;
2621
+ }, [M, K, y]), Ft = !!(R === "viewbox" && ((t == null ? void 0 : t.pathViewBox) ?? "") === se && ft && ($ === "circle" || !lo(ft, I))), Nt = _t((S, Y, U) => {
2622
+ const wt = In(S);
2623
+ if (Z((nt) => ({
2624
+ base: nt && (nt.base === y || nt.serialized === y) ? nt.base : y,
2625
+ serialized: wt,
2626
+ contours: S
2627
+ })), Y) {
2628
+ const nt = O.current, Ht = U != null && U.preserveShape ? nt.shape : "custom", zt = { ...nt, shape: Ht, customPath: wt };
2629
+ O.current = zt, l == null || l(zt);
2630
+ }
2631
+ }, [y, l]), pt = B(() => M ? {
2632
+ contours: Ft ? ft : null,
2633
+ snap: W,
2634
+ needsConversion: !Ft,
2635
+ onConvert: (S) => {
2636
+ const Y = In(S);
2637
+ Z({ base: Y, serialized: Y, contours: S });
2638
+ const U = {
2639
+ ...O.current,
2640
+ pathFit: "viewbox",
2641
+ pathViewBox: se,
2642
+ customPath: Y
2643
+ };
2644
+ O.current = U, l == null || l(U);
2645
+ },
2646
+ onChange: (S, Y) => {
2647
+ et(!0), v(!!(Y != null && Y.carryImage)), Nt(S, !1);
2648
+ },
2649
+ onCommit: (S, Y) => {
2650
+ Nt(S, !0, Y), et(!1);
2651
+ }
2652
+ } : null, [M, Ft, ft, W, l, Nt]), Q = H === "avoid" && !!(t != null && t.image), ot = B(() => ({
2653
+ focalX: (t == null ? void 0 : t.imageFocalX) ?? 0.5,
2654
+ focalY: (t == null ? void 0 : t.imageFocalY) ?? 0.5,
2655
+ scale: (t == null ? void 0 : t.imageScale) ?? 1
2656
+ }), [t == null ? void 0 : t.imageFocalX, t == null ? void 0 : t.imageFocalY, t == null ? void 0 : t.imageScale]), [Lt, jt] = yt(null), Kt = Lt ?? ot, Pt = _t((S) => jt(S), []), st = _t((S) => {
2657
+ jt(S);
2658
+ const Y = {
2659
+ ...O.current,
2660
+ imageFocalX: S.focalX,
2661
+ imageFocalY: S.focalY,
2662
+ imageScale: S.scale
2663
+ };
2664
+ O.current = Y, l == null || l(Y);
2665
+ }, [l]);
2666
+ At(() => {
2667
+ Lt && Math.abs(Lt.focalX - ot.focalX) < 1e-9 && Math.abs(Lt.focalY - ot.focalY) < 1e-9 && Math.abs(Lt.scale - ot.scale) < 1e-9 && jt(null);
2668
+ }, [Lt, ot]);
2669
+ const a = B(() => !M || !Q ? null : { onChange: Pt, onCommit: st }, [M, Q, Pt, st]), [w, g] = yt(void 0), k = St(void 0), N = _t((S) => {
2670
+ const Y = k.current;
2671
+ Y !== void 0 && Math.abs(Y - S) < 5e-3 || (k.current = S, g(S));
2672
+ }, []), p = B(() => A && typeof w == "number" ? w : 1, [w, A]), T = (S) => `calc(${S} * var(--${s}-fit, 1))`, z = B(() => {
2673
+ var U, wt, nt, Ht, zt;
2674
+ const S = (t == null ? void 0 : t.textFontSize) ?? 0.012, Y = Math.max((t == null ? void 0 : t.textLineHeight) ?? S, S);
2675
+ return {
2676
+ fontFamily: ro(t == null ? void 0 : t.textFontFamily),
2677
+ fontWeight: (U = t == null ? void 0 : t.textFontSettings) == null ? void 0 : U.fontWeight,
2678
+ fontStyle: (wt = t == null ? void 0 : t.textFontSettings) == null ? void 0 : wt.fontStyle,
2679
+ fontSize: T(wn(S, h)),
2680
+ lineHeight: T(wn(Y, h)),
2681
+ letterSpacing: T(wn((t == null ? void 0 : t.textLetterSpacing) ?? 0, h)),
2682
+ wordSpacing: T(wn((t == null ? void 0 : t.textWordSpacing) ?? 0, h)),
2683
+ textTransform: (nt = t == null ? void 0 : t.textTextAppearance) == null ? void 0 : nt.textTransform,
2684
+ textDecoration: (Ht = t == null ? void 0 : t.textTextAppearance) == null ? void 0 : Ht.textDecoration,
2685
+ fontVariant: (zt = t == null ? void 0 : t.textTextAppearance) == null ? void 0 : zt.fontVariant
2686
+ };
2687
+ }, [t, h, s]), tt = {
2688
+ [`--${s}-text-color`]: (t == null ? void 0 : t.textColor) ?? "#000000",
2689
+ [`--${s}-link-color`]: (t == null ? void 0 : t.linkColor) ?? (t == null ? void 0 : t.textColor) ?? "#000000",
2690
+ [`--${s}-background-color`]: (t == null ? void 0 : t.backgroundColor) ?? "transparent"
2691
+ };
2692
+ return /* @__PURE__ */ It(vn, { children: [
2693
+ /* @__PURE__ */ P("style", { dangerouslySetInnerHTML: { __html: d } }),
2694
+ /* @__PURE__ */ P(
2695
+ "div",
2696
+ {
2697
+ className: `${s}-wrapper`,
2698
+ style: {
2699
+ ...tt
2700
+ },
2701
+ children: /* @__PURE__ */ P(
2702
+ jr,
2703
+ {
2704
+ P: s,
2705
+ item: b,
2706
+ shape: Tt,
2707
+ customPath: y,
2708
+ pathFit: R,
2709
+ viewBox: I,
2710
+ mode: H,
2711
+ align: m,
2712
+ allowOverflow: _,
2713
+ fitEnabled: A,
2714
+ scale: p,
2715
+ onFitScale: N,
2716
+ padding: mt,
2717
+ columns: ht,
2718
+ gutter: ut,
2719
+ hyphenate: q,
2720
+ showOverflowIndicator: gt,
2721
+ dropCapLines: xt,
2722
+ dropCapSize: rt,
2723
+ showGuides: (L || M) && D,
2724
+ typography: z,
2725
+ imageUrl: H === "avoid" ? t == null ? void 0 : t.image : null,
2726
+ imageFocalX: Kt.focalX,
2727
+ imageFocalY: Kt.focalY,
2728
+ imageScale: Kt.scale,
2729
+ imageCustomPath: Wt,
2730
+ imagePathEdited: qt,
2731
+ pathDragActive: it,
2732
+ pathCarryImage: dt,
2733
+ onCarryImageConsumed: $t,
2734
+ pathEditor: D ? pt : null,
2735
+ imageEditor: D ? a : null
2736
+ }
2737
+ )
2738
+ }
2739
+ )
2740
+ ] });
2741
+ }
2742
+ export {
2743
+ se as EDIT_VIEW_BOX,
2744
+ si as Pretext,
2745
+ ai as SHAPE_IDS,
2746
+ er as clearNodeHandle,
2747
+ bn as flattenContours,
2748
+ or as insertNodeOnSegment,
2749
+ kt as mapContours,
2750
+ Bo as moveNodeTo,
2751
+ We as moveSelectedNodesBy,
2752
+ Ge as nearestSegmentHit,
2753
+ sn as parsePathNodes,
2754
+ ho as removeContourNode,
2755
+ tr as removeContourNodes,
2756
+ so as ringsToContours,
2757
+ Oe as scaleContours,
2758
+ In as serializeContours,
2759
+ nr as setNodeHandle,
2760
+ ci as settingsForEditablePreset,
2761
+ ve as toggleNodeSmooth
2762
+ };