likec4 1.24.0 → 1.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  import { jsx as t, jsxs as u, Fragment as z } from "react/jsx-runtime";
2
2
  import { useOverviewGraph as L } from "virtual:likec4/overview-graph";
3
3
  import { nonexhaustive as R } from "@likec4/core";
4
- import { u as V } from "./tanstack-router-B97XgOdm.js";
5
- import { B as G, H as v, P as g, u as $, a as K, i as U, b as A, c as X } from "./likec4-DgZMMrvs.js";
4
+ import { u as V } from "./tanstack-router-MjA2OK6n.js";
5
+ import { B as G, H as v, P as g, u as $, a as K, i as U, b as A, c as X } from "./likec4-DRDnYFvy.js";
6
6
  import { memo as k, useRef as Y, useMemo as B } from "react";
7
- import { c as b, I as q, n as S, u as j, i as J } from "./main-DiEdSc7f.js";
8
- import { P as O, c as I, G as C, T as F, a as y, C as Q, b as W, d as ee, I as te, B as P, u as se } from "./mantine-Dy50iVbn.js";
7
+ import { c as b, I as q, n as S, u as j, i as J } from "./main-CSfHpw_A.js";
8
+ import { P as O, c as I, G as C, T as F, a as y, C as Q, b as W, d as ee, I as te, B as P, u as se } from "./mantine-Z8I_Wyle.js";
9
9
  import { usePreviewUrl as ae } from "virtual:likec4/previews";
