leiting-bim 2.1.62 → 2.1.98
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.
- package/leiting-bim.es.js +1 -1
- package/leiting-bim.umd.js +42 -48
- package/leitingbim.css +1 -1
- package/package.json +1 -1
- package/plugins/cesium-core/dist/cesium-core.mjs +301 -295
- package/plugins/cesium-core/dist/cesium-core.mjs.map +1 -1
- package/plugins/cesium-core/dist/cesium-core.umd.js +13 -13
- package/plugins/cesium-core/dist/cesium-core.umd.js.map +1 -1
- package/plugins/cesium-core/dist/components/BufferedHierarchicalAggregator.d.ts +2 -0
- package/plugins/cesium-core/package.json +1 -1
- package/plugins/cesium-vue/dist/cesium-vue/src/components/basic-audio/index.d.ts +13 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/basic-video/index.d.ts +98 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/card-carousel/index.d.ts +147 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/card-content/index.d.ts +16 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/card-page/index.d.ts +64 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/carousel-img/index.d.ts +34 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/echarts-pro/index.d.ts +63 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-bubble/index.d.ts +73 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-default/index.d.ts +43 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-html/index.d.ts +43 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-manage/index.d.ts +159 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/marker-text/index.d.ts +25 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/measurement/index.d.ts +73 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/components/position-picker/index.d.ts +58 -0
- package/plugins/cesium-vue/dist/cesium-vue/src/index.d.ts +46 -0
- package/plugins/cesium-vue/dist/components/basic-audio.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/basic-audio.js.map +1 -1
- package/plugins/cesium-vue/dist/components/basic-video.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/basic-video.js.map +1 -1
- package/plugins/cesium-vue/dist/components/card-carousel.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/card-carousel.js.map +1 -1
- package/plugins/cesium-vue/dist/components/card-content.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/card-content.js.map +1 -1
- package/plugins/cesium-vue/dist/components/card-page.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/card-page.js.map +1 -1
- package/plugins/cesium-vue/dist/components/carousel-img.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/carousel-img.js.map +1 -1
- package/plugins/cesium-vue/dist/components/echarts-pro.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/marker-bubble.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/marker-bubble.js.map +1 -1
- package/plugins/cesium-vue/dist/components/marker-default.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/marker-default.js.map +1 -1
- package/plugins/cesium-vue/dist/components/marker-html.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/marker-html.js.map +1 -1
- package/plugins/cesium-vue/dist/components/marker-manage.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/marker-manage.js +511 -488
- package/plugins/cesium-vue/dist/components/marker-manage.js.map +1 -1
- package/plugins/cesium-vue/dist/components/marker-text.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/marker-text.js.map +1 -1
- package/plugins/cesium-vue/dist/components/measurement.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/measurement.js.map +1 -1
- package/plugins/cesium-vue/dist/components/position-picker.d.ts +3 -3
- package/plugins/cesium-vue/dist/components/position-picker.js.map +1 -1
- package/plugins/cesium-vue/dist/index-CUs_hd1V.js.map +1 -1
- package/plugins/cesium-vue/dist/index-Kdqw0FJN.js.map +1 -1
- package/plugins/cesium-vue/dist/index.d.ts +6 -46
- package/plugins/cesium-vue/dist/index.js.map +1 -1
- package/plugins/cesium-vue/package.json +4 -4
- package/plugins/theme-chalk/package.json +1 -1
- package/plugins/utils/package.json +1 -1
- package/snapdom-D8jRyUPk.js +0 -2896
package/snapdom-D8jRyUPk.js
DELETED
|
@@ -1,2896 +0,0 @@
|
|
|
1
|
-
var w = {
|
|
2
|
-
image: /* @__PURE__ */ new Map(),
|
|
3
|
-
background: /* @__PURE__ */ new Map(),
|
|
4
|
-
resource: /* @__PURE__ */ new Map(),
|
|
5
|
-
defaultStyle: /* @__PURE__ */ new Map(),
|
|
6
|
-
baseStyle: /* @__PURE__ */ new Map(),
|
|
7
|
-
computedStyle: /* @__PURE__ */ new WeakMap(),
|
|
8
|
-
font: /* @__PURE__ */ new Set(),
|
|
9
|
-
session: {
|
|
10
|
-
styleMap: /* @__PURE__ */ new Map(),
|
|
11
|
-
styleCache: /* @__PURE__ */ new WeakMap(),
|
|
12
|
-
nodeMap: /* @__PURE__ */ new Map()
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
function fe(t = "soft") {
|
|
16
|
-
switch (t) {
|
|
17
|
-
case "auto": {
|
|
18
|
-
w.session.styleMap = /* @__PURE__ */ new Map(), w.session.nodeMap = /* @__PURE__ */ new Map();
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
case "soft": {
|
|
22
|
-
w.session.styleMap = /* @__PURE__ */ new Map(), w.session.nodeMap = /* @__PURE__ */ new Map(), w.session.styleCache = /* @__PURE__ */ new WeakMap();
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
case "full":
|
|
26
|
-
return;
|
|
27
|
-
case "disabled": {
|
|
28
|
-
w.session.styleMap = /* @__PURE__ */ new Map(), w.session.nodeMap = /* @__PURE__ */ new Map(), w.session.styleCache = /* @__PURE__ */ new WeakMap(), w.computedStyle = /* @__PURE__ */ new WeakMap(), w.baseStyle = /* @__PURE__ */ new Map(), w.defaultStyle = /* @__PURE__ */ new Map(), w.image = /* @__PURE__ */ new Map(), w.background = /* @__PURE__ */ new Map(), w.resource = /* @__PURE__ */ new Map(), w.font = /* @__PURE__ */ new Set();
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
default: {
|
|
32
|
-
w.session.styleMap = /* @__PURE__ */ new Map(), w.session.nodeMap = /* @__PURE__ */ new Map(), w.session.styleCache = /* @__PURE__ */ new WeakMap();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function Ut(t) {
|
|
38
|
-
const e = t.match(/url\((['"]?)(.*?)(\1)\)/);
|
|
39
|
-
if (!e) return null;
|
|
40
|
-
const n = e[2].trim();
|
|
41
|
-
return n.startsWith("#") ? null : n;
|
|
42
|
-
}
|
|
43
|
-
function Be(t) {
|
|
44
|
-
if (!t || t === "none") return "";
|
|
45
|
-
let e = t.replace(/translate[XY]?\([^)]*\)/g, "");
|
|
46
|
-
return e = e.replace(/matrix\(([^)]+)\)/g, (n, r) => {
|
|
47
|
-
const o = r.split(",").map((s) => s.trim());
|
|
48
|
-
return o.length !== 6 ? `matrix(${r})` : (o[4] = "0", o[5] = "0", `matrix(${o.join(", ")})`);
|
|
49
|
-
}), e = e.replace(/matrix3d\(([^)]+)\)/g, (n, r) => {
|
|
50
|
-
const o = r.split(",").map((s) => s.trim());
|
|
51
|
-
return o.length !== 16 ? `matrix3d(${r})` : (o[12] = "0", o[13] = "0", `matrix3d(${o.join(", ")})`);
|
|
52
|
-
}), e.trim().replace(/\s{2,}/g, " ");
|
|
53
|
-
}
|
|
54
|
-
function yt(t) {
|
|
55
|
-
if (/%[0-9A-Fa-f]{2}/.test(t)) return t;
|
|
56
|
-
try {
|
|
57
|
-
return encodeURI(t);
|
|
58
|
-
} catch {
|
|
59
|
-
return t;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function De(t = "[snapDOM]", { ttlMs: e = 5 * 6e4, maxEntries: n = 12 } = {}) {
|
|
63
|
-
const r = /* @__PURE__ */ new Map();
|
|
64
|
-
let o = 0;
|
|
65
|
-
function s(a, l, i) {
|
|
66
|
-
if (o >= n) return;
|
|
67
|
-
const c = Date.now();
|
|
68
|
-
(r.get(l) || 0) > c || (r.set(l, c + e), o++, a === "warn" && console && console.warn ? console.warn(`${t} ${i}`) : console && console.error && console.error(`${t} ${i}`));
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
warnOnce(a, l) {
|
|
72
|
-
s("warn", a, l);
|
|
73
|
-
},
|
|
74
|
-
errorOnce(a, l) {
|
|
75
|
-
s("error", a, l);
|
|
76
|
-
},
|
|
77
|
-
reset() {
|
|
78
|
-
r.clear(), o = 0;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
var Kt = De("[snapDOM]", { ttlMs: 3 * 6e4, maxEntries: 10 }), At = /* @__PURE__ */ new Map(), ht = /* @__PURE__ */ new Map();
|
|
83
|
-
function He(t) {
|
|
84
|
-
return /^data:|^blob:|^about:blank$/i.test(t);
|
|
85
|
-
}
|
|
86
|
-
function qe(t, e) {
|
|
87
|
-
try {
|
|
88
|
-
const n = typeof location < "u" && location.href ? location.href : "http://localhost/", r = e.includes("{url}") ? e.split("{url}")[0] : e, o = new URL(r || ".", n), s = new URL(t, n);
|
|
89
|
-
if (s.origin === o.origin) return !0;
|
|
90
|
-
const a = s.searchParams;
|
|
91
|
-
if (a && (a.has("url") || a.has("target"))) return !0;
|
|
92
|
-
} catch {
|
|
93
|
-
}
|
|
94
|
-
return !1;
|
|
95
|
-
}
|
|
96
|
-
function je(t, e) {
|
|
97
|
-
if (!e || He(t) || qe(t, e)) return !1;
|
|
98
|
-
try {
|
|
99
|
-
const n = typeof location < "u" && location.href ? location.href : "http://localhost/", r = new URL(t, n);
|
|
100
|
-
return typeof location < "u" ? r.origin !== location.origin : !0;
|
|
101
|
-
} catch {
|
|
102
|
-
return !!e;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function Ve(t, e) {
|
|
106
|
-
if (!e) return t;
|
|
107
|
-
if (e.includes("{url}"))
|
|
108
|
-
return e.replace("{urlRaw}", yt(t)).replace("{url}", encodeURIComponent(t));
|
|
109
|
-
if (/[?&]url=?$/.test(e))
|
|
110
|
-
return `${e}${encodeURIComponent(t)}`;
|
|
111
|
-
if (e.endsWith("?"))
|
|
112
|
-
return `${e}url=${encodeURIComponent(t)}`;
|
|
113
|
-
if (e.endsWith("/"))
|
|
114
|
-
return `${e}${yt(t)}`;
|
|
115
|
-
const n = e.includes("?") ? "&" : "?";
|
|
116
|
-
return `${e}${n}url=${encodeURIComponent(t)}`;
|
|
117
|
-
}
|
|
118
|
-
function Jt(t) {
|
|
119
|
-
return new Promise((e, n) => {
|
|
120
|
-
const r = new FileReader();
|
|
121
|
-
r.onload = () => e(String(r.result || "")), r.onerror = () => n(new Error("read_failed")), r.readAsDataURL(t);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function ze(t, e) {
|
|
125
|
-
return [
|
|
126
|
-
e.as || "blob",
|
|
127
|
-
e.timeout ?? 3e3,
|
|
128
|
-
e.useProxy || "",
|
|
129
|
-
e.errorTTL ?? 8e3,
|
|
130
|
-
t
|
|
131
|
-
].join("|");
|
|
132
|
-
}
|
|
133
|
-
async function _(t, e = {}) {
|
|
134
|
-
const n = e.as ?? "blob", r = e.timeout ?? 3e3, o = e.useProxy || "", s = e.errorTTL ?? 8e3, a = e.headers || {}, l = !!e.silent;
|
|
135
|
-
if (/^data:/i.test(t))
|
|
136
|
-
try {
|
|
137
|
-
if (n === "text")
|
|
138
|
-
return { ok: !0, data: String(t), status: 200, url: t, fromCache: !1 };
|
|
139
|
-
if (n === "dataURL")
|
|
140
|
-
return {
|
|
141
|
-
ok: !0,
|
|
142
|
-
data: String(t),
|
|
143
|
-
status: 200,
|
|
144
|
-
url: t,
|
|
145
|
-
fromCache: !1,
|
|
146
|
-
mime: String(t).slice(5).split(";")[0] || ""
|
|
147
|
-
};
|
|
148
|
-
const [, h = "", p = ""] = String(t).match(/^data:([^,]*),(.*)$/) || [], S = /;base64/i.test(h) ? atob(p) : decodeURIComponent(p), x = new Uint8Array([...S].map((M) => M.charCodeAt(0))), C = new Blob([x], { type: (h || "").split(";")[0] || "" });
|
|
149
|
-
return { ok: !0, data: C, status: 200, url: t, fromCache: !1, mime: C.type || "" };
|
|
150
|
-
} catch {
|
|
151
|
-
return { ok: !1, data: null, status: 0, url: t, fromCache: !1, reason: "special_url_error" };
|
|
152
|
-
}
|
|
153
|
-
if (/^blob:/i.test(t))
|
|
154
|
-
try {
|
|
155
|
-
const h = await fetch(t);
|
|
156
|
-
if (!h.ok)
|
|
157
|
-
return { ok: !1, data: null, status: h.status, url: t, fromCache: !1, reason: "http_error" };
|
|
158
|
-
const p = await h.blob(), g = p.type || h.headers.get("content-type") || "";
|
|
159
|
-
return n === "dataURL" ? { ok: !0, data: await Jt(p), status: h.status, url: t, fromCache: !1, mime: g } : n === "text" ? { ok: !0, data: await p.text(), status: h.status, url: t, fromCache: !1, mime: g } : { ok: !0, data: p, status: h.status, url: t, fromCache: !1, mime: g };
|
|
160
|
-
} catch {
|
|
161
|
-
return { ok: !1, data: null, status: 0, url: t, fromCache: !1, reason: "network" };
|
|
162
|
-
}
|
|
163
|
-
if (/^about:blank$/i.test(t))
|
|
164
|
-
return n === "dataURL" ? {
|
|
165
|
-
ok: !0,
|
|
166
|
-
data: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",
|
|
167
|
-
status: 200,
|
|
168
|
-
url: t,
|
|
169
|
-
fromCache: !1,
|
|
170
|
-
mime: "image/png"
|
|
171
|
-
} : { ok: !0, data: n === "text" ? "" : new Blob([]), status: 200, url: t, fromCache: !1 };
|
|
172
|
-
const i = ze(t, { as: n, timeout: r, useProxy: o, errorTTL: s }), c = ht.get(i);
|
|
173
|
-
if (c && c.until > Date.now())
|
|
174
|
-
return { ...c.result, fromCache: !0 };
|
|
175
|
-
c && ht.delete(i);
|
|
176
|
-
const u = At.get(i);
|
|
177
|
-
if (u) return u;
|
|
178
|
-
const f = je(t, o) ? Ve(t, o) : t;
|
|
179
|
-
let d = e.credentials;
|
|
180
|
-
if (!d)
|
|
181
|
-
try {
|
|
182
|
-
const h = typeof location < "u" && location.href ? location.href : "http://localhost/", p = new URL(t, h);
|
|
183
|
-
d = typeof location < "u" && p.origin === location.origin ? "include" : "omit";
|
|
184
|
-
} catch {
|
|
185
|
-
d = "omit";
|
|
186
|
-
}
|
|
187
|
-
const y = new AbortController(), b = setTimeout(() => y.abort("timeout"), r), m = (async () => {
|
|
188
|
-
try {
|
|
189
|
-
const h = await fetch(f, { signal: y.signal, credentials: d, headers: a });
|
|
190
|
-
if (!h.ok) {
|
|
191
|
-
const S = { ok: !1, data: null, status: h.status, url: f, fromCache: !1, reason: "http_error" };
|
|
192
|
-
if (s > 0 && ht.set(i, { until: Date.now() + s, result: S }), !l) {
|
|
193
|
-
const x = `${h.status} ${h.statusText || ""}`.trim();
|
|
194
|
-
Kt.warnOnce(
|
|
195
|
-
`http:${h.status}:${n}:${new URL(t, location?.href ?? "http://localhost/").origin}`,
|
|
196
|
-
`HTTP error ${x} while fetching ${n} ${t}`
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
return e.onError && e.onError(S), S;
|
|
200
|
-
}
|
|
201
|
-
if (n === "text")
|
|
202
|
-
return { ok: !0, data: await h.text(), status: h.status, url: f, fromCache: !1 };
|
|
203
|
-
const p = await h.blob(), g = p.type || h.headers.get("content-type") || "";
|
|
204
|
-
return n === "dataURL" ? { ok: !0, data: await Jt(p), status: h.status, url: f, fromCache: !1, mime: g } : { ok: !0, data: p, status: h.status, url: f, fromCache: !1, mime: g };
|
|
205
|
-
} catch (h) {
|
|
206
|
-
const p = h && typeof h == "object" && "name" in h && h.name === "AbortError" ? String(h.message || "").includes("timeout") ? "timeout" : "abort" : "network", g = { ok: !1, data: null, status: 0, url: f, fromCache: !1, reason: p };
|
|
207
|
-
if (!/^blob:/i.test(t) && s > 0 && ht.set(i, { until: Date.now() + s, result: g }), !l) {
|
|
208
|
-
const S = `${p}:${n}:${new URL(t, location?.href ?? "http://localhost/").origin}`, x = p === "timeout" ? `Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}` : p === "abort" ? `Request aborted while fetching ${n} ${t}` : `Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;
|
|
209
|
-
Kt.errorOnce(S, x);
|
|
210
|
-
}
|
|
211
|
-
return e.onError && e.onError(g), g;
|
|
212
|
-
} finally {
|
|
213
|
-
clearTimeout(b), At.delete(i);
|
|
214
|
-
}
|
|
215
|
-
})();
|
|
216
|
-
return At.set(i, m), m;
|
|
217
|
-
}
|
|
218
|
-
function Bt(t, e) {
|
|
219
|
-
if (!e || !t.width || !t.height)
|
|
220
|
-
return t;
|
|
221
|
-
const n = document.createElement("canvas");
|
|
222
|
-
n.width = t.width, n.height = t.height;
|
|
223
|
-
const r = n.getContext("2d");
|
|
224
|
-
return r.fillStyle = e, r.fillRect(0, 0, n.width, n.height), r.drawImage(t, 0, 0), n;
|
|
225
|
-
}
|
|
226
|
-
async function Dt(t, e = {}) {
|
|
227
|
-
if (/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t) || t.trim() === "none")
|
|
228
|
-
return t;
|
|
229
|
-
const r = Ut(t);
|
|
230
|
-
if (!r)
|
|
231
|
-
return t;
|
|
232
|
-
const o = yt(r);
|
|
233
|
-
if (w.background.has(o)) {
|
|
234
|
-
const s = w.background.get(o);
|
|
235
|
-
return s ? `url("${s}")` : "none";
|
|
236
|
-
}
|
|
237
|
-
try {
|
|
238
|
-
const s = await _(o, { as: "dataURL", useProxy: e.useProxy });
|
|
239
|
-
return s.ok ? (w.background.set(o, s.data), `url("${s.data}")`) : (w.background.set(o, null), "none");
|
|
240
|
-
} catch {
|
|
241
|
-
return w.background.set(o, null), "none";
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
var de = /* @__PURE__ */ new Set([
|
|
245
|
-
"meta",
|
|
246
|
-
"script",
|
|
247
|
-
"noscript",
|
|
248
|
-
"title",
|
|
249
|
-
"link",
|
|
250
|
-
"template"
|
|
251
|
-
]), bt = /* @__PURE__ */ new Set([
|
|
252
|
-
// non-painting / head stuff
|
|
253
|
-
"meta",
|
|
254
|
-
"link",
|
|
255
|
-
"style",
|
|
256
|
-
"title",
|
|
257
|
-
"noscript",
|
|
258
|
-
"script",
|
|
259
|
-
"template",
|
|
260
|
-
// SVG whole namespace (safe for LeaderLine/presentation attrs)
|
|
261
|
-
"g",
|
|
262
|
-
"defs",
|
|
263
|
-
"use",
|
|
264
|
-
"marker",
|
|
265
|
-
"mask",
|
|
266
|
-
"clipPath",
|
|
267
|
-
"pattern",
|
|
268
|
-
"path",
|
|
269
|
-
"polygon",
|
|
270
|
-
"polyline",
|
|
271
|
-
"line",
|
|
272
|
-
"circle",
|
|
273
|
-
"ellipse",
|
|
274
|
-
"rect",
|
|
275
|
-
"filter",
|
|
276
|
-
"lineargradient",
|
|
277
|
-
"radialgradient",
|
|
278
|
-
"stop"
|
|
279
|
-
]), Xe = [
|
|
280
|
-
"div",
|
|
281
|
-
"span",
|
|
282
|
-
"p",
|
|
283
|
-
"a",
|
|
284
|
-
"img",
|
|
285
|
-
"ul",
|
|
286
|
-
"li",
|
|
287
|
-
"button",
|
|
288
|
-
"input",
|
|
289
|
-
"select",
|
|
290
|
-
"textarea",
|
|
291
|
-
"label",
|
|
292
|
-
"section",
|
|
293
|
-
"article",
|
|
294
|
-
"header",
|
|
295
|
-
"footer",
|
|
296
|
-
"nav",
|
|
297
|
-
"main",
|
|
298
|
-
"aside",
|
|
299
|
-
"h1",
|
|
300
|
-
"h2",
|
|
301
|
-
"h3",
|
|
302
|
-
"h4",
|
|
303
|
-
"h5",
|
|
304
|
-
"h6",
|
|
305
|
-
"table",
|
|
306
|
-
"thead",
|
|
307
|
-
"tbody",
|
|
308
|
-
"tr",
|
|
309
|
-
"td",
|
|
310
|
-
"th"
|
|
311
|
-
];
|
|
312
|
-
function Ye() {
|
|
313
|
-
for (let t of Xe) {
|
|
314
|
-
const e = String(t).toLowerCase();
|
|
315
|
-
de.has(e) || bt.has(e) || he(e);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
function he(t) {
|
|
319
|
-
if (t = String(t).toLowerCase(), bt.has(t)) {
|
|
320
|
-
const s = {};
|
|
321
|
-
return w.defaultStyle.set(t, s), s;
|
|
322
|
-
}
|
|
323
|
-
if (w.defaultStyle.has(t))
|
|
324
|
-
return w.defaultStyle.get(t);
|
|
325
|
-
let e = document.getElementById("snapdom-sandbox");
|
|
326
|
-
e || (e = document.createElement("div"), e.id = "snapdom-sandbox", e.setAttribute("data-snapdom-sandbox", "true"), e.setAttribute("aria-hidden", "true"), e.style.position = "absolute", e.style.left = "-9999px", e.style.top = "-9999px", e.style.width = "0px", e.style.height = "0px", e.style.overflow = "hidden", document.body.appendChild(e));
|
|
327
|
-
const n = document.createElement(t);
|
|
328
|
-
n.style.all = "initial", e.appendChild(n);
|
|
329
|
-
const r = getComputedStyle(n), o = {};
|
|
330
|
-
for (let s of r) {
|
|
331
|
-
if (me(s)) continue;
|
|
332
|
-
const a = r.getPropertyValue(s);
|
|
333
|
-
o[s] = a;
|
|
334
|
-
}
|
|
335
|
-
return e.removeChild(n), w.defaultStyle.set(t, o), o;
|
|
336
|
-
}
|
|
337
|
-
var Ge = /(?:^|-)(animation|transition)(?:-|$)/i, Ke = /^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i, Je = /* @__PURE__ */ new Set([
|
|
338
|
-
// Interaction hints
|
|
339
|
-
"cursor",
|
|
340
|
-
"pointer-events",
|
|
341
|
-
"touch-action",
|
|
342
|
-
"user-select",
|
|
343
|
-
// Printing/speech/reading-mode hints
|
|
344
|
-
"print-color-adjust",
|
|
345
|
-
"speak",
|
|
346
|
-
"reading-flow",
|
|
347
|
-
"reading-order",
|
|
348
|
-
// Anchoring/container/timeline scopes (metadata for layout queries)
|
|
349
|
-
"anchor-name",
|
|
350
|
-
"anchor-scope",
|
|
351
|
-
"container-name",
|
|
352
|
-
"container-type",
|
|
353
|
-
"timeline-scope"
|
|
354
|
-
]);
|
|
355
|
-
function me(t) {
|
|
356
|
-
const e = String(t).toLowerCase();
|
|
357
|
-
return !!(Je.has(e) || Ke.test(e) || Ge.test(e));
|
|
358
|
-
}
|
|
359
|
-
function Nt(t, e) {
|
|
360
|
-
if (e = String(e || "").toLowerCase(), bt.has(e))
|
|
361
|
-
return "";
|
|
362
|
-
const n = [], r = he(e);
|
|
363
|
-
for (let [o, s] of Object.entries(t)) {
|
|
364
|
-
if (me(o)) continue;
|
|
365
|
-
const a = r[o];
|
|
366
|
-
s && s !== a && n.push(`${o}:${s}`);
|
|
367
|
-
}
|
|
368
|
-
return n.sort(), n.join(";");
|
|
369
|
-
}
|
|
370
|
-
function Qe(t) {
|
|
371
|
-
const e = /* @__PURE__ */ new Set();
|
|
372
|
-
return t.nodeType !== Node.ELEMENT_NODE && t.nodeType !== Node.DOCUMENT_FRAGMENT_NODE ? [] : (t.tagName && e.add(t.tagName.toLowerCase()), typeof t.querySelectorAll == "function" && t.querySelectorAll("*").forEach((n) => e.add(n.tagName.toLowerCase())), Array.from(e));
|
|
373
|
-
}
|
|
374
|
-
function Ze(t) {
|
|
375
|
-
const e = /* @__PURE__ */ new Map();
|
|
376
|
-
for (let r of t) {
|
|
377
|
-
const o = w.defaultStyle.get(r);
|
|
378
|
-
if (!o) continue;
|
|
379
|
-
const s = Object.entries(o).map(([a, l]) => `${a}:${l};`).sort().join("");
|
|
380
|
-
s && (e.has(s) || e.set(s, []), e.get(s).push(r));
|
|
381
|
-
}
|
|
382
|
-
let n = "";
|
|
383
|
-
for (let [r, o] of e.entries())
|
|
384
|
-
n += `${o.join(",")} { ${r} }
|
|
385
|
-
`;
|
|
386
|
-
return n;
|
|
387
|
-
}
|
|
388
|
-
function tn(t) {
|
|
389
|
-
const e = Array.from(new Set(t.values())).filter(Boolean).sort(), n = /* @__PURE__ */ new Map();
|
|
390
|
-
let r = 1;
|
|
391
|
-
for (const o of e) n.set(o, `c${r++}`);
|
|
392
|
-
return n;
|
|
393
|
-
}
|
|
394
|
-
function Ht(t, e = null) {
|
|
395
|
-
if (!(t instanceof Element))
|
|
396
|
-
return window.getComputedStyle(t, e);
|
|
397
|
-
let n = w.computedStyle.get(t);
|
|
398
|
-
if (n || (n = /* @__PURE__ */ new Map(), w.computedStyle.set(t, n)), !n.has(e)) {
|
|
399
|
-
const r = window.getComputedStyle(t, e);
|
|
400
|
-
n.set(e, r);
|
|
401
|
-
}
|
|
402
|
-
return n.get(e);
|
|
403
|
-
}
|
|
404
|
-
function Qt(t) {
|
|
405
|
-
const e = {};
|
|
406
|
-
for (let n of t)
|
|
407
|
-
e[n] = t.getPropertyValue(n);
|
|
408
|
-
return e;
|
|
409
|
-
}
|
|
410
|
-
function qt(t) {
|
|
411
|
-
const e = [];
|
|
412
|
-
let n = 0, r = 0;
|
|
413
|
-
for (let o = 0; o < t.length; o++) {
|
|
414
|
-
const s = t[o];
|
|
415
|
-
s === "(" && n++, s === ")" && n--, s === "," && n === 0 && (e.push(t.slice(r, o).trim()), r = o + 1);
|
|
416
|
-
}
|
|
417
|
-
return e.push(t.slice(r).trim()), e;
|
|
418
|
-
}
|
|
419
|
-
function tt(t, { fast: e = !1 } = {}) {
|
|
420
|
-
if (e) return t();
|
|
421
|
-
"requestIdleCallback" in window ? requestIdleCallback(t, { timeout: 50 }) : setTimeout(t, 1);
|
|
422
|
-
}
|
|
423
|
-
function O() {
|
|
424
|
-
const t = typeof navigator < "u" && navigator.userAgent ? navigator.userAgent : "", e = /^((?!chrome|android).)*safari/i.test(t), n = /AppleWebKit/i.test(t) && /Mobile/i.test(t) && !/Safari/i.test(t), r = /(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(t);
|
|
425
|
-
return e || n || r;
|
|
426
|
-
}
|
|
427
|
-
var Zt = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new Map(), Rt = 0;
|
|
428
|
-
function ct() {
|
|
429
|
-
Rt++;
|
|
430
|
-
}
|
|
431
|
-
var te = !1;
|
|
432
|
-
function en(t = document.documentElement) {
|
|
433
|
-
if (!te) {
|
|
434
|
-
te = !0;
|
|
435
|
-
try {
|
|
436
|
-
new MutationObserver(() => ct()).observe(t, { subtree: !0, childList: !0, characterData: !0, attributes: !0 });
|
|
437
|
-
} catch {
|
|
438
|
-
}
|
|
439
|
-
try {
|
|
440
|
-
new MutationObserver(() => ct()).observe(document.head, { subtree: !0, childList: !0, characterData: !0, attributes: !0 });
|
|
441
|
-
} catch {
|
|
442
|
-
}
|
|
443
|
-
try {
|
|
444
|
-
const e = document.fonts;
|
|
445
|
-
e && (e.addEventListener?.("loadingdone", ct), e.ready?.then(() => ct()).catch(() => {
|
|
446
|
-
}));
|
|
447
|
-
} catch {
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
function nn(t, e = {}) {
|
|
452
|
-
const n = {}, r = t.getPropertyValue("visibility");
|
|
453
|
-
for (let o = 0; o < t.length; o++) {
|
|
454
|
-
const s = t[o];
|
|
455
|
-
let a = t.getPropertyValue(s);
|
|
456
|
-
(s === "background-image" || s === "content") && a.includes("url(") && !a.includes("data:") && (a = "none"), n[s] = a;
|
|
457
|
-
}
|
|
458
|
-
if (e.embedFonts) {
|
|
459
|
-
const o = [
|
|
460
|
-
"font-feature-settings",
|
|
461
|
-
"font-variation-settings",
|
|
462
|
-
"font-kerning",
|
|
463
|
-
"font-variant",
|
|
464
|
-
"font-variant-ligatures",
|
|
465
|
-
"font-optical-sizing"
|
|
466
|
-
];
|
|
467
|
-
for (const s of o)
|
|
468
|
-
if (!n[s])
|
|
469
|
-
try {
|
|
470
|
-
const a = t.getPropertyValue(s);
|
|
471
|
-
a && (n[s] = a);
|
|
472
|
-
} catch {
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
return r === "hidden" && (n.opacity = "0"), n;
|
|
476
|
-
}
|
|
477
|
-
var ee = /* @__PURE__ */ new WeakMap();
|
|
478
|
-
function rn(t) {
|
|
479
|
-
let e = ee.get(t);
|
|
480
|
-
return e || (e = Object.entries(t).sort((r, o) => r[0] < o[0] ? -1 : r[0] > o[0] ? 1 : 0).map(([r, o]) => `${r}:${o}`).join(";"), ee.set(t, e), e);
|
|
481
|
-
}
|
|
482
|
-
function on(t, e = null, n = {}) {
|
|
483
|
-
const r = Zt.get(t);
|
|
484
|
-
if (r && r.epoch === Rt) return r.snapshot;
|
|
485
|
-
const o = e || getComputedStyle(t), s = nn(o, n);
|
|
486
|
-
return fn(t, o, s), Zt.set(t, { epoch: Rt, snapshot: s }), s;
|
|
487
|
-
}
|
|
488
|
-
function an(t, e) {
|
|
489
|
-
return t && t.session && t.persist ? t : t && (t.styleMap || t.styleCache || t.nodeMap) ? {
|
|
490
|
-
session: t,
|
|
491
|
-
persist: {
|
|
492
|
-
snapshotKeyCache: Lt,
|
|
493
|
-
defaultStyle: w.defaultStyle,
|
|
494
|
-
baseStyle: w.baseStyle,
|
|
495
|
-
image: w.image,
|
|
496
|
-
resource: w.resource,
|
|
497
|
-
background: w.background,
|
|
498
|
-
font: w.font
|
|
499
|
-
},
|
|
500
|
-
options: e || {}
|
|
501
|
-
} : {
|
|
502
|
-
session: w.session,
|
|
503
|
-
persist: {
|
|
504
|
-
snapshotKeyCache: Lt,
|
|
505
|
-
defaultStyle: w.defaultStyle,
|
|
506
|
-
baseStyle: w.baseStyle,
|
|
507
|
-
image: w.image,
|
|
508
|
-
resource: w.resource,
|
|
509
|
-
background: w.background,
|
|
510
|
-
font: w.font
|
|
511
|
-
},
|
|
512
|
-
options: t || e || {}
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
async function et(t, e, n, r) {
|
|
516
|
-
if (t.tagName === "STYLE") return;
|
|
517
|
-
const o = an(n, r), s = o.options && o.options.cache || "auto";
|
|
518
|
-
if (s !== "disabled" && en(document.documentElement), s === "disabled" && !o.session.__bumpedForDisabled && (ct(), Lt.clear(), o.session.__bumpedForDisabled = !0), bt.has(t.tagName?.toLowerCase())) {
|
|
519
|
-
const d = t.getAttribute?.("style");
|
|
520
|
-
d && e.setAttribute("style", d);
|
|
521
|
-
}
|
|
522
|
-
const { session: a, persist: l } = o;
|
|
523
|
-
a.styleCache.has(t) || a.styleCache.set(t, getComputedStyle(t));
|
|
524
|
-
const i = a.styleCache.get(t), c = on(t, i, o.options), u = rn(c);
|
|
525
|
-
let f = l.snapshotKeyCache.get(u);
|
|
526
|
-
if (!f) {
|
|
527
|
-
const d = t.tagName?.toLowerCase() || "div";
|
|
528
|
-
f = Nt(c, d), l.snapshotKeyCache.set(u, f);
|
|
529
|
-
}
|
|
530
|
-
a.styleMap.set(e, f);
|
|
531
|
-
}
|
|
532
|
-
function sn(t) {
|
|
533
|
-
return t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof HTMLVideoElement || t instanceof HTMLIFrameElement || t instanceof SVGElement || t instanceof HTMLObjectElement || t instanceof HTMLEmbedElement;
|
|
534
|
-
}
|
|
535
|
-
function cn(t) {
|
|
536
|
-
return t.backgroundImage && t.backgroundImage !== "none" || t.backgroundColor && t.backgroundColor !== "rgba(0, 0, 0, 0)" && t.backgroundColor !== "transparent" || (parseFloat(t.borderTopWidth) || 0) > 0 || (parseFloat(t.borderBottomWidth) || 0) > 0 || (parseFloat(t.paddingTop) || 0) > 0 || (parseFloat(t.paddingBottom) || 0) > 0 ? !0 : (t.overflowBlock || t.overflowY || "visible") !== "visible";
|
|
537
|
-
}
|
|
538
|
-
function ln(t) {
|
|
539
|
-
const e = t.parentElement;
|
|
540
|
-
if (!e) return !1;
|
|
541
|
-
const n = getComputedStyle(e).display || "";
|
|
542
|
-
return n.includes("flex") || n.includes("grid");
|
|
543
|
-
}
|
|
544
|
-
function un(t, e) {
|
|
545
|
-
if (t.textContent && /\S/.test(t.textContent)) return !0;
|
|
546
|
-
const n = t.firstElementChild, r = t.lastElementChild;
|
|
547
|
-
if (n && n.tagName === "BR" || r && r.tagName === "BR") return !0;
|
|
548
|
-
const o = t.scrollHeight;
|
|
549
|
-
if (o === 0) return !1;
|
|
550
|
-
const s = parseFloat(e.paddingTop) || 0, a = parseFloat(e.paddingBottom) || 0;
|
|
551
|
-
return o > s + a;
|
|
552
|
-
}
|
|
553
|
-
function fn(t, e, n) {
|
|
554
|
-
if (t instanceof HTMLElement && t.style && t.style.height) return;
|
|
555
|
-
const r = e.display || "";
|
|
556
|
-
if (r.includes("flex") || r.includes("grid") || sn(t)) return;
|
|
557
|
-
const o = e.position;
|
|
558
|
-
o === "absolute" || o === "fixed" || o === "sticky" || e.transform === "none" && (cn(e) || ln(t) || un(t, e) && (delete n.height, delete n["block-size"]));
|
|
559
|
-
}
|
|
560
|
-
function dn(t, e) {
|
|
561
|
-
if (!(t instanceof Element) || !(e instanceof Element)) return;
|
|
562
|
-
const n = t.getAttribute?.("style");
|
|
563
|
-
let r = !!(n && n.includes("var("));
|
|
564
|
-
if (!r && t.attributes?.length) {
|
|
565
|
-
const a = t.attributes;
|
|
566
|
-
for (let l = 0; l < a.length; l++) {
|
|
567
|
-
const i = a[l];
|
|
568
|
-
if (i && typeof i.value == "string" && i.value.includes("var(")) {
|
|
569
|
-
r = !0;
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (!r) return;
|
|
575
|
-
let o;
|
|
576
|
-
try {
|
|
577
|
-
o = getComputedStyle(t);
|
|
578
|
-
} catch {
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
const s = t.style;
|
|
582
|
-
if (s && s.length)
|
|
583
|
-
for (let a = 0; a < s.length; a++) {
|
|
584
|
-
const l = s[a], i = s.getPropertyValue(l);
|
|
585
|
-
if (!i || !i.includes("var(")) continue;
|
|
586
|
-
const c = o.getPropertyValue(l);
|
|
587
|
-
if (c)
|
|
588
|
-
try {
|
|
589
|
-
e.style.setProperty(l, c.trim(), s.getPropertyPriority(l));
|
|
590
|
-
} catch {
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
if (t.attributes?.length) {
|
|
594
|
-
const a = t.attributes;
|
|
595
|
-
for (let l = 0; l < a.length; l++) {
|
|
596
|
-
const i = a[l];
|
|
597
|
-
if (!i || typeof i.value != "string" || !i.value.includes("var(")) continue;
|
|
598
|
-
const c = i.name;
|
|
599
|
-
let u = "";
|
|
600
|
-
try {
|
|
601
|
-
u = o.getPropertyValue(c);
|
|
602
|
-
} catch {
|
|
603
|
-
}
|
|
604
|
-
if (u)
|
|
605
|
-
try {
|
|
606
|
-
e.style.setProperty(c, u.trim());
|
|
607
|
-
} catch {
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
function Et(t, e, n) {
|
|
613
|
-
return Promise.all(t.map((r) => new Promise((o) => {
|
|
614
|
-
function s() {
|
|
615
|
-
tt((a) => {
|
|
616
|
-
(a && typeof a.timeRemaining == "function" ? a.timeRemaining() > 0 : !0) ? e(r, o) : s();
|
|
617
|
-
}, { fast: n });
|
|
618
|
-
}
|
|
619
|
-
s();
|
|
620
|
-
})));
|
|
621
|
-
}
|
|
622
|
-
function hn(t) {
|
|
623
|
-
return t = t.trim(), !t || /:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t) ? t : `${t}:not([data-sd-slotted])`;
|
|
624
|
-
}
|
|
625
|
-
function mn(t, e, n = !0) {
|
|
626
|
-
return t.split(",").map((r) => r.trim()).filter(Boolean).map((r) => {
|
|
627
|
-
if (r.startsWith(":where(") || r.startsWith("@")) return r;
|
|
628
|
-
const o = n ? hn(r) : r;
|
|
629
|
-
return `:where(${e} ${o})`;
|
|
630
|
-
}).join(", ");
|
|
631
|
-
}
|
|
632
|
-
function pn(t, e) {
|
|
633
|
-
return t ? (t = t.replace(/:host\(([^)]+)\)/g, (n, r) => `:where(${e}:is(${r.trim()}))`), t = t.replace(/:host\b/g, `:where(${e})`), t = t.replace(/:host-context\(([^)]+)\)/g, (n, r) => `:where(:where(${r.trim()}) ${e})`), t = t.replace(/::slotted\(([^)]+)\)/g, (n, r) => `:where(${e} ${r.trim()})`), t = t.replace(/(^|})(\s*)([^@}{]+){/g, (n, r, o, s) => {
|
|
634
|
-
const a = mn(
|
|
635
|
-
s,
|
|
636
|
-
e,
|
|
637
|
-
/*excludeSlotted*/
|
|
638
|
-
!0
|
|
639
|
-
);
|
|
640
|
-
return `${r}${o}${a}{`;
|
|
641
|
-
}), t) : "";
|
|
642
|
-
}
|
|
643
|
-
function gn(t) {
|
|
644
|
-
return t.shadowScopeSeq = (t.shadowScopeSeq || 0) + 1, `s${t.shadowScopeSeq}`;
|
|
645
|
-
}
|
|
646
|
-
function yn(t) {
|
|
647
|
-
let e = "";
|
|
648
|
-
try {
|
|
649
|
-
t.querySelectorAll("style").forEach((r) => {
|
|
650
|
-
e += (r.textContent || "") + `
|
|
651
|
-
`;
|
|
652
|
-
});
|
|
653
|
-
const n = t.adoptedStyleSheets || [];
|
|
654
|
-
for (const r of n)
|
|
655
|
-
try {
|
|
656
|
-
if (r && r.cssRules)
|
|
657
|
-
for (const o of r.cssRules) e += o.cssText + `
|
|
658
|
-
`;
|
|
659
|
-
} catch {
|
|
660
|
-
}
|
|
661
|
-
} catch {
|
|
662
|
-
}
|
|
663
|
-
return e;
|
|
664
|
-
}
|
|
665
|
-
function wn(t, e, n) {
|
|
666
|
-
if (!e) return;
|
|
667
|
-
const r = document.createElement("style");
|
|
668
|
-
r.setAttribute("data-sd", n), r.textContent = e, t.insertBefore(r, t.firstChild || null);
|
|
669
|
-
}
|
|
670
|
-
function bn(t, e) {
|
|
671
|
-
try {
|
|
672
|
-
const n = t.currentSrc || t.src || "";
|
|
673
|
-
if (!n) return;
|
|
674
|
-
e.setAttribute("src", n), e.removeAttribute("srcset"), e.removeAttribute("sizes"), e.loading = "eager", e.decoding = "sync";
|
|
675
|
-
} catch {
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
function Sn(t) {
|
|
679
|
-
const e = /* @__PURE__ */ new Set();
|
|
680
|
-
if (!t) return e;
|
|
681
|
-
const n = /var\(\s*(--[A-Za-z0-9_-]+)\b/g;
|
|
682
|
-
let r;
|
|
683
|
-
for (; r = n.exec(t); ) e.add(r[1]);
|
|
684
|
-
return e;
|
|
685
|
-
}
|
|
686
|
-
function xn(t, e) {
|
|
687
|
-
try {
|
|
688
|
-
let r = getComputedStyle(t).getPropertyValue(e).trim();
|
|
689
|
-
if (r) return r;
|
|
690
|
-
} catch {
|
|
691
|
-
}
|
|
692
|
-
try {
|
|
693
|
-
let r = getComputedStyle(document.documentElement).getPropertyValue(e).trim();
|
|
694
|
-
if (r) return r;
|
|
695
|
-
} catch {
|
|
696
|
-
}
|
|
697
|
-
return "";
|
|
698
|
-
}
|
|
699
|
-
function Cn(t, e, n) {
|
|
700
|
-
const r = [];
|
|
701
|
-
for (const o of e) {
|
|
702
|
-
const s = xn(t, o);
|
|
703
|
-
s && r.push(`${o}: ${s};`);
|
|
704
|
-
}
|
|
705
|
-
return r.length ? `${n}{${r.join("")}}
|
|
706
|
-
` : "";
|
|
707
|
-
}
|
|
708
|
-
function Mn(t) {
|
|
709
|
-
t && (t.nodeType === Node.ELEMENT_NODE && t.setAttribute("data-sd-slotted", ""), t.querySelectorAll && t.querySelectorAll("*").forEach((e) => e.setAttribute("data-sd-slotted", "")));
|
|
710
|
-
}
|
|
711
|
-
async function kn(t, e = 3) {
|
|
712
|
-
const n = () => {
|
|
713
|
-
try {
|
|
714
|
-
return t.contentDocument || t.contentWindow?.document || null;
|
|
715
|
-
} catch {
|
|
716
|
-
return null;
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
let r = n(), o = 0;
|
|
720
|
-
for (; o < e && (!r || !r.body && !r.documentElement); )
|
|
721
|
-
await new Promise((s) => setTimeout(s, 0)), r = n(), o++;
|
|
722
|
-
return r && (r.body || r.documentElement) ? r : null;
|
|
723
|
-
}
|
|
724
|
-
function vn(t) {
|
|
725
|
-
const e = t.getBoundingClientRect();
|
|
726
|
-
let n = 0, r = 0, o = 0, s = 0;
|
|
727
|
-
try {
|
|
728
|
-
const i = getComputedStyle(t);
|
|
729
|
-
n = parseFloat(i.borderLeftWidth) || 0, r = parseFloat(i.borderRightWidth) || 0, o = parseFloat(i.borderTopWidth) || 0, s = parseFloat(i.borderBottomWidth) || 0;
|
|
730
|
-
} catch {
|
|
731
|
-
}
|
|
732
|
-
const a = Math.max(0, Math.round(e.width - (n + r))), l = Math.max(0, Math.round(e.height - (o + s)));
|
|
733
|
-
return { contentWidth: a, contentHeight: l, rect: e };
|
|
734
|
-
}
|
|
735
|
-
function $n(t, e, n) {
|
|
736
|
-
const r = t.createElement("style");
|
|
737
|
-
return r.setAttribute("data-sd-iframe-pin", ""), r.textContent = `html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`, (t.head || t.documentElement).appendChild(r), () => {
|
|
738
|
-
try {
|
|
739
|
-
r.remove();
|
|
740
|
-
} catch {
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
async function An(t, e, n) {
|
|
745
|
-
const r = await kn(t, 3);
|
|
746
|
-
if (!r) throw new Error("iframe document not accessible/ready");
|
|
747
|
-
const { contentWidth: o, contentHeight: s, rect: a } = vn(t), l = n?.snap;
|
|
748
|
-
if (!l || typeof l.toPng != "function")
|
|
749
|
-
throw new Error("snapdom.toPng not available in iframe or window");
|
|
750
|
-
const i = { ...n, scale: 1 }, c = $n(r, o, s);
|
|
751
|
-
let u;
|
|
752
|
-
try {
|
|
753
|
-
u = await l.toPng(r.documentElement, i);
|
|
754
|
-
} finally {
|
|
755
|
-
c();
|
|
756
|
-
}
|
|
757
|
-
u.style.display = "block", u.style.width = `${o}px`, u.style.height = `${s}px`;
|
|
758
|
-
const f = document.createElement("div");
|
|
759
|
-
return e.nodeMap.set(f, t), et(t, f, e, n), f.style.overflow = "hidden", f.style.display = "block", f.style.width || (f.style.width = `${Math.round(a.width)}px`), f.style.height || (f.style.height = `${Math.round(a.height)}px`), f.appendChild(u), f;
|
|
760
|
-
}
|
|
761
|
-
async function pt(t, e, n) {
|
|
762
|
-
if (!t) throw new Error("Invalid node");
|
|
763
|
-
const r = /* @__PURE__ */ new Set();
|
|
764
|
-
let o = null, s = null;
|
|
765
|
-
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
766
|
-
const c = (t.localName || t.tagName || "").toLowerCase();
|
|
767
|
-
if (t.id === "snapdom-sandbox" || t.hasAttribute("data-snapdom-sandbox") || de.has(c))
|
|
768
|
-
return null;
|
|
769
|
-
}
|
|
770
|
-
if (t.nodeType === Node.TEXT_NODE || t.nodeType !== Node.ELEMENT_NODE)
|
|
771
|
-
return t.cloneNode(!0);
|
|
772
|
-
if (t.getAttribute("data-capture") === "exclude") {
|
|
773
|
-
if (n.excludeMode === "hide") {
|
|
774
|
-
const c = document.createElement("div"), u = t.getBoundingClientRect();
|
|
775
|
-
return c.style.cssText = `display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`, c;
|
|
776
|
-
} else if (n.excludeMode === "remove")
|
|
777
|
-
return null;
|
|
778
|
-
}
|
|
779
|
-
if (n.exclude && Array.isArray(n.exclude))
|
|
780
|
-
for (const c of n.exclude)
|
|
781
|
-
try {
|
|
782
|
-
if (t.matches?.(c)) {
|
|
783
|
-
if (n.excludeMode === "hide") {
|
|
784
|
-
const u = document.createElement("div"), f = t.getBoundingClientRect();
|
|
785
|
-
return u.style.cssText = `display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`, u;
|
|
786
|
-
} else if (n.excludeMode === "remove")
|
|
787
|
-
return null;
|
|
788
|
-
}
|
|
789
|
-
} catch (u) {
|
|
790
|
-
console.warn(`Invalid selector in exclude option: ${c}`, u);
|
|
791
|
-
}
|
|
792
|
-
if (typeof n.filter == "function")
|
|
793
|
-
try {
|
|
794
|
-
if (!n.filter(t)) {
|
|
795
|
-
if (n.filterMode === "hide") {
|
|
796
|
-
const c = document.createElement("div"), u = t.getBoundingClientRect();
|
|
797
|
-
return c.style.cssText = `display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`, c;
|
|
798
|
-
} else if (n.filterMode === "remove")
|
|
799
|
-
return null;
|
|
800
|
-
}
|
|
801
|
-
} catch (c) {
|
|
802
|
-
console.warn("Error in filter function:", c);
|
|
803
|
-
}
|
|
804
|
-
if (t.tagName === "IFRAME") {
|
|
805
|
-
let c = !1;
|
|
806
|
-
try {
|
|
807
|
-
c = !!(t.contentDocument || t.contentWindow?.document);
|
|
808
|
-
} catch {
|
|
809
|
-
c = !1;
|
|
810
|
-
}
|
|
811
|
-
if (c)
|
|
812
|
-
try {
|
|
813
|
-
return await An(t, e, n);
|
|
814
|
-
} catch (u) {
|
|
815
|
-
console.warn("[SnapDOM] iframe rasterization failed, fallback:", u);
|
|
816
|
-
}
|
|
817
|
-
if (n.placeholders) {
|
|
818
|
-
const u = document.createElement("div");
|
|
819
|
-
return u.style.cssText = `width:${t.offsetWidth}px;height:${t.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`, et(t, u, e, n), u;
|
|
820
|
-
} else {
|
|
821
|
-
const u = t.getBoundingClientRect(), f = document.createElement("div");
|
|
822
|
-
return f.style.cssText = `display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`, et(t, f, e, n), f;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
if (t.getAttribute("data-capture") === "placeholder") {
|
|
826
|
-
const c = t.cloneNode(!1);
|
|
827
|
-
e.nodeMap.set(c, t), et(t, c, e, n);
|
|
828
|
-
const u = document.createElement("div");
|
|
829
|
-
return u.textContent = t.getAttribute("data-placeholder-text") || "", u.style.cssText = "color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;", c.appendChild(u), c;
|
|
830
|
-
}
|
|
831
|
-
if (t.tagName === "CANVAS") {
|
|
832
|
-
const c = t.toDataURL(), u = document.createElement("img");
|
|
833
|
-
return u.src = c, u.width = t.width, u.height = t.height, e.nodeMap.set(u, t), et(t, u, e, n), u;
|
|
834
|
-
}
|
|
835
|
-
let a;
|
|
836
|
-
try {
|
|
837
|
-
if (a = t.cloneNode(!1), dn(t, a), e.nodeMap.set(a, t), t.tagName === "IMG") {
|
|
838
|
-
bn(t, a);
|
|
839
|
-
try {
|
|
840
|
-
const c = t.getBoundingClientRect();
|
|
841
|
-
let u = Math.round(c.width || 0), f = Math.round(c.height || 0);
|
|
842
|
-
if (!u || !f) {
|
|
843
|
-
const d = window.getComputedStyle(t), y = parseFloat(d.width) || 0, b = parseFloat(d.height) || 0, m = parseInt(t.getAttribute("width") || "", 10) || 0, h = parseInt(t.getAttribute("height") || "", 10) || 0, p = t.width || t.naturalWidth || 0, g = t.height || t.naturalHeight || 0;
|
|
844
|
-
u = Math.round(u || y || m || p || 0), f = Math.round(f || b || h || g || 0);
|
|
845
|
-
}
|
|
846
|
-
u && (a.dataset.snapdomWidth = String(u)), f && (a.dataset.snapdomHeight = String(f));
|
|
847
|
-
} catch {
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
} catch (c) {
|
|
851
|
-
throw console.error("[Snapdom] Failed to clone node:", t, c), c;
|
|
852
|
-
}
|
|
853
|
-
if (t instanceof HTMLTextAreaElement) {
|
|
854
|
-
const c = t.getBoundingClientRect();
|
|
855
|
-
a.style.width = `${c.width}px`, a.style.height = `${c.height}px`;
|
|
856
|
-
}
|
|
857
|
-
if (t instanceof HTMLInputElement && (a.value = t.value, a.setAttribute("value", t.value), t.checked !== void 0 && (a.checked = t.checked, t.checked && a.setAttribute("checked", ""), t.indeterminate && (a.indeterminate = t.indeterminate))), t instanceof HTMLSelectElement && (o = t.value), t instanceof HTMLTextAreaElement && (s = t.value), et(t, a, e, n), t.shadowRoot) {
|
|
858
|
-
let c = function(g, S) {
|
|
859
|
-
if (g.nodeType === Node.ELEMENT_NODE && g.tagName === "STYLE")
|
|
860
|
-
return S(null);
|
|
861
|
-
pt(g, e, n).then((x) => {
|
|
862
|
-
S(x || null);
|
|
863
|
-
}).catch(() => {
|
|
864
|
-
S(null);
|
|
865
|
-
});
|
|
866
|
-
};
|
|
867
|
-
try {
|
|
868
|
-
const g = t.shadowRoot.querySelectorAll("slot");
|
|
869
|
-
for (const S of g) {
|
|
870
|
-
let x = [];
|
|
871
|
-
try {
|
|
872
|
-
x = S.assignedNodes?.({ flatten: !0 }) || S.assignedNodes?.() || [];
|
|
873
|
-
} catch {
|
|
874
|
-
x = S.assignedNodes?.() || [];
|
|
875
|
-
}
|
|
876
|
-
for (const C of x) r.add(C);
|
|
877
|
-
}
|
|
878
|
-
} catch {
|
|
879
|
-
}
|
|
880
|
-
const u = gn(e), f = `[data-sd="${u}"]`;
|
|
881
|
-
try {
|
|
882
|
-
a.setAttribute("data-sd", u);
|
|
883
|
-
} catch {
|
|
884
|
-
}
|
|
885
|
-
const d = yn(t.shadowRoot), y = pn(d, f), b = Sn(d), m = Cn(t, b, f);
|
|
886
|
-
wn(a, m + y, u);
|
|
887
|
-
const h = document.createDocumentFragment(), p = await Et(Array.from(t.shadowRoot.childNodes), c, n.fast);
|
|
888
|
-
h.append(...p.filter((g) => !!g)), a.appendChild(h);
|
|
889
|
-
}
|
|
890
|
-
if (t.tagName === "SLOT") {
|
|
891
|
-
let c = function(b, m) {
|
|
892
|
-
pt(b, e, n).then((h) => {
|
|
893
|
-
h && Mn(h), m(h || null);
|
|
894
|
-
}).catch(() => {
|
|
895
|
-
m(null);
|
|
896
|
-
});
|
|
897
|
-
};
|
|
898
|
-
const u = t.assignedNodes?.({ flatten: !0 }) || [], f = u.length > 0 ? u : Array.from(t.childNodes), d = document.createDocumentFragment(), y = await Et(Array.from(f), c, n.fast);
|
|
899
|
-
return d.append(...y.filter((b) => !!b)), d;
|
|
900
|
-
}
|
|
901
|
-
function l(c, u) {
|
|
902
|
-
if (r.has(c)) return u(null);
|
|
903
|
-
pt(c, e, n).then((f) => {
|
|
904
|
-
u(f || null);
|
|
905
|
-
}).catch(() => {
|
|
906
|
-
u(null);
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
const i = await Et(Array.from(t.childNodes), l, n.fast);
|
|
910
|
-
if (a.append(...i.filter((c) => !!c)), o !== null && a instanceof HTMLSelectElement) {
|
|
911
|
-
a.value = o;
|
|
912
|
-
for (const c of a.options)
|
|
913
|
-
c.value === o ? c.setAttribute("selected", "") : c.removeAttribute("selected");
|
|
914
|
-
}
|
|
915
|
-
return s !== null && a instanceof HTMLTextAreaElement && (a.textContent = s), a;
|
|
916
|
-
}
|
|
917
|
-
var En = [
|
|
918
|
-
// /uicons/i,
|
|
919
|
-
/font\s*awesome/i,
|
|
920
|
-
/material\s*icons/i,
|
|
921
|
-
/ionicons/i,
|
|
922
|
-
/glyphicons/i,
|
|
923
|
-
/feather/i,
|
|
924
|
-
/bootstrap\s*icons/i,
|
|
925
|
-
/remix\s*icons/i,
|
|
926
|
-
/heroicons/i,
|
|
927
|
-
/layui/i,
|
|
928
|
-
/lucide/i
|
|
929
|
-
], It = [];
|
|
930
|
-
function Fn(t) {
|
|
931
|
-
const e = Array.isArray(t) ? t : [t];
|
|
932
|
-
for (const n of e)
|
|
933
|
-
n instanceof RegExp ? It.push(n) : typeof n == "string" ? It.push(new RegExp(n, "i")) : console.warn("[snapdom] Ignored invalid iconFont value:", n);
|
|
934
|
-
}
|
|
935
|
-
function q(t) {
|
|
936
|
-
const e = typeof t == "string" ? t : "", n = [...En, ...It];
|
|
937
|
-
for (const r of n)
|
|
938
|
-
if (r instanceof RegExp && r.test(e)) return !0;
|
|
939
|
-
return !!(/icon/i.test(e) || /glyph/i.test(e) || /symbols/i.test(e) || /feather/i.test(e) || /fontawesome/i.test(e));
|
|
940
|
-
}
|
|
941
|
-
async function Nn(t, e, n, r = 32, o = "#000") {
|
|
942
|
-
e = e.replace(/^['"]+|['"]+$/g, "");
|
|
943
|
-
const s = window.devicePixelRatio || 1;
|
|
944
|
-
try {
|
|
945
|
-
await document.fonts.ready;
|
|
946
|
-
} catch {
|
|
947
|
-
}
|
|
948
|
-
const a = document.createElement("span");
|
|
949
|
-
a.textContent = t, a.style.position = "absolute", a.style.visibility = "hidden", a.style.fontFamily = `"${e}"`, a.style.fontWeight = n || "normal", a.style.fontSize = `${r}px`, a.style.lineHeight = "1", a.style.whiteSpace = "nowrap", a.style.padding = "0", a.style.margin = "0", document.body.appendChild(a);
|
|
950
|
-
const l = a.getBoundingClientRect(), i = Math.ceil(l.width), c = Math.ceil(l.height);
|
|
951
|
-
document.body.removeChild(a);
|
|
952
|
-
const u = document.createElement("canvas");
|
|
953
|
-
u.width = Math.max(1, i * s), u.height = Math.max(1, c * s);
|
|
954
|
-
const f = u.getContext("2d");
|
|
955
|
-
return f.scale(s, s), f.font = n ? `${n} ${r}px "${e}"` : `${r}px "${e}"`, f.textAlign = "left", f.textBaseline = "top", f.fillStyle = o, f.fillText(t, 0, 0), {
|
|
956
|
-
dataUrl: u.toDataURL(),
|
|
957
|
-
width: i,
|
|
958
|
-
height: c
|
|
959
|
-
};
|
|
960
|
-
}
|
|
961
|
-
var Ln = /* @__PURE__ */ new Set([
|
|
962
|
-
"serif",
|
|
963
|
-
"sans-serif",
|
|
964
|
-
"monospace",
|
|
965
|
-
"cursive",
|
|
966
|
-
"fantasy",
|
|
967
|
-
"system-ui",
|
|
968
|
-
"emoji",
|
|
969
|
-
"math",
|
|
970
|
-
"fangsong",
|
|
971
|
-
"ui-serif",
|
|
972
|
-
"ui-sans-serif",
|
|
973
|
-
"ui-monospace",
|
|
974
|
-
"ui-rounded"
|
|
975
|
-
]);
|
|
976
|
-
function St(t) {
|
|
977
|
-
if (!t) return "";
|
|
978
|
-
for (let e of t.split(",")) {
|
|
979
|
-
let n = e.trim().replace(/^['"]+|['"]+$/g, "");
|
|
980
|
-
if (n && !Ln.has(n.toLowerCase()))
|
|
981
|
-
return n;
|
|
982
|
-
}
|
|
983
|
-
return "";
|
|
984
|
-
}
|
|
985
|
-
function gt(t) {
|
|
986
|
-
const e = String(t ?? "400").trim().toLowerCase();
|
|
987
|
-
if (e === "normal") return 400;
|
|
988
|
-
if (e === "bold") return 700;
|
|
989
|
-
const n = parseInt(e, 10);
|
|
990
|
-
return Number.isFinite(n) ? Math.min(900, Math.max(100, n)) : 400;
|
|
991
|
-
}
|
|
992
|
-
function Tt(t) {
|
|
993
|
-
const e = String(t ?? "normal").trim().toLowerCase();
|
|
994
|
-
return e.startsWith("italic") ? "italic" : e.startsWith("oblique") ? "oblique" : "normal";
|
|
995
|
-
}
|
|
996
|
-
function Rn(t) {
|
|
997
|
-
const e = String(t ?? "100%").match(/(\d+(?:\.\d+)?)\s*%/);
|
|
998
|
-
return e ? Math.max(50, Math.min(200, parseFloat(e[1]))) : 100;
|
|
999
|
-
}
|
|
1000
|
-
function In(t) {
|
|
1001
|
-
const e = String(t || "400").trim(), n = e.match(/^(\d{2,3})\s+(\d{2,3})$/);
|
|
1002
|
-
if (n) {
|
|
1003
|
-
const o = gt(n[1]), s = gt(n[2]);
|
|
1004
|
-
return { min: Math.min(o, s), max: Math.max(o, s) };
|
|
1005
|
-
}
|
|
1006
|
-
const r = gt(e);
|
|
1007
|
-
return { min: r, max: r };
|
|
1008
|
-
}
|
|
1009
|
-
function Tn(t) {
|
|
1010
|
-
const e = String(t || "normal").trim().toLowerCase();
|
|
1011
|
-
return e === "italic" ? { kind: "italic" } : e.startsWith("oblique") ? { kind: "oblique" } : { kind: "normal" };
|
|
1012
|
-
}
|
|
1013
|
-
function Pn(t) {
|
|
1014
|
-
const e = String(t || "100%").trim(), n = e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);
|
|
1015
|
-
if (n) {
|
|
1016
|
-
const s = parseFloat(n[1]), a = parseFloat(n[2]);
|
|
1017
|
-
return { min: Math.min(s, a), max: Math.max(s, a) };
|
|
1018
|
-
}
|
|
1019
|
-
const r = e.match(/(\d+(?:\.\d+)?)\s*%/), o = r ? parseFloat(r[1]) : 100;
|
|
1020
|
-
return { min: o, max: o };
|
|
1021
|
-
}
|
|
1022
|
-
function Wn(t, e) {
|
|
1023
|
-
if (!t) return !1;
|
|
1024
|
-
try {
|
|
1025
|
-
const n = new URL(t, location.href);
|
|
1026
|
-
if (n.origin === location.origin) return !0;
|
|
1027
|
-
const o = n.host.toLowerCase();
|
|
1028
|
-
if ([
|
|
1029
|
-
"fonts.googleapis.com",
|
|
1030
|
-
"fonts.gstatic.com",
|
|
1031
|
-
"use.typekit.net",
|
|
1032
|
-
"p.typekit.net",
|
|
1033
|
-
"kit.fontawesome.com",
|
|
1034
|
-
"use.fontawesome.com"
|
|
1035
|
-
].some((l) => o.endsWith(l))) return !0;
|
|
1036
|
-
const a = (n.pathname + n.search).toLowerCase();
|
|
1037
|
-
if (/\bfont(s)?\b/.test(a) || /\.woff2?(\b|$)/.test(a)) return !0;
|
|
1038
|
-
for (const l of e) {
|
|
1039
|
-
const i = l.toLowerCase().replace(/\s+/g, "+"), c = l.toLowerCase().replace(/\s+/g, "-");
|
|
1040
|
-
if (a.includes(i) || a.includes(c)) return !0;
|
|
1041
|
-
}
|
|
1042
|
-
return !1;
|
|
1043
|
-
} catch {
|
|
1044
|
-
return !1;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
function _n(t) {
|
|
1048
|
-
const e = /* @__PURE__ */ new Set();
|
|
1049
|
-
for (const n of t || []) {
|
|
1050
|
-
const r = String(n).split("__")[0]?.trim();
|
|
1051
|
-
r && e.add(r);
|
|
1052
|
-
}
|
|
1053
|
-
return e;
|
|
1054
|
-
}
|
|
1055
|
-
function ne(t, e) {
|
|
1056
|
-
return t && t.replace(
|
|
1057
|
-
/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,
|
|
1058
|
-
(n, r, o) => {
|
|
1059
|
-
const s = (o || "").trim();
|
|
1060
|
-
if (!s || /^data:|^blob:|^https?:|^file:|^about:/i.test(s)) return n;
|
|
1061
|
-
let a = s;
|
|
1062
|
-
try {
|
|
1063
|
-
a = new URL(s, e || location.href).href;
|
|
1064
|
-
} catch {
|
|
1065
|
-
}
|
|
1066
|
-
return `url("${a}")`;
|
|
1067
|
-
}
|
|
1068
|
-
);
|
|
1069
|
-
}
|
|
1070
|
-
var Pt = /@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g, wt = 4;
|
|
1071
|
-
async function On(t, e, n) {
|
|
1072
|
-
if (!t) return t;
|
|
1073
|
-
const r = /* @__PURE__ */ new Set();
|
|
1074
|
-
function o(l, i) {
|
|
1075
|
-
try {
|
|
1076
|
-
return new URL(l, i || location.href).href;
|
|
1077
|
-
} catch {
|
|
1078
|
-
return l;
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
async function s(l, i, c = 0) {
|
|
1082
|
-
if (c > wt)
|
|
1083
|
-
return console.warn(`[snapDOM] @import depth exceeded (${wt}) at ${i}`), l;
|
|
1084
|
-
let u = "", f = 0, d;
|
|
1085
|
-
for (; d = Pt.exec(l); ) {
|
|
1086
|
-
u += l.slice(f, d.index), f = Pt.lastIndex;
|
|
1087
|
-
const y = (d[2] || d[4] || "").trim(), b = o(y, i);
|
|
1088
|
-
if (r.has(b)) {
|
|
1089
|
-
console.warn(`[snapDOM] Skipping circular @import: ${b}`);
|
|
1090
|
-
continue;
|
|
1091
|
-
}
|
|
1092
|
-
r.add(b);
|
|
1093
|
-
let m = "";
|
|
1094
|
-
try {
|
|
1095
|
-
const h = await _(b, { as: "text", useProxy: n, silent: !0 });
|
|
1096
|
-
h.ok && typeof h.data == "string" && (m = h.data);
|
|
1097
|
-
} catch {
|
|
1098
|
-
}
|
|
1099
|
-
m ? (m = ne(m, b), m = await s(m, b, c + 1), u += `
|
|
1100
|
-
/* inlined: ${b} */
|
|
1101
|
-
${m}
|
|
1102
|
-
`) : u += d[0];
|
|
1103
|
-
}
|
|
1104
|
-
return u += l.slice(f), u;
|
|
1105
|
-
}
|
|
1106
|
-
let a = ne(t, e || location.href);
|
|
1107
|
-
return a = await s(a, e || location.href, 0), a;
|
|
1108
|
-
}
|
|
1109
|
-
var pe = /url\((["']?)([^"')]+)\1\)/g, Un = /@font-face[^{}]*\{[^}]*\}/g;
|
|
1110
|
-
function ge(t) {
|
|
1111
|
-
if (!t) return [];
|
|
1112
|
-
const e = [], n = t.split(",").map((r) => r.trim()).filter(Boolean);
|
|
1113
|
-
for (const r of n) {
|
|
1114
|
-
const o = r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);
|
|
1115
|
-
if (!o) continue;
|
|
1116
|
-
const s = o[1], a = o[2], l = (i) => {
|
|
1117
|
-
if (!i.includes("?")) return parseInt(i, 16);
|
|
1118
|
-
const c = parseInt(i.replace(/\?/g, "0"), 16), u = parseInt(i.replace(/\?/g, "F"), 16);
|
|
1119
|
-
return [c, u];
|
|
1120
|
-
};
|
|
1121
|
-
if (a) {
|
|
1122
|
-
const i = l(s), c = l(a), u = Array.isArray(i) ? i[0] : i, f = Array.isArray(c) ? c[1] : c;
|
|
1123
|
-
e.push([Math.min(u, f), Math.max(u, f)]);
|
|
1124
|
-
} else {
|
|
1125
|
-
const i = l(s);
|
|
1126
|
-
Array.isArray(i) ? e.push([i[0], i[1]]) : e.push([i, i]);
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
return e;
|
|
1130
|
-
}
|
|
1131
|
-
function ye(t, e) {
|
|
1132
|
-
if (!e.length || !t || t.size === 0) return !0;
|
|
1133
|
-
for (const n of t)
|
|
1134
|
-
for (const [r, o] of e) if (n >= r && n <= o) return !0;
|
|
1135
|
-
return !1;
|
|
1136
|
-
}
|
|
1137
|
-
function jt(t, e) {
|
|
1138
|
-
const n = [];
|
|
1139
|
-
if (!t) return n;
|
|
1140
|
-
for (const r of t.matchAll(pe)) {
|
|
1141
|
-
let o = (r[2] || "").trim();
|
|
1142
|
-
if (!(!o || o.startsWith("data:"))) {
|
|
1143
|
-
if (!/^https?:/i.test(o))
|
|
1144
|
-
try {
|
|
1145
|
-
o = new URL(o, e || location.href).href;
|
|
1146
|
-
} catch {
|
|
1147
|
-
}
|
|
1148
|
-
n.push(o);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
return n;
|
|
1152
|
-
}
|
|
1153
|
-
async function we(t, e, n = "") {
|
|
1154
|
-
let r = t;
|
|
1155
|
-
for (const o of t.matchAll(pe)) {
|
|
1156
|
-
const s = Ut(o[0]);
|
|
1157
|
-
if (!s) continue;
|
|
1158
|
-
let a = s;
|
|
1159
|
-
if (!a.startsWith("http") && !a.startsWith("data:"))
|
|
1160
|
-
try {
|
|
1161
|
-
a = new URL(a, e || location.href).href;
|
|
1162
|
-
} catch {
|
|
1163
|
-
}
|
|
1164
|
-
if (!q(a)) {
|
|
1165
|
-
if (w.resource?.has(a)) {
|
|
1166
|
-
w.font?.add(a), r = r.replace(o[0], `url(${w.resource.get(a)})`);
|
|
1167
|
-
continue;
|
|
1168
|
-
}
|
|
1169
|
-
if (!w.font?.has(a))
|
|
1170
|
-
try {
|
|
1171
|
-
const l = await _(a, { as: "dataURL", useProxy: n, silent: !0 });
|
|
1172
|
-
if (l.ok && typeof l.data == "string") {
|
|
1173
|
-
const i = l.data;
|
|
1174
|
-
w.resource?.set(a, i), w.font?.add(a), r = r.replace(o[0], `url(${i})`);
|
|
1175
|
-
}
|
|
1176
|
-
} catch {
|
|
1177
|
-
console.warn("[snapDOM] Failed to fetch font resource:", a);
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
return r;
|
|
1182
|
-
}
|
|
1183
|
-
function Bn(t) {
|
|
1184
|
-
if (!t.length) return null;
|
|
1185
|
-
const e = (l, i) => t.some(([c, u]) => !(u < l || c > i)), n = e(0, 255) || e(305, 305), r = e(256, 591) || e(7680, 7935), o = e(880, 1023), s = e(1024, 1279);
|
|
1186
|
-
return e(7840, 7929) || e(258, 259) || e(416, 417) || e(431, 432) ? "vietnamese" : s ? "cyrillic" : o ? "greek" : r ? "latin-ext" : n ? "latin" : null;
|
|
1187
|
-
}
|
|
1188
|
-
function re(t = {}) {
|
|
1189
|
-
const e = new Set((t.families || []).map((o) => String(o).toLowerCase())), n = new Set((t.domains || []).map((o) => String(o).toLowerCase())), r = new Set((t.subsets || []).map((o) => String(o).toLowerCase()));
|
|
1190
|
-
return (o, s) => {
|
|
1191
|
-
if (e.size && e.has(o.family.toLowerCase())) return !0;
|
|
1192
|
-
if (n.size)
|
|
1193
|
-
for (const a of o.srcUrls)
|
|
1194
|
-
try {
|
|
1195
|
-
if (n.has(new URL(a).host.toLowerCase())) return !0;
|
|
1196
|
-
} catch {
|
|
1197
|
-
}
|
|
1198
|
-
if (r.size) {
|
|
1199
|
-
const a = Bn(s);
|
|
1200
|
-
if (a && r.has(a)) return !0;
|
|
1201
|
-
}
|
|
1202
|
-
return !1;
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
function Dn(t) {
|
|
1206
|
-
if (!t) return t;
|
|
1207
|
-
const e = /@font-face[^{}]*\{[^}]*\}/gi, n = /* @__PURE__ */ new Set(), r = [];
|
|
1208
|
-
for (const s of t.match(e) || []) {
|
|
1209
|
-
const a = s.match(/font-family:\s*([^;]+);/i)?.[1] || "", l = St(a), i = (s.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), c = (s.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), u = (s.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), f = (s.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), d = (s.match(/src\s*:\s*([^;]+);/i)?.[1] || "").trim(), y = jt(d, location.href), b = y.length ? y.map((h) => String(h).toLowerCase()).sort().join("|") : d.toLowerCase(), m = [
|
|
1210
|
-
String(l || "").toLowerCase(),
|
|
1211
|
-
i,
|
|
1212
|
-
c,
|
|
1213
|
-
u,
|
|
1214
|
-
f.toLowerCase(),
|
|
1215
|
-
b
|
|
1216
|
-
].join("|");
|
|
1217
|
-
n.has(m) || (n.add(m), r.push(s));
|
|
1218
|
-
}
|
|
1219
|
-
if (r.length === 0) return t;
|
|
1220
|
-
let o = 0;
|
|
1221
|
-
return t.replace(e, () => r[o++] || "");
|
|
1222
|
-
}
|
|
1223
|
-
function Hn(t, e, n, r) {
|
|
1224
|
-
const o = Array.from(t || []).sort().join("|"), s = e ? JSON.stringify({
|
|
1225
|
-
families: (e.families || []).map((i) => String(i).toLowerCase()).sort(),
|
|
1226
|
-
domains: (e.domains || []).map((i) => String(i).toLowerCase()).sort(),
|
|
1227
|
-
subsets: (e.subsets || []).map((i) => String(i).toLowerCase()).sort()
|
|
1228
|
-
}) : "", a = (n || []).map((i) => `${(i.family || "").toLowerCase()}::${i.weight || "normal"}::${i.style || "normal"}::${i.src || ""}`).sort().join("|");
|
|
1229
|
-
return `fonts-embed-css::req=${o}::ex=${s}::lf=${a}::px=${r || ""}`;
|
|
1230
|
-
}
|
|
1231
|
-
async function be(t, e, n, r) {
|
|
1232
|
-
let o;
|
|
1233
|
-
try {
|
|
1234
|
-
o = t.cssRules || [];
|
|
1235
|
-
} catch {
|
|
1236
|
-
return;
|
|
1237
|
-
}
|
|
1238
|
-
const s = (a, l) => {
|
|
1239
|
-
try {
|
|
1240
|
-
return new URL(a, l || location.href).href;
|
|
1241
|
-
} catch {
|
|
1242
|
-
return a;
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
for (const a of o) {
|
|
1246
|
-
if (a.type === CSSRule.IMPORT_RULE && a.styleSheet) {
|
|
1247
|
-
const l = a.href ? s(a.href, e) : e;
|
|
1248
|
-
if (r.depth >= wt) {
|
|
1249
|
-
console.warn(`[snapDOM] CSSOM import depth exceeded (${wt}) at ${l}`);
|
|
1250
|
-
continue;
|
|
1251
|
-
}
|
|
1252
|
-
if (l && r.visitedSheets.has(l)) {
|
|
1253
|
-
console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);
|
|
1254
|
-
continue;
|
|
1255
|
-
}
|
|
1256
|
-
l && r.visitedSheets.add(l);
|
|
1257
|
-
const i = { ...r, depth: (r.depth || 0) + 1 };
|
|
1258
|
-
await be(a.styleSheet, l, n, i);
|
|
1259
|
-
continue;
|
|
1260
|
-
}
|
|
1261
|
-
if (a.type === CSSRule.FONT_FACE_RULE) {
|
|
1262
|
-
const l = (a.style.getPropertyValue("font-family") || "").trim(), i = St(l);
|
|
1263
|
-
if (!i || q(i)) continue;
|
|
1264
|
-
const c = (a.style.getPropertyValue("font-weight") || "400").trim(), u = (a.style.getPropertyValue("font-style") || "normal").trim(), f = (a.style.getPropertyValue("font-stretch") || "100%").trim(), d = (a.style.getPropertyValue("src") || "").trim(), y = (a.style.getPropertyValue("unicode-range") || "").trim();
|
|
1265
|
-
if (!r.faceMatchesRequired(i, u, c, f)) continue;
|
|
1266
|
-
const b = ge(y);
|
|
1267
|
-
if (!ye(r.usedCodepoints, b)) continue;
|
|
1268
|
-
const m = {
|
|
1269
|
-
family: i,
|
|
1270
|
-
weightSpec: c,
|
|
1271
|
-
styleSpec: u,
|
|
1272
|
-
stretchSpec: f,
|
|
1273
|
-
unicodeRange: y,
|
|
1274
|
-
srcRaw: d,
|
|
1275
|
-
srcUrls: jt(d, e || location.href),
|
|
1276
|
-
href: e || location.href
|
|
1277
|
-
};
|
|
1278
|
-
if (r.simpleExcluder && r.simpleExcluder(m, b)) continue;
|
|
1279
|
-
if (/url\(/i.test(d)) {
|
|
1280
|
-
const h = await we(d, e || location.href, r.useProxy);
|
|
1281
|
-
await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y ? `unicode-range:${y};` : ""}}`);
|
|
1282
|
-
} else
|
|
1283
|
-
await n(`@font-face{font-family:${i};src:${d};font-style:${u};font-weight:${c};font-stretch:${f};${y ? `unicode-range:${y};` : ""}}`);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
async function Se({
|
|
1288
|
-
required: t,
|
|
1289
|
-
usedCodepoints: e,
|
|
1290
|
-
exclude: n = void 0,
|
|
1291
|
-
localFonts: r = [],
|
|
1292
|
-
useProxy: o = ""
|
|
1293
|
-
} = {}) {
|
|
1294
|
-
t instanceof Set || (t = /* @__PURE__ */ new Set()), e instanceof Set || (e = /* @__PURE__ */ new Set());
|
|
1295
|
-
const s = /* @__PURE__ */ new Map();
|
|
1296
|
-
for (const m of t) {
|
|
1297
|
-
const [h, p, g, S] = String(m).split("__");
|
|
1298
|
-
if (!h) continue;
|
|
1299
|
-
const x = s.get(h) || [];
|
|
1300
|
-
x.push({ w: parseInt(p, 10), s: g, st: parseInt(S, 10) }), s.set(h, x);
|
|
1301
|
-
}
|
|
1302
|
-
function a(m, h, p, g) {
|
|
1303
|
-
if (!s.has(m)) return !1;
|
|
1304
|
-
const S = s.get(m), x = In(p), C = Tn(h), M = Pn(g), v = x.min !== x.max, I = x.min, P = ($) => C.kind === "normal" && $ === "normal" || C.kind !== "normal" && ($ === "italic" || $ === "oblique");
|
|
1305
|
-
let N = !1;
|
|
1306
|
-
for (const $ of S) {
|
|
1307
|
-
const k = v ? $.w >= x.min && $.w <= x.max : $.w === I, T = P(Tt($.s)), U = $.st >= M.min && $.st <= M.max;
|
|
1308
|
-
if (k && T && U) {
|
|
1309
|
-
N = !0;
|
|
1310
|
-
break;
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
if (N) return !0;
|
|
1314
|
-
if (!v)
|
|
1315
|
-
for (const $ of S) {
|
|
1316
|
-
const k = P(Tt($.s)), T = $.st >= M.min && $.st <= M.max;
|
|
1317
|
-
if (Math.abs(I - $.w) <= 300 && k && T) return !0;
|
|
1318
|
-
}
|
|
1319
|
-
return !1;
|
|
1320
|
-
}
|
|
1321
|
-
const l = re(n), i = Hn(t, n, r, o);
|
|
1322
|
-
if (w.resource?.has(i))
|
|
1323
|
-
return w.resource.get(i);
|
|
1324
|
-
const c = _n(t), u = [], f = Pt;
|
|
1325
|
-
for (const m of document.querySelectorAll("style")) {
|
|
1326
|
-
const h = m.textContent || "";
|
|
1327
|
-
for (const p of h.matchAll(f)) {
|
|
1328
|
-
const g = (p[2] || p[4] || "").trim();
|
|
1329
|
-
if (!g || q(g)) continue;
|
|
1330
|
-
document.querySelector(`link[rel="stylesheet"][href="${g}"]`) || u.push(g);
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
u.length && await Promise.all(u.map((m) => new Promise((h) => {
|
|
1334
|
-
if (document.querySelector(`link[rel="stylesheet"][href="${m}"]`)) return h(null);
|
|
1335
|
-
const p = document.createElement("link");
|
|
1336
|
-
p.rel = "stylesheet", p.href = m, p.setAttribute("data-snapdom", "injected-import"), p.onload = () => h(p), p.onerror = () => h(null), document.head.appendChild(p);
|
|
1337
|
-
})));
|
|
1338
|
-
let d = "";
|
|
1339
|
-
const y = Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter((m) => !!m.href);
|
|
1340
|
-
for (const m of y)
|
|
1341
|
-
try {
|
|
1342
|
-
if (q(m.href)) continue;
|
|
1343
|
-
let h = "", p = !1;
|
|
1344
|
-
try {
|
|
1345
|
-
p = new URL(m.href, location.href).origin === location.origin;
|
|
1346
|
-
} catch {
|
|
1347
|
-
}
|
|
1348
|
-
if (!p && !Wn(m.href, c))
|
|
1349
|
-
continue;
|
|
1350
|
-
if (p) {
|
|
1351
|
-
const S = Array.from(document.styleSheets).find((x) => x.href === m.href);
|
|
1352
|
-
if (S)
|
|
1353
|
-
try {
|
|
1354
|
-
const x = S.cssRules || [];
|
|
1355
|
-
h = Array.from(x).map((C) => C.cssText).join("");
|
|
1356
|
-
} catch {
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
if (!h && (h = (await _(m.href, { as: "text", useProxy: o })).data, q(m.href)))
|
|
1360
|
-
continue;
|
|
1361
|
-
h = await On(h, m.href, o);
|
|
1362
|
-
let g = "";
|
|
1363
|
-
for (const S of h.match(Un) || []) {
|
|
1364
|
-
const x = (S.match(/font-family:\s*([^;]+);/i)?.[1] || "").trim(), C = St(x);
|
|
1365
|
-
if (!C || q(C)) continue;
|
|
1366
|
-
const M = (S.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), v = (S.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), I = (S.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), P = (S.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), N = (S.match(/src\s*:\s*([^;]+);/i)?.[1] || "").trim(), $ = jt(N, m.href);
|
|
1367
|
-
if (!a(C, v, M, I)) continue;
|
|
1368
|
-
const k = ge(P);
|
|
1369
|
-
if (!ye(e, k)) continue;
|
|
1370
|
-
const T = { family: C, weightSpec: M, styleSpec: v, stretchSpec: I, unicodeRange: P, srcRaw: N, srcUrls: $, href: m.href };
|
|
1371
|
-
if (n && l(T, k)) continue;
|
|
1372
|
-
const U = /url\(/i.test(N) ? await we(S, m.href, o) : S;
|
|
1373
|
-
g += U;
|
|
1374
|
-
}
|
|
1375
|
-
g.trim() && (d += g);
|
|
1376
|
-
} catch {
|
|
1377
|
-
console.warn("[snapDOM] Failed to process stylesheet:", m.href);
|
|
1378
|
-
}
|
|
1379
|
-
const b = {
|
|
1380
|
-
requiredIndex: s,
|
|
1381
|
-
usedCodepoints: e,
|
|
1382
|
-
faceMatchesRequired: a,
|
|
1383
|
-
simpleExcluder: n ? re(n) : null,
|
|
1384
|
-
useProxy: o,
|
|
1385
|
-
visitedSheets: /* @__PURE__ */ new Set(),
|
|
1386
|
-
depth: 0
|
|
1387
|
-
};
|
|
1388
|
-
for (const m of document.styleSheets)
|
|
1389
|
-
if (!(m.href && y.some((h) => h.href === m.href)))
|
|
1390
|
-
try {
|
|
1391
|
-
const h = m.href || location.href;
|
|
1392
|
-
h && b.visitedSheets.add(h), await be(
|
|
1393
|
-
m,
|
|
1394
|
-
h,
|
|
1395
|
-
async (p) => {
|
|
1396
|
-
d += p;
|
|
1397
|
-
},
|
|
1398
|
-
b
|
|
1399
|
-
);
|
|
1400
|
-
} catch {
|
|
1401
|
-
}
|
|
1402
|
-
try {
|
|
1403
|
-
for (const m of document.fonts || []) {
|
|
1404
|
-
if (!m || !m.family || m.status !== "loaded" || !m._snapdomSrc) continue;
|
|
1405
|
-
const h = String(m.family).replace(/^['"]+|['"]+$/g, "");
|
|
1406
|
-
if (q(h) || !s.has(h) || n?.families && n.families.some((g) => String(g).toLowerCase() === h.toLowerCase()))
|
|
1407
|
-
continue;
|
|
1408
|
-
let p = m._snapdomSrc;
|
|
1409
|
-
if (!String(p).startsWith("data:")) {
|
|
1410
|
-
if (w.resource?.has(m._snapdomSrc))
|
|
1411
|
-
p = w.resource.get(m._snapdomSrc), w.font?.add(m._snapdomSrc);
|
|
1412
|
-
else if (!w.font?.has(m._snapdomSrc))
|
|
1413
|
-
try {
|
|
1414
|
-
const g = await _(m._snapdomSrc, { as: "dataURL", useProxy: o, silent: !0 });
|
|
1415
|
-
if (g.ok && typeof g.data == "string")
|
|
1416
|
-
p = g.data, w.resource?.set(m._snapdomSrc, p), w.font?.add(m._snapdomSrc);
|
|
1417
|
-
else
|
|
1418
|
-
continue;
|
|
1419
|
-
} catch {
|
|
1420
|
-
console.warn("[snapDOM] Failed to fetch dynamic font src:", m._snapdomSrc);
|
|
1421
|
-
continue;
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
d += `@font-face{font-family:'${h}';src:url(${p});font-style:${m.style || "normal"};font-weight:${m.weight || "normal"};}`;
|
|
1425
|
-
}
|
|
1426
|
-
} catch {
|
|
1427
|
-
}
|
|
1428
|
-
for (const m of r) {
|
|
1429
|
-
if (!m || typeof m != "object") continue;
|
|
1430
|
-
const h = String(m.family || "").replace(/^['"]+|['"]+$/g, "");
|
|
1431
|
-
if (!h || q(h) || !s.has(h) || n?.families && n.families.some((M) => String(M).toLowerCase() === h.toLowerCase())) continue;
|
|
1432
|
-
const p = m.weight != null ? String(m.weight) : "normal", g = m.style != null ? String(m.style) : "normal", S = m.stretchPct != null ? `${m.stretchPct}%` : "100%", x = String(m.src || "");
|
|
1433
|
-
let C = x;
|
|
1434
|
-
if (!C.startsWith("data:")) {
|
|
1435
|
-
if (w.resource?.has(x))
|
|
1436
|
-
C = w.resource.get(x), w.font?.add(x);
|
|
1437
|
-
else if (!w.font?.has(x))
|
|
1438
|
-
try {
|
|
1439
|
-
const M = await _(x, { as: "dataURL", useProxy: o, silent: !0 });
|
|
1440
|
-
if (M.ok && typeof M.data == "string")
|
|
1441
|
-
C = M.data, w.resource?.set(x, C), w.font?.add(x);
|
|
1442
|
-
else
|
|
1443
|
-
continue;
|
|
1444
|
-
} catch {
|
|
1445
|
-
console.warn("[snapDOM] Failed to fetch localFonts src:", x);
|
|
1446
|
-
continue;
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
d += `@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`;
|
|
1450
|
-
}
|
|
1451
|
-
return d && (d = Dn(d), w.resource?.set(i, d)), d;
|
|
1452
|
-
}
|
|
1453
|
-
function xe(t) {
|
|
1454
|
-
const e = /* @__PURE__ */ new Set();
|
|
1455
|
-
if (!t) return e;
|
|
1456
|
-
const n = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, null), r = (a) => {
|
|
1457
|
-
const l = St(a.fontFamily);
|
|
1458
|
-
if (!l) return;
|
|
1459
|
-
const i = (c, u, f) => `${l}__${gt(c)}__${Tt(u)}__${Rn(f)}`;
|
|
1460
|
-
e.add(i(a.fontWeight, a.fontStyle, a.fontStretch));
|
|
1461
|
-
};
|
|
1462
|
-
r(getComputedStyle(t));
|
|
1463
|
-
const o = getComputedStyle(t, "::before");
|
|
1464
|
-
o && o.content && o.content !== "none" && r(o);
|
|
1465
|
-
const s = getComputedStyle(t, "::after");
|
|
1466
|
-
for (s && s.content && s.content !== "none" && r(s); n.nextNode(); ) {
|
|
1467
|
-
const a = (
|
|
1468
|
-
/** @type {Element} */
|
|
1469
|
-
n.currentNode
|
|
1470
|
-
), l = getComputedStyle(a);
|
|
1471
|
-
r(l);
|
|
1472
|
-
const i = getComputedStyle(a, "::before");
|
|
1473
|
-
i && i.content && i.content !== "none" && r(i);
|
|
1474
|
-
const c = getComputedStyle(a, "::after");
|
|
1475
|
-
c && c.content && c.content !== "none" && r(c);
|
|
1476
|
-
}
|
|
1477
|
-
return e;
|
|
1478
|
-
}
|
|
1479
|
-
function Ce(t) {
|
|
1480
|
-
const e = /* @__PURE__ */ new Set(), n = (o) => {
|
|
1481
|
-
if (o)
|
|
1482
|
-
for (const s of o) e.add(s.codePointAt(0));
|
|
1483
|
-
}, r = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null);
|
|
1484
|
-
for (; r.nextNode(); ) {
|
|
1485
|
-
const o = r.currentNode;
|
|
1486
|
-
if (o.nodeType === Node.TEXT_NODE)
|
|
1487
|
-
n(o.nodeValue || "");
|
|
1488
|
-
else if (o.nodeType === Node.ELEMENT_NODE) {
|
|
1489
|
-
const s = (
|
|
1490
|
-
/** @type {Element} */
|
|
1491
|
-
o
|
|
1492
|
-
);
|
|
1493
|
-
for (const a of ["::before", "::after"]) {
|
|
1494
|
-
const i = getComputedStyle(s, a)?.getPropertyValue("content");
|
|
1495
|
-
if (!(!i || i === "none"))
|
|
1496
|
-
if (/^"/.test(i) || /^'/.test(i))
|
|
1497
|
-
n(i.slice(1, -1));
|
|
1498
|
-
else {
|
|
1499
|
-
const c = i.match(/\\[0-9A-Fa-f]{1,6}/g);
|
|
1500
|
-
if (c)
|
|
1501
|
-
for (const u of c)
|
|
1502
|
-
try {
|
|
1503
|
-
e.add(parseInt(u.slice(1), 16));
|
|
1504
|
-
} catch {
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
return e;
|
|
1511
|
-
}
|
|
1512
|
-
async function Me(t, e = 2) {
|
|
1513
|
-
try {
|
|
1514
|
-
await document.fonts.ready;
|
|
1515
|
-
} catch {
|
|
1516
|
-
}
|
|
1517
|
-
const n = Array.from(t || []).filter(Boolean);
|
|
1518
|
-
if (n.length === 0) return;
|
|
1519
|
-
const r = () => {
|
|
1520
|
-
const o = document.createElement("div");
|
|
1521
|
-
o.style.cssText = "position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";
|
|
1522
|
-
for (const s of n) {
|
|
1523
|
-
const a = document.createElement("span");
|
|
1524
|
-
a.textContent = "AaBbGg1234ÁÉÍÓÚçñ—∞", a.style.fontFamily = `"${s}"`, a.style.fontWeight = "700", a.style.fontStyle = "italic", a.style.fontSize = "32px", a.style.lineHeight = "1", a.style.whiteSpace = "nowrap", a.style.margin = "0", a.style.padding = "0", o.appendChild(a);
|
|
1525
|
-
}
|
|
1526
|
-
document.body.appendChild(o), o.offsetWidth, document.body.removeChild(o);
|
|
1527
|
-
};
|
|
1528
|
-
for (let o = 0; o < Math.max(1, e); o++)
|
|
1529
|
-
r(), await new Promise((s) => requestAnimationFrame(() => requestAnimationFrame(s)));
|
|
1530
|
-
}
|
|
1531
|
-
function qn(t) {
|
|
1532
|
-
return /\bcounter\s*\(|\bcounters\s*\(/.test(t || "");
|
|
1533
|
-
}
|
|
1534
|
-
function jn(t) {
|
|
1535
|
-
return (t || "").replace(/"([^"]*)"/g, "$1");
|
|
1536
|
-
}
|
|
1537
|
-
function oe(t, e = !1) {
|
|
1538
|
-
let n = "", r = Math.max(1, t);
|
|
1539
|
-
for (; r > 0; )
|
|
1540
|
-
r--, n = String.fromCharCode(97 + r % 26) + n, r = Math.floor(r / 26);
|
|
1541
|
-
return e ? n.toUpperCase() : n;
|
|
1542
|
-
}
|
|
1543
|
-
function ae(t, e = !0) {
|
|
1544
|
-
const n = [[1e3, "M"], [900, "CM"], [500, "D"], [400, "CD"], [100, "C"], [90, "XC"], [50, "L"], [40, "XL"], [10, "X"], [9, "IX"], [5, "V"], [4, "IV"], [1, "I"]];
|
|
1545
|
-
let r = Math.max(1, Math.min(3999, t)), o = "";
|
|
1546
|
-
for (const [s, a] of n) for (; r >= s; )
|
|
1547
|
-
o += a, r -= s;
|
|
1548
|
-
return e ? o : o.toLowerCase();
|
|
1549
|
-
}
|
|
1550
|
-
function se(t, e) {
|
|
1551
|
-
switch ((e || "decimal").toLowerCase()) {
|
|
1552
|
-
case "decimal":
|
|
1553
|
-
return String(Math.max(0, t));
|
|
1554
|
-
case "decimal-leading-zero":
|
|
1555
|
-
return (t < 10 ? "0" : "") + String(Math.max(0, t));
|
|
1556
|
-
case "lower-alpha":
|
|
1557
|
-
return oe(t, !1);
|
|
1558
|
-
case "upper-alpha":
|
|
1559
|
-
return oe(t, !0);
|
|
1560
|
-
case "lower-roman":
|
|
1561
|
-
return ae(t, !1);
|
|
1562
|
-
case "upper-roman":
|
|
1563
|
-
return ae(t, !0);
|
|
1564
|
-
default:
|
|
1565
|
-
return String(Math.max(0, t));
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
function Vn(t) {
|
|
1569
|
-
const e = /* @__PURE__ */ new WeakMap(), n = t instanceof Document ? t.documentElement : t, r = (c) => c && c.tagName === "LI", o = (c) => {
|
|
1570
|
-
let u = 0, f = c?.parentElement;
|
|
1571
|
-
if (!f) return 0;
|
|
1572
|
-
for (const d of f.children) {
|
|
1573
|
-
if (d === c) break;
|
|
1574
|
-
d.tagName === "LI" && u++;
|
|
1575
|
-
}
|
|
1576
|
-
return u;
|
|
1577
|
-
}, s = (c) => {
|
|
1578
|
-
const u = /* @__PURE__ */ new Map();
|
|
1579
|
-
for (const [f, d] of c) u.set(f, d.slice());
|
|
1580
|
-
return u;
|
|
1581
|
-
}, a = (c, u, f) => {
|
|
1582
|
-
const d = s(c);
|
|
1583
|
-
let y;
|
|
1584
|
-
try {
|
|
1585
|
-
y = f.style?.counterReset || getComputedStyle(f).counterReset;
|
|
1586
|
-
} catch {
|
|
1587
|
-
}
|
|
1588
|
-
if (y && y !== "none")
|
|
1589
|
-
for (const m of y.split(",")) {
|
|
1590
|
-
const h = m.trim().split(/\s+/), p = h[0], g = Number.isFinite(Number(h[1])) ? Number(h[1]) : 0;
|
|
1591
|
-
if (!p) continue;
|
|
1592
|
-
const S = u.get(p);
|
|
1593
|
-
if (S && S.length) {
|
|
1594
|
-
const x = S.slice();
|
|
1595
|
-
x.push(g), d.set(p, x);
|
|
1596
|
-
} else
|
|
1597
|
-
d.set(p, [g]);
|
|
1598
|
-
}
|
|
1599
|
-
let b;
|
|
1600
|
-
try {
|
|
1601
|
-
b = f.style?.counterIncrement || getComputedStyle(f).counterIncrement;
|
|
1602
|
-
} catch {
|
|
1603
|
-
}
|
|
1604
|
-
if (b && b !== "none")
|
|
1605
|
-
for (const m of b.split(",")) {
|
|
1606
|
-
const h = m.trim().split(/\s+/), p = h[0], g = Number.isFinite(Number(h[1])) ? Number(h[1]) : 1;
|
|
1607
|
-
if (!p) continue;
|
|
1608
|
-
const S = d.get(p) || [];
|
|
1609
|
-
S.length === 0 && S.push(0), S[S.length - 1] += g, d.set(p, S);
|
|
1610
|
-
}
|
|
1611
|
-
try {
|
|
1612
|
-
if (getComputedStyle(f).display === "list-item" && r(f)) {
|
|
1613
|
-
const h = f.parentElement;
|
|
1614
|
-
let p = 1;
|
|
1615
|
-
if (h && h.tagName === "OL") {
|
|
1616
|
-
const S = h.getAttribute("start"), x = Number.isFinite(Number(S)) ? Number(S) : 1, C = o(f), M = f.getAttribute("value");
|
|
1617
|
-
p = Number.isFinite(Number(M)) ? Number(M) : x + C;
|
|
1618
|
-
} else
|
|
1619
|
-
p = 1 + o(f);
|
|
1620
|
-
const g = d.get("list-item") || [];
|
|
1621
|
-
g.length === 0 && g.push(0), g[g.length - 1] = p, d.set("list-item", g);
|
|
1622
|
-
}
|
|
1623
|
-
} catch {
|
|
1624
|
-
}
|
|
1625
|
-
return d;
|
|
1626
|
-
}, l = (c, u, f) => {
|
|
1627
|
-
const d = a(f, u, c);
|
|
1628
|
-
e.set(c, d);
|
|
1629
|
-
let y = d;
|
|
1630
|
-
for (const b of c.children)
|
|
1631
|
-
y = l(b, d, y);
|
|
1632
|
-
return d;
|
|
1633
|
-
}, i = /* @__PURE__ */ new Map();
|
|
1634
|
-
return l(n, i, i), {
|
|
1635
|
-
/**
|
|
1636
|
-
* Get top value for counter name at given node.
|
|
1637
|
-
* @param {Element} node
|
|
1638
|
-
* @param {string} name
|
|
1639
|
-
*/
|
|
1640
|
-
get(c, u) {
|
|
1641
|
-
const f = e.get(c)?.get(u);
|
|
1642
|
-
return f && f.length ? f[f.length - 1] : 0;
|
|
1643
|
-
},
|
|
1644
|
-
/**
|
|
1645
|
-
* Get full stack for counter name at given node.
|
|
1646
|
-
* @param {Element} node
|
|
1647
|
-
* @param {string} name
|
|
1648
|
-
*/
|
|
1649
|
-
getStack(c, u) {
|
|
1650
|
-
const f = e.get(c)?.get(u);
|
|
1651
|
-
return f ? f.slice() : [];
|
|
1652
|
-
}
|
|
1653
|
-
};
|
|
1654
|
-
}
|
|
1655
|
-
function zn(t, e, n) {
|
|
1656
|
-
if (!t || t === "none") return t;
|
|
1657
|
-
try {
|
|
1658
|
-
const r = /\b(counter|counters)\s*\(([^)]+)\)/g;
|
|
1659
|
-
let o = t.replace(r, (s, a, l) => {
|
|
1660
|
-
const i = String(l).split(",").map((c) => c.trim());
|
|
1661
|
-
if (a === "counter") {
|
|
1662
|
-
const c = i[0]?.replace(/^["']|["']$/g, ""), u = (i[1] || "decimal").toLowerCase(), f = n.get(e, c);
|
|
1663
|
-
return se(f, u);
|
|
1664
|
-
} else {
|
|
1665
|
-
const c = i[0]?.replace(/^["']|["']$/g, ""), u = i[1]?.replace(/^["']|["']$/g, "") ?? "", f = (i[2] || "decimal").toLowerCase(), d = n.getStack(e, c);
|
|
1666
|
-
return d.length ? d.map((b) => se(b, f)).join(u) : "";
|
|
1667
|
-
}
|
|
1668
|
-
});
|
|
1669
|
-
return jn(o);
|
|
1670
|
-
} catch {
|
|
1671
|
-
return "- ";
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
var st = null, lt = /* @__PURE__ */ new WeakMap();
|
|
1675
|
-
function Xn(t) {
|
|
1676
|
-
return (t || "").replace(/"([^"]*)"/g, "$1");
|
|
1677
|
-
}
|
|
1678
|
-
function Yn(t) {
|
|
1679
|
-
if (!t) return "";
|
|
1680
|
-
const e = [], n = /"([^"]*)"/g;
|
|
1681
|
-
let r;
|
|
1682
|
-
for (; r = n.exec(t); ) e.push(r[1]);
|
|
1683
|
-
return e.length ? e.join("") : Xn(t);
|
|
1684
|
-
}
|
|
1685
|
-
function Wt(t, e) {
|
|
1686
|
-
const n = t.parentElement, r = n ? lt.get(n) : null;
|
|
1687
|
-
return r ? {
|
|
1688
|
-
get(o, s) {
|
|
1689
|
-
const a = e.get(o, s), l = r.get(s);
|
|
1690
|
-
return typeof l == "number" ? Math.max(a, l) : a;
|
|
1691
|
-
},
|
|
1692
|
-
getStack(o, s) {
|
|
1693
|
-
const a = e.getStack(o, s);
|
|
1694
|
-
if (!a.length) return a;
|
|
1695
|
-
const l = r.get(s);
|
|
1696
|
-
if (typeof l == "number") {
|
|
1697
|
-
const i = a.slice();
|
|
1698
|
-
return i[i.length - 1] = Math.max(i[i.length - 1], l), i;
|
|
1699
|
-
}
|
|
1700
|
-
return a;
|
|
1701
|
-
}
|
|
1702
|
-
} : e;
|
|
1703
|
-
}
|
|
1704
|
-
function _t(t, e, n) {
|
|
1705
|
-
const r = /* @__PURE__ */ new Map();
|
|
1706
|
-
function o(i) {
|
|
1707
|
-
const c = [];
|
|
1708
|
-
if (!i || i === "none") return c;
|
|
1709
|
-
for (const u of String(i).split(",")) {
|
|
1710
|
-
const f = u.trim().split(/\s+/), d = f[0], y = Number.isFinite(Number(f[1])) ? Number(f[1]) : void 0;
|
|
1711
|
-
d && c.push({ name: d, num: y });
|
|
1712
|
-
}
|
|
1713
|
-
return c;
|
|
1714
|
-
}
|
|
1715
|
-
const s = o(e?.counterReset), a = o(e?.counterIncrement);
|
|
1716
|
-
function l(i) {
|
|
1717
|
-
if (r.has(i)) return r.get(i).slice();
|
|
1718
|
-
let c = n.getStack(t, i);
|
|
1719
|
-
c = c.length ? c.slice() : [];
|
|
1720
|
-
const u = s.find((d) => d.name === i);
|
|
1721
|
-
if (u) {
|
|
1722
|
-
const d = Number.isFinite(u.num) ? u.num : 0;
|
|
1723
|
-
c = c.length ? [...c, d] : [d];
|
|
1724
|
-
}
|
|
1725
|
-
const f = a.find((d) => d.name === i);
|
|
1726
|
-
if (f) {
|
|
1727
|
-
const d = Number.isFinite(f.num) ? f.num : 1;
|
|
1728
|
-
c.length === 0 && (c = [0]), c[c.length - 1] += d;
|
|
1729
|
-
}
|
|
1730
|
-
return r.set(i, c.slice()), c;
|
|
1731
|
-
}
|
|
1732
|
-
return {
|
|
1733
|
-
get(i, c) {
|
|
1734
|
-
const u = l(c);
|
|
1735
|
-
return u.length ? u[u.length - 1] : 0;
|
|
1736
|
-
},
|
|
1737
|
-
getStack(i, c) {
|
|
1738
|
-
return l(c);
|
|
1739
|
-
},
|
|
1740
|
-
/** expone increments del pseudo para que el caller pueda propagar a hermanos */
|
|
1741
|
-
__incs: a
|
|
1742
|
-
};
|
|
1743
|
-
}
|
|
1744
|
-
function Gn(t, e, n) {
|
|
1745
|
-
let r;
|
|
1746
|
-
try {
|
|
1747
|
-
r = getComputedStyle(t, e);
|
|
1748
|
-
} catch {
|
|
1749
|
-
}
|
|
1750
|
-
const o = r?.content;
|
|
1751
|
-
if (!o || o === "none" || o === "normal") return { text: "", incs: [] };
|
|
1752
|
-
const s = Wt(t, n), a = _t(t, r, s);
|
|
1753
|
-
let l = qn(o) ? zn(o, t, a) : o;
|
|
1754
|
-
return { text: Yn(l), incs: a.__incs || [] };
|
|
1755
|
-
}
|
|
1756
|
-
async function ke(t, e, n, r) {
|
|
1757
|
-
if (!(t instanceof Element) || !(e instanceof Element)) return;
|
|
1758
|
-
if (!st)
|
|
1759
|
-
try {
|
|
1760
|
-
st = Vn(t.ownerDocument || document);
|
|
1761
|
-
} catch {
|
|
1762
|
-
}
|
|
1763
|
-
for (const a of ["::before", "::after", "::first-letter"])
|
|
1764
|
-
try {
|
|
1765
|
-
const l = Ht(t, a);
|
|
1766
|
-
if (!l || typeof l[Symbol.iterator] != "function" || l.content === "none" && l.backgroundImage === "none" && l.backgroundColor === "transparent" && (l.borderStyle === "none" || parseFloat(l.borderWidth) === 0) && (!l.transform || l.transform === "none") && l.display === "inline") continue;
|
|
1767
|
-
if (a === "::first-letter") {
|
|
1768
|
-
const A = getComputedStyle(t);
|
|
1769
|
-
if (!(l.color !== A.color || l.fontSize !== A.fontSize || l.fontWeight !== A.fontWeight)) continue;
|
|
1770
|
-
const L = Array.from(e.childNodes).find(
|
|
1771
|
-
(nt) => nt.nodeType === Node.TEXT_NODE && nt.textContent?.trim().length > 0
|
|
1772
|
-
);
|
|
1773
|
-
if (!L) continue;
|
|
1774
|
-
const R = L.textContent, D = R.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0], Q = R.slice(D?.length || 0);
|
|
1775
|
-
if (!D || /[\uD800-\uDFFF]/.test(D)) continue;
|
|
1776
|
-
const Y = document.createElement("span");
|
|
1777
|
-
Y.textContent = D, Y.dataset.snapdomPseudo = "::first-letter";
|
|
1778
|
-
const ft = Qt(l), Ct = Nt(ft, "span");
|
|
1779
|
-
n.styleMap.set(Y, Ct);
|
|
1780
|
-
const dt = document.createTextNode(Q);
|
|
1781
|
-
e.replaceChild(dt, L), e.insertBefore(Y, dt);
|
|
1782
|
-
continue;
|
|
1783
|
-
}
|
|
1784
|
-
const c = l.content, { text: u, incs: f } = Gn(t, a, st), d = l.backgroundImage, y = l.backgroundColor, b = l.fontFamily, m = parseInt(l.fontSize) || 32, h = parseInt(l.fontWeight) || !1, p = l.color || "#000", g = l.borderStyle, S = parseFloat(l.borderWidth), x = l.transform, C = q(b), M = c !== "none" && u !== "", v = d && d !== "none", I = y && y !== "transparent" && y !== "rgba(0, 0, 0, 0)", P = g && g !== "none" && S > 0, N = x && x !== "none";
|
|
1785
|
-
if (!(M || v || I || P || N)) {
|
|
1786
|
-
if (f && f.length && t.parentElement) {
|
|
1787
|
-
const A = lt.get(t.parentElement) || /* @__PURE__ */ new Map();
|
|
1788
|
-
for (const { name: F } of f) {
|
|
1789
|
-
if (!F) continue;
|
|
1790
|
-
const L = Wt(t, st), B = _t(t, getComputedStyle(t, a), L).get(t, F);
|
|
1791
|
-
A.set(F, B);
|
|
1792
|
-
}
|
|
1793
|
-
lt.set(t.parentElement, A);
|
|
1794
|
-
}
|
|
1795
|
-
continue;
|
|
1796
|
-
}
|
|
1797
|
-
const k = document.createElement("span");
|
|
1798
|
-
k.dataset.snapdomPseudo = a, k.style.verticalAlign = "middle", k.style.pointerEvents = "none";
|
|
1799
|
-
const T = Qt(l), U = Nt(T, "span");
|
|
1800
|
-
if (n.styleMap.set(k, U), C && u && u.length === 1) {
|
|
1801
|
-
const { dataUrl: A, width: F, height: L } = await Nn(u, b, h, m, p), R = document.createElement("img");
|
|
1802
|
-
R.src = A, R.style = `height:${m}px;width:${F / L * m}px;object-fit:contain;`, k.appendChild(R), e.dataset.snapdomHasIcon = "true";
|
|
1803
|
-
} else if (u && u.startsWith("url(")) {
|
|
1804
|
-
const A = Ut(u);
|
|
1805
|
-
if (A?.trim())
|
|
1806
|
-
try {
|
|
1807
|
-
const F = document.createElement("img"), L = await _(yt(A), { as: "dataURL", useProxy: r.useProxy });
|
|
1808
|
-
F.src = L.data, F.style = `width:${m}px;height:auto;object-fit:contain;`, k.appendChild(F);
|
|
1809
|
-
} catch (F) {
|
|
1810
|
-
console.error(`[snapdom] Error in pseudo ${a} for`, t, F);
|
|
1811
|
-
}
|
|
1812
|
-
} else !C && M && (k.textContent = u);
|
|
1813
|
-
if (k.style.background = "none", "mask" in k.style && (k.style.mask = "none"), v)
|
|
1814
|
-
try {
|
|
1815
|
-
const A = qt(d), F = await Promise.all(A.map(Dt));
|
|
1816
|
-
k.style.backgroundImage = F.join(", ");
|
|
1817
|
-
} catch (A) {
|
|
1818
|
-
console.warn(`[snapdom] Failed to inline background-image for ${a}`, A);
|
|
1819
|
-
}
|
|
1820
|
-
I && (k.style.backgroundColor = y);
|
|
1821
|
-
const X = k.childNodes.length > 0 || k.textContent?.trim() !== "" || v || I || P || N;
|
|
1822
|
-
if (f && f.length && t.parentElement) {
|
|
1823
|
-
const A = lt.get(t.parentElement) || /* @__PURE__ */ new Map(), F = Wt(t, st), L = _t(t, getComputedStyle(t, a), F);
|
|
1824
|
-
for (const { name: R } of f) {
|
|
1825
|
-
if (!R) continue;
|
|
1826
|
-
const B = L.get(t, R);
|
|
1827
|
-
A.set(R, B);
|
|
1828
|
-
}
|
|
1829
|
-
lt.set(t.parentElement, A);
|
|
1830
|
-
}
|
|
1831
|
-
if (!X) continue;
|
|
1832
|
-
a === "::before" ? e.insertBefore(k, e.firstChild) : e.appendChild(k);
|
|
1833
|
-
} catch (l) {
|
|
1834
|
-
console.warn(`[snapdom] Failed to capture ${a} for`, t, l);
|
|
1835
|
-
}
|
|
1836
|
-
const o = Array.from(t.children), s = Array.from(e.children).filter((a) => !a.dataset.snapdomPseudo);
|
|
1837
|
-
for (let a = 0; a < Math.min(o.length, s.length); a++)
|
|
1838
|
-
await ke(o[a], s[a], n, r);
|
|
1839
|
-
}
|
|
1840
|
-
function Kn(t) {
|
|
1841
|
-
if (!t) return;
|
|
1842
|
-
const e = /* @__PURE__ */ new Set();
|
|
1843
|
-
if (t.querySelectorAll("use").forEach((l) => {
|
|
1844
|
-
const i = l.getAttribute("xlink:href") || l.getAttribute("href");
|
|
1845
|
-
i && i.startsWith("#") && e.add(i.slice(1));
|
|
1846
|
-
}), !e.size) return;
|
|
1847
|
-
const n = Array.from(document.querySelectorAll("svg > symbol, svg > defs")), r = n.filter((l) => l.tagName.toLowerCase() === "symbol"), o = n.filter((l) => l.tagName.toLowerCase() === "defs");
|
|
1848
|
-
let s = t.querySelector("svg.inline-defs-container");
|
|
1849
|
-
s || (s = document.createElementNS("http://www.w3.org/2000/svg", "svg"), s.setAttribute("aria-hidden", "true"), s.setAttribute("style", "position: absolute; width: 0; height: 0; overflow: hidden;"), s.classList.add("inline-defs-container"), t.insertBefore(s, t.firstChild));
|
|
1850
|
-
const a = /* @__PURE__ */ new Set();
|
|
1851
|
-
t.querySelectorAll("symbol[id], defs > *[id]").forEach((l) => {
|
|
1852
|
-
a.add(l.id);
|
|
1853
|
-
}), e.forEach((l) => {
|
|
1854
|
-
if (a.has(l)) return;
|
|
1855
|
-
const i = r.find((c) => c.id === l);
|
|
1856
|
-
if (i) {
|
|
1857
|
-
s.appendChild(i.cloneNode(!0)), a.add(l);
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
for (const c of o) {
|
|
1861
|
-
const u = c.querySelector(`#${CSS.escape(l)}`);
|
|
1862
|
-
if (u) {
|
|
1863
|
-
let f = s.querySelector("defs");
|
|
1864
|
-
f || (f = document.createElementNS("http://www.w3.org/2000/svg", "defs"), s.appendChild(f)), f.appendChild(u.cloneNode(!0)), a.add(l);
|
|
1865
|
-
break;
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
});
|
|
1869
|
-
}
|
|
1870
|
-
function Jn(t, e) {
|
|
1871
|
-
if (!t || !e) return;
|
|
1872
|
-
const n = t.scrollTop || 0;
|
|
1873
|
-
if (!n) return;
|
|
1874
|
-
getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
1875
|
-
const r = t.getBoundingClientRect(), o = t.clientHeight, s = "data-snap-ph", a = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
|
|
1876
|
-
for (; a.nextNode(); ) {
|
|
1877
|
-
const l = (
|
|
1878
|
-
/** @type {HTMLElement} */
|
|
1879
|
-
a.currentNode
|
|
1880
|
-
), i = getComputedStyle(l), c = i.position;
|
|
1881
|
-
if (c !== "sticky" && c !== "-webkit-sticky") continue;
|
|
1882
|
-
const u = ie(i.top), f = ie(i.bottom);
|
|
1883
|
-
if (u == null && f == null) continue;
|
|
1884
|
-
const d = Qn(l, t), y = Zn(e, d, s);
|
|
1885
|
-
if (!y) continue;
|
|
1886
|
-
const b = l.getBoundingClientRect(), m = b.width, h = b.height, p = b.left - r.left;
|
|
1887
|
-
if (!(m > 0 && h > 0) || !Number.isFinite(p)) continue;
|
|
1888
|
-
const g = u != null ? u + n : n + (o - h - /** bottomInit non-null */
|
|
1889
|
-
f);
|
|
1890
|
-
if (!Number.isFinite(g)) continue;
|
|
1891
|
-
const S = Number.parseInt(i.zIndex, 10), x = Number.isFinite(S), C = x ? Math.max(S, 1) + 1 : 2, M = x ? S - 1 : 0, v = y.cloneNode(!1);
|
|
1892
|
-
v.setAttribute(s, "1"), v.style.position = "sticky", v.style.left = `${p}px`, v.style.top = `${g}px`, v.style.width = `${m}px`, v.style.height = `${h}px`, v.style.visibility = "hidden", v.style.zIndex = String(M), v.style.overflow = "hidden", v.style.background = "transparent", v.style.boxShadow = "none", v.style.filter = "none", y.parentElement?.insertBefore(v, y), y.style.position = "absolute", y.style.left = `${p}px`, y.style.top = `${g}px`, y.style.bottom = "auto", y.style.zIndex = String(C), y.style.pointerEvents = "none";
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
function ie(t) {
|
|
1896
|
-
if (!t || t === "auto") return null;
|
|
1897
|
-
const e = Number.parseFloat(t);
|
|
1898
|
-
return Number.isFinite(e) ? e : null;
|
|
1899
|
-
}
|
|
1900
|
-
function Qn(t, e) {
|
|
1901
|
-
const n = [];
|
|
1902
|
-
for (let r = t; r && r !== e; ) {
|
|
1903
|
-
const o = r.parentElement;
|
|
1904
|
-
if (!o) break;
|
|
1905
|
-
n.push(Array.prototype.indexOf.call(o.children, r)), r = o;
|
|
1906
|
-
}
|
|
1907
|
-
return n.reverse();
|
|
1908
|
-
}
|
|
1909
|
-
function Zn(t, e, n) {
|
|
1910
|
-
let r = t;
|
|
1911
|
-
for (let o = 0; o < e.length; o++)
|
|
1912
|
-
if (r = /** @type {HTMLElement|undefined} */
|
|
1913
|
-
tr(r, n)[e[o]], !r) return null;
|
|
1914
|
-
return r instanceof HTMLElement ? r : null;
|
|
1915
|
-
}
|
|
1916
|
-
function tr(t, e) {
|
|
1917
|
-
const n = [], r = t.children;
|
|
1918
|
-
for (let o = 0; o < r.length; o++) {
|
|
1919
|
-
const s = r[o];
|
|
1920
|
-
s.hasAttribute(e) || n.push(s);
|
|
1921
|
-
}
|
|
1922
|
-
return n;
|
|
1923
|
-
}
|
|
1924
|
-
async function er(t, e = {}) {
|
|
1925
|
-
const n = {
|
|
1926
|
-
styleMap: w.session.styleMap,
|
|
1927
|
-
styleCache: w.session.styleCache,
|
|
1928
|
-
nodeMap: w.session.nodeMap
|
|
1929
|
-
};
|
|
1930
|
-
let r, o = "", s = "";
|
|
1931
|
-
nr(t);
|
|
1932
|
-
try {
|
|
1933
|
-
Kn(t);
|
|
1934
|
-
} catch (i) {
|
|
1935
|
-
console.warn("inlineExternal defs or symbol failed:", i);
|
|
1936
|
-
}
|
|
1937
|
-
try {
|
|
1938
|
-
r = await pt(t, n, e, t);
|
|
1939
|
-
} catch (i) {
|
|
1940
|
-
throw console.warn("deepClone failed:", i), i;
|
|
1941
|
-
}
|
|
1942
|
-
try {
|
|
1943
|
-
await ke(t, r, n, e);
|
|
1944
|
-
} catch (i) {
|
|
1945
|
-
console.warn("inlinePseudoElements failed:", i);
|
|
1946
|
-
}
|
|
1947
|
-
await sr(r);
|
|
1948
|
-
try {
|
|
1949
|
-
const i = r.querySelectorAll("style[data-sd]");
|
|
1950
|
-
for (const c of i)
|
|
1951
|
-
s += c.textContent || "", c.remove();
|
|
1952
|
-
} catch {
|
|
1953
|
-
}
|
|
1954
|
-
const a = tn(n.styleMap);
|
|
1955
|
-
o = Array.from(a.entries()).map(([i, c]) => `.${c}{${i}}`).join(""), o = s + o;
|
|
1956
|
-
for (const [i, c] of n.styleMap.entries()) {
|
|
1957
|
-
if (i.tagName === "STYLE") continue;
|
|
1958
|
-
if (i.getRootNode && i.getRootNode() instanceof ShadowRoot) {
|
|
1959
|
-
i.setAttribute("style", c.replace(/;/g, "; "));
|
|
1960
|
-
continue;
|
|
1961
|
-
}
|
|
1962
|
-
const u = a.get(c);
|
|
1963
|
-
u && i.classList.add(u);
|
|
1964
|
-
const f = i.style?.backgroundImage, d = i.dataset?.snapdomHasIcon;
|
|
1965
|
-
f && f !== "none" && (i.style.backgroundImage = f), d && (i.style.verticalAlign = "middle", i.style.display = "inline");
|
|
1966
|
-
}
|
|
1967
|
-
for (const [i, c] of n.nodeMap.entries()) {
|
|
1968
|
-
const u = c.scrollLeft, f = c.scrollTop;
|
|
1969
|
-
if ((u || f) && i instanceof HTMLElement) {
|
|
1970
|
-
i.style.overflow = "hidden", i.style.scrollbarWidth = "none", i.style.msOverflowStyle = "none";
|
|
1971
|
-
const y = document.createElement("div");
|
|
1972
|
-
for (y.style.transform = `translate(${-u}px, ${-f}px)`, y.style.willChange = "transform", y.style.display = "inline-block", y.style.width = "100%"; i.firstChild; )
|
|
1973
|
-
y.appendChild(i.firstChild);
|
|
1974
|
-
i.appendChild(y);
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
const l = r instanceof HTMLElement && r.firstElementChild instanceof HTMLElement ? r.firstElementChild : r;
|
|
1978
|
-
if (Jn(t, l), t === n.nodeMap.get(r)) {
|
|
1979
|
-
const i = n.styleCache.get(t) || window.getComputedStyle(t);
|
|
1980
|
-
n.styleCache.set(t, i);
|
|
1981
|
-
const c = Be(i.transform);
|
|
1982
|
-
r.style.margin = "0", r.style.top = "auto", r.style.left = "auto", r.style.right = "auto", r.style.bottom = "auto", r.style.animation = "none", r.style.transition = "none", r.style.willChange = "auto", r.style.float = "none", r.style.clear = "none", r.style.transform = c || "";
|
|
1983
|
-
}
|
|
1984
|
-
for (const [i, c] of n.nodeMap.entries())
|
|
1985
|
-
c.tagName === "PRE" && (i.style.marginTop = "0", i.style.marginBlockStart = "0");
|
|
1986
|
-
return { clone: r, classCSS: o, styleCache: n.styleCache };
|
|
1987
|
-
}
|
|
1988
|
-
function nr(t) {
|
|
1989
|
-
const e = getComputedStyle(t), n = e.outlineStyle, r = e.outlineWidth, o = e.borderStyle, s = e.borderWidth, a = n !== "none" && parseFloat(r) > 0, l = o === "none" || parseFloat(s) === 0;
|
|
1990
|
-
a && l && (t.style.border = `${r} solid transparent`);
|
|
1991
|
-
}
|
|
1992
|
-
var it = /* @__PURE__ */ new Map();
|
|
1993
|
-
async function ut(t) {
|
|
1994
|
-
if (w.resource?.has(t)) return w.resource.get(t);
|
|
1995
|
-
if (it.has(t)) return it.get(t);
|
|
1996
|
-
const e = (async () => {
|
|
1997
|
-
const n = await _(t, { as: "dataURL", silent: !0 });
|
|
1998
|
-
if (!n.ok || typeof n.data != "string")
|
|
1999
|
-
throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);
|
|
2000
|
-
return w.resource?.set(t, n.data), n.data;
|
|
2001
|
-
})();
|
|
2002
|
-
it.set(t, e);
|
|
2003
|
-
try {
|
|
2004
|
-
const n = await e;
|
|
2005
|
-
return it.set(t, n), n;
|
|
2006
|
-
} catch (n) {
|
|
2007
|
-
throw it.delete(t), n;
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
var rr = /\bblob:[^)"'\s]+/g;
|
|
2011
|
-
async function ce(t) {
|
|
2012
|
-
if (!t || t.indexOf("blob:") === -1) return t;
|
|
2013
|
-
const e = Array.from(new Set(t.match(rr) || []));
|
|
2014
|
-
if (e.length === 0) return t;
|
|
2015
|
-
let n = t;
|
|
2016
|
-
for (const r of e)
|
|
2017
|
-
try {
|
|
2018
|
-
const o = await ut(r);
|
|
2019
|
-
n = n.split(r).join(o);
|
|
2020
|
-
} catch {
|
|
2021
|
-
}
|
|
2022
|
-
return n;
|
|
2023
|
-
}
|
|
2024
|
-
function mt(t) {
|
|
2025
|
-
return typeof t == "string" && t.startsWith("blob:");
|
|
2026
|
-
}
|
|
2027
|
-
function or(t) {
|
|
2028
|
-
return (t || "").split(",").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
2029
|
-
const n = e.match(/^(\S+)(\s+.+)?$/);
|
|
2030
|
-
return n ? { url: n[1], desc: n[2] || "" } : null;
|
|
2031
|
-
}).filter(Boolean);
|
|
2032
|
-
}
|
|
2033
|
-
function ar(t) {
|
|
2034
|
-
return t.map((e) => e.desc ? `${e.url} ${e.desc.trim()}` : e.url).join(", ");
|
|
2035
|
-
}
|
|
2036
|
-
async function sr(t) {
|
|
2037
|
-
if (!t) return;
|
|
2038
|
-
const e = t.querySelectorAll ? t.querySelectorAll("img") : [];
|
|
2039
|
-
for (const a of e)
|
|
2040
|
-
try {
|
|
2041
|
-
const i = a.getAttribute("src") || a.currentSrc || "";
|
|
2042
|
-
if (mt(i)) {
|
|
2043
|
-
const u = await ut(i);
|
|
2044
|
-
a.setAttribute("src", u);
|
|
2045
|
-
}
|
|
2046
|
-
const c = a.getAttribute("srcset");
|
|
2047
|
-
if (c && c.includes("blob:")) {
|
|
2048
|
-
const u = or(c);
|
|
2049
|
-
let f = !1;
|
|
2050
|
-
for (const d of u)
|
|
2051
|
-
if (mt(d.url))
|
|
2052
|
-
try {
|
|
2053
|
-
d.url = await ut(d.url), f = !0;
|
|
2054
|
-
} catch {
|
|
2055
|
-
}
|
|
2056
|
-
f && a.setAttribute("srcset", ar(u));
|
|
2057
|
-
}
|
|
2058
|
-
} catch {
|
|
2059
|
-
}
|
|
2060
|
-
const n = t.querySelectorAll ? t.querySelectorAll("image") : [];
|
|
2061
|
-
for (const a of n)
|
|
2062
|
-
try {
|
|
2063
|
-
const l = "http://www.w3.org/1999/xlink", i = a.getAttribute("href") || a.getAttributeNS?.(l, "href");
|
|
2064
|
-
if (mt(i)) {
|
|
2065
|
-
const c = await ut(i);
|
|
2066
|
-
a.setAttribute("href", c), a.removeAttributeNS?.(l, "href");
|
|
2067
|
-
}
|
|
2068
|
-
} catch {
|
|
2069
|
-
}
|
|
2070
|
-
const r = t.querySelectorAll ? t.querySelectorAll("[style*='blob:']") : [];
|
|
2071
|
-
for (const a of r)
|
|
2072
|
-
try {
|
|
2073
|
-
const l = a.getAttribute("style");
|
|
2074
|
-
if (l && l.includes("blob:")) {
|
|
2075
|
-
const i = await ce(l);
|
|
2076
|
-
a.setAttribute("style", i);
|
|
2077
|
-
}
|
|
2078
|
-
} catch {
|
|
2079
|
-
}
|
|
2080
|
-
const o = t.querySelectorAll ? t.querySelectorAll("style") : [];
|
|
2081
|
-
for (const a of o)
|
|
2082
|
-
try {
|
|
2083
|
-
const l = a.textContent || "";
|
|
2084
|
-
l.includes("blob:") && (a.textContent = await ce(l));
|
|
2085
|
-
} catch {
|
|
2086
|
-
}
|
|
2087
|
-
const s = ["poster"];
|
|
2088
|
-
for (const a of s) {
|
|
2089
|
-
const l = t.querySelectorAll ? t.querySelectorAll(`[${a}^='blob:']`) : [];
|
|
2090
|
-
for (const i of l)
|
|
2091
|
-
try {
|
|
2092
|
-
const c = i.getAttribute(a);
|
|
2093
|
-
mt(c) && i.setAttribute(a, await ut(c));
|
|
2094
|
-
} catch {
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
async function ir(t, e = {}) {
|
|
2099
|
-
const n = Array.from(t.querySelectorAll("img")), r = async (o) => {
|
|
2100
|
-
if (!o.getAttribute("src")) {
|
|
2101
|
-
const u = o.currentSrc || o.src || "";
|
|
2102
|
-
u && o.setAttribute("src", u);
|
|
2103
|
-
}
|
|
2104
|
-
o.removeAttribute("srcset"), o.removeAttribute("sizes");
|
|
2105
|
-
const s = o.src || "";
|
|
2106
|
-
if (!s) return;
|
|
2107
|
-
const a = await _(s, { as: "dataURL", useProxy: e.useProxy });
|
|
2108
|
-
if (a.ok && typeof a.data == "string" && a.data.startsWith("data:")) {
|
|
2109
|
-
o.src = a.data, o.width || (o.width = o.naturalWidth || 100), o.height || (o.height = o.naturalHeight || 100);
|
|
2110
|
-
return;
|
|
2111
|
-
}
|
|
2112
|
-
const { fallbackURL: l } = e || {};
|
|
2113
|
-
if (l)
|
|
2114
|
-
try {
|
|
2115
|
-
const u = parseInt(o.dataset?.snapdomWidth || "", 10) || 0, f = parseInt(o.dataset?.snapdomHeight || "", 10) || 0, d = parseInt(o.getAttribute("width") || "", 10) || 0, y = parseInt(o.getAttribute("height") || "", 10) || 0, b = parseFloat(o.style?.width || "") || 0, m = parseFloat(o.style?.height || "") || 0, h = u || b || d || o.width || void 0, p = f || m || y || o.height || void 0, g = typeof l == "function" ? await l({ width: h, height: p, src: s, element: o }) : l;
|
|
2116
|
-
if (g) {
|
|
2117
|
-
const S = await _(g, { as: "dataURL", useProxy: e.useProxy });
|
|
2118
|
-
o.src = S.data, !o.width && h && (o.width = h), !o.height && p && (o.height = p), o.width || (o.width = o.naturalWidth || 100), o.height || (o.height = o.naturalHeight || 100);
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
} catch {
|
|
2122
|
-
}
|
|
2123
|
-
const i = o.width || o.naturalWidth || 100, c = o.height || o.naturalHeight || 100;
|
|
2124
|
-
if (e.placeholders !== !1) {
|
|
2125
|
-
const u = document.createElement("div");
|
|
2126
|
-
u.style.cssText = [
|
|
2127
|
-
`width:${i}px`,
|
|
2128
|
-
`height:${c}px`,
|
|
2129
|
-
"background:#ccc",
|
|
2130
|
-
"display:inline-block",
|
|
2131
|
-
"text-align:center",
|
|
2132
|
-
`line-height:${c}px`,
|
|
2133
|
-
"color:#666",
|
|
2134
|
-
"font-size:12px",
|
|
2135
|
-
"overflow:hidden"
|
|
2136
|
-
].join(";"), u.textContent = "img", o.replaceWith(u);
|
|
2137
|
-
} else {
|
|
2138
|
-
const u = document.createElement("div");
|
|
2139
|
-
u.style.cssText = `display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`, o.replaceWith(u);
|
|
2140
|
-
}
|
|
2141
|
-
};
|
|
2142
|
-
for (let o = 0; o < n.length; o += 4) {
|
|
2143
|
-
const s = n.slice(o, o + 4).map(r);
|
|
2144
|
-
await Promise.allSettled(s);
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
async function ve(t, e, n, r = {}) {
|
|
2148
|
-
const o = [[t, e]], s = [
|
|
2149
|
-
"background-image",
|
|
2150
|
-
// Mask shorthands & images (both standard and WebKit)
|
|
2151
|
-
"mask",
|
|
2152
|
-
"mask-image",
|
|
2153
|
-
"-webkit-mask",
|
|
2154
|
-
"-webkit-mask-image",
|
|
2155
|
-
// Mask sources (rare, but keep)
|
|
2156
|
-
"mask-source",
|
|
2157
|
-
"mask-box-image-source",
|
|
2158
|
-
"mask-border-source",
|
|
2159
|
-
"-webkit-mask-box-image-source",
|
|
2160
|
-
// Border image
|
|
2161
|
-
"border-image",
|
|
2162
|
-
"border-image-source"
|
|
2163
|
-
], a = [
|
|
2164
|
-
"mask-position",
|
|
2165
|
-
"mask-size",
|
|
2166
|
-
"mask-repeat",
|
|
2167
|
-
// WebKit variants
|
|
2168
|
-
"-webkit-mask-position",
|
|
2169
|
-
"-webkit-mask-size",
|
|
2170
|
-
"-webkit-mask-repeat",
|
|
2171
|
-
// Extra (optional but helpful across engines)
|
|
2172
|
-
"mask-origin",
|
|
2173
|
-
"mask-clip",
|
|
2174
|
-
"-webkit-mask-origin",
|
|
2175
|
-
"-webkit-mask-clip",
|
|
2176
|
-
// Some engines expose X/Y position separately:
|
|
2177
|
-
"-webkit-mask-position-x",
|
|
2178
|
-
"-webkit-mask-position-y"
|
|
2179
|
-
], l = [
|
|
2180
|
-
"border-image-slice",
|
|
2181
|
-
"border-image-width",
|
|
2182
|
-
"border-image-outset",
|
|
2183
|
-
"border-image-repeat"
|
|
2184
|
-
];
|
|
2185
|
-
for (; o.length; ) {
|
|
2186
|
-
const [i, c] = o.shift(), u = n.get(i) || Ht(i);
|
|
2187
|
-
n.has(i) || n.set(i, u);
|
|
2188
|
-
const f = (() => {
|
|
2189
|
-
const b = u.getPropertyValue("border-image"), m = u.getPropertyValue("border-image-source");
|
|
2190
|
-
return b && b !== "none" || m && m !== "none";
|
|
2191
|
-
})();
|
|
2192
|
-
for (const b of s) {
|
|
2193
|
-
const m = u.getPropertyValue(b);
|
|
2194
|
-
if (!m || m === "none") continue;
|
|
2195
|
-
const h = qt(m), p = await Promise.all(
|
|
2196
|
-
h.map((g) => Dt(g, r))
|
|
2197
|
-
);
|
|
2198
|
-
p.some((g) => g && g !== "none" && !/^url\(undefined/.test(g)) && c.style.setProperty(b, p.join(", "));
|
|
2199
|
-
}
|
|
2200
|
-
for (const b of a) {
|
|
2201
|
-
const m = u.getPropertyValue(b);
|
|
2202
|
-
!m || m === "initial" || c.style.setProperty(b, m);
|
|
2203
|
-
}
|
|
2204
|
-
if (f)
|
|
2205
|
-
for (const b of l) {
|
|
2206
|
-
const m = u.getPropertyValue(b);
|
|
2207
|
-
!m || m === "initial" || c.style.setProperty(b, m);
|
|
2208
|
-
}
|
|
2209
|
-
const d = Array.from(i.children), y = Array.from(c.children);
|
|
2210
|
-
for (let b = 0; b < Math.min(d.length, y.length); b++)
|
|
2211
|
-
o.push([d[b], y[b]]);
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
function cr(t) {
|
|
2215
|
-
if (!t) return () => {
|
|
2216
|
-
};
|
|
2217
|
-
const e = lr(t);
|
|
2218
|
-
if (e <= 0) return () => {
|
|
2219
|
-
};
|
|
2220
|
-
if (!dr(t)) return () => {
|
|
2221
|
-
};
|
|
2222
|
-
const n = getComputedStyle(t), r = Math.round(ur(n) * e + fr(n)), o = t.textContent ?? "", s = o;
|
|
2223
|
-
if (t.scrollHeight <= r + 0.5)
|
|
2224
|
-
return () => {
|
|
2225
|
-
};
|
|
2226
|
-
let a = 0, l = o.length, i = -1;
|
|
2227
|
-
for (; a <= l; ) {
|
|
2228
|
-
const c = a + l >> 1;
|
|
2229
|
-
t.textContent = o.slice(0, c) + "…", t.scrollHeight <= r + 0.5 ? (i = c, a = c + 1) : l = c - 1;
|
|
2230
|
-
}
|
|
2231
|
-
return t.textContent = (i >= 0 ? o.slice(0, i) : "") + "…", () => {
|
|
2232
|
-
t.textContent = s;
|
|
2233
|
-
};
|
|
2234
|
-
}
|
|
2235
|
-
function lr(t) {
|
|
2236
|
-
const e = getComputedStyle(t);
|
|
2237
|
-
let n = e.getPropertyValue("-webkit-line-clamp") || e.getPropertyValue("line-clamp");
|
|
2238
|
-
n = (n || "").trim();
|
|
2239
|
-
const r = parseInt(n, 10);
|
|
2240
|
-
return Number.isFinite(r) && r > 0 ? r : 0;
|
|
2241
|
-
}
|
|
2242
|
-
function ur(t) {
|
|
2243
|
-
const e = (t.lineHeight || "").trim(), n = parseFloat(t.fontSize) || 16;
|
|
2244
|
-
return !e || e === "normal" ? Math.round(n * 1.2) : e.endsWith("px") ? parseFloat(e) : /^\d+(\.\d+)?$/.test(e) ? Math.round(parseFloat(e) * n) : e.endsWith("%") ? Math.round(parseFloat(e) / 100 * n) : Math.round(n * 1.2);
|
|
2245
|
-
}
|
|
2246
|
-
function fr(t) {
|
|
2247
|
-
return (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0);
|
|
2248
|
-
}
|
|
2249
|
-
function dr(t) {
|
|
2250
|
-
return t.childElementCount > 0 ? !1 : Array.from(t.childNodes).some((e) => e.nodeType === Node.TEXT_NODE);
|
|
2251
|
-
}
|
|
2252
|
-
function hr(t, e) {
|
|
2253
|
-
if (!t || !e || !e.style) return;
|
|
2254
|
-
const n = getComputedStyle(t);
|
|
2255
|
-
try {
|
|
2256
|
-
e.style.boxShadow = "none";
|
|
2257
|
-
} catch {
|
|
2258
|
-
}
|
|
2259
|
-
try {
|
|
2260
|
-
e.style.textShadow = "none";
|
|
2261
|
-
} catch {
|
|
2262
|
-
}
|
|
2263
|
-
try {
|
|
2264
|
-
e.style.outline = "none";
|
|
2265
|
-
} catch {
|
|
2266
|
-
}
|
|
2267
|
-
const o = (n.filter || "").replace(/\bblur\([^()]*\)\s*/gi, "").replace(/\bdrop-shadow\([^()]*\)\s*/gi, "").trim().replace(/\s+/g, " ");
|
|
2268
|
-
try {
|
|
2269
|
-
e.style.filter = o.length ? o : "none";
|
|
2270
|
-
} catch {
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
async function $e(t, e) {
|
|
2274
|
-
if (!t) throw new Error("Element cannot be null or undefined");
|
|
2275
|
-
fe(e.cache);
|
|
2276
|
-
const n = e.fast, r = !!e.straighten, o = !!e.noShadows;
|
|
2277
|
-
let s, a, l, i = "", c = "", u, f, d = null;
|
|
2278
|
-
const y = cr(t);
|
|
2279
|
-
try {
|
|
2280
|
-
({ clone: s, classCSS: a, styleCache: l } = await er(t, e)), r && s && (d = mr(t, s)), o && s && hr(t, s);
|
|
2281
|
-
} finally {
|
|
2282
|
-
y();
|
|
2283
|
-
}
|
|
2284
|
-
await new Promise((p) => {
|
|
2285
|
-
tt(async () => {
|
|
2286
|
-
await ir(s, e), p();
|
|
2287
|
-
}, { fast: n });
|
|
2288
|
-
}), await new Promise((p) => {
|
|
2289
|
-
tt(async () => {
|
|
2290
|
-
await ve(t, s, l, e), p();
|
|
2291
|
-
}, { fast: n });
|
|
2292
|
-
}), e.embedFonts && await new Promise((p) => {
|
|
2293
|
-
tt(async () => {
|
|
2294
|
-
const g = xe(t), S = Ce(t);
|
|
2295
|
-
if (O()) {
|
|
2296
|
-
const x = new Set(
|
|
2297
|
-
Array.from(g).map((C) => String(C).split("__")[0]).filter(Boolean)
|
|
2298
|
-
);
|
|
2299
|
-
await Me(x, 1);
|
|
2300
|
-
}
|
|
2301
|
-
i = await Se({
|
|
2302
|
-
required: g,
|
|
2303
|
-
usedCodepoints: S,
|
|
2304
|
-
exclude: e.excludeFonts,
|
|
2305
|
-
useProxy: e.useProxy
|
|
2306
|
-
}), p();
|
|
2307
|
-
}, { fast: n });
|
|
2308
|
-
});
|
|
2309
|
-
const b = Qe(s).sort(), m = b.join(",");
|
|
2310
|
-
w.baseStyle.has(m) ? c = w.baseStyle.get(m) : await new Promise((p) => {
|
|
2311
|
-
tt(() => {
|
|
2312
|
-
c = Ze(b), w.baseStyle.set(m, c), p();
|
|
2313
|
-
}, { fast: n });
|
|
2314
|
-
}), await new Promise((p) => {
|
|
2315
|
-
tt(() => {
|
|
2316
|
-
const g = getComputedStyle(t);
|
|
2317
|
-
function S(H) {
|
|
2318
|
-
const W = `${H.filter || ""} ${H.webkitFilter || ""}`.trim();
|
|
2319
|
-
if (!W || W === "none")
|
|
2320
|
-
return { bleed: { top: 0, right: 0, bottom: 0, left: 0 }, has: !1 };
|
|
2321
|
-
const z = W.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi) || [];
|
|
2322
|
-
let G = 0, rt = 0, ot = 0, at = 0, K = !1;
|
|
2323
|
-
for (const _e of z) {
|
|
2324
|
-
K = !0;
|
|
2325
|
-
const Oe = _e.match(/-?\d+(?:\.\d+)?px/gi)?.map((Ue) => parseFloat(Ue)) || [], [vt = 0, $t = 0, Xt = 0] = Oe, Yt = Math.abs(vt) + Xt, Gt = Math.abs($t) + Xt;
|
|
2326
|
-
rt = Math.max(rt, Yt + Math.max(vt, 0)), at = Math.max(at, Yt + Math.max(-vt, 0)), ot = Math.max(ot, Gt + Math.max($t, 0)), G = Math.max(G, Gt + Math.max(-$t, 0));
|
|
2327
|
-
}
|
|
2328
|
-
return { bleed: { top: Math.ceil(G), right: Math.ceil(rt), bottom: Math.ceil(ot), left: Math.ceil(at) }, has: K };
|
|
2329
|
-
}
|
|
2330
|
-
const x = t.getBoundingClientRect(), C = Math.max(1, Math.ceil(t.offsetWidth || parseFloat(g.width) || x.width || 1)), M = Math.max(1, Math.ceil(t.offsetHeight || parseFloat(g.height) || x.height || 1)), v = (H, W = NaN) => {
|
|
2331
|
-
const z = typeof H == "string" ? parseFloat(H) : H;
|
|
2332
|
-
return Number.isFinite(z) ? z : W;
|
|
2333
|
-
}, I = v(e.width), P = v(e.height);
|
|
2334
|
-
let N = C, $ = M;
|
|
2335
|
-
const k = Number.isFinite(I), T = Number.isFinite(P), U = M > 0 ? C / M : 1;
|
|
2336
|
-
k && T ? (N = Math.max(1, Math.ceil(I)), $ = Math.max(1, Math.ceil(P))) : k ? (N = Math.max(1, Math.ceil(I)), $ = Math.max(1, Math.ceil(N / (U || 1)))) : T ? ($ = Math.max(1, Math.ceil(P)), N = Math.max(1, Math.ceil($ * (U || 1)))) : (N = C, $ = M);
|
|
2337
|
-
let J = 0, X = 0, A = C, F = M;
|
|
2338
|
-
if (r && d && Number.isFinite(d.a)) {
|
|
2339
|
-
const H = { a: d.a, b: d.b || 0, c: d.c || 0, d: d.d || 1, e: 0, f: 0 }, W = le(C, M, H, 0, 0);
|
|
2340
|
-
J = W.minX, X = W.minY, A = W.maxX, F = W.maxY;
|
|
2341
|
-
} else if (!r && wr(t)) {
|
|
2342
|
-
const W = g.transform && g.transform !== "none" ? g.transform : "", z = br(t), G = Mr({
|
|
2343
|
-
baseTransform: W,
|
|
2344
|
-
rotate: z.rotate || "0deg",
|
|
2345
|
-
scale: z.scale,
|
|
2346
|
-
translate: z.translate
|
|
2347
|
-
}), { ox: rt, oy: ot } = xr(g, C, M), at = G.is2D ? G : new DOMMatrix(G.toString()), K = le(C, M, at, rt, ot);
|
|
2348
|
-
J = K.minX, X = K.minY, A = K.maxX, F = K.maxY;
|
|
2349
|
-
}
|
|
2350
|
-
const L = pr(g), R = gr(g), B = yr(g), D = S(g), Q = o ? { top: 0, right: 0, bottom: 0, left: 0 } : {
|
|
2351
|
-
top: L.top + R.top + B.top + D.bleed.top,
|
|
2352
|
-
right: L.right + R.right + B.right + D.bleed.right,
|
|
2353
|
-
bottom: L.bottom + R.bottom + B.bottom + D.bleed.bottom,
|
|
2354
|
-
left: L.left + R.left + B.left + D.bleed.left
|
|
2355
|
-
};
|
|
2356
|
-
J -= Q.left, X -= Q.top, A += Q.right, F += Q.bottom;
|
|
2357
|
-
const Y = Math.max(1, Math.ceil(A - J)), ft = Math.max(1, Math.ceil(F - X)), Ct = Math.max(1, Math.round(Y * (k || T ? N / C : 1))), dt = Math.max(1, Math.round(ft * (T || k ? $ / M : 1))), nt = "http://www.w3.org/2000/svg", j = (O() ? 1 : 0) + (r ? 1 : 0), V = document.createElementNS(nt, "foreignObject"), Re = Math.floor(J), Ie = Math.floor(X);
|
|
2358
|
-
V.setAttribute("x", String(-(Re - j))), V.setAttribute("y", String(-(Ie - j))), V.setAttribute("width", String(Math.ceil(C + j * 2))), V.setAttribute("height", String(Math.ceil(M + j * 2))), V.style.overflow = "visible";
|
|
2359
|
-
const Vt = document.createElement("style");
|
|
2360
|
-
Vt.textContent = c + i + "svg{overflow:visible;} foreignObject{overflow:visible;}" + a, V.appendChild(Vt);
|
|
2361
|
-
const Z = document.createElement("div");
|
|
2362
|
-
Z.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), Z.style.width = `${C}px`, Z.style.height = `${M}px`, Z.style.overflow = "visible", s.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), Z.appendChild(s), V.appendChild(Z);
|
|
2363
|
-
const Te = new XMLSerializer().serializeToString(V), Mt = Y + j * 2, kt = ft + j * 2, zt = k || T;
|
|
2364
|
-
e.meta = { w0: C, h0: M, vbW: Mt, vbH: kt, targetW: N, targetH: $ };
|
|
2365
|
-
const Pe = O() && zt ? Mt : Ct + j * 2, We = O() && zt ? kt : dt + j * 2;
|
|
2366
|
-
f = `<svg xmlns="${nt}" width="${Pe}" height="${We}" viewBox="0 0 ${Mt} ${kt}">` + Te + "</svg>", u = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`, p();
|
|
2367
|
-
}, { fast: n });
|
|
2368
|
-
});
|
|
2369
|
-
const h = document.getElementById("snapdom-sandbox");
|
|
2370
|
-
return h && h.style.position === "absolute" && h.remove(), u;
|
|
2371
|
-
}
|
|
2372
|
-
function mr(t, e) {
|
|
2373
|
-
if (!t || !e || !e.style) return null;
|
|
2374
|
-
const n = getComputedStyle(t);
|
|
2375
|
-
try {
|
|
2376
|
-
e.style.transformOrigin = "0 0";
|
|
2377
|
-
} catch {
|
|
2378
|
-
}
|
|
2379
|
-
try {
|
|
2380
|
-
"translate" in e.style && (e.style.translate = "none"), "rotate" in e.style && (e.style.rotate = "none");
|
|
2381
|
-
} catch {
|
|
2382
|
-
}
|
|
2383
|
-
const r = n.transform || "none";
|
|
2384
|
-
if (r === "none")
|
|
2385
|
-
try {
|
|
2386
|
-
const s = Ae(t);
|
|
2387
|
-
if (s.a === 1 && s.b === 0 && s.c === 0 && s.d === 1)
|
|
2388
|
-
return e.style.transform = "none", { a: 1, b: 0, c: 0, d: 1 };
|
|
2389
|
-
} catch {
|
|
2390
|
-
}
|
|
2391
|
-
const o = r.match(/^matrix\(\s*([^)]+)\)$/i);
|
|
2392
|
-
if (o) {
|
|
2393
|
-
const s = o[1].split(",").map((a) => parseFloat(a.trim()));
|
|
2394
|
-
if (s.length === 6 && s.every(Number.isFinite)) {
|
|
2395
|
-
const [a, l, i, c] = s, u = Math.sqrt(a * a + l * l) || 0;
|
|
2396
|
-
let f = 0, d = 0, y = 0, b = 0, m = 0, h = 0;
|
|
2397
|
-
u > 0 && (f = a / u, d = l / u, y = f * i + d * c, b = i - f * y, m = c - d * y, h = Math.sqrt(b * b + m * m) || 0, h > 0 ? y = y / h : y = 0);
|
|
2398
|
-
const p = u, g = 0, S = y * h, x = h;
|
|
2399
|
-
try {
|
|
2400
|
-
e.style.transform = `matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`;
|
|
2401
|
-
} catch {
|
|
2402
|
-
}
|
|
2403
|
-
return { a: p, b: g, c: S, d: x };
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
try {
|
|
2407
|
-
const s = String(r).trim();
|
|
2408
|
-
return e.style.transform = s + " translate(0px, 0px) rotate(0deg)", null;
|
|
2409
|
-
} catch {
|
|
2410
|
-
return null;
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
function pr(t) {
|
|
2414
|
-
const e = t.boxShadow || "";
|
|
2415
|
-
if (!e || e === "none") return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
2416
|
-
const n = e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map((l) => l.trim());
|
|
2417
|
-
let r = 0, o = 0, s = 0, a = 0;
|
|
2418
|
-
for (const l of n) {
|
|
2419
|
-
const i = l.match(/-?\d+(\.\d+)?px/g)?.map((m) => parseFloat(m)) || [];
|
|
2420
|
-
if (i.length < 2) continue;
|
|
2421
|
-
const [c, u, f = 0, d = 0] = i, y = Math.abs(c) + f + d, b = Math.abs(u) + f + d;
|
|
2422
|
-
o = Math.max(o, y + Math.max(c, 0)), a = Math.max(a, y + Math.max(-c, 0)), s = Math.max(s, b + Math.max(u, 0)), r = Math.max(r, b + Math.max(-u, 0));
|
|
2423
|
-
}
|
|
2424
|
-
return { top: Math.ceil(r), right: Math.ceil(o), bottom: Math.ceil(s), left: Math.ceil(a) };
|
|
2425
|
-
}
|
|
2426
|
-
function gr(t) {
|
|
2427
|
-
const e = (t.filter || "").match(/blur\(\s*([0-9.]+)px\s*\)/), n = e ? Math.ceil(parseFloat(e[1]) || 0) : 0;
|
|
2428
|
-
return { top: n, right: n, bottom: n, left: n };
|
|
2429
|
-
}
|
|
2430
|
-
function yr(t) {
|
|
2431
|
-
if ((t.outlineStyle || "none") === "none") return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
2432
|
-
const e = Math.ceil(parseFloat(t.outlineWidth || "0") || 0);
|
|
2433
|
-
return { top: e, right: e, bottom: e, left: e };
|
|
2434
|
-
}
|
|
2435
|
-
function le(t, e, n, r, o) {
|
|
2436
|
-
const s = n.a, a = n.b, l = n.c, i = n.d, c = n.e || 0, u = n.f || 0;
|
|
2437
|
-
function f(p, g) {
|
|
2438
|
-
let S = p - r, x = g - o, C = s * S + l * x, M = a * S + i * x;
|
|
2439
|
-
return C += r + c, M += o + u, [C, M];
|
|
2440
|
-
}
|
|
2441
|
-
const d = [f(0, 0), f(t, 0), f(0, e), f(t, e)];
|
|
2442
|
-
let y = 1 / 0, b = 1 / 0, m = -1 / 0, h = -1 / 0;
|
|
2443
|
-
for (const [p, g] of d)
|
|
2444
|
-
p < y && (y = p), g < b && (b = g), p > m && (m = p), g > h && (h = g);
|
|
2445
|
-
return { minX: y, minY: b, maxX: m, maxY: h, width: m - y, height: h - b };
|
|
2446
|
-
}
|
|
2447
|
-
function wr(t) {
|
|
2448
|
-
return Sr(t);
|
|
2449
|
-
}
|
|
2450
|
-
function Ae(t) {
|
|
2451
|
-
const e = getComputedStyle(t).transform;
|
|
2452
|
-
if (!e || e === "none") return new DOMMatrix();
|
|
2453
|
-
try {
|
|
2454
|
-
return new DOMMatrix(e);
|
|
2455
|
-
} catch {
|
|
2456
|
-
return new WebKitCSSMatrix(e);
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
function br(t) {
|
|
2460
|
-
const e = { rotate: "0deg", scale: null, translate: null }, n = typeof t.computedStyleMap == "function" ? t.computedStyleMap() : null;
|
|
2461
|
-
if (n) {
|
|
2462
|
-
const o = (i) => {
|
|
2463
|
-
try {
|
|
2464
|
-
return typeof n.has == "function" && !n.has(i) || typeof n.get != "function" ? null : n.get(i);
|
|
2465
|
-
} catch {
|
|
2466
|
-
return null;
|
|
2467
|
-
}
|
|
2468
|
-
}, s = o("rotate");
|
|
2469
|
-
if (s)
|
|
2470
|
-
if (s.angle) {
|
|
2471
|
-
const i = s.angle;
|
|
2472
|
-
e.rotate = i.unit === "rad" ? i.value * 180 / Math.PI + "deg" : i.value + i.unit;
|
|
2473
|
-
} else s.unit ? e.rotate = s.unit === "rad" ? s.value * 180 / Math.PI + "deg" : s.value + s.unit : e.rotate = String(s);
|
|
2474
|
-
else {
|
|
2475
|
-
const i = getComputedStyle(t);
|
|
2476
|
-
e.rotate = i.rotate && i.rotate !== "none" ? i.rotate : "0deg";
|
|
2477
|
-
}
|
|
2478
|
-
const a = o("scale");
|
|
2479
|
-
if (a) {
|
|
2480
|
-
const i = "x" in a && a.x?.value != null ? a.x.value : Array.isArray(a) ? a[0]?.value : Number(a) || 1, c = "y" in a && a.y?.value != null ? a.y.value : Array.isArray(a) ? a[1]?.value : i;
|
|
2481
|
-
e.scale = `${i} ${c}`;
|
|
2482
|
-
} else {
|
|
2483
|
-
const i = getComputedStyle(t);
|
|
2484
|
-
e.scale = i.scale && i.scale !== "none" ? i.scale : null;
|
|
2485
|
-
}
|
|
2486
|
-
const l = o("translate");
|
|
2487
|
-
if (l) {
|
|
2488
|
-
const i = "x" in l && "value" in l.x ? l.x.value : Array.isArray(l) ? l[0]?.value : 0, c = "y" in l && "value" in l.y ? l.y.value : Array.isArray(l) ? l[1]?.value : 0, u = "x" in l && l.x?.unit ? l.x.unit : "px", f = "y" in l && l.y?.unit ? l.y.unit : "px";
|
|
2489
|
-
e.translate = `${i}${u} ${c}${f}`;
|
|
2490
|
-
} else {
|
|
2491
|
-
const i = getComputedStyle(t);
|
|
2492
|
-
e.translate = i.translate && i.translate !== "none" ? i.translate : null;
|
|
2493
|
-
}
|
|
2494
|
-
return e;
|
|
2495
|
-
}
|
|
2496
|
-
const r = getComputedStyle(t);
|
|
2497
|
-
return e.rotate = r.rotate && r.rotate !== "none" ? r.rotate : "0deg", e.scale = r.scale && r.scale !== "none" ? r.scale : null, e.translate = r.translate && r.translate !== "none" ? r.translate : null, e;
|
|
2498
|
-
}
|
|
2499
|
-
function Sr(t) {
|
|
2500
|
-
const e = getComputedStyle(t), n = e.transform || "none";
|
|
2501
|
-
if (n !== "none" && !/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n)) return !0;
|
|
2502
|
-
const o = e.rotate && e.rotate !== "none" && e.rotate !== "0deg", s = e.scale && e.scale !== "none" && e.scale !== "1", a = e.translate && e.translate !== "none" && e.translate !== "0px 0px";
|
|
2503
|
-
return !!(o || s || a);
|
|
2504
|
-
}
|
|
2505
|
-
function xr(t, e, n) {
|
|
2506
|
-
const r = (t.transformOrigin || "0 0").trim().split(/\s+/), [o, s] = [r[0] || "0", r[1] || "0"], a = (l, i) => {
|
|
2507
|
-
const c = l.toLowerCase();
|
|
2508
|
-
return c === "left" || c === "top" ? 0 : c === "center" ? i / 2 : c === "right" || c === "bottom" ? i : c.endsWith("px") ? parseFloat(c) || 0 : c.endsWith("%") ? (parseFloat(c) || 0) * i / 100 : /^-?\d+(\.\d+)?$/.test(c) && parseFloat(c) || 0;
|
|
2509
|
-
};
|
|
2510
|
-
return {
|
|
2511
|
-
ox: a(o, e),
|
|
2512
|
-
oy: a(s, n)
|
|
2513
|
-
};
|
|
2514
|
-
}
|
|
2515
|
-
var Ft = null;
|
|
2516
|
-
function Cr() {
|
|
2517
|
-
if (Ft) return Ft;
|
|
2518
|
-
const t = document.createElement("div");
|
|
2519
|
-
return t.id = "snapdom-measure-slot", t.setAttribute("aria-hidden", "true"), Object.assign(t.style, {
|
|
2520
|
-
position: "absolute",
|
|
2521
|
-
left: "-99999px",
|
|
2522
|
-
top: "0px",
|
|
2523
|
-
width: "0px",
|
|
2524
|
-
height: "0px",
|
|
2525
|
-
overflow: "hidden",
|
|
2526
|
-
opacity: "0",
|
|
2527
|
-
pointerEvents: "none",
|
|
2528
|
-
contain: "size layout style"
|
|
2529
|
-
}), document.documentElement.appendChild(t), Ft = t, t;
|
|
2530
|
-
}
|
|
2531
|
-
function Mr(t) {
|
|
2532
|
-
const e = Cr(), n = document.createElement("div");
|
|
2533
|
-
n.style.transformOrigin = "0 0", t.baseTransform && (n.style.transform = t.baseTransform), t.rotate && (n.style.rotate = t.rotate), t.scale && (n.style.scale = t.scale), t.translate && (n.style.translate = t.translate), e.appendChild(n);
|
|
2534
|
-
const r = Ae(n);
|
|
2535
|
-
return e.removeChild(n), r;
|
|
2536
|
-
}
|
|
2537
|
-
function kr(t) {
|
|
2538
|
-
if (typeof t == "string") {
|
|
2539
|
-
const e = t.toLowerCase().trim();
|
|
2540
|
-
if (e === "disabled" || e === "full" || e === "auto" || e === "soft") return (
|
|
2541
|
-
/** @type {CachePolicy} */
|
|
2542
|
-
e
|
|
2543
|
-
);
|
|
2544
|
-
}
|
|
2545
|
-
return "soft";
|
|
2546
|
-
}
|
|
2547
|
-
function vr(t = {}) {
|
|
2548
|
-
const e = t.format ?? "png", n = kr(t.cache);
|
|
2549
|
-
return {
|
|
2550
|
-
// Debug & perf
|
|
2551
|
-
debug: t.debug ?? !1,
|
|
2552
|
-
fast: t.fast ?? !0,
|
|
2553
|
-
scale: t.scale ?? 1,
|
|
2554
|
-
// DOM filters
|
|
2555
|
-
exclude: t.exclude ?? [],
|
|
2556
|
-
excludeMode: t.excludeMode ?? "hide",
|
|
2557
|
-
filter: t.filter ?? null,
|
|
2558
|
-
filterMode: t.filterMode ?? "hide",
|
|
2559
|
-
// Placeholders
|
|
2560
|
-
placeholders: t.placeholders !== !1,
|
|
2561
|
-
// default true
|
|
2562
|
-
// Fonts
|
|
2563
|
-
embedFonts: t.embedFonts ?? !1,
|
|
2564
|
-
iconFonts: Array.isArray(t.iconFonts) ? t.iconFonts : t.iconFonts ? [t.iconFonts] : [],
|
|
2565
|
-
localFonts: Array.isArray(t.localFonts) ? t.localFonts : [],
|
|
2566
|
-
excludeFonts: t.excludeFonts ?? void 0,
|
|
2567
|
-
fallbackURL: t.fallbackURL ?? void 0,
|
|
2568
|
-
/** @type {CachePolicy} */
|
|
2569
|
-
cache: n,
|
|
2570
|
-
// Network
|
|
2571
|
-
useProxy: typeof t.useProxy == "string" ? t.useProxy : "",
|
|
2572
|
-
// Output
|
|
2573
|
-
width: t.width ?? null,
|
|
2574
|
-
height: t.height ?? null,
|
|
2575
|
-
format: e,
|
|
2576
|
-
type: t.type ?? "svg",
|
|
2577
|
-
quality: t.quality ?? 0.92,
|
|
2578
|
-
dpr: t.dpr ?? (window.devicePixelRatio || 1),
|
|
2579
|
-
backgroundColor: t.backgroundColor ?? (["jpg", "jpeg", "webp"].includes(e) ? "#ffffff" : null),
|
|
2580
|
-
filename: t.filename ?? "snapDOM",
|
|
2581
|
-
// NEW flags (user-friendly)
|
|
2582
|
-
straighten: t.straighten ?? !1,
|
|
2583
|
-
noShadows: t.noShadows ?? !1
|
|
2584
|
-
// Plugins (reservado)
|
|
2585
|
-
// plugins: normalizePlugins(...),
|
|
2586
|
-
};
|
|
2587
|
-
}
|
|
2588
|
-
function $r(t) {
|
|
2589
|
-
return typeof t == "string" && /^data:image\/svg\+xml/i.test(t);
|
|
2590
|
-
}
|
|
2591
|
-
function Ar(t) {
|
|
2592
|
-
const e = t.indexOf(",");
|
|
2593
|
-
return e >= 0 ? decodeURIComponent(t.slice(e + 1)) : "";
|
|
2594
|
-
}
|
|
2595
|
-
function Er(t) {
|
|
2596
|
-
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`;
|
|
2597
|
-
}
|
|
2598
|
-
function Fr(t) {
|
|
2599
|
-
let e = [], n = "", r = 0;
|
|
2600
|
-
for (let o = 0; o < t.length; o++) {
|
|
2601
|
-
const s = t[o];
|
|
2602
|
-
s === "(" && r++, s === ")" && (r = Math.max(0, r - 1)), s === ";" && r === 0 ? (e.push(n), n = "") : n += s;
|
|
2603
|
-
}
|
|
2604
|
-
return n.trim() && e.push(n), e.map((o) => o.trim()).filter(Boolean);
|
|
2605
|
-
}
|
|
2606
|
-
function Nr(t) {
|
|
2607
|
-
const e = [];
|
|
2608
|
-
let n = "", r = 0;
|
|
2609
|
-
for (let s = 0; s < t.length; s++) {
|
|
2610
|
-
const a = t[s];
|
|
2611
|
-
a === "(" && r++, a === ")" && (r = Math.max(0, r - 1)), a === "," && r === 0 ? (e.push(n.trim()), n = "") : n += a;
|
|
2612
|
-
}
|
|
2613
|
-
n.trim() && e.push(n.trim());
|
|
2614
|
-
const o = [];
|
|
2615
|
-
for (const s of e) {
|
|
2616
|
-
if (/\binset\b/i.test(s)) continue;
|
|
2617
|
-
const a = s.match(/-?\d+(?:\.\d+)?px/gi) || [], [l = "0px", i = "0px", c = "0px"] = a;
|
|
2618
|
-
let u = s.replace(/-?\d+(?:\.\d+)?px/gi, "").replace(/\binset\b/ig, "").trim().replace(/\s{2,}/g, " ");
|
|
2619
|
-
const f = !!u && u !== ",";
|
|
2620
|
-
o.push(`drop-shadow(${l} ${i} ${c}${f ? ` ${u}` : ""})`);
|
|
2621
|
-
}
|
|
2622
|
-
return o.join(" ");
|
|
2623
|
-
}
|
|
2624
|
-
function Ee(t) {
|
|
2625
|
-
const e = Fr(t);
|
|
2626
|
-
let n = null, r = null, o = null;
|
|
2627
|
-
const s = [];
|
|
2628
|
-
for (const l of e) {
|
|
2629
|
-
const i = l.indexOf(":");
|
|
2630
|
-
if (i < 0) continue;
|
|
2631
|
-
const c = l.slice(0, i).trim().toLowerCase(), u = l.slice(i + 1).trim();
|
|
2632
|
-
c === "box-shadow" ? o = u : c === "filter" ? n = u : c === "-webkit-filter" ? r = u : s.push([c, u]);
|
|
2633
|
-
}
|
|
2634
|
-
if (o) {
|
|
2635
|
-
const l = Nr(o);
|
|
2636
|
-
l && (n = n ? `${n} ${l}` : l, r = r ? `${r} ${l}` : l);
|
|
2637
|
-
}
|
|
2638
|
-
const a = [...s];
|
|
2639
|
-
return n && a.push(["filter", n]), r && a.push(["-webkit-filter", r]), a.map(([l, i]) => `${l}:${i}`).join(";");
|
|
2640
|
-
}
|
|
2641
|
-
function Lr(t) {
|
|
2642
|
-
return t.replace(/([^{}]+)\{([^}]*)\}/g, (e, n, r) => `${n}{${Ee(r)}}`);
|
|
2643
|
-
}
|
|
2644
|
-
function Rr(t) {
|
|
2645
|
-
return t = t.replace(
|
|
2646
|
-
/<style[^>]*>([\s\S]*?)<\/style>/gi,
|
|
2647
|
-
(e, n) => e.replace(n, Lr(n))
|
|
2648
|
-
), t = t.replace(
|
|
2649
|
-
/style=(['"])([\s\S]*?)\1/gi,
|
|
2650
|
-
(e, n, r) => `style=${n}${Ee(r)}${n}`
|
|
2651
|
-
), t;
|
|
2652
|
-
}
|
|
2653
|
-
function Ir(t) {
|
|
2654
|
-
if (!O() || !$r(t)) return t;
|
|
2655
|
-
try {
|
|
2656
|
-
const e = Ar(t), n = Rr(e);
|
|
2657
|
-
return Er(n);
|
|
2658
|
-
} catch {
|
|
2659
|
-
return t;
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
async function xt(t, e) {
|
|
2663
|
-
let { width: n, height: r, scale: o = 1, dpr: s = 1, meta: a = {} } = e;
|
|
2664
|
-
t = Ir(t);
|
|
2665
|
-
const l = new Image();
|
|
2666
|
-
l.loading = "eager", l.decoding = "sync", l.crossOrigin = "anonymous", l.src = t, await l.decode();
|
|
2667
|
-
const i = l.naturalWidth, c = l.naturalHeight, u = Number.isFinite(a.w0) ? a.w0 : i, f = Number.isFinite(a.h0) ? a.h0 : c;
|
|
2668
|
-
let d, y;
|
|
2669
|
-
const b = Number.isFinite(n), m = Number.isFinite(r);
|
|
2670
|
-
if (b && m)
|
|
2671
|
-
d = Math.max(1, n), y = Math.max(1, r);
|
|
2672
|
-
else if (b) {
|
|
2673
|
-
const g = n / Math.max(1, u);
|
|
2674
|
-
d = n, y = Math.round(f * g);
|
|
2675
|
-
} else if (m) {
|
|
2676
|
-
const g = r / Math.max(1, f);
|
|
2677
|
-
y = r, d = Math.round(u * g);
|
|
2678
|
-
} else
|
|
2679
|
-
d = i, y = c;
|
|
2680
|
-
d = Math.round(d * o), y = Math.round(y * o);
|
|
2681
|
-
const h = document.createElement("canvas");
|
|
2682
|
-
h.width = Math.ceil(d * s), h.height = Math.ceil(y * s), h.style.width = `${d}px`, h.style.height = `${y}px`;
|
|
2683
|
-
const p = h.getContext("2d");
|
|
2684
|
-
return s !== 1 && p.scale(s, s), p.drawImage(l, 0, 0, d, y), h;
|
|
2685
|
-
}
|
|
2686
|
-
async function Fe(t, e) {
|
|
2687
|
-
const n = await xt(t, e), r = e.backgroundColor ? Bt(n, e.backgroundColor) : n, o = new Image();
|
|
2688
|
-
return o.src = r.toDataURL(`image/${e.format}`, e.quality), await o.decode(), o.style.width = `${r.width / e.dpr}px`, o.style.height = `${r.height / e.dpr}px`, o;
|
|
2689
|
-
}
|
|
2690
|
-
async function ue(t, e) {
|
|
2691
|
-
const { scale: n = 1, width: r, height: o, meta: s = {} } = e, a = Number.isFinite(r), l = Number.isFinite(o), i = Number.isFinite(n) && n !== 1 || a || l;
|
|
2692
|
-
if (O() && i)
|
|
2693
|
-
return await Fe(t, { ...e, format: "png", quality: 1, meta: s });
|
|
2694
|
-
const c = new Image();
|
|
2695
|
-
if (c.decoding = "sync", c.loading = "eager", c.src = t, await c.decode(), a && l)
|
|
2696
|
-
c.style.width = `${r}px`, c.style.height = `${o}px`;
|
|
2697
|
-
else if (a) {
|
|
2698
|
-
const u = Number.isFinite(s.w0) ? s.w0 : c.naturalWidth, f = Number.isFinite(s.h0) ? s.h0 : c.naturalHeight, d = r / Math.max(1, u);
|
|
2699
|
-
c.style.width = `${r}px`, c.style.height = `${Math.round(f * d)}px`;
|
|
2700
|
-
} else if (l) {
|
|
2701
|
-
const u = Number.isFinite(s.w0) ? s.w0 : c.naturalWidth, f = Number.isFinite(s.h0) ? s.h0 : c.naturalHeight, d = o / Math.max(1, f);
|
|
2702
|
-
c.style.height = `${o}px`, c.style.width = `${Math.round(u * d)}px`;
|
|
2703
|
-
} else {
|
|
2704
|
-
const u = Math.round(c.naturalWidth * n), f = Math.round(c.naturalHeight * n);
|
|
2705
|
-
if (c.style.width = `${u}px`, c.style.height = `${f}px`, typeof t == "string" && t.startsWith("data:image/svg+xml"))
|
|
2706
|
-
try {
|
|
2707
|
-
const y = decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/, `width="${u}"`).replace(/height="[^"]*"/, `height="${f}"`);
|
|
2708
|
-
t = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`, c.src = t;
|
|
2709
|
-
} catch {
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
return c;
|
|
2713
|
-
}
|
|
2714
|
-
async function Ne(t, e) {
|
|
2715
|
-
const n = e.type;
|
|
2716
|
-
if (n === "svg") {
|
|
2717
|
-
const s = decodeURIComponent(t.split(",")[1]);
|
|
2718
|
-
return new Blob([s], { type: "image/svg+xml" });
|
|
2719
|
-
}
|
|
2720
|
-
const r = await xt(t, e), o = e.backgroundColor ? Bt(r, e.backgroundColor) : r;
|
|
2721
|
-
return new Promise(
|
|
2722
|
-
(s) => o.toBlob(
|
|
2723
|
-
(a) => s(a),
|
|
2724
|
-
`image/${n}`,
|
|
2725
|
-
e.quality
|
|
2726
|
-
)
|
|
2727
|
-
);
|
|
2728
|
-
}
|
|
2729
|
-
async function Tr(t, e) {
|
|
2730
|
-
if (e.dpr = 1, e.format === "svg") {
|
|
2731
|
-
const s = await Ne(t, { ...e, type: "svg" }), a = URL.createObjectURL(s), l = document.createElement("a");
|
|
2732
|
-
l.href = a, l.download = e.filename, l.click(), URL.revokeObjectURL(a);
|
|
2733
|
-
return;
|
|
2734
|
-
}
|
|
2735
|
-
const n = await xt(t, e), r = e.backgroundColor ? Bt(n, e.backgroundColor) : n, o = document.createElement("a");
|
|
2736
|
-
o.href = r.toDataURL(`image/${e.format}`, e.quality), o.download = e.filename, o.click();
|
|
2737
|
-
}
|
|
2738
|
-
var Le = /* @__PURE__ */ Symbol("snapdom.internal"), Ot = !1;
|
|
2739
|
-
async function E(t, e) {
|
|
2740
|
-
if (!t) throw new Error("Element cannot be null or undefined");
|
|
2741
|
-
const n = vr(e);
|
|
2742
|
-
if (O() && (n.embedFonts === !0 || Wr(t)))
|
|
2743
|
-
for (let r = 0; r < 3; r++)
|
|
2744
|
-
try {
|
|
2745
|
-
await Pr(t, e), console.log("Iteración número:", r), Ot = !1;
|
|
2746
|
-
} catch {
|
|
2747
|
-
}
|
|
2748
|
-
return n.iconFonts && n.iconFonts.length > 0 && Fn(n.iconFonts), n.snap || (n.snap = {
|
|
2749
|
-
toPng: (r, o) => E.toPng(r, o),
|
|
2750
|
-
toSvg: (r, o) => E.toSvg(r, o)
|
|
2751
|
-
}), E.capture(t, n, Le);
|
|
2752
|
-
}
|
|
2753
|
-
E.capture = async (t, e, n) => {
|
|
2754
|
-
if (n !== Le) throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");
|
|
2755
|
-
const r = await $e(t, e), o = (a) => ({ ...e, ...a || {} }), s = (a) => (l) => {
|
|
2756
|
-
const i = o({ ...l || {}, format: a }), c = a === "jpeg" || a === "jpg", u = i.backgroundColor == null || i.backgroundColor === "transparent";
|
|
2757
|
-
return c && u && (i.backgroundColor = "#ffffff"), Fe(r, i);
|
|
2758
|
-
};
|
|
2759
|
-
return {
|
|
2760
|
-
url: r,
|
|
2761
|
-
toRaw: () => r,
|
|
2762
|
-
toImg: (a) => ue(r, o(a)),
|
|
2763
|
-
toSvg: (a) => ue(r, o(a)),
|
|
2764
|
-
toCanvas: (a) => xt(r, o(a)),
|
|
2765
|
-
toBlob: (a) => Ne(r, o(a)),
|
|
2766
|
-
toPng: s("png"),
|
|
2767
|
-
toJpg: s("jpeg"),
|
|
2768
|
-
toWebp: s("webp"),
|
|
2769
|
-
download: (a) => Tr(r, o(a))
|
|
2770
|
-
};
|
|
2771
|
-
};
|
|
2772
|
-
E.toRaw = (t, e) => E(t, e).then((n) => n.toRaw());
|
|
2773
|
-
E.toImg = (t, e) => E(t, e).then((n) => n.toImg());
|
|
2774
|
-
E.toSvg = (t, e) => E(t, e).then((n) => n.toSvg());
|
|
2775
|
-
E.toCanvas = (t, e) => E(t, e).then((n) => n.toCanvas());
|
|
2776
|
-
E.toBlob = (t, e) => E(t, e).then((n) => n.toBlob());
|
|
2777
|
-
E.toPng = (t, e) => E(t, { ...e, format: "png" }).then((n) => n.toPng());
|
|
2778
|
-
E.toJpg = (t, e) => E(t, { ...e, format: "jpeg" }).then((n) => n.toJpg());
|
|
2779
|
-
E.toWebp = (t, e) => E(t, { ...e, format: "webp" }).then((n) => n.toWebp());
|
|
2780
|
-
E.download = (t, e) => E(t, e).then((n) => n.download());
|
|
2781
|
-
async function Pr(t, e) {
|
|
2782
|
-
if (Ot) return;
|
|
2783
|
-
const n = {
|
|
2784
|
-
...e,
|
|
2785
|
-
fast: !0,
|
|
2786
|
-
embedFonts: !0,
|
|
2787
|
-
scale: 0.2
|
|
2788
|
-
};
|
|
2789
|
-
let r;
|
|
2790
|
-
try {
|
|
2791
|
-
r = await $e(t, n);
|
|
2792
|
-
} catch {
|
|
2793
|
-
return;
|
|
2794
|
-
}
|
|
2795
|
-
await new Promise((o) => {
|
|
2796
|
-
const s = new Image();
|
|
2797
|
-
s.decoding = "sync", s.loading = "eager", s.style.position = "fixed", s.style.left = 0, s.style.top = 0, s.style.width = "10px", s.style.height = "10px", s.style.opacity = "0.01", s.style.transform = "translateZ(10px)", s.style.willChange = "transform,opacity;", s.src = r;
|
|
2798
|
-
const a = async () => {
|
|
2799
|
-
await new Promise((l) => setTimeout(l, 100)), s && s.parentNode && s.parentNode.removeChild(s), Ot = !0, o();
|
|
2800
|
-
};
|
|
2801
|
-
document.body.appendChild(s), a();
|
|
2802
|
-
});
|
|
2803
|
-
}
|
|
2804
|
-
function Wr(t) {
|
|
2805
|
-
const e = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
|
|
2806
|
-
for (; e.nextNode(); ) {
|
|
2807
|
-
const n = (
|
|
2808
|
-
/** @type {Element} */
|
|
2809
|
-
e.currentNode
|
|
2810
|
-
), r = getComputedStyle(n), o = r.backgroundImage && r.backgroundImage !== "none", s = r.maskImage && r.maskImage !== "none" || r.webkitMaskImage && r.webkitMaskImage !== "none";
|
|
2811
|
-
if (o || s) return !0;
|
|
2812
|
-
}
|
|
2813
|
-
return !1;
|
|
2814
|
-
}
|
|
2815
|
-
async function Hr(t = document, e = {}) {
|
|
2816
|
-
const {
|
|
2817
|
-
embedFonts: n = !0,
|
|
2818
|
-
useProxy: r = ""
|
|
2819
|
-
} = e, o = e.cache ?? e.cacheOpt ?? "full";
|
|
2820
|
-
fe(o);
|
|
2821
|
-
try {
|
|
2822
|
-
await document.fonts?.ready;
|
|
2823
|
-
} catch {
|
|
2824
|
-
}
|
|
2825
|
-
try {
|
|
2826
|
-
Ye();
|
|
2827
|
-
} catch {
|
|
2828
|
-
}
|
|
2829
|
-
w.session = w.session || {}, w.session.styleCache || (w.session.styleCache = /* @__PURE__ */ new WeakMap()), w.image = w.image || /* @__PURE__ */ new Map();
|
|
2830
|
-
try {
|
|
2831
|
-
await ve(
|
|
2832
|
-
t,
|
|
2833
|
-
/* mirror */
|
|
2834
|
-
void 0,
|
|
2835
|
-
w.session.styleCache,
|
|
2836
|
-
{ useProxy: r }
|
|
2837
|
-
);
|
|
2838
|
-
} catch {
|
|
2839
|
-
}
|
|
2840
|
-
let s = [], a = [];
|
|
2841
|
-
try {
|
|
2842
|
-
t?.querySelectorAll && (s = Array.from(t.querySelectorAll("img[src]")), a = Array.from(t.querySelectorAll("*")));
|
|
2843
|
-
} catch {
|
|
2844
|
-
}
|
|
2845
|
-
const l = [];
|
|
2846
|
-
for (const i of s) {
|
|
2847
|
-
const c = i?.currentSrc || i?.src;
|
|
2848
|
-
if (c && !w.image.has(c)) {
|
|
2849
|
-
const u = Promise.resolve().then(async () => {
|
|
2850
|
-
const f = await _(c, { as: "dataURL", useProxy: r });
|
|
2851
|
-
f?.ok && typeof f.data == "string" && w.image.set(c, f.data);
|
|
2852
|
-
}).catch(() => {
|
|
2853
|
-
});
|
|
2854
|
-
l.push(u);
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
for (const i of a) {
|
|
2858
|
-
let c = "";
|
|
2859
|
-
try {
|
|
2860
|
-
c = Ht(i).backgroundImage;
|
|
2861
|
-
} catch {
|
|
2862
|
-
}
|
|
2863
|
-
if (c && c !== "none") {
|
|
2864
|
-
const u = qt(c);
|
|
2865
|
-
for (const f of u)
|
|
2866
|
-
if (f.startsWith("url(")) {
|
|
2867
|
-
const d = Promise.resolve().then(() => Dt(f, { ...e, useProxy: r })).catch(() => {
|
|
2868
|
-
});
|
|
2869
|
-
l.push(d);
|
|
2870
|
-
}
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
if (n)
|
|
2874
|
-
try {
|
|
2875
|
-
const i = xe(t), c = Ce(t);
|
|
2876
|
-
if (typeof O == "function" ? O() : !!O) {
|
|
2877
|
-
const f = new Set(
|
|
2878
|
-
Array.from(i).map((d) => String(d).split("__")[0]).filter(Boolean)
|
|
2879
|
-
);
|
|
2880
|
-
await Me(f, 3);
|
|
2881
|
-
}
|
|
2882
|
-
await Se({
|
|
2883
|
-
required: i,
|
|
2884
|
-
usedCodepoints: c,
|
|
2885
|
-
exclude: e.excludeFonts,
|
|
2886
|
-
localFonts: e.localFonts,
|
|
2887
|
-
useProxy: e.useProxy ?? r
|
|
2888
|
-
});
|
|
2889
|
-
} catch {
|
|
2890
|
-
}
|
|
2891
|
-
await Promise.allSettled(l);
|
|
2892
|
-
}
|
|
2893
|
-
export {
|
|
2894
|
-
Hr as preCache,
|
|
2895
|
-
E as snapdom
|
|
2896
|
-
};
|