@squeed/flow-sdk 1.1.16 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,121 @@
1
+ Third-party software included in @squeed/flow-sdk
2
+
3
+ The SDK is licensed under the terms in LICENSE. The following notices apply
4
+ to bundled dependencies and adapted source code. React, Chakra UI, Emotion,
5
+ Framer Motion, React Icons, and markdown-to-jsx are external dependencies with
6
+ their own licenses.
7
+
8
+ ===========================================================================
9
+ Cytoscape.js - adapted edge geometry in src/engine/geometry.ts and EdgeView.tsx
10
+ https://github.com/cytoscape/cytoscape.js
11
+
12
+ Copyright (c) 2016-2025, The Cytoscape Consortium.
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
15
+ this software and associated documentation files (the "Software"), to deal in
16
+ the Software without restriction, including without limitation the rights to
17
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
18
+ of the Software, and to permit persons to whom the Software is furnished to do
19
+ so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+
32
+ ===========================================================================
33
+ Dagre and Graphlib
34
+ https://github.com/dagrejs/dagre
35
+ https://github.com/dagrejs/graphlib
36
+
37
+ Copyright (c) 2012-2014 Chris Pettitt
38
+
39
+ Permission is hereby granted, free of charge, to any person obtaining a copy
40
+ of this software and associated documentation files (the "Software"), to deal
41
+ in the Software without restriction, including without limitation the rights
42
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43
+ copies of the Software, and to permit persons to whom the Software is
44
+ furnished to do so, subject to the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be included in
47
+ all copies or substantial portions of the Software.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55
+ THE SOFTWARE.
56
+
57
+ ===========================================================================
58
+ Lodash and Lodash ES
59
+ https://github.com/lodash/lodash
60
+
61
+ Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
62
+
63
+ Based on Underscore.js, copyright Jeremy Ashkenas,
64
+ DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
65
+
66
+ This software consists of voluntary contributions made by many
67
+ individuals. For exact contribution history, see the revision history
68
+ available at https://github.com/lodash/lodash
69
+
70
+ The following license applies to all parts of this software except as
71
+ documented below:
72
+
73
+ ====
74
+
75
+ Permission is hereby granted, free of charge, to any person obtaining
76
+ a copy of this software and associated documentation files (the
77
+ "Software"), to deal in the Software without restriction, including
78
+ without limitation the rights to use, copy, modify, merge, publish,
79
+ distribute, sublicense, and/or sell copies of the Software, and to
80
+ permit persons to whom the Software is furnished to do so, subject to
81
+ the following conditions:
82
+
83
+ The above copyright notice and this permission notice shall be
84
+ included in all copies or substantial portions of the Software.
85
+
86
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
88
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
89
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
90
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
91
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
92
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
93
+
94
+ ====
95
+
96
+ Copyright and related rights for sample code are waived via CC0. Sample
97
+ code is defined as all source code displayed within the prose of the
98
+ documentation.
99
+
100
+ CC0: http://creativecommons.org/publicdomain/zero/1.0/
101
+
102
+ ====
103
+
104
+ Files located in the node_modules and vendor directories are externally
105
+ maintained libraries used by this software which have their own
106
+ licenses; we recommend you read them, as their terms may differ from the
107
+ terms above.
108
+
109
+ ===========================================================================
110
+ UUID
111
+ https://github.com/uuidjs/uuid
112
+
113
+ The MIT License (MIT)
114
+
115
+ Copyright (c) 2010-2020 Robert Kieffer and other contributors
116
+
117
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
118
+
119
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
120
+
121
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,461 @@
1
+ function O(t, e) {
2
+ if (t.match(/^[a-z]+:\/\//i))
3
+ return t;
4
+ if (t.match(/^\/\//))
5
+ return window.location.protocol + t;
6
+ if (t.match(/^[a-z]+:/i))
7
+ return t;
8
+ const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), c = n.createElement("a");
9
+ return n.head.appendChild(r), n.body.appendChild(c), e && (r.href = e), c.href = t, c.href;
10
+ }
11
+ const _ = /* @__PURE__ */ (() => {
12
+ let t = 0;
13
+ const e = () => (
14
+ // eslint-disable-next-line no-bitwise
15
+ `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
16
+ );
17
+ return () => (t += 1, `u${e()}${t}`);
18
+ })();
19
+ function u(t) {
20
+ const e = [];
21
+ for (let n = 0, r = t.length; n < r; n++)
22
+ e.push(t[n]);
23
+ return e;
24
+ }
25
+ let m = null;
26
+ function I(t = {}) {
27
+ return m || (t.includeStyleProperties ? (m = t.includeStyleProperties, m) : (m = u(window.getComputedStyle(document.documentElement)), m));
28
+ }
29
+ function y(t, e) {
30
+ const r = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
31
+ return r ? parseFloat(r.replace("px", "")) : 0;
32
+ }
33
+ function W(t) {
34
+ const e = y(t, "border-left-width"), n = y(t, "border-right-width");
35
+ return t.clientWidth + e + n;
36
+ }
37
+ function j(t) {
38
+ const e = y(t, "border-top-width"), n = y(t, "border-bottom-width");
39
+ return t.clientHeight + e + n;
40
+ }
41
+ function q(t, e = {}) {
42
+ const n = e.width || W(t), r = e.height || j(t);
43
+ return { width: n, height: r };
44
+ }
45
+ function S(t) {
46
+ return new Promise((e, n) => {
47
+ const r = new Image();
48
+ r.onload = () => {
49
+ r.decode().then(() => {
50
+ requestAnimationFrame(() => e(r));
51
+ });
52
+ }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
53
+ });
54
+ }
55
+ async function z(t) {
56
+ return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
57
+ }
58
+ async function B(t, e, n) {
59
+ const r = "http://www.w3.org/2000/svg", c = document.createElementNS(r, "svg"), s = document.createElementNS(r, "foreignObject");
60
+ return c.setAttribute("width", `${e}`), c.setAttribute("height", `${n}`), c.setAttribute("viewBox", `0 0 ${e} ${n}`), s.setAttribute("width", "100%"), s.setAttribute("height", "100%"), s.setAttribute("x", "0"), s.setAttribute("y", "0"), s.setAttribute("externalResourcesRequired", "true"), c.appendChild(s), s.appendChild(t), z(c);
61
+ }
62
+ const l = (t, e) => {
63
+ if (t instanceof e)
64
+ return !0;
65
+ const n = Object.getPrototypeOf(t);
66
+ return n === null ? !1 : n.constructor.name === e.name || l(n, e);
67
+ };
68
+ function G(t) {
69
+ const e = t.getPropertyValue("content");
70
+ return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
71
+ }
72
+ function X(t, e) {
73
+ return I(e).map((n) => {
74
+ const r = t.getPropertyValue(n), c = t.getPropertyPriority(n);
75
+ return `${n}: ${r}${c ? " !important" : ""};`;
76
+ }).join(" ");
77
+ }
78
+ function K(t, e, n, r) {
79
+ const c = `.${t}:${e}`, s = n.cssText ? G(n) : X(n, r);
80
+ return document.createTextNode(`${c}{${s}}`);
81
+ }
82
+ function R(t, e, n, r) {
83
+ const c = window.getComputedStyle(t, n), s = c.getPropertyValue("content");
84
+ if (s === "" || s === "none")
85
+ return;
86
+ const a = _();
87
+ try {
88
+ e.className = `${e.className} ${a}`;
89
+ } catch {
90
+ return;
91
+ }
92
+ const i = document.createElement("style");
93
+ i.appendChild(K(a, n, c, r)), e.appendChild(i);
94
+ }
95
+ function J(t, e, n) {
96
+ R(t, e, ":before", n), R(t, e, ":after", n);
97
+ }
98
+ const C = "application/font-woff", P = "image/jpeg", Q = {
99
+ woff: C,
100
+ woff2: C,
101
+ ttf: "application/font-truetype",
102
+ eot: "application/vnd.ms-fontobject",
103
+ png: "image/png",
104
+ jpg: P,
105
+ jpeg: P,
106
+ gif: "image/gif",
107
+ tiff: "image/tiff",
108
+ svg: "image/svg+xml",
109
+ webp: "image/webp"
110
+ };
111
+ function Y(t) {
112
+ const e = /\.([^./]*?)$/g.exec(t);
113
+ return e ? e[1] : "";
114
+ }
115
+ function E(t) {
116
+ const e = Y(t).toLowerCase();
117
+ return Q[e] || "";
118
+ }
119
+ function Z(t) {
120
+ return t.split(/,/)[1];
121
+ }
122
+ function b(t) {
123
+ return t.search(/^(data:)/) !== -1;
124
+ }
125
+ function N(t, e) {
126
+ return `data:${e};base64,${t}`;
127
+ }
128
+ async function A(t, e, n) {
129
+ const r = await fetch(t, e);
130
+ if (r.status === 404)
131
+ throw new Error(`Resource "${r.url}" not found`);
132
+ const c = await r.blob();
133
+ return new Promise((s, a) => {
134
+ const i = new FileReader();
135
+ i.onerror = a, i.onloadend = () => {
136
+ try {
137
+ s(n({ res: r, result: i.result }));
138
+ } catch (o) {
139
+ a(o);
140
+ }
141
+ }, i.readAsDataURL(c);
142
+ });
143
+ }
144
+ const p = {};
145
+ function tt(t, e, n) {
146
+ let r = t.replace(/\?.*/, "");
147
+ return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
148
+ }
149
+ async function x(t, e, n) {
150
+ const r = tt(t, e, n.includeQueryParams);
151
+ if (p[r] != null)
152
+ return p[r];
153
+ n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
154
+ let c;
155
+ try {
156
+ const s = await A(t, n.fetchRequestInit, ({ res: a, result: i }) => (e || (e = a.headers.get("Content-Type") || ""), Z(i)));
157
+ c = N(s, e);
158
+ } catch (s) {
159
+ c = n.imagePlaceholder || "";
160
+ let a = `Failed to fetch resource: ${t}`;
161
+ s && (a = typeof s == "string" ? s : s.message), a && console.warn(a);
162
+ }
163
+ return p[r] = c, c;
164
+ }
165
+ async function et(t) {
166
+ const e = t.toDataURL();
167
+ return e === "data:," ? t.cloneNode(!1) : S(e);
168
+ }
169
+ async function rt(t, e) {
170
+ if (t.currentSrc) {
171
+ const s = document.createElement("canvas"), a = s.getContext("2d");
172
+ s.width = t.clientWidth, s.height = t.clientHeight, a == null || a.drawImage(t, 0, 0, s.width, s.height);
173
+ const i = s.toDataURL();
174
+ return S(i);
175
+ }
176
+ const n = t.poster, r = E(n), c = await x(n, r, e);
177
+ return S(c);
178
+ }
179
+ async function nt(t, e) {
180
+ var n;
181
+ try {
182
+ if (!((n = t == null ? void 0 : t.contentDocument) === null || n === void 0) && n.body)
183
+ return await d(t.contentDocument.body, e, !0);
184
+ } catch {
185
+ }
186
+ return t.cloneNode(!1);
187
+ }
188
+ async function st(t, e) {
189
+ return l(t, HTMLCanvasElement) ? et(t) : l(t, HTMLVideoElement) ? rt(t, e) : l(t, HTMLIFrameElement) ? nt(t, e) : t.cloneNode(v(t));
190
+ }
191
+ const ct = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", v = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
192
+ async function at(t, e, n) {
193
+ var r, c;
194
+ if (v(e))
195
+ return e;
196
+ let s = [];
197
+ return ct(t) && t.assignedNodes ? s = u(t.assignedNodes()) : l(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? s = u(t.contentDocument.body.childNodes) : s = u(((c = t.shadowRoot) !== null && c !== void 0 ? c : t).childNodes), s.length === 0 || l(t, HTMLVideoElement) || await s.reduce((a, i) => a.then(() => d(i, n)).then((o) => {
198
+ o && e.appendChild(o);
199
+ }), Promise.resolve()), e;
200
+ }
201
+ function it(t, e, n) {
202
+ const r = e.style;
203
+ if (!r)
204
+ return;
205
+ const c = window.getComputedStyle(t);
206
+ c.cssText ? (r.cssText = c.cssText, r.transformOrigin = c.transformOrigin) : I(n).forEach((s) => {
207
+ let a = c.getPropertyValue(s);
208
+ s === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), l(t, HTMLIFrameElement) && s === "display" && a === "inline" && (a = "block"), s === "d" && e.getAttribute("d") && (a = `path(${e.getAttribute("d")})`), r.setProperty(s, a, c.getPropertyPriority(s));
209
+ });
210
+ }
211
+ function ot(t, e) {
212
+ l(t, HTMLTextAreaElement) && (e.innerHTML = t.value), l(t, HTMLInputElement) && e.setAttribute("value", t.value);
213
+ }
214
+ function lt(t, e) {
215
+ if (l(t, HTMLSelectElement)) {
216
+ const r = Array.from(e.children).find((c) => t.value === c.getAttribute("value"));
217
+ r && r.setAttribute("selected", "");
218
+ }
219
+ }
220
+ function ut(t, e, n) {
221
+ return l(e, Element) && (it(t, e, n), J(t, e, n), ot(t, e), lt(t, e)), e;
222
+ }
223
+ async function ft(t, e) {
224
+ const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
225
+ if (n.length === 0)
226
+ return t;
227
+ const r = {};
228
+ for (let s = 0; s < n.length; s++) {
229
+ const i = n[s].getAttribute("xlink:href");
230
+ if (i) {
231
+ const o = t.querySelector(i), f = document.querySelector(i);
232
+ !o && f && !r[i] && (r[i] = await d(f, e, !0));
233
+ }
234
+ }
235
+ const c = Object.values(r);
236
+ if (c.length) {
237
+ const s = "http://www.w3.org/1999/xhtml", a = document.createElementNS(s, "svg");
238
+ a.setAttribute("xmlns", s), a.style.position = "absolute", a.style.width = "0", a.style.height = "0", a.style.overflow = "hidden", a.style.display = "none";
239
+ const i = document.createElementNS(s, "defs");
240
+ a.appendChild(i);
241
+ for (let o = 0; o < c.length; o++)
242
+ i.appendChild(c[o]);
243
+ t.appendChild(a);
244
+ }
245
+ return t;
246
+ }
247
+ async function d(t, e, n) {
248
+ return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => st(r, e)).then((r) => at(t, r, e)).then((r) => ut(t, r, e)).then((r) => ft(r, e));
249
+ }
250
+ const D = /url\((['"]?)([^'"]+?)\1\)/g, mt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ht = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
251
+ function gt(t) {
252
+ const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
253
+ return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
254
+ }
255
+ function yt(t) {
256
+ const e = [];
257
+ return t.replace(D, (n, r, c) => (e.push(c), n)), e.filter((n) => !b(n));
258
+ }
259
+ async function dt(t, e, n, r, c) {
260
+ try {
261
+ const s = n ? O(e, n) : e, a = E(e);
262
+ let i;
263
+ return c || (i = await x(s, a, r)), t.replace(gt(e), `$1${i}$3`);
264
+ } catch {
265
+ }
266
+ return t;
267
+ }
268
+ function wt(t, { preferredFontFormat: e }) {
269
+ return e ? t.replace(ht, (n) => {
270
+ for (; ; ) {
271
+ const [r, , c] = mt.exec(n) || [];
272
+ if (!c)
273
+ return "";
274
+ if (c === e)
275
+ return `src: ${r};`;
276
+ }
277
+ }) : t;
278
+ }
279
+ function U(t) {
280
+ return t.search(D) !== -1;
281
+ }
282
+ async function V(t, e, n) {
283
+ if (!U(t))
284
+ return t;
285
+ const r = wt(t, n);
286
+ return yt(r).reduce((s, a) => s.then((i) => dt(i, a, e, n)), Promise.resolve(r));
287
+ }
288
+ async function h(t, e, n) {
289
+ var r;
290
+ const c = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
291
+ if (c) {
292
+ const s = await V(c, null, n);
293
+ return e.style.setProperty(t, s, e.style.getPropertyPriority(t)), !0;
294
+ }
295
+ return !1;
296
+ }
297
+ async function pt(t, e) {
298
+ await h("background", t, e) || await h("background-image", t, e), await h("mask", t, e) || await h("-webkit-mask", t, e) || await h("mask-image", t, e) || await h("-webkit-mask-image", t, e);
299
+ }
300
+ async function St(t, e) {
301
+ const n = l(t, HTMLImageElement);
302
+ if (!(n && !b(t.src)) && !(l(t, SVGImageElement) && !b(t.href.baseVal)))
303
+ return;
304
+ const r = n ? t.src : t.href.baseVal, c = await x(r, E(r), e);
305
+ await new Promise((s, a) => {
306
+ t.onload = s, t.onerror = e.onImageErrorHandler ? (...o) => {
307
+ try {
308
+ s(e.onImageErrorHandler(...o));
309
+ } catch (f) {
310
+ a(f);
311
+ }
312
+ } : a;
313
+ const i = t;
314
+ i.decode && (i.decode = s), i.loading === "lazy" && (i.loading = "eager"), n ? (t.srcset = "", t.src = c) : t.href.baseVal = c;
315
+ });
316
+ }
317
+ async function bt(t, e) {
318
+ const r = u(t.childNodes).map((c) => k(c, e));
319
+ await Promise.all(r).then(() => t);
320
+ }
321
+ async function k(t, e) {
322
+ l(t, Element) && (await pt(t, e), await St(t, e), await bt(t, e));
323
+ }
324
+ function Et(t, e) {
325
+ const { style: n } = t;
326
+ e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
327
+ const r = e.style;
328
+ return r != null && Object.keys(r).forEach((c) => {
329
+ n[c] = r[c];
330
+ }), t;
331
+ }
332
+ const T = {};
333
+ async function $(t) {
334
+ let e = T[t];
335
+ if (e != null)
336
+ return e;
337
+ const r = await (await fetch(t)).text();
338
+ return e = { url: t, cssText: r }, T[t] = e, e;
339
+ }
340
+ async function F(t, e) {
341
+ let n = t.cssText;
342
+ const r = /url\(["']?([^"')]+)["']?\)/g, s = (n.match(/url\([^)]+\)/g) || []).map(async (a) => {
343
+ let i = a.replace(r, "$1");
344
+ return i.startsWith("https://") || (i = new URL(i, t.url).href), A(i, e.fetchRequestInit, ({ result: o }) => (n = n.replace(a, `url(${o})`), [a, o]));
345
+ });
346
+ return Promise.all(s).then(() => n);
347
+ }
348
+ function L(t) {
349
+ if (t == null)
350
+ return [];
351
+ const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
352
+ let r = t.replace(n, "");
353
+ const c = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
354
+ for (; ; ) {
355
+ const o = c.exec(r);
356
+ if (o === null)
357
+ break;
358
+ e.push(o[0]);
359
+ }
360
+ r = r.replace(c, "");
361
+ const s = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", i = new RegExp(a, "gi");
362
+ for (; ; ) {
363
+ let o = s.exec(r);
364
+ if (o === null) {
365
+ if (o = i.exec(r), o === null)
366
+ break;
367
+ s.lastIndex = i.lastIndex;
368
+ } else
369
+ i.lastIndex = s.lastIndex;
370
+ e.push(o[0]);
371
+ }
372
+ return e;
373
+ }
374
+ async function xt(t, e) {
375
+ const n = [], r = [];
376
+ return t.forEach((c) => {
377
+ if ("cssRules" in c)
378
+ try {
379
+ u(c.cssRules || []).forEach((s, a) => {
380
+ if (s.type === CSSRule.IMPORT_RULE) {
381
+ let i = a + 1;
382
+ const o = s.href, f = $(o).then((g) => F(g, e)).then((g) => L(g).forEach((w) => {
383
+ try {
384
+ c.insertRule(w, w.startsWith("@import") ? i += 1 : c.cssRules.length);
385
+ } catch (M) {
386
+ console.error("Error inserting rule from remote css", {
387
+ rule: w,
388
+ error: M
389
+ });
390
+ }
391
+ })).catch((g) => {
392
+ console.error("Error loading remote css", g.toString());
393
+ });
394
+ r.push(f);
395
+ }
396
+ });
397
+ } catch (s) {
398
+ const a = t.find((i) => i.href == null) || document.styleSheets[0];
399
+ c.href != null && r.push($(c.href).then((i) => F(i, e)).then((i) => L(i).forEach((o) => {
400
+ a.insertRule(o, a.cssRules.length);
401
+ })).catch((i) => {
402
+ console.error("Error loading remote stylesheet", i);
403
+ })), console.error("Error inlining remote css file", s);
404
+ }
405
+ }), Promise.all(r).then(() => (t.forEach((c) => {
406
+ if ("cssRules" in c)
407
+ try {
408
+ u(c.cssRules || []).forEach((s) => {
409
+ n.push(s);
410
+ });
411
+ } catch (s) {
412
+ console.error(`Error while reading CSS rules from ${c.href}`, s);
413
+ }
414
+ }), n));
415
+ }
416
+ function Rt(t) {
417
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => U(e.style.getPropertyValue("src")));
418
+ }
419
+ async function Ct(t, e) {
420
+ if (t.ownerDocument == null)
421
+ throw new Error("Provided element is not within a Document");
422
+ const n = u(t.ownerDocument.styleSheets), r = await xt(n, e);
423
+ return Rt(r);
424
+ }
425
+ function H(t) {
426
+ return t.trim().replace(/["']/g, "");
427
+ }
428
+ function Pt(t) {
429
+ const e = /* @__PURE__ */ new Set();
430
+ function n(r) {
431
+ (r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((s) => {
432
+ e.add(H(s));
433
+ }), Array.from(r.children).forEach((s) => {
434
+ s instanceof HTMLElement && n(s);
435
+ });
436
+ }
437
+ return n(t), e;
438
+ }
439
+ async function Tt(t, e) {
440
+ const n = await Ct(t, e), r = Pt(t);
441
+ return (await Promise.all(n.filter((s) => r.has(H(s.style.fontFamily))).map((s) => {
442
+ const a = s.parentStyleSheet ? s.parentStyleSheet.href : null;
443
+ return V(s.cssText, a, e);
444
+ }))).join(`
445
+ `);
446
+ }
447
+ async function $t(t, e) {
448
+ const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Tt(t, e);
449
+ if (n) {
450
+ const r = document.createElement("style"), c = document.createTextNode(n);
451
+ r.appendChild(c), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
452
+ }
453
+ }
454
+ async function Ft(t, e = {}) {
455
+ const { width: n, height: r } = q(t, e), c = await d(t, e, !0);
456
+ return await $t(c, e), await k(c, e), Et(c, e), await B(c, n, r);
457
+ }
458
+ export {
459
+ Ft as toSvg
460
+ };
461
+ //# sourceMappingURL=index-CPKLNAh1.js.map