10
10
  /**
11
11
  * @license @tabler/icons-react v3.29.0 - MIT
@@ -1,4 +1,4 @@
1
- function O(t, e) {
1
+ function W(t, e) {
2
2
  if (t.match(/^[a-z]+:\/\//i))
3
3
  return t;
4
4
  if (t.match(/^\/\//))
@@ -8,7 +8,7 @@ function O(t, e) {
8
8
  const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), s = r.createElement("a");
9
9
  return r.head.appendChild(n), r.body.appendChild(s), e && (n.href = e), s.href = t, s.href;
10
10
  }
11
- const _ = /* @__PURE__ */ (() => {
11
+ const q = /* @__PURE__ */ (() => {
12
12
  let t = 0;
13
13
  const e = () => (
14
14
  // eslint-disable-next-line no-bitwise
@@ -16,29 +16,33 @@ const _ = /* @__PURE__ */ (() => {
16
16
  );
17
17
  return () => (t += 1, `u${e()}${t}`);
18
18
  })();
19
- function h(t) {
19
+ function m(t) {
20
20
  const e = [];
21
21
  for (let r = 0, n = t.length; r < n; r++)
22
22
  e.push(t[r]);
23
23
  return e;
24
24
  }
25
- function d(t, e) {
25
+ let g = null;
26
+ function I(t = {}) {
27
+ return g || (t.includeStyleProperties ? (g = t.includeStyleProperties, g) : (g = m(window.getComputedStyle(document.documentElement)), g));
28
+ }
29
+ function y(t, e) {
26
30
  const n = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
27
31
  return n ? parseFloat(n.replace("px", "")) : 0;
28
32
  }
29
- function W(t) {
30
- const e = d(t, "border-left-width"), r = d(t, "border-right-width");
33
+ function B(t) {
34
+ const e = y(t, "border-left-width"), r = y(t, "border-right-width");
31
35
  return t.clientWidth + e + r;
32
36
  }
33
- function q(t) {
34
- const e = d(t, "border-top-width"), r = d(t, "border-bottom-width");
37
+ function j(t) {
38
+ const e = y(t, "border-top-width"), r = y(t, "border-bottom-width");
35
39
  return t.clientHeight + e + r;
36
40
  }
37
- function A(t, e = {}) {
38
- const r = e.width || W(t), n = e.height || q(t);
41
+ function k(t, e = {}) {
42
+ const r = e.width || B(t), n = e.height || j(t);
39
43
  return { width: r, height: n };
40
44
  }
41
- function B() {
45
+ function z() {
42
46
  let t, e;
43
47
  try {
44
48
  e = process;
@@ -48,10 +52,10 @@ function B() {
48
52
  return r && (t = parseInt(r, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
49
53
  }
50
54
  const u = 16384;
51
- function j(t) {
55
+ function G(t) {
52
56
  (t.width > u || t.height > u) && (t.width > u && t.height > u ? t.width > t.height ? (t.height *= u / t.width, t.width = u) : (t.width *= u / t.height, t.height = u) : t.width > u ? (t.height *= u / t.width, t.width = u) : (t.width *= u / t.height, t.height = u));
53
57
  }
54
- function z(t, e = {}) {
58
+ function X(t, e = {}) {
55
59
  return t.toBlob ? new Promise((r) => {
56
60
  t.toBlob(r, e.type ? e.type : "image/png", e.quality ? e.quality : 1);
57
61
  }) : new Promise((r) => {
@@ -63,7 +67,7 @@ function z(t, e = {}) {
63
67
  }));
64
68
  });
65
69
  }
66
- function y(t) {
70
+ function w(t) {
67
71
  return new Promise((e, r) => {
68
72
  const n = new Image();
69
73
  n.onload = () => {
@@ -73,12 +77,12 @@ function y(t) {
73
77
  }, n.onerror = r, n.crossOrigin = "anonymous", n.decoding = "async", n.src = t;
74
78
  });
75
79
  }
76
- async function G(t) {
80
+ async function K(t) {
77
81
  return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
78
82
  }
79
- async function X(t, e, r) {
83
+ async function J(t, e, r) {
80
84
  const n = "http://www.w3.org/2000/svg", s = document.createElementNS(n, "svg"), i = document.createElementNS(n, "foreignObject");
81
- return s.setAttribute("width", `${e}`), s.setAttribute("height", `${r}`), s.setAttribute("viewBox", `0 0 ${e} ${r}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), s.appendChild(i), i.appendChild(t), G(s);
85
+ return s.setAttribute("width", `${e}`), s.setAttribute("height", `${r}`), s.setAttribute("viewBox", `0 0 ${e} ${r}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), s.appendChild(i), i.appendChild(t), K(s);
82
86
  }
83
87
  const l = (t, e) => {
84
88
  if (t instanceof e)
@@ -86,67 +90,67 @@ const l = (t, e) => {
86
90
  const r = Object.getPrototypeOf(t);
87
91
  return r === null ? !1 : r.constructor.name === e.name || l(r, e);
88
92
  };
89
- function K(t) {
93
+ function Q(t) {
90
94
  const e = t.getPropertyValue("content");
91
95
  return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
92
96
  }
93
- function J(t) {
94
- return h(t).map((e) => {
95
- const r = t.getPropertyValue(e), n = t.getPropertyPriority(e);
96
- return `${e}: ${r}${n ? " !important" : ""};`;
97
+ function Y(t, e) {
98
+ return I(e).map((r) => {
99
+ const n = t.getPropertyValue(r), s = t.getPropertyPriority(r);
100
+ return `${r}: ${n}${s ? " !important" : ""};`;
97
101
  }).join(" ");
98
102
  }
99
- function Q(t, e, r) {
100
- const n = `.${t}:${e}`, s = r.cssText ? K(r) : J(r);
101
- return document.createTextNode(`${n}{${s}}`);
103
+ function Z(t, e, r, n) {
104
+ const s = `.${t}:${e}`, i = r.cssText ? Q(r) : Y(r, n);
105
+ return document.createTextNode(`${s}{${i}}`);
102
106
  }
103
- function R(t, e, r) {
104
- const n = window.getComputedStyle(t, r), s = n.getPropertyValue("content");
105
- if (s === "" || s === "none")
107
+ function C(t, e, r, n) {
108
+ const s = window.getComputedStyle(t, r), i = s.getPropertyValue("content");
109
+ if (i === "" || i === "none")
106
110
  return;
107
- const i = _();
111
+ const c = q();
108
112
  try {
109
- e.className = `${e.className} ${i}`;
113
+ e.className = `${e.className} ${c}`;
110
114
  } catch {
111
115
  return;
112
116
  }
113
- const c = document.createElement("style");
114
- c.appendChild(Q(i, r, n)), e.appendChild(c);
117
+ const a = document.createElement("style");
118
+ a.appendChild(Z(c, r, s, n)), e.appendChild(a);
115
119
  }
116
- function Y(t, e) {
117
- R(t, e, ":before"), R(t, e, ":after");
120
+ function N(t, e, r) {
121
+ C(t, e, ":before", r), C(t, e, ":after", r);
118
122
  }
119
- const C = "application/font-woff", P = "image/jpeg", Z = {
120
- woff: C,
121
- woff2: C,
123
+ const P = "application/font-woff", $ = "image/jpeg", tt = {
124
+ woff: P,
125
+ woff2: P,
122
126
  ttf: "application/font-truetype",
123
127
  eot: "application/vnd.ms-fontobject",
124
128
  png: "image/png",
125
- jpg: P,
126
- jpeg: P,
129
+ jpg: $,
130
+ jpeg: $,
127
131
  gif: "image/gif",
128
132
  tiff: "image/tiff",
129
133
  svg: "image/svg+xml",
130
134
  webp: "image/webp"
131
135
  };
132
- function N(t) {
136
+ function et(t) {
133
137
  const e = /\.([^./]*?)$/g.exec(t);
134
138
  return e ? e[1] : "";
135
139
  }
136
- function E(t) {
137
- const e = N(t).toLowerCase();
138
- return Z[e] || "";
140
+ function x(t) {
141
+ const e = et(t).toLowerCase();
142
+ return tt[e] || "";
139
143
  }
140
- function tt(t) {
144
+ function rt(t) {
141
145
  return t.split(/,/)[1];
142
146
  }
143
- function S(t) {
147
+ function E(t) {
144
148
  return t.search(/^(data:)/) !== -1;
145
149
  }
146
- function et(t, e) {
150
+ function nt(t, e) {
147
151
  return `data:${e};base64,${t}`;
148
152
  }
149
- async function I(t, e, r) {
153
+ async function D(t, e, r) {
150
154
  const n = await fetch(t, e);
151
155
  if (n.status === 404)
152
156
  throw new Error(`Resource "${n.url}" not found`);
@@ -162,86 +166,86 @@ async function I(t, e, r) {
162
166
  }, a.readAsDataURL(s);
163
167
  });
164
168
  }
165
- const b = {};
166
- function nt(t, e, r) {
169
+ const S = {};
170
+ function it(t, e, r) {
167
171
  let n = t.replace(/\?.*/, "");
168
172
  return r && (n = t), /ttf|otf|eot|woff2?/i.test(n) && (n = n.replace(/.*\//, "")), e ? `[${e}]${n}` : n;
169
173
  }
170
- async function x(t, e, r) {
171
- const n = nt(t, e, r.includeQueryParams);
172
- if (b[n] != null)
173
- return b[n];
174
+ async function R(t, e, r) {
175
+ const n = it(t, e, r.includeQueryParams);
176
+ if (S[n] != null)
177
+ return S[n];
174
178
  r.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
175
179
  let s;
176
180
  try {
177
- const i = await I(t, r.fetchRequestInit, ({ res: c, result: a }) => (e || (e = c.headers.get("Content-Type") || ""), tt(a)));
178
- s = et(i, e);
181
+ const i = await D(t, r.fetchRequestInit, ({ res: c, result: a }) => (e || (e = c.headers.get("Content-Type") || ""), rt(a)));
182
+ s = nt(i, e);
179
183
  } catch (i) {
180
184
  s = r.imagePlaceholder || "";
181
185
  let c = `Failed to fetch resource: ${t}`;
182
186
  i && (c = typeof i == "string" ? i : i.message), c && console.warn(c);
183
187
  }
184
- return b[n] = s, s;
188
+ return S[n] = s, s;
185
189
  }
186
- async function rt(t) {
190
+ async function st(t) {
187
191
  const e = t.toDataURL();
188
- return e === "data:," ? t.cloneNode(!1) : y(e);
192
+ return e === "data:," ? t.cloneNode(!1) : w(e);
189
193
  }
190
- async function it(t, e) {
194
+ async function ct(t, e) {
191
195
  if (t.currentSrc) {
192
196
  const i = document.createElement("canvas"), c = i.getContext("2d");
193
197
  i.width = t.clientWidth, i.height = t.clientHeight, c?.drawImage(t, 0, 0, i.width, i.height);
194
198
  const a = i.toDataURL();
195
- return y(a);
199
+ return w(a);
196
200
  }
197
- const r = t.poster, n = E(r), s = await x(r, n, e);
198
- return y(s);
201
+ const r = t.poster, n = x(r), s = await R(r, n, e);
202
+ return w(s);
199
203
  }
200
- async function st(t) {
201
- var e;
204
+ async function at(t, e) {
205
+ var r;
202
206
  try {
203
- if (!((e = t?.contentDocument) === null || e === void 0) && e.body)
204
- return await w(t.contentDocument.body, {}, !0);
207
+ if (!((r = t?.contentDocument) === null || r === void 0) && r.body)
208
+ return await p(t.contentDocument.body, e, !0);
205
209
  } catch {
206
210
  }
207
211
  return t.cloneNode(!1);
208
212
  }
209
- async function ct(t, e) {
210
- return l(t, HTMLCanvasElement) ? rt(t) : l(t, HTMLVideoElement) ? it(t, e) : l(t, HTMLIFrameElement) ? st(t) : t.cloneNode(D(t));
213
+ async function ot(t, e) {
214
+ return l(t, HTMLCanvasElement) ? st(t) : l(t, HTMLVideoElement) ? ct(t, e) : l(t, HTMLIFrameElement) ? at(t, e) : t.cloneNode(U(t));
211
215
  }
212
- const at = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", D = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
213
- async function ot(t, e, r) {
216
+ const lt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", U = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
217
+ async function ut(t, e, r) {
214
218
  var n, s;
215
- if (D(e))
219
+ if (U(e))
216
220
  return e;
217
221
  let i = [];
218
- return at(t) && t.assignedNodes ? i = h(t.assignedNodes()) : l(t, HTMLIFrameElement) && (!((n = t.contentDocument) === null || n === void 0) && n.body) ? i = h(t.contentDocument.body.childNodes) : i = h(((s = t.shadowRoot) !== null && s !== void 0 ? s : t).childNodes), i.length === 0 || l(t, HTMLVideoElement) || await i.reduce((c, a) => c.then(() => w(a, r)).then((o) => {
222
+ return lt(t) && t.assignedNodes ? i = m(t.assignedNodes()) : l(t, HTMLIFrameElement) && (!((n = t.contentDocument) === null || n === void 0) && n.body) ? i = m(t.contentDocument.body.childNodes) : i = m(((s = t.shadowRoot) !== null && s !== void 0 ? s : t).childNodes), i.length === 0 || l(t, HTMLVideoElement) || await i.reduce((c, a) => c.then(() => p(a, r)).then((o) => {
219
223
  o && e.appendChild(o);
220
224
  }), Promise.resolve()), e;
221
225
  }
222
- function lt(t, e) {
223
- const r = e.style;
224
- if (!r)
226
+ function ft(t, e, r) {
227
+ const n = e.style;
228
+ if (!n)
225
229
  return;
226
- const n = window.getComputedStyle(t);
227
- n.cssText ? (r.cssText = n.cssText, r.transformOrigin = n.transformOrigin) : h(n).forEach((s) => {
228
- let i = n.getPropertyValue(s);
229
- s === "font-size" && i.endsWith("px") && (i = `${Math.floor(parseFloat(i.substring(0, i.length - 2))) - 0.1}px`), l(t, HTMLIFrameElement) && s === "display" && i === "inline" && (i = "block"), s === "d" && e.getAttribute("d") && (i = `path(${e.getAttribute("d")})`), r.setProperty(s, i, n.getPropertyPriority(s));
230
+ const s = window.getComputedStyle(t);
231
+ s.cssText ? (n.cssText = s.cssText, n.transformOrigin = s.transformOrigin) : I(r).forEach((i) => {
232
+ let c = s.getPropertyValue(i);
233
+ i === "font-size" && c.endsWith("px") && (c = `${Math.floor(parseFloat(c.substring(0, c.length - 2))) - 0.1}px`), l(t, HTMLIFrameElement) && i === "display" && c === "inline" && (c = "block"), i === "d" && e.getAttribute("d") && (c = `path(${e.getAttribute("d")})`), n.setProperty(i, c, s.getPropertyPriority(i));
230
234
  });
231
235
  }
232
- function ut(t, e) {
236
+ function ht(t, e) {
233
237
  l(t, HTMLTextAreaElement) && (e.innerHTML = t.value), l(t, HTMLInputElement) && e.setAttribute("value", t.value);
234
238
  }
235
- function ft(t, e) {
239
+ function mt(t, e) {
236
240
  if (l(t, HTMLSelectElement)) {
237
241
  const r = e, n = Array.from(r.children).find((s) => t.value === s.getAttribute("value"));
238
242
  n && n.setAttribute("selected", "");
239
243
  }
240
244
  }
241
- function ht(t, e) {
242
- return l(e, Element) && (lt(t, e), Y(t, e), ut(t, e), ft(t, e)), e;
245
+ function gt(t, e, r) {
246
+ return l(e, Element) && (ft(t, e, r), N(t, e, r), ht(t, e), mt(t, e)), e;
243
247
  }
244
- async function mt(t, e) {
248
+ async function dt(t, e) {
245
249
  const r = t.querySelectorAll ? t.querySelectorAll("use") : [];
246
250
  if (r.length === 0)
247
251
  return t;
@@ -250,7 +254,7 @@ async function mt(t, e) {
250
254
  const a = r[i].getAttribute("xlink:href");
251
255
  if (a) {
252
256
  const o = t.querySelector(a), f = document.querySelector(a);
253
- !o && f && !n[a] && (n[a] = await w(f, e, !0));
257
+ !o && f && !n[a] && (n[a] = await p(f, e, !0));
254
258
  }
255
259
  }
256
260
  const s = Object.values(n);
@@ -265,31 +269,31 @@ async function mt(t, e) {
265
269
  }
266
270
  return t;
267
271
  }
268
- async function w(t, e, r) {
269
- return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => ct(n, e)).then((n) => ot(t, n, e)).then((n) => ht(t, n)).then((n) => mt(n, e));
272
+ async function p(t, e, r) {
273
+ return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => ot(n, e)).then((n) => ut(t, n, e)).then((n) => gt(t, n, e)).then((n) => dt(n, e));
270
274
  }
271
- const U = /url\((['"]?)([^'"]+?)\1\)/g, gt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, dt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
272
- function yt(t) {
275
+ const v = /url\((['"]?)([^'"]+?)\1\)/g, yt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, wt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
276
+ function pt(t) {
273
277
  const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
274
278
  return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
275
279
  }
276
- function wt(t) {
280
+ function bt(t) {
277
281
  const e = [];
278
- return t.replace(U, (r, n, s) => (e.push(s), r)), e.filter((r) => !S(r));
282
+ return t.replace(v, (r, n, s) => (e.push(s), r)), e.filter((r) => !E(r));
279
283
  }
280
- async function pt(t, e, r, n, s) {
284
+ async function St(t, e, r, n, s) {
281
285
  try {
282
- const i = r ? O(e, r) : e, c = E(e);
286
+ const i = r ? W(e, r) : e, c = x(e);
283
287
  let a;
284
- return s || (a = await x(i, c, n)), t.replace(yt(e), `$1${a}$3`);
288
+ return s || (a = await R(i, c, n)), t.replace(pt(e), `$1${a}$3`);
285
289
  } catch {
286
290
  }
287
291
  return t;
288
292
  }
289
- function bt(t, { preferredFontFormat: e }) {
290
- return e ? t.replace(dt, (r) => {
293
+ function Et(t, { preferredFontFormat: e }) {
294
+ return e ? t.replace(wt, (r) => {
291
295
  for (; ; ) {
292
- const [n, , s] = gt.exec(r) || [];
296
+ const [n, , s] = yt.exec(r) || [];
293
297
  if (!s)
294
298
  return "";
295
299
  if (s === e)
@@ -297,32 +301,32 @@ function bt(t, { preferredFontFormat: e }) {
297
301
  }
298
302
  }) : t;
299
303
  }
300
- function v(t) {
301
- return t.search(U) !== -1;
304
+ function H(t) {
305
+ return t.search(v) !== -1;
302
306
  }
303
- async function H(t, e, r) {
304
- if (!v(t))
307
+ async function V(t, e, r) {
308
+ if (!H(t))
305
309
  return t;
306
- const n = bt(t, r);
307
- return wt(n).reduce((i, c) => i.then((a) => pt(a, c, e, r)), Promise.resolve(n));
310
+ const n = Et(t, r);
311
+ return bt(n).reduce((i, c) => i.then((a) => St(a, c, e, r)), Promise.resolve(n));
308
312
  }
309
- async function g(t, e, r) {
313
+ async function d(t, e, r) {
310
314
  var n;
311
315
  const s = (n = e.style) === null || n === void 0 ? void 0 : n.getPropertyValue(t);
312
316
  if (s) {
313
- const i = await H(s, null, r);
317
+ const i = await V(s, null, r);
314
318
  return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
315
319
  }
316
320
  return !1;
317
321
  }
318
- async function St(t, e) {
319
- await g("background", t, e) || await g("background-image", t, e), await g("mask", t, e) || await g("mask-image", t, e);
322
+ async function xt(t, e) {
323
+ await d("background", t, e) || await d("background-image", t, e), await d("mask", t, e) || await d("-webkit-mask", t, e) || await d("mask-image", t, e) || await d("-webkit-mask-image", t, e);
320
324
  }
321
- async function Et(t, e) {
325
+ async function Rt(t, e) {
322
326
  const r = l(t, HTMLImageElement);
323
- if (!(r && !S(t.src)) && !(l(t, SVGImageElement) && !S(t.href.baseVal)))
327
+ if (!(r && !E(t.src)) && !(l(t, SVGImageElement) && !E(t.href.baseVal)))
324
328
  return;
325
- const n = r ? t.src : t.href.baseVal, s = await x(n, E(n), e);
329
+ const n = r ? t.src : t.href.baseVal, s = await R(n, x(n), e);
326
330
  await new Promise((i, c) => {
327
331
  t.onload = i, t.onerror = e.onImageErrorHandler ? (...o) => {
328
332
  try {
@@ -335,14 +339,14 @@ async function Et(t, e) {
335
339
  a.decode && (a.decode = i), a.loading === "lazy" && (a.loading = "eager"), r ? (t.srcset = "", t.src = s) : t.href.baseVal = s;
336
340
  });
337
341
  }
338
- async function xt(t, e) {
339
- const n = h(t.childNodes).map((s) => V(s, e));
342
+ async function Ct(t, e) {
343
+ const n = m(t.childNodes).map((s) => M(s, e));
340
344
  await Promise.all(n).then(() => t);
341
345
  }
342
- async function V(t, e) {
343
- l(t, Element) && (await St(t, e), await Et(t, e), await xt(t, e));
346
+ async function M(t, e) {
347
+ l(t, Element) && (await xt(t, e), await Rt(t, e), await Ct(t, e));
344
348
  }
345
- function Rt(t, e) {
349
+ function Pt(t, e) {
346
350
  const { style: r } = t;
347
351
  e.backgroundColor && (r.backgroundColor = e.backgroundColor), e.width && (r.width = `${e.width}px`), e.height && (r.height = `${e.height}px`);
348
352
  const n = e.style;
@@ -350,23 +354,23 @@ function Rt(t, e) {
350
354
  r[s] = n[s];
351
355
  }), t;
352
356
  }
353
- const $ = {};
354
- async function T(t) {
355
- let e = $[t];
357
+ const T = {};
358
+ async function F(t) {
359
+ let e = T[t];
356
360
  if (e != null)
357
361
  return e;
358
362
  const n = await (await fetch(t)).text();
359
- return e = { url: t, cssText: n }, $[t] = e, e;
363
+ return e = { url: t, cssText: n }, T[t] = e, e;
360
364
  }
361
- async function F(t, e) {
365
+ async function L(t, e) {
362
366
  let r = t.cssText;
363
367
  const n = /url\(["']?([^"')]+)["']?\)/g, i = (r.match(/url\([^)]+\)/g) || []).map(async (c) => {
364
368
  let a = c.replace(n, "$1");
365
- return a.startsWith("https://") || (a = new URL(a, t.url).href), I(a, e.fetchRequestInit, ({ result: o }) => (r = r.replace(c, `url(${o})`), [c, o]));
369
+ return a.startsWith("https://") || (a = new URL(a, t.url).href), D(a, e.fetchRequestInit, ({ result: o }) => (r = r.replace(c, `url(${o})`), [c, o]));
366
370
  });
367
371
  return Promise.all(i).then(() => r);
368
372
  }
369
- function L(t) {
373
+ function A(t) {
370
374
  if (t == null)
371
375
  return [];
372
376
  const e = [], r = /(\/\*[\s\S]*?\*\/)/gi;
@@ -392,33 +396,33 @@ function L(t) {
392
396
  }
393
397
  return e;
394
398
  }
395
- async function Ct(t, e) {
399
+ async function $t(t, e) {
396
400
  const r = [], n = [];
397
401
  return t.forEach((s) => {
398
402
  if ("cssRules" in s)
399
403
  try {
400
- h(s.cssRules || []).forEach((i, c) => {
404
+ m(s.cssRules || []).forEach((i, c) => {
401
405
  if (i.type === CSSRule.IMPORT_RULE) {
402
406
  let a = c + 1;
403
- const o = i.href, f = T(o).then((m) => F(m, e)).then((m) => L(m).forEach((p) => {
407
+ const o = i.href, f = F(o).then((h) => L(h, e)).then((h) => A(h).forEach((b) => {
404
408
  try {
405
- s.insertRule(p, p.startsWith("@import") ? a += 1 : s.cssRules.length);
406
- } catch (M) {
409
+ s.insertRule(b, b.startsWith("@import") ? a += 1 : s.cssRules.length);
410
+ } catch (_) {
407
411
  console.error("Error inserting rule from remote css", {
408
- rule: p,
409
- error: M
412
+ rule: b,
413
+ error: _
410
414
  });
411
415
  }
412
- })).catch((m) => {
413
- console.error("Error loading remote css", m.toString());
416
+ })).catch((h) => {
417
+ console.error("Error loading remote css", h.toString());
414
418
  });
415
419
  n.push(f);
416
420
  }
417
421
  });
418
422
  } catch (i) {
419
423
  const c = t.find((a) => a.href == null) || document.styleSheets[0];
420
- s.href != null && n.push(T(s.href).then((a) => F(a, e)).then((a) => L(a).forEach((o) => {
421
- c.insertRule(o, s.cssRules.length);
424
+ s.href != null && n.push(F(s.href).then((a) => L(a, e)).then((a) => A(a).forEach((o) => {
425
+ c.insertRule(o, c.cssRules.length);
422
426
  })).catch((a) => {
423
427
  console.error("Error loading remote stylesheet", a);
424
428
  })), console.error("Error inlining remote css file", i);
@@ -426,7 +430,7 @@ async function Ct(t, e) {
426
430
  }), Promise.all(n).then(() => (t.forEach((s) => {
427
431
  if ("cssRules" in s)
428
432
  try {
429
- h(s.cssRules || []).forEach((i) => {
433
+ m(s.cssRules || []).forEach((i) => {
430
434
  r.push(i);
431
435
  });
432
436
  } catch (i) {
@@ -434,58 +438,58 @@ async function Ct(t, e) {
434
438
  }
435
439
  }), r));
436
440
  }
437
- function Pt(t) {
438
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => v(e.style.getPropertyValue("src")));
441
+ function Tt(t) {
442
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => H(e.style.getPropertyValue("src")));
439
443
  }
440
- async function $t(t, e) {
444
+ async function Ft(t, e) {
441
445
  if (t.ownerDocument == null)
442
446
  throw new Error("Provided element is not within a Document");
443
- const r = h(t.ownerDocument.styleSheets), n = await Ct(r, e);
444
- return Pt(n);
447
+ const r = m(t.ownerDocument.styleSheets), n = await $t(r, e);
448
+ return Tt(n);
445
449
  }
446
- function k(t) {
450
+ function O(t) {
447
451
  return t.trim().replace(/["']/g, "");
448
452
  }
449
- function Tt(t) {
453
+ function Lt(t) {
450
454
  const e = /* @__PURE__ */ new Set();
451
455
  function r(n) {
452
456
  (n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((i) => {
453
- e.add(k(i));
457
+ e.add(O(i));
454
458
  }), Array.from(n.children).forEach((i) => {
455
459
  i instanceof HTMLElement && r(i);
456
460
  });
457
461
  }
458
462
  return r(t), e;
459
463
  }
460
- async function Ft(t, e) {
461
- const r = await $t(t, e), n = Tt(t);
462
- return (await Promise.all(r.filter((i) => n.has(k(i.style.fontFamily))).map((i) => {
464
+ async function At(t, e) {
465
+ const r = await Ft(t, e), n = Lt(t);
466
+ return (await Promise.all(r.filter((i) => n.has(O(i.style.fontFamily))).map((i) => {
463
467
  const c = i.parentStyleSheet ? i.parentStyleSheet.href : null;
464
- return H(i.cssText, c, e);
468
+ return V(i.cssText, c, e);
465
469
  }))).join(`
466
470
  `);
467
471
  }
468
- async function Lt(t, e) {
469
- const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Ft(t, e);
472
+ async function It(t, e) {
473
+ const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await At(t, e);
470
474
  if (r) {
471
475
  const n = document.createElement("style"), s = document.createTextNode(r);
472
476
  n.appendChild(s), t.firstChild ? t.insertBefore(n, t.firstChild) : t.appendChild(n);
473
477
  }
474
478
  }
475
- async function At(t, e = {}) {
476
- const { width: r, height: n } = A(t, e), s = await w(t, e, !0);
477
- return await Lt(s, e), await V(s, e), Rt(s, e), await X(s, r, n);
478
- }
479
- async function It(t, e = {}) {
480
- const { width: r, height: n } = A(t, e), s = await At(t, e), i = await y(s), c = document.createElement("canvas"), a = c.getContext("2d"), o = e.pixelRatio || B(), f = e.canvasWidth || r, m = e.canvasHeight || n;
481
- return c.width = f * o, c.height = m * o, e.skipAutoScale || j(c), c.style.width = `${f}`, c.style.height = `${m}`, e.backgroundColor && (a.fillStyle = e.backgroundColor, a.fillRect(0, 0, c.width, c.height)), a.drawImage(i, 0, 0, c.width, c.height), c;
479
+ async function kt(t, e = {}) {
480
+ const { width: r, height: n } = k(t, e), s = await p(t, e, !0);
481
+ return await It(s, e), await M(s, e), Pt(s, e), await J(s, r, n);
482
482
  }
483
483
  async function Dt(t, e = {}) {
484
- const r = await It(t, e);
485
- return await z(r);
484
+ const { width: r, height: n } = k(t, e), s = await kt(t, e), i = await w(s), c = document.createElement("canvas"), a = c.getContext("2d"), o = e.pixelRatio || z(), f = e.canvasWidth || r, h = e.canvasHeight || n;
485
+ return c.width = f * o, c.height = h * o, e.skipAutoScale || G(c), c.style.width = `${f}`, c.style.height = `${h}`, e.backgroundColor && (a.fillStyle = e.backgroundColor, a.fillRect(0, 0, c.width, c.height)), a.drawImage(i, 0, 0, c.width, c.height), c;
486
+ }
487
+ async function Ut(t, e = {}) {
488
+ const r = await Dt(t, e);
489
+ return await X(r);
486
490
  }
487
491
  export {
488
- Dt as toBlob,
489
- It as toCanvas,
490
- At as toSvg
492
+ Ut as toBlob,
493
+ Dt as toCanvas,
494
+ kt as toSvg
491
495
  };