pixelagent 0.1.27 → 0.1.28
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/dist/{captureBehind-DUL_bR7u.js → captureBehind-Cz9XErY8.js} +238 -222
- package/dist/{captureBehind-DUL_bR7u.js.map → captureBehind-Cz9XErY8.js.map} +1 -1
- package/dist/glass/GlassSurface.d.ts +7 -0
- package/dist/glass/GlassSurface.d.ts.map +1 -1
- package/dist/glass/captureBehind.d.ts +18 -0
- package/dist/glass/captureBehind.d.ts.map +1 -1
- package/dist/pixelagent.js +304 -296
- package/dist/pixelagent.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
const
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
const J = "[modern-screenshot]", T = typeof window < "u", ge = T && "Worker" in window;
|
|
2
|
+
var Q;
|
|
3
|
+
const q = T ? (Q = window.navigator) == null ? void 0 : Q.userAgent : "", Z = q.includes("Chrome"), D = q.includes("AppleWebKit") && !Z, W = q.includes("Firefox"), me = (e) => e && "__CONTEXT__" in e, he = (e) => e.constructor.name === "CSSFontFaceRule", pe = (e) => e.constructor.name === "CSSImportRule", we = (e) => e.constructor.name === "CSSLayerBlockRule", v = (e) => e.nodeType === 1, _ = (e) => typeof e.className == "object", ee = (e) => e.tagName === "image", ye = (e) => e.tagName === "use", A = (e) => v(e) && typeof e.style < "u" && !_(e), Se = (e) => e.nodeType === 8, be = (e) => e.nodeType === 3, R = (e) => e.tagName === "IMG", $ = (e) => e.tagName === "VIDEO", Ee = (e) => e.tagName === "CANVAS", Ce = (e) => e.tagName === "TEXTAREA", ve = (e) => e.tagName === "INPUT", Ne = (e) => e.tagName === "STYLE", Te = (e) => e.tagName === "SCRIPT", Re = (e) => e.tagName === "SELECT", Ae = (e) => e.tagName === "SLOT", ke = (e) => e.tagName === "IFRAME", Ie = (...e) => console.warn(J, ...e);
|
|
4
|
+
function _e(e) {
|
|
5
5
|
var r;
|
|
6
6
|
const t = (r = e == null ? void 0 : e.createElement) == null ? void 0 : r.call(e, "canvas");
|
|
7
7
|
return t && (t.height = t.width = 1), !!t && "toDataURL" in t && !!t.toDataURL("image/webp").includes("image/webp");
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
function
|
|
9
|
+
const L = (e) => e.startsWith("data:");
|
|
10
|
+
function te(e, t) {
|
|
11
11
|
if (e.match(/^[a-z]+:\/\//i))
|
|
12
12
|
return e;
|
|
13
13
|
if (T && e.match(/^\/\//))
|
|
14
14
|
return window.location.protocol + e;
|
|
15
15
|
if (e.match(/^[a-z]+:/i) || !T)
|
|
16
16
|
return e;
|
|
17
|
-
const r =
|
|
17
|
+
const r = x().implementation.createHTMLDocument(), n = r.createElement("base"), i = r.createElement("a");
|
|
18
18
|
return r.head.appendChild(n), r.body.appendChild(i), t && (n.href = t), i.href = e, i.href;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function x(e) {
|
|
21
21
|
return (e && v(e) ? e == null ? void 0 : e.ownerDocument : e) ?? window.document;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
const n =
|
|
23
|
+
const P = "http://www.w3.org/2000/svg";
|
|
24
|
+
function Fe(e, t, r) {
|
|
25
|
+
const n = x(r).createElementNS(P, "svg");
|
|
26
26
|
return n.setAttributeNS(null, "width", e.toString()), n.setAttributeNS(null, "height", t.toString()), n.setAttributeNS(null, "viewBox", `0 0 ${e} ${t}`), n;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function De(e, t) {
|
|
29
29
|
let r = new XMLSerializer().serializeToString(e);
|
|
30
30
|
return t && (r = r.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu, "")), `data:image/svg+xml;charset=utf-8,${encodeURIComponent(r)}`;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Me(e, t) {
|
|
33
33
|
return new Promise((r, n) => {
|
|
34
34
|
const i = new FileReader();
|
|
35
35
|
i.onload = () => r(i.result), i.onerror = () => n(i.error), i.onabort = () => n(new Error(`Failed read blob to ${t}`)), i.readAsDataURL(e);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const $e = (e) => Me(e, "dataUrl");
|
|
39
39
|
function N(e, t) {
|
|
40
|
-
const r =
|
|
40
|
+
const r = x(t).createElement("img");
|
|
41
41
|
return r.decoding = "sync", r.loading = "eager", r.src = e, r;
|
|
42
42
|
}
|
|
43
43
|
function k(e, t) {
|
|
44
44
|
return new Promise((r) => {
|
|
45
|
-
const { timeout: n, ownerDocument: i, onError: o, onWarn: a } = t ?? {}, s = typeof e == "string" ? N(e,
|
|
45
|
+
const { timeout: n, ownerDocument: i, onError: o, onWarn: a } = t ?? {}, s = typeof e == "string" ? N(e, x(i)) : e;
|
|
46
46
|
let c = null, u = null;
|
|
47
47
|
function l() {
|
|
48
48
|
r(s), c && clearTimeout(c), u == null || u();
|
|
49
49
|
}
|
|
50
50
|
if (n && (c = setTimeout(l, n)), $(s)) {
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
51
|
+
const g = s.currentSrc || s.src;
|
|
52
|
+
if (!g)
|
|
53
53
|
return s.poster ? k(s.poster, t).then(r) : l();
|
|
54
54
|
if (s.readyState >= 2)
|
|
55
55
|
return l();
|
|
56
|
-
const m = l, f = (
|
|
56
|
+
const m = l, f = (h) => {
|
|
57
57
|
a == null || a(
|
|
58
58
|
"Failed video load",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
), o == null || o(
|
|
59
|
+
g,
|
|
60
|
+
h
|
|
61
|
+
), o == null || o(h), l();
|
|
62
62
|
};
|
|
63
63
|
u = () => {
|
|
64
64
|
s.removeEventListener("loadeddata", m), s.removeEventListener("error", f);
|
|
65
65
|
}, s.addEventListener("loadeddata", m, { once: !0 }), s.addEventListener("error", f, { once: !0 });
|
|
66
66
|
} else {
|
|
67
|
-
const
|
|
68
|
-
if (!
|
|
67
|
+
const g = ee(s) ? s.href.baseVal : s.currentSrc || s.src;
|
|
68
|
+
if (!g)
|
|
69
69
|
return l();
|
|
70
70
|
const m = async () => {
|
|
71
71
|
if (R(s) && "decode" in s)
|
|
72
72
|
try {
|
|
73
73
|
await s.decode();
|
|
74
|
-
} catch (
|
|
74
|
+
} catch (h) {
|
|
75
75
|
a == null || a(
|
|
76
76
|
"Failed to decode image, trying to render anyway",
|
|
77
|
-
s.dataset.originalSrc ||
|
|
78
|
-
|
|
77
|
+
s.dataset.originalSrc || g,
|
|
78
|
+
h
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
l();
|
|
82
|
-
}, f = (
|
|
82
|
+
}, f = (h) => {
|
|
83
83
|
a == null || a(
|
|
84
84
|
"Failed image load",
|
|
85
|
-
s.dataset.originalSrc ||
|
|
86
|
-
|
|
85
|
+
s.dataset.originalSrc || g,
|
|
86
|
+
h
|
|
87
87
|
), l();
|
|
88
88
|
};
|
|
89
89
|
if (R(s) && s.complete)
|
|
@@ -94,40 +94,40 @@ function k(e, t) {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
async function
|
|
97
|
+
async function xe(e, t) {
|
|
98
98
|
A(e) && (R(e) || $(e) ? await k(e, t) : await Promise.all(
|
|
99
99
|
["img", "video"].flatMap((r) => Array.from(e.querySelectorAll(r)).map((n) => k(n, t)))
|
|
100
100
|
));
|
|
101
101
|
}
|
|
102
|
-
const
|
|
102
|
+
const re = /* @__PURE__ */ (function() {
|
|
103
103
|
let t = 0;
|
|
104
104
|
const r = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
|
|
105
105
|
return () => (t += 1, `u${r()}${t}`);
|
|
106
106
|
})();
|
|
107
|
-
function
|
|
107
|
+
function ne(e) {
|
|
108
108
|
return e == null ? void 0 : e.split(",").map((t) => t.trim().replace(/"|'/g, "").toLowerCase()).filter(Boolean);
|
|
109
109
|
}
|
|
110
110
|
let j = 0;
|
|
111
111
|
function Pe(e) {
|
|
112
|
-
const t = `${
|
|
112
|
+
const t = `${J}[#${j}]`;
|
|
113
113
|
return j++, {
|
|
114
114
|
// eslint-disable-next-line no-console
|
|
115
115
|
time: (r) => e && console.time(`${t} ${r}`),
|
|
116
116
|
// eslint-disable-next-line no-console
|
|
117
117
|
timeEnd: (r) => e && console.timeEnd(`${t} ${r}`),
|
|
118
|
-
warn: (...r) => e &&
|
|
118
|
+
warn: (...r) => e && Ie(...r)
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function Ue(e) {
|
|
122
122
|
return {
|
|
123
123
|
cache: e ? "no-cache" : "force-cache"
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
async function
|
|
127
|
-
return me(e) ? e :
|
|
126
|
+
async function se(e, t) {
|
|
127
|
+
return me(e) ? e : Le(e, { ...t, autoDestruct: !0 });
|
|
128
128
|
}
|
|
129
|
-
async function
|
|
130
|
-
var f,
|
|
129
|
+
async function Le(e, t) {
|
|
130
|
+
var f, h;
|
|
131
131
|
const { scale: r = 1, workerUrl: n, workerNumber: i = 1 } = t || {}, o = !!(t != null && t.debug), a = (t == null ? void 0 : t.features) ?? !0, s = e.ownerDocument ?? (T ? window.document : void 0), c = ((f = e.ownerDocument) == null ? void 0 : f.defaultView) ?? (T ? window : void 0), u = /* @__PURE__ */ new Map(), l = {
|
|
132
132
|
// Options
|
|
133
133
|
width: 0,
|
|
@@ -143,7 +143,7 @@ async function Ue(e, t) {
|
|
|
143
143
|
progress: null,
|
|
144
144
|
debug: o,
|
|
145
145
|
fetch: {
|
|
146
|
-
requestInit:
|
|
146
|
+
requestInit: Ue((h = t == null ? void 0 : t.fetch) == null ? void 0 : h.bypassingCache),
|
|
147
147
|
placeholderImage: "data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
148
148
|
bypassingCache: !1,
|
|
149
149
|
...t == null ? void 0 : t.fetch
|
|
@@ -167,13 +167,13 @@ async function Ue(e, t) {
|
|
|
167
167
|
ownerDocument: s,
|
|
168
168
|
ownerWindow: c,
|
|
169
169
|
dpi: r === 1 ? null : 96 * r,
|
|
170
|
-
svgStyleElement:
|
|
171
|
-
svgDefsElement: s == null ? void 0 : s.createElementNS(
|
|
170
|
+
svgStyleElement: oe(s),
|
|
171
|
+
svgDefsElement: s == null ? void 0 : s.createElementNS(P, "defs"),
|
|
172
172
|
svgStyles: /* @__PURE__ */ new Map(),
|
|
173
173
|
defaultComputedStyles: /* @__PURE__ */ new Map(),
|
|
174
174
|
workers: [
|
|
175
175
|
...Array.from({
|
|
176
|
-
length:
|
|
176
|
+
length: ge && n && i ? i : 0
|
|
177
177
|
})
|
|
178
178
|
].map(() => {
|
|
179
179
|
try {
|
|
@@ -194,7 +194,7 @@ async function Ue(e, t) {
|
|
|
194
194
|
fontFamilies: /* @__PURE__ */ new Map(),
|
|
195
195
|
fontCssTexts: /* @__PURE__ */ new Map(),
|
|
196
196
|
acceptOfImage: `${[
|
|
197
|
-
|
|
197
|
+
_e(s) && "image/webp",
|
|
198
198
|
"image/svg+xml",
|
|
199
199
|
"image/*",
|
|
200
200
|
"*/*"
|
|
@@ -206,11 +206,11 @@ async function Ue(e, t) {
|
|
|
206
206
|
isEnable: (d) => d === "restoreScrollPosition" ? typeof a == "boolean" ? !1 : a[d] ?? !1 : typeof a == "boolean" ? a : a[d] ?? !0,
|
|
207
207
|
shadowRoots: []
|
|
208
208
|
};
|
|
209
|
-
l.log.time("wait until load"), await
|
|
210
|
-
const { width:
|
|
211
|
-
return l.width =
|
|
209
|
+
l.log.time("wait until load"), await xe(e, { timeout: l.timeout, onWarn: l.log.warn }), l.log.timeEnd("wait until load");
|
|
210
|
+
const { width: g, height: m } = Be(e, l);
|
|
211
|
+
return l.width = g, l.height = m, l;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function oe(e) {
|
|
214
214
|
if (!e)
|
|
215
215
|
return;
|
|
216
216
|
const t = e.createElement("style"), r = t.ownerDocument.createTextNode(`
|
|
@@ -221,7 +221,7 @@ function se(e) {
|
|
|
221
221
|
`);
|
|
222
222
|
return t.appendChild(r), t;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Be(e, t) {
|
|
225
225
|
let { width: r, height: n } = t;
|
|
226
226
|
if (v(e) && (!r || !n)) {
|
|
227
227
|
const i = e.getBoundingClientRect();
|
|
@@ -229,7 +229,7 @@ function Le(e, t) {
|
|
|
229
229
|
}
|
|
230
230
|
return { width: r, height: n };
|
|
231
231
|
}
|
|
232
|
-
async function
|
|
232
|
+
async function Oe(e, t) {
|
|
233
233
|
const {
|
|
234
234
|
log: r,
|
|
235
235
|
timeout: n,
|
|
@@ -237,7 +237,7 @@ async function Be(e, t) {
|
|
|
237
237
|
drawImageInterval: o
|
|
238
238
|
} = t;
|
|
239
239
|
r.time("image to canvas");
|
|
240
|
-
const a = await k(e, { timeout: n, onWarn: t.log.warn }), { canvas: s, context2d: c } =
|
|
240
|
+
const a = await k(e, { timeout: n, onWarn: t.log.warn }), { canvas: s, context2d: c } = qe(e.ownerDocument, t), u = () => {
|
|
241
241
|
try {
|
|
242
242
|
c == null || c.drawImage(a, 0, 0, s.width, s.height);
|
|
243
243
|
} catch (l) {
|
|
@@ -246,20 +246,20 @@ async function Be(e, t) {
|
|
|
246
246
|
};
|
|
247
247
|
if (u(), t.isEnable("fixSvgXmlDecode"))
|
|
248
248
|
for (let l = 0; l < i; l++)
|
|
249
|
-
await new Promise((
|
|
249
|
+
await new Promise((g) => {
|
|
250
250
|
setTimeout(() => {
|
|
251
|
-
c == null || c.clearRect(0, 0, s.width, s.height), u(),
|
|
251
|
+
c == null || c.clearRect(0, 0, s.width, s.height), u(), g();
|
|
252
252
|
}, l + o);
|
|
253
253
|
});
|
|
254
254
|
return t.drawImageCount = 0, r.timeEnd("image to canvas"), s;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function qe(e, t) {
|
|
257
257
|
const { width: r, height: n, scale: i, backgroundColor: o, maximumCanvasSize: a } = t, s = e.createElement("canvas");
|
|
258
258
|
s.width = Math.floor(r * i), s.height = Math.floor(n * i), s.style.width = `${r}px`, s.style.height = `${n}px`, a && (s.width > a || s.height > a) && (s.width > a && s.height > a ? s.width > s.height ? (s.height *= a / s.width, s.width = a) : (s.width *= a / s.height, s.height = a) : s.width > a ? (s.height *= a / s.width, s.width = a) : (s.width *= a / s.height, s.height = a));
|
|
259
259
|
const c = s.getContext("2d");
|
|
260
260
|
return c && o && (c.fillStyle = o, c.fillRect(0, 0, s.width, s.height)), { canvas: s, context2d: c };
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function ae(e, t) {
|
|
263
263
|
if (e.ownerDocument)
|
|
264
264
|
try {
|
|
265
265
|
const o = e.toDataURL();
|
|
@@ -280,21 +280,21 @@ function oe(e, t) {
|
|
|
280
280
|
}
|
|
281
281
|
return r;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function We(e, t) {
|
|
284
284
|
var r;
|
|
285
285
|
try {
|
|
286
286
|
if ((r = e == null ? void 0 : e.contentDocument) != null && r.documentElement)
|
|
287
|
-
return
|
|
287
|
+
return V(e.contentDocument.documentElement, t);
|
|
288
288
|
} catch (n) {
|
|
289
289
|
t.log.warn("Failed to clone iframe", n);
|
|
290
290
|
}
|
|
291
291
|
return e.cloneNode(!1);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Ve(e) {
|
|
294
294
|
const t = e.cloneNode(!1);
|
|
295
295
|
return e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager"), t;
|
|
296
296
|
}
|
|
297
|
-
async function
|
|
297
|
+
async function He(e, t) {
|
|
298
298
|
if (e.ownerDocument && !e.currentSrc && e.poster)
|
|
299
299
|
return N(e.poster, e.ownerDocument);
|
|
300
300
|
const r = e.cloneNode(!1);
|
|
@@ -315,35 +315,35 @@ async function Ve(e, t) {
|
|
|
315
315
|
} catch (a) {
|
|
316
316
|
return t.log.warn("Failed to clone video", a), e.poster ? N(e.poster, e.ownerDocument) : r;
|
|
317
317
|
}
|
|
318
|
-
return
|
|
318
|
+
return ae(o, t);
|
|
319
319
|
}
|
|
320
320
|
return r;
|
|
321
321
|
}
|
|
322
322
|
function je(e, t) {
|
|
323
|
-
return
|
|
323
|
+
return Ee(e) ? ae(e, t) : ke(e) ? We(e, t) : R(e) ? Ve(e) : $(e) ? He(e, t) : e.cloneNode(!1);
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function ze(e) {
|
|
326
326
|
let t = e.sandbox;
|
|
327
327
|
if (!t) {
|
|
328
328
|
const { ownerDocument: r } = e;
|
|
329
329
|
try {
|
|
330
|
-
r && (t = r.createElement("iframe"), t.id = `__SANDBOX__${
|
|
330
|
+
r && (t = r.createElement("iframe"), t.id = `__SANDBOX__${re()}`, t.width = "0", t.height = "0", t.style.visibility = "hidden", t.style.position = "fixed", r.body.appendChild(t), t.srcdoc = '<!DOCTYPE html><meta charset="UTF-8"><title></title><body>', e.sandbox = t);
|
|
331
331
|
} catch (n) {
|
|
332
332
|
e.log.warn("Failed to getSandBox", n);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
return t;
|
|
336
336
|
}
|
|
337
|
-
const
|
|
337
|
+
const Xe = [
|
|
338
338
|
"width",
|
|
339
339
|
"height",
|
|
340
340
|
"-webkit-text-fill-color"
|
|
341
|
-
],
|
|
341
|
+
], Ge = [
|
|
342
342
|
"stroke",
|
|
343
343
|
"fill"
|
|
344
344
|
];
|
|
345
|
-
function
|
|
346
|
-
const { defaultComputedStyles: n } = r, i = e.nodeName.toLowerCase(), o = _(e) && i !== "svg", a = o ?
|
|
345
|
+
function ie(e, t, r) {
|
|
346
|
+
const { defaultComputedStyles: n } = r, i = e.nodeName.toLowerCase(), o = _(e) && i !== "svg", a = o ? Ge.map((d) => [d, e.getAttribute(d)]).filter(([, d]) => d !== null) : [], s = [
|
|
347
347
|
o && "svg",
|
|
348
348
|
i,
|
|
349
349
|
a.map((d, p) => `${d}=${p}`).join(","),
|
|
@@ -351,22 +351,22 @@ function ae(e, t, r) {
|
|
|
351
351
|
].filter(Boolean).join(":");
|
|
352
352
|
if (n.has(s))
|
|
353
353
|
return n.get(s);
|
|
354
|
-
const c =
|
|
354
|
+
const c = ze(r), u = c == null ? void 0 : c.contentWindow;
|
|
355
355
|
if (!u)
|
|
356
356
|
return /* @__PURE__ */ new Map();
|
|
357
357
|
const l = u == null ? void 0 : u.document;
|
|
358
|
-
let
|
|
359
|
-
o ? (
|
|
358
|
+
let g, m;
|
|
359
|
+
o ? (g = l.createElementNS(P, "svg"), m = g.ownerDocument.createElementNS(g.namespaceURI, i), a.forEach(([d, p]) => {
|
|
360
360
|
m.setAttributeNS(null, d, p);
|
|
361
|
-
}),
|
|
362
|
-
const f = u.getComputedStyle(m, t),
|
|
361
|
+
}), g.appendChild(m)) : g = m = l.createElement(i), m.textContent = " ", l.body.appendChild(g);
|
|
362
|
+
const f = u.getComputedStyle(m, t), h = /* @__PURE__ */ new Map();
|
|
363
363
|
for (let d = f.length, p = 0; p < d; p++) {
|
|
364
364
|
const y = f.item(p);
|
|
365
|
-
|
|
365
|
+
Xe.includes(y) || h.set(y, f.getPropertyValue(y));
|
|
366
366
|
}
|
|
367
|
-
return l.body.removeChild(
|
|
367
|
+
return l.body.removeChild(g), n.set(s, h), h;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function le(e, t, r) {
|
|
370
370
|
var s;
|
|
371
371
|
const n = /* @__PURE__ */ new Map(), i = [], o = /* @__PURE__ */ new Map();
|
|
372
372
|
if (r)
|
|
@@ -378,9 +378,9 @@ function ie(e, t, r) {
|
|
|
378
378
|
a(l);
|
|
379
379
|
}
|
|
380
380
|
for (let c = i.length, u = 0; u < c; u++)
|
|
381
|
-
(s = o.get(i[u])) == null || s.forEach((l,
|
|
381
|
+
(s = o.get(i[u])) == null || s.forEach((l, g) => n.set(g, l));
|
|
382
382
|
function a(c) {
|
|
383
|
-
const u = e.getPropertyValue(c), l = e.getPropertyPriority(c),
|
|
383
|
+
const u = e.getPropertyValue(c), l = e.getPropertyPriority(c), g = c.lastIndexOf("-"), m = g > -1 ? c.substring(0, g) : void 0;
|
|
384
384
|
if (m) {
|
|
385
385
|
let f = o.get(m);
|
|
386
386
|
f || (f = /* @__PURE__ */ new Map(), o.set(m, f)), f.set(c, [u, l]);
|
|
@@ -389,14 +389,14 @@ function ie(e, t, r) {
|
|
|
389
389
|
}
|
|
390
390
|
return n;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
var
|
|
394
|
-
const { ownerWindow: i, includeStyleProperties: o, currentParentNodeStyle: a } = n, s = t.style, c = i.getComputedStyle(e), u =
|
|
392
|
+
function Ye(e, t, r, n) {
|
|
393
|
+
var g, m, f, h;
|
|
394
|
+
const { ownerWindow: i, includeStyleProperties: o, currentParentNodeStyle: a } = n, s = t.style, c = i.getComputedStyle(e), u = ie(e, null, n);
|
|
395
395
|
a == null || a.forEach((d, p) => {
|
|
396
396
|
u.delete(p);
|
|
397
397
|
});
|
|
398
|
-
const l =
|
|
399
|
-
l.delete("transition-property"), l.delete("all"), l.delete("d"), l.delete("content"), r && (l.delete("position"), l.delete("margin-top"), l.delete("margin-right"), l.delete("margin-bottom"), l.delete("margin-left"), l.delete("margin-block-start"), l.delete("margin-block-end"), l.delete("margin-inline-start"), l.delete("margin-inline-end"), l.set("box-sizing", ["border-box", ""])), ((
|
|
398
|
+
const l = le(c, u, o);
|
|
399
|
+
l.delete("transition-property"), l.delete("all"), l.delete("d"), l.delete("content"), r && (l.delete("position"), l.delete("margin-top"), l.delete("margin-right"), l.delete("margin-bottom"), l.delete("margin-left"), l.delete("margin-block-start"), l.delete("margin-block-end"), l.delete("margin-inline-start"), l.delete("margin-inline-end"), l.set("box-sizing", ["border-box", ""])), ((g = l.get("background-clip")) == null ? void 0 : g[0]) === "text" && t.classList.add("______background-clip--text"), Z && (l.has("font-kerning") || l.set("font-kerning", ["normal", ""]), (((m = l.get("overflow-x")) == null ? void 0 : m[0]) === "hidden" || ((f = l.get("overflow-y")) == null ? void 0 : f[0]) === "hidden") && ((h = l.get("text-overflow")) == null ? void 0 : h[0]) === "ellipsis" && e.scrollWidth === e.clientWidth && l.set("text-overflow", ["clip", ""]));
|
|
400
400
|
for (let d = s.length, p = 0; p < d; p++)
|
|
401
401
|
s.removeProperty(s.item(p));
|
|
402
402
|
return l.forEach(([d, p], y) => {
|
|
@@ -404,13 +404,13 @@ function Ge(e, t, r, n) {
|
|
|
404
404
|
}), l;
|
|
405
405
|
}
|
|
406
406
|
function Ke(e, t) {
|
|
407
|
-
(
|
|
407
|
+
(Ce(e) || ve(e) || Re(e)) && t.setAttribute("value", e.value);
|
|
408
408
|
}
|
|
409
|
-
const
|
|
409
|
+
const Qe = [
|
|
410
410
|
"::before",
|
|
411
411
|
"::after"
|
|
412
412
|
// '::placeholder', TODO
|
|
413
|
-
],
|
|
413
|
+
], Je = [
|
|
414
414
|
"::-webkit-scrollbar",
|
|
415
415
|
"::-webkit-scrollbar-button",
|
|
416
416
|
// '::-webkit-scrollbar:horizontal', TODO
|
|
@@ -421,22 +421,22 @@ const Ye = [
|
|
|
421
421
|
"::-webkit-scrollbar-corner",
|
|
422
422
|
"::-webkit-resizer"
|
|
423
423
|
];
|
|
424
|
-
function
|
|
424
|
+
function Ze(e, t, r, n, i) {
|
|
425
425
|
const { ownerWindow: o, svgStyleElement: a, svgStyles: s, currentNodeStyle: c } = n;
|
|
426
426
|
if (!a || !o)
|
|
427
427
|
return;
|
|
428
428
|
function u(l) {
|
|
429
429
|
var w;
|
|
430
|
-
const
|
|
431
|
-
let m =
|
|
430
|
+
const g = o.getComputedStyle(e, l);
|
|
431
|
+
let m = g.getPropertyValue("content");
|
|
432
432
|
if (!m || m === "none")
|
|
433
433
|
return;
|
|
434
434
|
i == null || i(m), m = m.replace(/(')|(")|(counter\(.+\))/g, "");
|
|
435
|
-
const f = [
|
|
435
|
+
const f = [re()], h = ie(e, l, n);
|
|
436
436
|
c == null || c.forEach((b, E) => {
|
|
437
|
-
|
|
437
|
+
h.delete(E);
|
|
438
438
|
});
|
|
439
|
-
const d =
|
|
439
|
+
const d = le(g, h, n.includeStyleProperties);
|
|
440
440
|
d.delete("content"), d.delete("-webkit-locale"), ((w = d.get("background-clip")) == null ? void 0 : w[0]) === "text" && t.classList.add("______background-clip--text");
|
|
441
441
|
const p = [
|
|
442
442
|
`content: '${m}';`
|
|
@@ -456,33 +456,33 @@ function Je(e, t, r, n, i) {
|
|
|
456
456
|
let S = s.get(y);
|
|
457
457
|
S || (S = [], s.set(y, S)), S.push(`.${f[0]}${l}`);
|
|
458
458
|
}
|
|
459
|
-
|
|
459
|
+
Qe.forEach(u), r && Je.forEach(u);
|
|
460
460
|
}
|
|
461
|
-
const
|
|
461
|
+
const z = /* @__PURE__ */ new Set([
|
|
462
462
|
"symbol"
|
|
463
463
|
// test/fixtures/svg.symbol.html
|
|
464
464
|
]);
|
|
465
|
-
async function
|
|
466
|
-
if (v(r) && (
|
|
465
|
+
async function X(e, t, r, n, i) {
|
|
466
|
+
if (v(r) && (Ne(r) || Te(r)) || n.filter && !n.filter(r))
|
|
467
467
|
return;
|
|
468
|
-
|
|
469
|
-
const o = await
|
|
470
|
-
n.isEnable("restoreScrollPosition") &&
|
|
468
|
+
z.has(t.nodeName) || z.has(r.nodeName) ? n.currentParentNodeStyle = void 0 : n.currentParentNodeStyle = n.currentNodeStyle;
|
|
469
|
+
const o = await V(r, n, !1, i);
|
|
470
|
+
n.isEnable("restoreScrollPosition") && et(e, o), t.appendChild(o);
|
|
471
471
|
}
|
|
472
|
-
async function
|
|
472
|
+
async function G(e, t, r, n) {
|
|
473
473
|
var o;
|
|
474
474
|
let i = e.firstChild;
|
|
475
475
|
v(e) && e.shadowRoot && (i = (o = e.shadowRoot) == null ? void 0 : o.firstChild, r.shadowRoots.push(e.shadowRoot));
|
|
476
476
|
for (let a = i; a; a = a.nextSibling)
|
|
477
|
-
if (!
|
|
478
|
-
if (v(a) &&
|
|
477
|
+
if (!Se(a))
|
|
478
|
+
if (v(a) && Ae(a) && typeof a.assignedNodes == "function") {
|
|
479
479
|
const s = a.assignedNodes();
|
|
480
480
|
for (let c = 0; c < s.length; c++)
|
|
481
|
-
await
|
|
481
|
+
await X(e, t, s[c], r, n);
|
|
482
482
|
} else
|
|
483
|
-
await
|
|
483
|
+
await X(e, t, a, r, n);
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function et(e, t) {
|
|
486
486
|
if (!A(e) || !A(t))
|
|
487
487
|
return;
|
|
488
488
|
const { scrollTop: r, scrollLeft: n } = e;
|
|
@@ -491,16 +491,16 @@ function Ze(e, t) {
|
|
|
491
491
|
const { transform: i } = t.style, o = new DOMMatrix(i), { a, b: s, c, d: u } = o;
|
|
492
492
|
o.a = 1, o.b = 0, o.c = 0, o.d = 1, o.translateSelf(-n, -r), o.a = a, o.b = s, o.c = c, o.d = u, t.style.transform = o.toString();
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function tt(e, t) {
|
|
495
495
|
const { backgroundColor: r, width: n, height: i, style: o } = t, a = e.style;
|
|
496
496
|
if (r && a.setProperty("background-color", r, "important"), n && a.setProperty("width", `${n}px`, "important"), i && a.setProperty("height", `${i}px`, "important"), o)
|
|
497
497
|
for (const s in o) a[s] = o[s];
|
|
498
498
|
}
|
|
499
|
-
const
|
|
500
|
-
async function
|
|
501
|
-
var u, l,
|
|
499
|
+
const rt = /^[\w-:]+$/;
|
|
500
|
+
async function V(e, t, r = !1, n) {
|
|
501
|
+
var u, l, g, m;
|
|
502
502
|
const { ownerDocument: i, ownerWindow: o, fontFamilies: a, onCloneEachNode: s } = t;
|
|
503
|
-
if (i &&
|
|
503
|
+
if (i && be(e))
|
|
504
504
|
return n && /\S/.test(e.data) && n(e.data), i.createTextNode(e.data);
|
|
505
505
|
if (i && o && v(e) && (A(e) || _(e))) {
|
|
506
506
|
const f = await je(e, t);
|
|
@@ -508,32 +508,32 @@ async function W(e, t, r = !1, n) {
|
|
|
508
508
|
const w = f.getAttributeNames();
|
|
509
509
|
for (let b = w.length, E = 0; E < b; E++) {
|
|
510
510
|
const C = w[E];
|
|
511
|
-
|
|
511
|
+
rt.test(C) || f.removeAttribute(C);
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
const
|
|
515
|
-
r &&
|
|
514
|
+
const h = t.currentNodeStyle = Ye(e, f, r, t);
|
|
515
|
+
r && tt(f, t);
|
|
516
516
|
let d = !1;
|
|
517
517
|
if (t.isEnable("copyScrollbar")) {
|
|
518
518
|
const w = [
|
|
519
|
-
(u =
|
|
520
|
-
(l =
|
|
519
|
+
(u = h.get("overflow-x")) == null ? void 0 : u[0],
|
|
520
|
+
(l = h.get("overflow-y")) == null ? void 0 : l[0]
|
|
521
521
|
];
|
|
522
522
|
d = w.includes("scroll") || (w.includes("auto") || w.includes("overlay")) && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
|
|
523
523
|
}
|
|
524
|
-
const p = (
|
|
524
|
+
const p = (g = h.get("text-transform")) == null ? void 0 : g[0], y = ne((m = h.get("font-family")) == null ? void 0 : m[0]), S = y ? (w) => {
|
|
525
525
|
p === "uppercase" ? w = w.toUpperCase() : p === "lowercase" ? w = w.toLowerCase() : p === "capitalize" && (w = w[0].toUpperCase() + w.substring(1)), y.forEach((b) => {
|
|
526
526
|
let E = a.get(b);
|
|
527
527
|
E || a.set(b, E = /* @__PURE__ */ new Set()), w.split("").forEach((C) => E.add(C));
|
|
528
528
|
});
|
|
529
529
|
} : void 0;
|
|
530
|
-
return
|
|
530
|
+
return Ze(
|
|
531
531
|
e,
|
|
532
532
|
f,
|
|
533
533
|
d,
|
|
534
534
|
t,
|
|
535
535
|
S
|
|
536
|
-
), Ke(e, f), $(e) || await
|
|
536
|
+
), Ke(e, f), $(e) || await G(
|
|
537
537
|
e,
|
|
538
538
|
f,
|
|
539
539
|
t,
|
|
@@ -541,9 +541,9 @@ async function W(e, t, r = !1, n) {
|
|
|
541
541
|
), await (s == null ? void 0 : s(f)), f;
|
|
542
542
|
}
|
|
543
543
|
const c = e.cloneNode(!1);
|
|
544
|
-
return await
|
|
544
|
+
return await G(e, c, t), await (s == null ? void 0 : s(c)), c;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function nt(e) {
|
|
547
547
|
if (e.ownerDocument = void 0, e.ownerWindow = void 0, e.svgStyleElement = void 0, e.svgDefsElement = void 0, e.svgStyles.clear(), e.defaultComputedStyles.clear(), e.sandbox) {
|
|
548
548
|
try {
|
|
549
549
|
e.sandbox.remove();
|
|
@@ -554,7 +554,7 @@ function rt(e) {
|
|
|
554
554
|
}
|
|
555
555
|
e.workers = [], e.fontFamilies.clear(), e.fontCssTexts.clear(), e.requests.clear(), e.tasks = [], e.shadowRoots = [];
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function st(e) {
|
|
558
558
|
const { url: t, timeout: r, responseType: n, ...i } = e, o = new AbortController(), a = r ? setTimeout(() => o.abort(), r) : void 0;
|
|
559
559
|
return fetch(t, { signal: o.signal, ...i }).then((s) => {
|
|
560
560
|
if (!s.ok)
|
|
@@ -563,7 +563,7 @@ function nt(e) {
|
|
|
563
563
|
case "arrayBuffer":
|
|
564
564
|
return s.arrayBuffer();
|
|
565
565
|
case "dataUrl":
|
|
566
|
-
return s.blob().then(
|
|
566
|
+
return s.blob().then($e);
|
|
567
567
|
case "text":
|
|
568
568
|
default:
|
|
569
569
|
return s.text();
|
|
@@ -579,28 +579,28 @@ function I(e, t) {
|
|
|
579
579
|
requests: u,
|
|
580
580
|
fetchFn: l,
|
|
581
581
|
fetch: {
|
|
582
|
-
requestInit:
|
|
582
|
+
requestInit: g,
|
|
583
583
|
bypassingCache: m,
|
|
584
584
|
placeholderImage: f
|
|
585
585
|
},
|
|
586
|
-
font:
|
|
586
|
+
font: h,
|
|
587
587
|
workers: d,
|
|
588
588
|
fontFamilies: p
|
|
589
589
|
} = e;
|
|
590
|
-
n === "image" && (
|
|
590
|
+
n === "image" && (D || W) && e.drawImageCount++;
|
|
591
591
|
let y = u.get(r);
|
|
592
592
|
if (!y) {
|
|
593
593
|
m && m instanceof RegExp && m.test(a) && (a += (/\?/.test(a) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
594
|
-
const S = n.startsWith("font") &&
|
|
594
|
+
const S = n.startsWith("font") && h && h.minify, w = /* @__PURE__ */ new Set();
|
|
595
595
|
S && n.split(";")[1].split(",").forEach((F) => {
|
|
596
|
-
p.has(F) && p.get(F).forEach((
|
|
596
|
+
p.has(F) && p.get(F).forEach((H) => w.add(H));
|
|
597
597
|
});
|
|
598
598
|
const b = S && w.size, E = {
|
|
599
599
|
url: a,
|
|
600
600
|
timeout: s,
|
|
601
601
|
responseType: b ? "arrayBuffer" : i,
|
|
602
602
|
headers: n === "image" ? { accept: c } : void 0,
|
|
603
|
-
...
|
|
603
|
+
...g
|
|
604
604
|
};
|
|
605
605
|
y = {
|
|
606
606
|
type: n,
|
|
@@ -613,9 +613,9 @@ function I(e, t) {
|
|
|
613
613
|
if (C)
|
|
614
614
|
return C;
|
|
615
615
|
}
|
|
616
|
-
return !
|
|
616
|
+
return !D && r.startsWith("http") && d.length ? new Promise((C, F) => {
|
|
617
617
|
d[u.size & d.length - 1].postMessage({ rawUrl: r, ...E }), y.resolve = C, y.reject = F;
|
|
618
|
-
}) :
|
|
618
|
+
}) : st(E);
|
|
619
619
|
})().catch((C) => {
|
|
620
620
|
if (u.delete(r), n === "image" && f)
|
|
621
621
|
return e.log.warn("Failed to fetch image base64, trying to use placeholder image", a), typeof f == "string" ? f : f(o);
|
|
@@ -624,10 +624,10 @@ function I(e, t) {
|
|
|
624
624
|
}
|
|
625
625
|
return y.response;
|
|
626
626
|
}
|
|
627
|
-
async function
|
|
628
|
-
if (!
|
|
627
|
+
async function ce(e, t, r, n) {
|
|
628
|
+
if (!ue(e))
|
|
629
629
|
return e;
|
|
630
|
-
for (const [i, o] of
|
|
630
|
+
for (const [i, o] of ot(e, t))
|
|
631
631
|
try {
|
|
632
632
|
const a = await I(
|
|
633
633
|
r,
|
|
@@ -637,35 +637,35 @@ async function le(e, t, r, n) {
|
|
|
637
637
|
responseType: "dataUrl"
|
|
638
638
|
}
|
|
639
639
|
);
|
|
640
|
-
e = e.replace(
|
|
640
|
+
e = e.replace(at(i), `$1${a}$3`);
|
|
641
641
|
} catch (a) {
|
|
642
642
|
r.log.warn("Failed to fetch css data url", i, a);
|
|
643
643
|
}
|
|
644
644
|
return e;
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function ue(e) {
|
|
647
647
|
return /url\((['"]?)([^'"]+?)\1\)/.test(e);
|
|
648
648
|
}
|
|
649
|
-
const
|
|
650
|
-
function
|
|
649
|
+
const fe = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
650
|
+
function ot(e, t) {
|
|
651
651
|
const r = [];
|
|
652
|
-
return e.replace(
|
|
652
|
+
return e.replace(fe, (n, i, o) => (r.push([o, te(o, t)]), n)), r.filter(([n]) => !L(n));
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function at(e) {
|
|
655
655
|
const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
656
656
|
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
657
657
|
}
|
|
658
|
-
const
|
|
658
|
+
const it = [
|
|
659
659
|
"background-image",
|
|
660
660
|
"border-image-source",
|
|
661
661
|
"-webkit-border-image",
|
|
662
662
|
"-webkit-mask-image",
|
|
663
663
|
"list-style-image"
|
|
664
664
|
];
|
|
665
|
-
function
|
|
666
|
-
return
|
|
665
|
+
function lt(e, t) {
|
|
666
|
+
return it.map((r) => {
|
|
667
667
|
const n = e.getPropertyValue(r);
|
|
668
|
-
return !n || n === "none" ? null : ((
|
|
668
|
+
return !n || n === "none" ? null : ((D || W) && t.drawImageCount++, ce(n, null, t, !0).then((i) => {
|
|
669
669
|
!i || n === i || e.setProperty(
|
|
670
670
|
r,
|
|
671
671
|
i,
|
|
@@ -674,10 +674,10 @@ function it(e, t) {
|
|
|
674
674
|
}));
|
|
675
675
|
}).filter(Boolean);
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function ct(e, t) {
|
|
678
678
|
if (R(e)) {
|
|
679
679
|
const r = e.currentSrc || e.src;
|
|
680
|
-
if (!
|
|
680
|
+
if (!L(r))
|
|
681
681
|
return [
|
|
682
682
|
I(t, {
|
|
683
683
|
url: r,
|
|
@@ -688,8 +688,8 @@ function lt(e, t) {
|
|
|
688
688
|
n && (e.srcset = "", e.dataset.originalSrc = r, e.src = n || "");
|
|
689
689
|
})
|
|
690
690
|
];
|
|
691
|
-
(
|
|
692
|
-
} else if (_(e) && !
|
|
691
|
+
(D || W) && t.drawImageCount++;
|
|
692
|
+
} else if (_(e) && !L(e.href.baseVal)) {
|
|
693
693
|
const r = e.href.baseVal;
|
|
694
694
|
return [
|
|
695
695
|
I(t, {
|
|
@@ -704,7 +704,7 @@ function lt(e, t) {
|
|
|
704
704
|
}
|
|
705
705
|
return [];
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function ut(e, t) {
|
|
708
708
|
const { ownerDocument: r, svgDefsElement: n } = t, i = e.getAttribute("href") ?? e.getAttribute("xlink:href");
|
|
709
709
|
if (!i)
|
|
710
710
|
return [];
|
|
@@ -730,13 +730,13 @@ function ct(e, t) {
|
|
|
730
730
|
}
|
|
731
731
|
return [];
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function de(e, t) {
|
|
734
734
|
const { tasks: r } = t;
|
|
735
|
-
v(e) && ((R(e) ||
|
|
736
|
-
|
|
735
|
+
v(e) && ((R(e) || ee(e)) && r.push(...ct(e, t)), ye(e) && r.push(...ut(e, t))), A(e) && r.push(...lt(e.style, t)), e.childNodes.forEach((n) => {
|
|
736
|
+
de(n, t);
|
|
737
737
|
});
|
|
738
738
|
}
|
|
739
|
-
async function
|
|
739
|
+
async function ft(e, t) {
|
|
740
740
|
const {
|
|
741
741
|
ownerDocument: r,
|
|
742
742
|
svgStyleElement: n,
|
|
@@ -754,16 +754,16 @@ async function ut(e, t) {
|
|
|
754
754
|
const c = Array.from(r.styleSheets).filter((f) => {
|
|
755
755
|
try {
|
|
756
756
|
return "cssRules" in f && !!f.cssRules.length;
|
|
757
|
-
} catch (
|
|
758
|
-
return t.log.warn(`Error while reading CSS rules from ${f.href}`,
|
|
757
|
+
} catch (h) {
|
|
758
|
+
return t.log.warn(`Error while reading CSS rules from ${f.href}`, h), !1;
|
|
759
759
|
}
|
|
760
760
|
}), u = r.implementation.createHTMLDocument(""), l = u.createElement("style");
|
|
761
761
|
u.head.appendChild(l);
|
|
762
|
-
const
|
|
762
|
+
const g = l.sheet;
|
|
763
763
|
await Promise.all(
|
|
764
|
-
c.flatMap((f) => Array.from(f.cssRules).map(async (
|
|
765
|
-
if (
|
|
766
|
-
const d =
|
|
764
|
+
c.flatMap((f) => Array.from(f.cssRules).map(async (h) => {
|
|
765
|
+
if (pe(h)) {
|
|
766
|
+
const d = h.href;
|
|
767
767
|
let p = "";
|
|
768
768
|
try {
|
|
769
769
|
p = await I(t, {
|
|
@@ -775,53 +775,53 @@ async function ut(e, t) {
|
|
|
775
775
|
t.log.warn(`Error fetch remote css import from ${d}`, S);
|
|
776
776
|
}
|
|
777
777
|
const y = p.replace(
|
|
778
|
-
|
|
779
|
-
(S, w, b) => S.replace(b,
|
|
778
|
+
fe,
|
|
779
|
+
(S, w, b) => S.replace(b, te(b, d))
|
|
780
780
|
);
|
|
781
|
-
for (const S of
|
|
781
|
+
for (const S of gt(y))
|
|
782
782
|
try {
|
|
783
|
-
|
|
783
|
+
g.insertRule(S, g.cssRules.length);
|
|
784
784
|
} catch (w) {
|
|
785
785
|
t.log.warn("Error inserting rule from remote css import", { rule: S, error: w });
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
788
|
}))
|
|
789
|
-
),
|
|
789
|
+
), g.cssRules.length && c.push(g);
|
|
790
790
|
const m = [];
|
|
791
791
|
c.forEach((f) => {
|
|
792
|
-
|
|
792
|
+
B(f.cssRules, m);
|
|
793
793
|
}), m.filter((f) => {
|
|
794
|
-
var
|
|
795
|
-
return
|
|
794
|
+
var h;
|
|
795
|
+
return he(f) && ue(f.style.getPropertyValue("src")) && ((h = ne(f.style.getPropertyValue("font-family"))) == null ? void 0 : h.some((d) => i.has(d)));
|
|
796
796
|
}).forEach((f) => {
|
|
797
|
-
const
|
|
797
|
+
const h = f, d = o.get(h.cssText);
|
|
798
798
|
d ? n.appendChild(r.createTextNode(`${d}
|
|
799
799
|
`)) : a.push(
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
800
|
+
ce(
|
|
801
|
+
h.cssText,
|
|
802
|
+
h.parentStyleSheet ? h.parentStyleSheet.href : null,
|
|
803
803
|
t
|
|
804
804
|
).then((p) => {
|
|
805
|
-
p = K(p, t), o.set(
|
|
805
|
+
p = K(p, t), o.set(h.cssText, p), n.appendChild(r.createTextNode(`${p}
|
|
806
806
|
`));
|
|
807
807
|
})
|
|
808
808
|
);
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
|
-
const
|
|
813
|
-
function
|
|
812
|
+
const dt = /(\/\*[\s\S]*?\*\/)/g, Y = /((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;
|
|
813
|
+
function gt(e) {
|
|
814
814
|
if (e == null)
|
|
815
815
|
return [];
|
|
816
816
|
const t = [];
|
|
817
|
-
let r = e.replace(
|
|
817
|
+
let r = e.replace(dt, "");
|
|
818
818
|
for (; ; ) {
|
|
819
|
-
const o =
|
|
819
|
+
const o = Y.exec(r);
|
|
820
820
|
if (!o)
|
|
821
821
|
break;
|
|
822
822
|
t.push(o[0]);
|
|
823
823
|
}
|
|
824
|
-
r = r.replace(
|
|
824
|
+
r = r.replace(Y, "");
|
|
825
825
|
const n = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, i = new RegExp(
|
|
826
826
|
// eslint-disable-next-line
|
|
827
827
|
"((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",
|
|
@@ -839,10 +839,10 @@ function dt(e) {
|
|
|
839
839
|
}
|
|
840
840
|
return t;
|
|
841
841
|
}
|
|
842
|
-
const mt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,
|
|
842
|
+
const mt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ht = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
843
843
|
function K(e, t) {
|
|
844
844
|
const { font: r } = t, n = r ? r == null ? void 0 : r.preferredFormat : void 0;
|
|
845
|
-
return n ? e.replace(
|
|
845
|
+
return n ? e.replace(ht, (i) => {
|
|
846
846
|
for (; ; ) {
|
|
847
847
|
const [o, , a] = mt.exec(i) || [];
|
|
848
848
|
if (!a)
|
|
@@ -852,18 +852,18 @@ function K(e, t) {
|
|
|
852
852
|
}
|
|
853
853
|
}) : e;
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function B(e, t = []) {
|
|
856
856
|
for (const r of Array.from(e))
|
|
857
|
-
|
|
857
|
+
we(r) ? t.push(...B(r.cssRules)) : "cssRules" in r ? B(r.cssRules, t) : t.push(r);
|
|
858
858
|
return t;
|
|
859
859
|
}
|
|
860
|
-
const
|
|
861
|
-
function
|
|
862
|
-
return
|
|
860
|
+
const pt = /\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;
|
|
861
|
+
function wt(e) {
|
|
862
|
+
return pt.test(e.innerHTML);
|
|
863
863
|
}
|
|
864
|
-
async function
|
|
865
|
-
const r = await
|
|
866
|
-
if (v(r.node) && _(r.node) && !
|
|
864
|
+
async function yt(e, t) {
|
|
865
|
+
const r = await se(e, t);
|
|
866
|
+
if (v(r.node) && _(r.node) && !wt(r.node))
|
|
867
867
|
return r.node;
|
|
868
868
|
const {
|
|
869
869
|
ownerDocument: n,
|
|
@@ -874,13 +874,13 @@ async function wt(e, t) {
|
|
|
874
874
|
svgStyles: c,
|
|
875
875
|
font: u,
|
|
876
876
|
progress: l,
|
|
877
|
-
autoDestruct:
|
|
877
|
+
autoDestruct: g,
|
|
878
878
|
onCloneNode: m,
|
|
879
879
|
onEmbedNode: f,
|
|
880
|
-
onCreateForeignObjectSvg:
|
|
880
|
+
onCreateForeignObjectSvg: h
|
|
881
881
|
} = r;
|
|
882
882
|
i.time("clone node");
|
|
883
|
-
const d = await
|
|
883
|
+
const d = await V(r.node, r, !0);
|
|
884
884
|
if (a && n) {
|
|
885
885
|
let b = "";
|
|
886
886
|
c.forEach((E, C) => {
|
|
@@ -891,7 +891,7 @@ async function wt(e, t) {
|
|
|
891
891
|
`;
|
|
892
892
|
}), a.appendChild(n.createTextNode(b));
|
|
893
893
|
}
|
|
894
|
-
i.timeEnd("clone node"), await (m == null ? void 0 : m(d)), u !== !1 && v(d) && (i.time("embed web font"), await
|
|
894
|
+
i.timeEnd("clone node"), await (m == null ? void 0 : m(d)), u !== !1 && v(d) && (i.time("embed web font"), await ft(d, r), i.timeEnd("embed web font")), i.time("embed node"), de(d, r);
|
|
895
895
|
const p = o.length;
|
|
896
896
|
let y = 0;
|
|
897
897
|
const S = async () => {
|
|
@@ -908,63 +908,79 @@ async function wt(e, t) {
|
|
|
908
908
|
}
|
|
909
909
|
};
|
|
910
910
|
l == null || l(y, p), await Promise.all([...Array.from({ length: 4 })].map(S)), i.timeEnd("embed node"), await (f == null ? void 0 : f(d));
|
|
911
|
-
const w =
|
|
912
|
-
return s && w.insertBefore(s, w.children[0]), a && w.insertBefore(a, w.children[0]),
|
|
911
|
+
const w = St(d, r);
|
|
912
|
+
return s && w.insertBefore(s, w.children[0]), a && w.insertBefore(a, w.children[0]), g && nt(r), await (h == null ? void 0 : h(w)), w;
|
|
913
913
|
}
|
|
914
|
-
function
|
|
915
|
-
const { width: r, height: n } = t, i =
|
|
914
|
+
function St(e, t) {
|
|
915
|
+
const { width: r, height: n } = t, i = Fe(r, n, e.ownerDocument), o = i.ownerDocument.createElementNS(i.namespaceURI, "foreignObject");
|
|
916
916
|
return o.setAttributeNS(null, "x", "0%"), o.setAttributeNS(null, "y", "0%"), o.setAttributeNS(null, "width", "100%"), o.setAttributeNS(null, "height", "100%"), o.append(e), i.appendChild(o), i;
|
|
917
917
|
}
|
|
918
|
-
async function
|
|
918
|
+
async function bt(e, t) {
|
|
919
919
|
var a;
|
|
920
|
-
const r = await
|
|
921
|
-
r.autoDestruct || (r.svgStyleElement =
|
|
920
|
+
const r = await se(e, t), n = await yt(r), i = De(n, r.isEnable("removeControlCharacter"));
|
|
921
|
+
r.autoDestruct || (r.svgStyleElement = oe(r.ownerDocument), r.svgDefsElement = (a = r.ownerDocument) == null ? void 0 : a.createElementNS(P, "defs"), r.svgStyles.clear());
|
|
922
922
|
const o = N(i, n.ownerDocument);
|
|
923
|
-
return await
|
|
923
|
+
return await Oe(o, r);
|
|
924
924
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
925
|
+
function Et(e, t, r) {
|
|
926
|
+
return {
|
|
927
|
+
sx: Math.round((e.left + t.x) * r),
|
|
928
|
+
sy: Math.round((e.top + t.y) * r)
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
const O = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap();
|
|
932
|
+
function vt(e = document.body) {
|
|
933
|
+
O.delete(e), M.set(e, (M.get(e) ?? 0) + 1);
|
|
928
934
|
}
|
|
929
|
-
async function
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
935
|
+
async function Ct(e, t, r) {
|
|
936
|
+
for (; ; ) {
|
|
937
|
+
const o = O.get(e);
|
|
938
|
+
if (o && o.scale === t) return o.full;
|
|
939
|
+
const a = U.get(e);
|
|
940
|
+
if (!a) break;
|
|
941
|
+
if (await a === null) return null;
|
|
942
|
+
}
|
|
943
|
+
const n = M.get(e) ?? 0, i = (async () => {
|
|
934
944
|
try {
|
|
935
|
-
const o = await
|
|
945
|
+
const o = await bt(e, {
|
|
936
946
|
scale: t,
|
|
937
947
|
backgroundColor: null,
|
|
938
948
|
filter: (a) => !(a === r || a instanceof Element && r.contains(a))
|
|
939
949
|
});
|
|
940
|
-
return
|
|
950
|
+
return M.get(e) === n && O.set(e, { full: o, scale: t }), o;
|
|
941
951
|
} catch {
|
|
942
952
|
return null;
|
|
943
953
|
} finally {
|
|
944
|
-
|
|
954
|
+
U.delete(e);
|
|
945
955
|
}
|
|
946
|
-
})()
|
|
956
|
+
})();
|
|
957
|
+
return U.set(e, i), i;
|
|
947
958
|
}
|
|
948
|
-
async function
|
|
949
|
-
const { surface: t, host: r = document.body, scale: n = window.devicePixelRatio || 1 } = e, i = await
|
|
959
|
+
async function Nt(e) {
|
|
960
|
+
const { surface: t, host: r = document.body, scale: n = window.devicePixelRatio || 1 } = e, i = await Ct(r, n, t);
|
|
950
961
|
if (!i) return null;
|
|
951
|
-
const o = t.getBoundingClientRect(), a = Math.max(1, Math.round(o.width)), s = Math.max(1, Math.round(o.height)), c =
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
962
|
+
const o = t.getBoundingClientRect(), a = Math.max(1, Math.round(o.width)), s = Math.max(1, Math.round(o.height)), { sx: c, sy: u } = Et(
|
|
963
|
+
o,
|
|
964
|
+
{ x: window.scrollX || 0, y: window.scrollY || 0 },
|
|
965
|
+
n
|
|
966
|
+
), l = document.createElement("canvas");
|
|
967
|
+
l.width = a, l.height = s;
|
|
968
|
+
const g = l.getContext("2d");
|
|
969
|
+
return g ? (g.filter = "blur(4px) saturate(1.3)", g.drawImage(
|
|
955
970
|
i,
|
|
956
|
-
|
|
957
|
-
|
|
971
|
+
c,
|
|
972
|
+
u,
|
|
958
973
|
Math.round(a * n),
|
|
959
974
|
Math.round(s * n),
|
|
960
975
|
0,
|
|
961
976
|
0,
|
|
962
977
|
a,
|
|
963
978
|
s
|
|
964
|
-
),
|
|
979
|
+
), g.filter = "none", { canvas: l, width: a, height: s }) : null;
|
|
965
980
|
}
|
|
966
981
|
export {
|
|
967
|
-
|
|
968
|
-
|
|
982
|
+
Nt as captureBehind,
|
|
983
|
+
vt as invalidateCaptureCache,
|
|
984
|
+
Et as snapshotCropOrigin
|
|
969
985
|
};
|
|
970
|
-
//# sourceMappingURL=captureBehind-
|
|
986
|
+
//# sourceMappingURL=captureBehind-Cz9XErY8.js.map
|