@appsurify-testmap/rrweb-cypress-plugin 2.1.1-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,537 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ const testContexts = /* @__PURE__ */ new Map();
5
+ function setCurrentTestContext(key, ctx) {
6
+ testContexts.set(key, ctx);
7
+ }
8
+ function getCurrentTestContext(key) {
9
+ return testContexts.get(key);
10
+ }
11
+ function safeSerializeArray(arr) {
12
+ return arr.filter((value) => {
13
+ if (typeof value === "object" && value !== null && "log" in value && value.log === false) {
14
+ return false;
15
+ }
16
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null;
17
+ });
18
+ }
19
+ function buildSelector(subject) {
20
+ const el = subject == null ? void 0 : subject[0];
21
+ if (!el) return null;
22
+ const tag = el.tagName.toLowerCase();
23
+ const id = el.id ? `#${el.id}` : "";
24
+ const classSelector = Array.from(el.classList).map((cls) => `.${cls}`).join("");
25
+ return `${tag}${id}${classSelector}`;
26
+ }
27
+ function getTestKey(test) {
28
+ return test.titlePath().join(" > ");
29
+ }
30
+ function prepareTestSuite(suite) {
31
+ if (!suite) return void 0;
32
+ return {
33
+ id: suite.id,
34
+ file: suite.file,
35
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
36
+ // @ts-ignore
37
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
38
+ invocationDetails: safeInvocationDetails(suite.invocationDetails),
39
+ pending: suite.pending,
40
+ root: suite.root,
41
+ title: suite.title,
42
+ type: suite.type
43
+ };
44
+ }
45
+ function safeInvocationDetails(details) {
46
+ return {
47
+ absoluteFile: (details == null ? void 0 : details.absoluteFile) ?? "",
48
+ column: (details == null ? void 0 : details.column) ?? 0,
49
+ fileUrl: (details == null ? void 0 : details.fileUrl) ?? "",
50
+ function: (details == null ? void 0 : details.function) ?? "",
51
+ line: (details == null ? void 0 : details.line) ?? 0,
52
+ originalFile: (details == null ? void 0 : details.originalFile) ?? "",
53
+ relativeFile: (details == null ? void 0 : details.relativeFile) ?? ""
54
+ };
55
+ }
56
+ function mapTestRunContextToResult(ctx) {
57
+ return {
58
+ spec: mapSpec(ctx.spec),
59
+ browser: mapBrowser(ctx.browser),
60
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
61
+ // @ts-ignore
62
+ test: mapTest(ctx.test),
63
+ recorderEvents: Array.isArray(ctx.recorderEvents) ? ctx.recorderEvents : []
64
+ };
65
+ }
66
+ function mapSpec(spec) {
67
+ return {
68
+ name: spec.name ?? "",
69
+ absolute: spec.absolute ?? "",
70
+ relative: spec.relative ?? "",
71
+ specFilter: spec.specFilter ?? "",
72
+ specType: spec.specType ?? "integration",
73
+ baseName: spec.baseName ?? "",
74
+ fileExtension: spec.fileExtension ?? "",
75
+ fileName: spec.fileName ?? "",
76
+ id: spec.id ?? ""
77
+ };
78
+ }
79
+ function mapBrowser(browser) {
80
+ return {
81
+ name: browser.name ?? "",
82
+ version: browser.version ?? "",
83
+ displayName: browser.displayName ?? "",
84
+ family: browser.family ?? "",
85
+ majorVersion: browser.majorVersion ?? "",
86
+ channel: browser.channel ?? "",
87
+ path: browser.path ?? ""
88
+ };
89
+ }
90
+ function mapTest(test) {
91
+ return {
92
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
93
+ // @ts-ignore
94
+ suite: prepareTestSuite(test.parent),
95
+ file: test.file ?? "",
96
+ duration: test.duration ?? 0,
97
+ id: test.id ?? "",
98
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
99
+ // @ts-ignore
100
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
101
+ invocationDetails: safeInvocationDetails(test.invocationDetails),
102
+ pending: test.pending ?? false,
103
+ state: test.state ?? "unknown",
104
+ sync: test.sync ?? false,
105
+ timedOut: test.timedOut ?? false,
106
+ title: test.title ?? "",
107
+ titlePath: typeof test.titlePath === "function" ? test.titlePath() : [],
108
+ fullTitle: typeof test.fullTitle === "function" ? test.fullTitle() : "",
109
+ type: test.type ?? "test"
110
+ };
111
+ }
112
+ const defaultOptions = {
113
+ key: "id"
114
+ };
115
+ const PLUGIN_NAME = "rrweb/sequential-id@1";
116
+ const getRecordSequentialIdPlugin = (options) => {
117
+ const _options = Object.assign({}, defaultOptions, options);
118
+ let localId = 0;
119
+ return {
120
+ name: PLUGIN_NAME,
121
+ eventProcessor(event) {
122
+ const id = _options.getId ? _options.getId() : ++localId;
123
+ Object.assign(event, {
124
+ [_options.key]: id
125
+ });
126
+ return event;
127
+ },
128
+ options: _options
129
+ };
130
+ };
131
+ const rrSrc = '(function (g, f) {\n if ("object" == typeof exports && "object" == typeof module) {\n module.exports = f();\n } else if ("function" == typeof define && define.amd) {\n define("rrweb", [], f);\n } else if ("object" == typeof exports) {\n exports["rrweb"] = f();\n } else {\n g["rrweb"] = f();\n }\n }(this, () => {\nvar exports = {};\nvar module = { exports };\n"use strict";\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nvar __objRest = (source, exclude) => {\n var target = {};\n for (var prop in source)\n if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)\n target[prop] = source[prop];\n if (source != null && __getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(source)) {\n if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))\n target[prop] = source[prop];\n }\n return target;\n};\nObject.defineProperty(exports, Symbol.toStringTag, { value: "Module" });\nvar __defProp2 = Object.defineProperty;\nvar __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);\nvar _a;\nvar __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);\nvar NodeType$3 = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2["Document"] = 0] = "Document";\n NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";\n NodeType2[NodeType2["Element"] = 2] = "Element";\n NodeType2[NodeType2["Text"] = 3] = "Text";\n NodeType2[NodeType2["CDATA"] = 4] = "CDATA";\n NodeType2[NodeType2["Comment"] = 5] = "Comment";\n return NodeType2;\n})(NodeType$3 || {});\nconst testableAccessors$1 = {\n Node: ["childNodes", "parentNode", "parentElement", "textContent"],\n ShadowRoot: ["host", "styleSheets"],\n Element: ["shadowRoot", "querySelector", "querySelectorAll"],\n MutationObserver: []\n};\nconst testableMethods$1 = {\n Node: ["contains", "getRootNode"],\n ShadowRoot: ["getSelection"],\n Element: [],\n MutationObserver: ["constructor"]\n};\nconst untaintedBasePrototype$1 = {};\nconst isAngularZonePresent$1 = () => {\n return !!globalThis.Zone;\n};\nfunction getUntaintedPrototype$1(key) {\n if (untaintedBasePrototype$1[key])\n return untaintedBasePrototype$1[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes("[native code]")\n );\n }\n )\n );\n const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent$1()) {\n untaintedBasePrototype$1[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement("iframe");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype$1[key] = untaintedObject;\n } catch (e) {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache$1 = {};\nfunction getUntaintedAccessor$1(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache$1[cacheKey])\n return untaintedAccessorCache$1[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache$1[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache$1 = {};\nfunction getUntaintedMethod$1(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache$1[cacheKey])\n return untaintedMethodCache$1[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype$1(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== "function") return instance[method];\n untaintedMethodCache$1[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes$1(n2) {\n return getUntaintedAccessor$1("Node", n2, "childNodes");\n}\nfunction parentNode$1(n2) {\n return getUntaintedAccessor$1("Node", n2, "parentNode");\n}\nfunction parentElement$1(n2) {\n return getUntaintedAccessor$1("Node", n2, "parentElement");\n}\nfunction textContent$1(n2) {\n return getUntaintedAccessor$1("Node", n2, "textContent");\n}\nfunction contains$1(n2, other) {\n return getUntaintedMethod$1("Node", n2, "contains")(other);\n}\nfunction getRootNode$1(n2) {\n return getUntaintedMethod$1("Node", n2, "getRootNode")();\n}\nfunction host$1(n2) {\n if (!n2 || !("host" in n2)) return null;\n return getUntaintedAccessor$1("ShadowRoot", n2, "host");\n}\nfunction styleSheets$1(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot$1(n2) {\n if (!n2 || !("shadowRoot" in n2)) return null;\n return getUntaintedAccessor$1("Element", n2, "shadowRoot");\n}\nfunction querySelector$1(n2, selectors) {\n return getUntaintedAccessor$1("Element", n2, "querySelector")(selectors);\n}\nfunction querySelectorAll$1(n2, selectors) {\n return getUntaintedAccessor$1("Element", n2, "querySelectorAll")(selectors);\n}\nfunction mutationObserverCtor$1() {\n return getUntaintedPrototype$1("MutationObserver").constructor;\n}\nfunction patch$1(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === "function") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch (e) {\n return () => {\n };\n }\n}\nfunction describeNode$1(el) {\n const tag = el.tagName.toLowerCase();\n const id = el.id ? `#${el.id}` : "";\n const classes = el.classList.length ? "." + Array.from(el.classList).join(".") : "";\n return `${tag}${id}${classes}`;\n}\nfunction getElementVisibility$1(el) {\n var _a3;\n var _a2, _b;\n const win = (_a3 = (_a2 = el.ownerDocument) == null ? void 0 : _a2.defaultView) != null ? _a3 : window;\n const rect = el.getBoundingClientRect();\n const viewportWidth = win.innerWidth || win.document.documentElement.clientWidth || 0;\n const viewportHeight = win.innerHeight || win.document.documentElement.clientHeight || 0;\n const isRectVisible = rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;\n const style = (_b = win.getComputedStyle) == null ? void 0 : _b.call(win, el);\n const isStyleVisible2 = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;\n const isVisible = isStyleVisible2 && isRectVisible;\n let ratio = 0;\n if (isVisible) {\n const xOverlap = Math.max(\n 0,\n Math.min(rect.right, viewportWidth) - Math.max(rect.left, 0)\n );\n const yOverlap = Math.max(\n 0,\n Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0)\n );\n const intersectionArea = xOverlap * yOverlap;\n const elementArea = rect.width * rect.height;\n ratio = elementArea > 0 ? intersectionArea / elementArea : 0;\n }\n return {\n isVisible,\n ratio\n };\n}\nconst index$1 = {\n childNodes: childNodes$1,\n parentNode: parentNode$1,\n parentElement: parentElement$1,\n textContent: textContent$1,\n contains: contains$1,\n getRootNode: getRootNode$1,\n host: host$1,\n styleSheets: styleSheets$1,\n shadowRoot: shadowRoot$1,\n querySelector: querySelector$1,\n querySelectorAll: querySelectorAll$1,\n mutationObserver: mutationObserverCtor$1,\n patch: patch$1,\n describeNode: describeNode$1,\n getElementVisibility: getElementVisibility$1\n};\nfunction isElement(n2) {\n return n2.nodeType === n2.ELEMENT_NODE;\n}\nfunction isShadowRoot(n2) {\n const hostEl = (\n // anchor and textarea elements also have a `host` property\n // but only shadow roots have a `mode` property\n n2 && "host" in n2 && "mode" in n2 && index$1.host(n2) || null\n );\n return Boolean(\n hostEl && "shadowRoot" in hostEl && index$1.shadowRoot(hostEl) === n2\n );\n}\nfunction isNativeShadowDom(shadowRoot2) {\n return Object.prototype.toString.call(shadowRoot2) === "[object ShadowRoot]";\n}\nfunction fixBrowserCompatibilityIssuesInCSS(cssText) {\n if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {\n cssText = cssText.replace(\n /\\sbackground-clip:\\s*text;/g,\n " -webkit-background-clip: text; background-clip: text;"\n );\n }\n return cssText;\n}\nfunction escapeImportStatement(rule2) {\n const { cssText } = rule2;\n if (cssText.split(\'"\').length < 3) return cssText;\n const statement = ["@import", `url(${JSON.stringify(rule2.href)})`];\n if (rule2.layerName === "") {\n statement.push(`layer`);\n } else if (rule2.layerName) {\n statement.push(`layer(${rule2.layerName})`);\n }\n if (rule2.supportsText) {\n statement.push(`supports(${rule2.supportsText})`);\n }\n if (rule2.media.length) {\n statement.push(rule2.media.mediaText);\n }\n return statement.join(" ") + ";";\n}\nfunction stringifyStylesheet(s2) {\n try {\n const rules2 = s2.rules || s2.cssRules;\n if (!rules2) {\n return null;\n }\n let sheetHref = s2.href;\n if (!sheetHref && s2.ownerNode && s2.ownerNode.ownerDocument) {\n sheetHref = s2.ownerNode.ownerDocument.location.href;\n }\n const stringifiedRules = Array.from(\n rules2,\n (rule2) => stringifyRule(rule2, sheetHref)\n ).join("");\n return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);\n } catch (error) {\n return null;\n }\n}\nfunction stringifyRule(rule2, sheetHref) {\n if (isCSSImportRule(rule2)) {\n let importStringified;\n try {\n importStringified = // for same-origin stylesheets,\n // we can access the imported stylesheet rules directly\n stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement\n escapeImportStatement(rule2);\n } catch (error) {\n importStringified = rule2.cssText;\n }\n if (rule2.styleSheet.href) {\n return absolutifyURLs(importStringified, rule2.styleSheet.href);\n }\n return importStringified;\n } else {\n let ruleStringified = rule2.cssText;\n if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {\n ruleStringified = fixSafariColons(ruleStringified);\n }\n if (sheetHref) {\n return absolutifyURLs(ruleStringified, sheetHref);\n }\n return ruleStringified;\n }\n}\nfunction fixSafariColons(cssStringified) {\n const regex = /(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;\n return cssStringified.replace(regex, "$1\\\\$2");\n}\nfunction isCSSImportRule(rule2) {\n return "styleSheet" in rule2;\n}\nfunction isCSSStyleRule(rule2) {\n return "selectorText" in rule2;\n}\nclass Mirror {\n constructor() {\n __publicField$1(this, "idNodeMap", /* @__PURE__ */ new Map());\n __publicField$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n var _a2;\n if (!n2) return -1;\n const id = (_a2 = this.getMeta(n2)) == null ? void 0 : _a2.id;\n return id != null ? id : -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn\'t remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror$2() {\n return new Mirror();\n}\nfunction maskInputValue({\n element,\n maskInputOptions,\n tagName,\n type,\n value,\n maskInputFn\n}) {\n let text = value || "";\n const actualType = type && toLowerCase(type);\n if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {\n if (maskInputFn) {\n text = maskInputFn(text, element);\n } else {\n text = "*".repeat(text.length);\n }\n }\n return text;\n}\nfunction toLowerCase(str) {\n return str.toLowerCase();\n}\nconst ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";\nfunction is2DCanvasBlank(canvas) {\n const ctx = canvas.getContext("2d");\n if (!ctx) return true;\n const chunkSize = 50;\n for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) {\n for (let y = 0; y < canvas.height; y += chunkSize) {\n const getImageData = ctx.getImageData;\n const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;\n const pixelBuffer = new Uint32Array(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n originalGetImageData.call(\n ctx,\n x2,\n y,\n Math.min(chunkSize, canvas.width - x2),\n Math.min(chunkSize, canvas.height - y)\n ).data.buffer\n );\n if (pixelBuffer.some((pixel) => pixel !== 0)) return false;\n }\n }\n return true;\n}\nfunction getInputType(element) {\n const type = element.type;\n return element.hasAttribute("data-rr-is-password") ? "password" : type ? (\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n toLowerCase(type)\n ) : null;\n}\nfunction extractFileExtension(path, baseURL) {\n var _a2;\n let url;\n try {\n url = new URL(path, baseURL != null ? baseURL : window.location.href);\n } catch (err) {\n return null;\n }\n const regex = /\\.([0-9a-z]+)(?:$)/i;\n const match = url.pathname.match(regex);\n return (_a2 = match == null ? void 0 : match[1]) != null ? _a2 : null;\n}\nfunction extractOrigin(url) {\n let origin = "";\n if (url.indexOf("//") > -1) {\n origin = url.split("/").slice(0, 3).join("/");\n } else {\n origin = url.split("/")[0];\n }\n origin = origin.split("?")[0];\n return origin;\n}\nconst URL_IN_CSS_REF = /url\\((?:(\')([^\']*)\'|(")(.*?)"|([^)]*))\\)/gm;\nconst URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\\/\\//i;\nconst URL_WWW_MATCH = /^www\\..*/i;\nconst DATA_URI = /^(data:)([^,]*),(.*)/i;\nfunction absolutifyURLs(cssText, href) {\n return (cssText || "").replace(\n URL_IN_CSS_REF,\n (origin, quote1, path1, quote2, path2, path3) => {\n const filePath = path1 || path2 || path3;\n const maybeQuote = quote1 || quote2 || "";\n if (!filePath) {\n return origin;\n }\n if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (DATA_URI.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (filePath[0] === "/") {\n return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;\n }\n const stack = href.split("/");\n const parts = filePath.split("/");\n stack.pop();\n for (const part of parts) {\n if (part === ".") {\n continue;\n } else if (part === "..") {\n stack.pop();\n } else {\n stack.push(part);\n }\n }\n return `url(${maybeQuote}${stack.join("/")}${maybeQuote})`;\n }\n );\n}\nfunction normalizeCssString(cssText, _testNoPxNorm = false) {\n if (_testNoPxNorm) {\n return cssText.replace(/(\\/\\*[^*]*\\*\\/)|[\\s;]/g, "");\n } else {\n return cssText.replace(/(\\/\\*[^*]*\\*\\/)|[\\s;]/g, "").replace(/0px/g, "0");\n }\n}\nfunction splitCssText(cssText, style, _testNoPxNorm = false) {\n const childNodes2 = Array.from(style.childNodes);\n const splits = [];\n let iterCount = 0;\n if (childNodes2.length > 1 && cssText && typeof cssText === "string") {\n let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);\n const normFactor = cssTextNorm.length / cssText.length;\n for (let i2 = 1; i2 < childNodes2.length; i2++) {\n if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {\n const textContentNorm = normalizeCssString(\n childNodes2[i2].textContent,\n _testNoPxNorm\n );\n const jLimit = 100;\n let j = 3;\n for (; j < textContentNorm.length; j++) {\n if (\n // keep consuming css identifiers (to get a decent chunk more quickly)\n textContentNorm[j].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section\n textContentNorm.indexOf(textContentNorm.substring(0, j), 1) !== -1\n ) {\n continue;\n }\n break;\n }\n for (; j < textContentNorm.length; j++) {\n let startSubstring = textContentNorm.substring(0, j);\n let cssNormSplits = cssTextNorm.split(startSubstring);\n let splitNorm = -1;\n if (cssNormSplits.length === 2) {\n splitNorm = cssNormSplits[0].length;\n } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {\n splitNorm = cssTextNorm.indexOf(startSubstring, 1);\n } else if (cssNormSplits.length === 1) {\n startSubstring = startSubstring.substring(\n 0,\n startSubstring.length - 1\n );\n cssNormSplits = cssTextNorm.split(startSubstring);\n if (cssNormSplits.length <= 1) {\n splits.push(cssText);\n return splits;\n }\n j = jLimit + 1;\n } else if (j === textContentNorm.length - 1) {\n splitNorm = cssTextNorm.indexOf(startSubstring);\n }\n if (cssNormSplits.length >= 2 && j > jLimit) {\n const prevTextContent = childNodes2[i2 - 1].textContent;\n if (prevTextContent && typeof prevTextContent === "string") {\n const prevMinLength = normalizeCssString(prevTextContent).length;\n splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);\n }\n if (splitNorm === -1) {\n splitNorm = cssNormSplits[0].length;\n }\n }\n if (splitNorm !== -1) {\n let k = Math.floor(splitNorm / normFactor);\n for (; k > 0 && k < cssText.length; ) {\n iterCount += 1;\n if (iterCount > 50 * childNodes2.length) {\n splits.push(cssText);\n return splits;\n }\n const normPart = normalizeCssString(\n cssText.substring(0, k),\n _testNoPxNorm\n );\n if (normPart.length === splitNorm) {\n splits.push(cssText.substring(0, k));\n cssText = cssText.substring(k);\n cssTextNorm = cssTextNorm.substring(splitNorm);\n break;\n } else if (normPart.length < splitNorm) {\n k += Math.max(\n 1,\n Math.floor((splitNorm - normPart.length) / normFactor)\n );\n } else {\n k -= Math.max(\n 1,\n Math.floor((normPart.length - splitNorm) * normFactor)\n );\n }\n }\n break;\n }\n }\n }\n }\n }\n splits.push(cssText);\n return splits;\n}\nfunction markCssSplits(cssText, style) {\n return splitCssText(cssText, style).join("/* rr_split */");\n}\nfunction isSelectorUnique(selector, target) {\n try {\n const matches = document.querySelectorAll(selector);\n return matches.length === 1 && matches[0] === target;\n } catch (e) {\n return false;\n }\n}\nfunction buildSelector(node2) {\n if (!(node2 instanceof Element)) return null;\n if (node2.id) {\n return `#${CSS.escape(node2.id)}`;\n }\n const parts = [];\n const tag = node2.tagName.toLowerCase();\n if (node2.classList.length) {\n parts.push(...Array.from(node2.classList).map((cls) => `.${CSS.escape(cls)}`));\n }\n Array.from(node2.attributes).forEach((attr) => {\n if (attr.name.startsWith("data-")) {\n parts.push(`[${attr.name}="${CSS.escape(attr.value)}"]`);\n }\n });\n const shortSelector = `${tag}${parts.join("")}`;\n if (isSelectorUnique(shortSelector, node2)) {\n return shortSelector;\n }\n const pathParts = [];\n let current = node2;\n while (current && current.nodeType === Node.ELEMENT_NODE) {\n const parent = current.parentElement;\n const tagName = current.tagName.toLowerCase();\n let nth = "";\n if (parent) {\n const siblings = Array.from(parent.children).filter(\n (el) => el.tagName.toLowerCase() === tagName\n );\n if (siblings.length > 1) {\n nth = `:nth-of-type(${siblings.indexOf(current) + 1})`;\n }\n }\n pathParts.unshift(`${tagName}${nth}`);\n current = parent;\n }\n return pathParts.join(" > ") || null;\n}\nfunction buildXPath(node2) {\n switch (node2.nodeType) {\n case Node.DOCUMENT_NODE:\n return "/";\n case Node.DOCUMENT_TYPE_NODE:\n return "/html/doctype";\n case Node.ELEMENT_NODE: {\n const element = node2;\n if (element.id) {\n return `//*[@id="${CSS.escape(element.id)}"]`;\n }\n if (element.tagName.toLowerCase() === "html") return "/html";\n if (element === document.head) return "/html/head";\n if (element === document.body) return "/html/body";\n const parent = element.parentNode;\n if (!parent) return "";\n const tag = element.tagName.toLowerCase();\n const siblings = Array.from(parent.children).filter(\n (el) => el.tagName.toLowerCase() === tag\n );\n const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";\n return `${buildXPath(parent)}/${tag}${index2}`;\n }\n case Node.TEXT_NODE:\n case Node.CDATA_SECTION_NODE:\n case Node.COMMENT_NODE: {\n const parent = node2.parentNode;\n if (!parent) return "";\n const typeMap = {\n [Node.TEXT_NODE]: "text()",\n [Node.CDATA_SECTION_NODE]: "text()",\n // CDATA ≡ text() в XPath\n [Node.COMMENT_NODE]: "comment()"\n };\n const sameTypeSiblings = Array.from(parent.childNodes).filter(\n (sibling) => sibling.nodeType === node2.nodeType\n );\n const index2 = sameTypeSiblings.length > 1 ? `[${sameTypeSiblings.indexOf(node2)}]` : "";\n return `${buildXPath(parent)}/${typeMap[node2.nodeType]}${index2}`;\n }\n default:\n return "";\n }\n}\nfunction isTextVisible(n2) {\n var _a2;\n const parent = index$1.parentNode(n2);\n const parentElement2 = parent && parent;\n if (!parentElement2) {\n return false;\n }\n const isParentVisible = isElementVisible(parentElement2);\n if (!isParentVisible) {\n return false;\n }\n const textContent2 = (_a2 = n2.textContent) == null ? void 0 : _a2.trim();\n return textContent2 !== "";\n}\nfunction isElementVisible(el) {\n const visibility = index$1.getElementVisibility(el);\n return visibility.isVisible;\n}\nconst interactiveEvents$1 = [\n "change",\n "submit",\n "dragstart",\n "drop",\n "pointerdown",\n "pointerup",\n "input",\n "keydown",\n "keyup",\n "keypress",\n "mouseenter",\n "mouseleave",\n "mouseup",\n "mousedown",\n "click",\n "contextmenu",\n "dblclick",\n "focus",\n "blur",\n "touchstart",\n "touchmove",\n "touchend",\n "touchcancel"\n];\nconst interactiveTags = [\n "a",\n "button",\n "input",\n "select",\n "textarea",\n "label",\n "details",\n "summary",\n "dialog",\n "video",\n "audio"\n];\nconst inlineEventAttributes$1 = [\n "onclick",\n "ondblclick",\n "onmousedown",\n "onmouseup",\n "onmouseover",\n "onmouseout",\n "onmousemove",\n "onfocus",\n "onblur",\n "onkeydown",\n "onkeypress",\n "onkeyup",\n "onchange",\n "oninput",\n "onsubmit",\n "onreset",\n "onselect",\n "oncontextmenu",\n "ontouchstart",\n "ontouchmove",\n "ontouchend",\n "ontouchcancel"\n];\nconst interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();\nconst originalAddEventListener$1 = EventTarget.prototype.addEventListener;\nEventTarget.prototype.addEventListener = function(type, listener, options) {\n originalAddEventListener$1.call(this, type, listener, options);\n if (this instanceof Element) {\n const eventType = type.toLowerCase();\n if (interactiveEvents$1.includes(eventType)) {\n interactiveElementsRegistry$1.add(this);\n }\n }\n};\nconst originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;\nEventTarget.prototype.removeEventListener = function(type, listener, options) {\n originalRemoveEventListener$1.call(this, type, listener, options);\n};\nfunction hasEventListeners(n2) {\n return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);\n}\nfunction isElementInteractive(n2) {\n if (n2.nodeType === Node.ELEMENT_NODE) {\n const element = n2;\n const tagName = element.tagName.toLowerCase();\n if (interactiveTags.includes(tagName)) {\n return true;\n }\n const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";\n const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(\n element.getAttribute("role") || ""\n );\n const result2 = hasEventListeners(element) || hasTabIndex || hasRoleInteractive || element instanceof HTMLAnchorElement && element.hasAttribute("href") || element instanceof HTMLButtonElement && !element.disabled;\n return result2;\n }\n return false;\n}\nfunction inspectInlineEventHandlers$1() {\n const allElements = document.querySelectorAll("*");\n allElements.forEach((el) => {\n inlineEventAttributes$1.forEach((attr) => {\n if (el.hasAttribute(attr)) {\n interactiveElementsRegistry$1.add(el);\n }\n });\n });\n}\nif (document.readyState === "complete" || document.readyState === "interactive") {\n inspectInlineEventHandlers$1();\n} else {\n document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);\n}\nlet _id = 1;\nconst tagNameRegex = new RegExp("[^a-z0-9-_:]");\nconst IGNORED_NODE = -2;\nfunction genId() {\n return _id++;\n}\nfunction getValidTagName$1(element) {\n if (element instanceof HTMLFormElement) {\n return "form";\n }\n const processedTagName = toLowerCase(element.tagName);\n if (tagNameRegex.test(processedTagName)) {\n return "div";\n }\n return processedTagName;\n}\nlet canvasService;\nlet canvasCtx;\nconst SRCSET_NOT_SPACES = /^[^ \\t\\n\\r\\u000c]+/;\nconst SRCSET_COMMAS_OR_SPACES = /^[, \\t\\n\\r\\u000c]+/;\nfunction getAbsoluteSrcsetString(doc, attributeValue) {\n if (attributeValue.trim() === "") {\n return attributeValue;\n }\n let pos = 0;\n function collectCharacters(regEx) {\n let chars2;\n const match = regEx.exec(attributeValue.substring(pos));\n if (match) {\n chars2 = match[0];\n pos += chars2.length;\n return chars2;\n }\n return "";\n }\n const output = [];\n while (true) {\n collectCharacters(SRCSET_COMMAS_OR_SPACES);\n if (pos >= attributeValue.length) {\n break;\n }\n let url = collectCharacters(SRCSET_NOT_SPACES);\n if (url.slice(-1) === ",") {\n url = absoluteToDoc(doc, url.substring(0, url.length - 1));\n output.push(url);\n } else {\n let descriptorsStr = "";\n url = absoluteToDoc(doc, url);\n let inParens = false;\n while (true) {\n const c2 = attributeValue.charAt(pos);\n if (c2 === "") {\n output.push((url + descriptorsStr).trim());\n break;\n } else if (!inParens) {\n if (c2 === ",") {\n pos += 1;\n output.push((url + descriptorsStr).trim());\n break;\n } else if (c2 === "(") {\n inParens = true;\n }\n } else {\n if (c2 === ")") {\n inParens = false;\n }\n }\n descriptorsStr += c2;\n pos += 1;\n }\n }\n }\n return output.join(", ");\n}\nconst cachedDocument = /* @__PURE__ */ new WeakMap();\nfunction absoluteToDoc(doc, attributeValue) {\n if (!attributeValue || attributeValue.trim() === "") {\n return attributeValue;\n }\n return getHref(doc, attributeValue);\n}\nfunction isSVGElement(el) {\n return Boolean(el.tagName === "svg" || el.ownerSVGElement);\n}\nfunction getHref(doc, customHref) {\n let a2 = cachedDocument.get(doc);\n if (!a2) {\n a2 = doc.createElement("a");\n cachedDocument.set(doc, a2);\n }\n if (!customHref) {\n customHref = "";\n } else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) {\n return customHref;\n }\n a2.setAttribute("href", customHref);\n return a2.href;\n}\nfunction transformAttribute(doc, tagName, name, value) {\n if (!value) {\n return value;\n }\n if (name === "src" || name === "href" && !(tagName === "use" && value[0] === "#")) {\n return absoluteToDoc(doc, value);\n } else if (name === "xlink:href" && value[0] !== "#") {\n return absoluteToDoc(doc, value);\n } else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {\n return absoluteToDoc(doc, value);\n } else if (name === "srcset") {\n return getAbsoluteSrcsetString(doc, value);\n } else if (name === "style") {\n return absolutifyURLs(value, getHref(doc));\n } else if (tagName === "object" && name === "data") {\n return absoluteToDoc(doc, value);\n }\n return value;\n}\nfunction ignoreAttribute(tagName, name, _value) {\n return (tagName === "video" || tagName === "audio") && name === "autoplay";\n}\nfunction isExcludeAttribute(name, exclude) {\n return typeof exclude === "string" ? name.includes(exclude) : exclude.test(name);\n}\nfunction _isBlockedElement(element, blockClass, blockSelector) {\n try {\n if (typeof blockClass === "string") {\n if (element.classList.contains(blockClass)) {\n return true;\n }\n } else {\n for (let eIndex = element.classList.length; eIndex--; ) {\n const className = element.classList[eIndex];\n if (blockClass.test(className)) {\n return true;\n }\n }\n }\n if (blockSelector) {\n return element.matches(blockSelector);\n }\n } catch (e2) {\n }\n return false;\n}\nfunction classMatchesRegex(node2, regex, checkAncestors) {\n if (!node2) return false;\n if (node2.nodeType !== node2.ELEMENT_NODE) {\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n }\n for (let eIndex = node2.classList.length; eIndex--; ) {\n const className = node2.classList[eIndex];\n if (regex.test(className)) {\n return true;\n }\n }\n if (!checkAncestors) return false;\n return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);\n}\nfunction needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {\n let el;\n if (isElement(node2)) {\n el = node2;\n if (!index$1.childNodes(el).length) {\n return false;\n }\n } else if (index$1.parentElement(node2) === null) {\n return false;\n } else {\n el = index$1.parentElement(node2);\n }\n try {\n if (typeof maskTextClass === "string") {\n if (checkAncestors) {\n if (el.closest(`.${maskTextClass}`)) return true;\n } else {\n if (el.classList.contains(maskTextClass)) return true;\n }\n } else {\n if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;\n }\n if (maskTextSelector) {\n if (checkAncestors) {\n if (el.closest(maskTextSelector)) return true;\n } else {\n if (el.matches(maskTextSelector)) return true;\n }\n }\n } catch (e2) {\n }\n return false;\n}\nfunction onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {\n const win = iframeEl.contentWindow;\n if (!win) {\n return;\n }\n let fired = false;\n let readyState;\n try {\n readyState = win.document.readyState;\n } catch (error) {\n return;\n }\n if (readyState !== "complete") {\n const timer = setTimeout(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, iframeLoadTimeout);\n iframeEl.addEventListener("load", () => {\n clearTimeout(timer);\n fired = true;\n listener();\n });\n return;\n }\n const blankUrl = "about:blank";\n if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {\n setTimeout(listener, 0);\n return iframeEl.addEventListener("load", listener);\n }\n iframeEl.addEventListener("load", listener);\n}\nfunction onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {\n let fired = false;\n let styleSheetLoaded;\n try {\n styleSheetLoaded = link.sheet;\n } catch (error) {\n return;\n }\n if (styleSheetLoaded) return;\n const timer = setTimeout(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, styleSheetLoadTimeout);\n link.addEventListener("load", () => {\n clearTimeout(timer);\n fired = true;\n listener();\n });\n}\nfunction serializeNode(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n excludeAttribute,\n needsMask,\n inlineStylesheet,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n cssCaptured = false\n } = options;\n const rootId = getRootId(doc, mirror2);\n switch (n2.nodeType) {\n case n2.DOCUMENT_NODE:\n if (n2.compatMode !== "CSS1Compat") {\n return {\n type: NodeType$3.Document,\n childNodes: [],\n compatMode: n2.compatMode\n // probably "BackCompat"\n };\n } else {\n return {\n type: NodeType$3.Document,\n childNodes: []\n };\n }\n case n2.DOCUMENT_TYPE_NODE:\n return {\n type: NodeType$3.DocumentType,\n name: n2.name,\n publicId: n2.publicId,\n systemId: n2.systemId,\n rootId\n };\n case n2.ELEMENT_NODE:\n return serializeElementNode(n2, {\n doc,\n blockClass,\n blockSelector,\n excludeAttribute,\n inlineStylesheet,\n maskInputOptions,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n rootId\n });\n case n2.TEXT_NODE:\n return serializeTextNode(n2, {\n doc,\n needsMask,\n maskTextFn,\n rootId,\n cssCaptured\n });\n case n2.CDATA_SECTION_NODE:\n return {\n type: NodeType$3.CDATA,\n textContent: "",\n rootId\n };\n case n2.COMMENT_NODE:\n return {\n type: NodeType$3.Comment,\n textContent: index$1.textContent(n2) || "",\n rootId\n };\n default:\n return false;\n }\n}\nfunction getRootId(doc, mirror2) {\n if (!mirror2.hasNode(doc)) return void 0;\n const docId = mirror2.getId(doc);\n return docId === 1 ? void 0 : docId;\n}\nfunction serializeTextNode(n2, options) {\n const { needsMask, maskTextFn, rootId, cssCaptured } = options;\n const parent = index$1.parentNode(n2);\n const parentTagName = parent && parent.tagName;\n let textContent2 = "";\n const isStyle = parentTagName === "STYLE" ? true : void 0;\n const isScript = parentTagName === "SCRIPT" ? true : void 0;\n if (isScript) {\n textContent2 = "SCRIPT_PLACEHOLDER";\n } else if (!cssCaptured) {\n textContent2 = index$1.textContent(n2);\n if (isStyle && textContent2) {\n textContent2 = absolutifyURLs(textContent2, getHref(options.doc));\n }\n }\n if (!isStyle && !isScript && textContent2 && needsMask) {\n textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\\S]/g, "*");\n }\n return {\n type: NodeType$3.Text,\n textContent: textContent2 || "",\n rootId\n };\n}\nfunction serializeElementNode(n2, options) {\n const {\n doc,\n blockClass,\n blockSelector,\n excludeAttribute,\n inlineStylesheet,\n maskInputOptions = {},\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n rootId\n } = options;\n const needBlock = _isBlockedElement(n2, blockClass, blockSelector);\n const tagName = getValidTagName$1(n2);\n let attributes = {};\n const len = n2.attributes.length;\n for (let i2 = 0; i2 < len; i2++) {\n const attr = n2.attributes[i2];\n if (isExcludeAttribute(attr.name, excludeAttribute)) {\n continue;\n }\n if (!ignoreAttribute(tagName, attr.name, attr.value)) {\n attributes[attr.name] = transformAttribute(\n doc,\n tagName,\n toLowerCase(attr.name),\n attr.value\n );\n }\n }\n if (tagName === "link" && inlineStylesheet) {\n const stylesheet = Array.from(doc.styleSheets).find((s2) => {\n return s2.href === n2.href;\n });\n let cssText = null;\n if (stylesheet) {\n cssText = stringifyStylesheet(stylesheet);\n }\n if (cssText) {\n delete attributes.rel;\n delete attributes.href;\n attributes._cssText = cssText;\n }\n }\n if (tagName === "style" && n2.sheet) {\n let cssText = stringifyStylesheet(\n n2.sheet\n );\n if (cssText) {\n if (n2.childNodes.length > 1) {\n cssText = markCssSplits(cssText, n2);\n }\n attributes._cssText = cssText;\n }\n }\n if (tagName === "input" || tagName === "textarea" || tagName === "select") {\n const value = n2.value;\n const checked = n2.checked;\n if (attributes.type !== "radio" && attributes.type !== "checkbox" && attributes.type !== "submit" && attributes.type !== "button" && value) {\n attributes.value = maskInputValue({\n element: n2,\n type: getInputType(n2),\n tagName,\n value,\n maskInputOptions,\n maskInputFn\n });\n } else if (checked) {\n attributes.checked = checked;\n }\n }\n if (tagName === "option") {\n if (n2.selected && !maskInputOptions["select"]) {\n attributes.selected = true;\n } else {\n delete attributes.selected;\n }\n }\n if (tagName === "dialog" && n2.open) {\n attributes.rr_open_mode = n2.matches("dialog:modal") ? "modal" : "non-modal";\n }\n if (tagName === "canvas" && recordCanvas) {\n if (n2.__context === "2d") {\n if (!is2DCanvasBlank(n2)) {\n attributes.rr_dataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n }\n } else if (!("__context" in n2)) {\n const canvasDataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n const blankCanvas = doc.createElement("canvas");\n blankCanvas.width = n2.width;\n blankCanvas.height = n2.height;\n const blankCanvasDataURL = blankCanvas.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n if (canvasDataURL !== blankCanvasDataURL) {\n attributes.rr_dataURL = canvasDataURL;\n }\n }\n }\n if (tagName === "img" && inlineImages) {\n if (!canvasService) {\n canvasService = doc.createElement("canvas");\n canvasCtx = canvasService.getContext("2d");\n }\n const image = n2;\n const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";\n const priorCrossOrigin = image.crossOrigin;\n const recordInlineImage = () => {\n image.removeEventListener("load", recordInlineImage);\n try {\n canvasService.width = image.naturalWidth;\n canvasService.height = image.naturalHeight;\n canvasCtx.drawImage(image, 0, 0);\n attributes.rr_dataURL = canvasService.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n } catch (err) {\n if (image.crossOrigin !== "anonymous") {\n image.crossOrigin = "anonymous";\n if (image.complete && image.naturalWidth !== 0)\n recordInlineImage();\n else image.addEventListener("load", recordInlineImage);\n return;\n } else {\n console.warn(\n `Cannot inline img src=${imageSrc}! Error: ${err}`\n );\n }\n }\n if (image.crossOrigin === "anonymous") {\n priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");\n }\n };\n if (image.complete && image.naturalWidth !== 0) recordInlineImage();\n else image.addEventListener("load", recordInlineImage);\n }\n if (tagName === "audio" || tagName === "video") {\n const mediaAttributes = attributes;\n mediaAttributes.rr_mediaState = n2.paused ? "paused" : "played";\n mediaAttributes.rr_mediaCurrentTime = n2.currentTime;\n mediaAttributes.rr_mediaPlaybackRate = n2.playbackRate;\n mediaAttributes.rr_mediaMuted = n2.muted;\n mediaAttributes.rr_mediaLoop = n2.loop;\n mediaAttributes.rr_mediaVolume = n2.volume;\n }\n if (!newlyAddedElement) {\n if (n2.scrollLeft) {\n attributes.rr_scrollLeft = n2.scrollLeft;\n }\n if (n2.scrollTop) {\n attributes.rr_scrollTop = n2.scrollTop;\n }\n }\n if (needBlock) {\n const { width, height } = n2.getBoundingClientRect();\n attributes = {\n class: attributes.class,\n rr_width: `${width}px`,\n rr_height: `${height}px`\n };\n }\n if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {\n if (!n2.contentDocument) {\n attributes.rr_src = attributes.src;\n }\n delete attributes.src;\n }\n let isCustomElement;\n try {\n if (customElements.get(tagName)) isCustomElement = true;\n } catch (e2) {\n }\n return {\n type: NodeType$3.Element,\n tagName,\n attributes,\n childNodes: [],\n isSVG: isSVGElement(n2) || void 0,\n needBlock,\n rootId,\n isCustom: isCustomElement\n };\n}\nfunction lowerIfExists(maybeAttr) {\n if (maybeAttr === void 0 || maybeAttr === null) {\n return "";\n } else {\n return maybeAttr.toLowerCase();\n }\n}\nfunction slimDOMExcluded(sn, slimDOMOptions) {\n if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) {\n return true;\n } else if (sn.type === NodeType$3.Element) {\n if (slimDOMOptions.script && // script tag\n (sn.tagName === "script" || // (module)preload link\n sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link\n sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {\n return true;\n } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(\n /^msapplication-tile(image|color)$/\n ) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {\n return true;\n } else if (sn.tagName === "meta") {\n if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {\n return true;\n } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)\n lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {\n return true;\n } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {\n return true;\n } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {\n return true;\n } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {\n return true;\n } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) {\n return true;\n }\n }\n }\n return false;\n}\nfunction serializeNodeWithId(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n skipChild = false,\n inlineStylesheet = true,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions = {},\n inlineImages = false,\n recordCanvas = false,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout = 5e3,\n onStylesheetLoad,\n stylesheetLoadTimeout = 5e3,\n keepIframeSrcFn = () => false,\n newlyAddedElement = false,\n cssCaptured = false\n } = options;\n let { needsMask } = options;\n let { preserveWhiteSpace = true } = options;\n if (!needsMask) {\n const checkAncestors = needsMask === void 0;\n needsMask = needMaskingText(\n n2,\n maskTextClass,\n maskTextSelector,\n checkAncestors\n );\n }\n const _serializedNode = serializeNode(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n excludeAttribute,\n needsMask,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n cssCaptured\n });\n if (!_serializedNode) {\n console.warn(n2, "not serialized");\n return null;\n }\n let id;\n if (mirror2.hasNode(n2)) {\n id = mirror2.getId(n2);\n } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.textContent.replace(/^\\s+|\\s+$/gm, "").length) {\n id = IGNORED_NODE;\n } else {\n id = genId();\n }\n const serializedNode = Object.assign(_serializedNode, { id });\n if (isElement(n2) || n2.nodeType === Node.TEXT_NODE) {\n serializedNode.xpath = buildXPath(n2);\n if (isElement(n2)) {\n const selector = buildSelector(n2);\n if (selector) {\n serializedNode.selector = selector;\n }\n }\n if (n2.nodeType === Node.TEXT_NODE) {\n serializedNode.isVisible = isTextVisible(n2);\n }\n if (n2.nodeType === Node.ELEMENT_NODE) {\n serializedNode.isVisible = isElementVisible(n2);\n serializedNode.isInteractive = isElementInteractive(n2);\n }\n }\n mirror2.add(n2, serializedNode);\n if (id === IGNORED_NODE) {\n return null;\n }\n if (onSerialize) {\n onSerialize(n2);\n }\n let recordChild = !skipChild;\n if (serializedNode.type === NodeType$3.Element) {\n recordChild = recordChild && !serializedNode.needBlock;\n delete serializedNode.needBlock;\n const shadowRootEl = index$1.shadowRoot(n2);\n if (shadowRootEl && isNativeShadowDom(shadowRootEl))\n serializedNode.isShadowHost = true;\n }\n if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) {\n if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") {\n preserveWhiteSpace = false;\n }\n const bypassOptions = {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n skipChild,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n cssCaptured: false\n };\n if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;\n else {\n if (serializedNode.type === NodeType$3.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {\n bypassOptions.cssCaptured = true;\n }\n for (const childN of Array.from(index$1.childNodes(n2))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n let shadowRootEl = null;\n if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {\n for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n }\n const parent = index$1.parentNode(n2);\n if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {\n serializedNode.isShadow = true;\n }\n if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {\n onceIframeLoaded(\n n2,\n () => {\n const iframeDoc = n2.contentDocument;\n if (iframeDoc && onIframeLoad) {\n const serializedIframeNode = serializeNodeWithId(iframeDoc, {\n doc: iframeDoc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n });\n if (serializedIframeNode) {\n onIframeLoad(\n n2,\n serializedIframeNode\n );\n }\n }\n },\n iframeLoadTimeout\n );\n }\n if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {\n onceStylesheetLoaded(\n n2,\n () => {\n if (onStylesheetLoad) {\n const serializedLinkNode = serializeNodeWithId(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn\n });\n if (serializedLinkNode) {\n onStylesheetLoad(\n n2,\n serializedLinkNode\n );\n }\n }\n },\n stylesheetLoadTimeout\n );\n }\n return serializedNode;\n}\nfunction snapshot(n2, options) {\n const {\n mirror: mirror2 = new Mirror(),\n blockClass = "rr-block",\n blockSelector = null,\n maskTextClass = "rr-mask",\n maskTextSelector = null,\n excludeAttribute = /.^/,\n inlineStylesheet = true,\n inlineImages = false,\n recordCanvas = false,\n maskAllInputs = false,\n maskTextFn,\n maskInputFn,\n slimDOM = false,\n dataURLOptions,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn = () => false\n } = options || {};\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n "datetime-local": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n password: true\n } : maskAllInputs === false ? {\n password: true\n } : maskAllInputs;\n const slimDOMOptions = slimDOM === true || slimDOM === "all" ? (\n // if true: set of sensible options that should not throw away any information\n {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaDescKeywords: slimDOM === "all",\n // destructive\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaAuthorship: true,\n headMetaVerification: true\n }\n ) : slimDOM === false ? {} : slimDOM;\n return serializeNodeWithId(n2, {\n doc: n2,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n newlyAddedElement: false\n });\n}\nfunction getDefaultExportFromCjs$1(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;\n}\nfunction getAugmentedNamespace$1(n2) {\n if (n2.__esModule) return n2;\n var f2 = n2.default;\n if (typeof f2 == "function") {\n var a2 = function a22() {\n if (this instanceof a22) {\n return Reflect.construct(f2, arguments, this.constructor);\n }\n return f2.apply(this, arguments);\n };\n a2.prototype = f2.prototype;\n } else a2 = {};\n Object.defineProperty(a2, "__esModule", { value: true });\n Object.keys(n2).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n2, k);\n Object.defineProperty(a2, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n2[k];\n }\n });\n });\n return a2;\n}\nvar picocolors_browser$1 = { exports: {} };\nvar x$1 = String;\nvar create$1 = function() {\n return { isColorSupported: false, reset: x$1, bold: x$1, dim: x$1, italic: x$1, underline: x$1, inverse: x$1, hidden: x$1, strikethrough: x$1, black: x$1, red: x$1, green: x$1, yellow: x$1, blue: x$1, magenta: x$1, cyan: x$1, white: x$1, gray: x$1, bgBlack: x$1, bgRed: x$1, bgGreen: x$1, bgYellow: x$1, bgBlue: x$1, bgMagenta: x$1, bgCyan: x$1, bgWhite: x$1 };\n};\npicocolors_browser$1.exports = create$1();\npicocolors_browser$1.exports.createColors = create$1;\nvar picocolors_browserExports$1 = picocolors_browser$1.exports;\nconst __viteBrowserExternal$2 = {};\nconst __viteBrowserExternal$1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n default: __viteBrowserExternal$2\n}, Symbol.toStringTag, { value: "Module" }));\nconst require$$2$1 = /* @__PURE__ */ getAugmentedNamespace$1(__viteBrowserExternal$1$1);\nlet pico$1 = picocolors_browserExports$1;\nlet terminalHighlight$1$1 = require$$2$1;\nlet CssSyntaxError$3$1 = class CssSyntaxError extends Error {\n constructor(message, line, column, source, file, plugin22) {\n super(message);\n this.name = "CssSyntaxError";\n this.reason = message;\n if (file) {\n this.file = file;\n }\n if (source) {\n this.source = source;\n }\n if (plugin22) {\n this.plugin = plugin22;\n }\n if (typeof line !== "undefined" && typeof column !== "undefined") {\n if (typeof line === "number") {\n this.line = line;\n this.column = column;\n } else {\n this.line = line.line;\n this.column = line.column;\n this.endLine = column.line;\n this.endColumn = column.column;\n }\n }\n this.setMessage();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CssSyntaxError);\n }\n }\n setMessage() {\n this.message = this.plugin ? this.plugin + ": " : "";\n this.message += this.file ? this.file : "<css input>";\n if (typeof this.line !== "undefined") {\n this.message += ":" + this.line + ":" + this.column;\n }\n this.message += ": " + this.reason;\n }\n showSourceCode(color) {\n if (!this.source) return "";\n let css = this.source;\n if (color == null) color = pico$1.isColorSupported;\n if (terminalHighlight$1$1) {\n if (color) css = terminalHighlight$1$1(css);\n }\n let lines = css.split(/\\r?\\n/);\n let start = Math.max(this.line - 3, 0);\n let end = Math.min(this.line + 2, lines.length);\n let maxWidth = String(end).length;\n let mark, aside;\n if (color) {\n let { bold, gray, red } = pico$1.createColors(true);\n mark = (text) => bold(red(text));\n aside = (text) => gray(text);\n } else {\n mark = aside = (str) => str;\n }\n return lines.slice(start, end).map((line, index2) => {\n let number = start + 1 + index2;\n let gutter = " " + (" " + number).slice(-maxWidth) + " | ";\n if (number === this.line) {\n let spacing = aside(gutter.replace(/\\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\\t]/g, " ");\n return mark(">") + aside(gutter) + line + "\\n " + spacing + mark("^");\n }\n return " " + aside(gutter) + line;\n }).join("\\n");\n }\n toString() {\n let code = this.showSourceCode();\n if (code) {\n code = "\\n\\n" + code + "\\n";\n }\n return this.name + ": " + this.message + code;\n }\n};\nvar cssSyntaxError$1 = CssSyntaxError$3$1;\nCssSyntaxError$3$1.default = CssSyntaxError$3$1;\nvar symbols$1 = {};\nsymbols$1.isClean = Symbol("isClean");\nsymbols$1.my = Symbol("my");\nconst DEFAULT_RAW$1 = {\n after: "\\n",\n beforeClose: "\\n",\n beforeComment: "\\n",\n beforeDecl: "\\n",\n beforeOpen: " ",\n beforeRule: "\\n",\n colon: ": ",\n commentLeft: " ",\n commentRight: " ",\n emptyBody: "",\n indent: " ",\n semicolon: false\n};\nfunction capitalize$1(str) {\n return str[0].toUpperCase() + str.slice(1);\n}\nlet Stringifier$2$1 = class Stringifier {\n constructor(builder) {\n this.builder = builder;\n }\n atrule(node2, semicolon) {\n let name = "@" + node2.name;\n let params = node2.params ? this.rawValue(node2, "params") : "";\n if (typeof node2.raws.afterName !== "undefined") {\n name += node2.raws.afterName;\n } else if (params) {\n name += " ";\n }\n if (node2.nodes) {\n this.block(node2, name + params);\n } else {\n let end = (node2.raws.between || "") + (semicolon ? ";" : "");\n this.builder(name + params + end, node2);\n }\n }\n beforeAfter(node2, detect) {\n let value;\n if (node2.type === "decl") {\n value = this.raw(node2, null, "beforeDecl");\n } else if (node2.type === "comment") {\n value = this.raw(node2, null, "beforeComment");\n } else if (detect === "before") {\n value = this.raw(node2, null, "beforeRule");\n } else {\n value = this.raw(node2, null, "beforeClose");\n }\n let buf = node2.parent;\n let depth = 0;\n while (buf && buf.type !== "root") {\n depth += 1;\n buf = buf.parent;\n }\n if (value.includes("\\n")) {\n let indent = this.raw(node2, null, "indent");\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent;\n }\n }\n return value;\n }\n block(node2, start) {\n let between = this.raw(node2, "between", "beforeOpen");\n this.builder(start + between + "{", node2, "start");\n let after;\n if (node2.nodes && node2.nodes.length) {\n this.body(node2);\n after = this.raw(node2, "after");\n } else {\n after = this.raw(node2, "after", "emptyBody");\n }\n if (after) this.builder(after);\n this.builder("}", node2, "end");\n }\n body(node2) {\n let last = node2.nodes.length - 1;\n while (last > 0) {\n if (node2.nodes[last].type !== "comment") break;\n last -= 1;\n }\n let semicolon = this.raw(node2, "semicolon");\n for (let i2 = 0; i2 < node2.nodes.length; i2++) {\n let child = node2.nodes[i2];\n let before = this.raw(child, "before");\n if (before) this.builder(before);\n this.stringify(child, last !== i2 || semicolon);\n }\n }\n comment(node2) {\n let left = this.raw(node2, "left", "commentLeft");\n let right = this.raw(node2, "right", "commentRight");\n this.builder("/*" + left + node2.text + right + "*/", node2);\n }\n decl(node2, semicolon) {\n let between = this.raw(node2, "between", "colon");\n let string = node2.prop + between + this.rawValue(node2, "value");\n if (node2.important) {\n string += node2.raws.important || " !important";\n }\n if (semicolon) string += ";";\n this.builder(string, node2);\n }\n document(node2) {\n this.body(node2);\n }\n raw(node2, own, detect) {\n let value;\n if (!detect) detect = own;\n if (own) {\n value = node2.raws[own];\n if (typeof value !== "undefined") return value;\n }\n let parent = node2.parent;\n if (detect === "before") {\n if (!parent || parent.type === "root" && parent.first === node2) {\n return "";\n }\n if (parent && parent.type === "document") {\n return "";\n }\n }\n if (!parent) return DEFAULT_RAW$1[detect];\n let root2 = node2.root();\n if (!root2.rawCache) root2.rawCache = {};\n if (typeof root2.rawCache[detect] !== "undefined") {\n return root2.rawCache[detect];\n }\n if (detect === "before" || detect === "after") {\n return this.beforeAfter(node2, detect);\n } else {\n let method = "raw" + capitalize$1(detect);\n if (this[method]) {\n value = this[method](root2, node2);\n } else {\n root2.walk((i2) => {\n value = i2.raws[own];\n if (typeof value !== "undefined") return false;\n });\n }\n }\n if (typeof value === "undefined") value = DEFAULT_RAW$1[detect];\n root2.rawCache[detect] = value;\n return value;\n }\n rawBeforeClose(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && i2.nodes.length > 0) {\n if (typeof i2.raws.after !== "undefined") {\n value = i2.raws.after;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, "");\n return value;\n }\n rawBeforeComment(root2, node2) {\n let value;\n root2.walkComments((i2) => {\n if (typeof i2.raws.before !== "undefined") {\n value = i2.raws.before;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n });\n if (typeof value === "undefined") {\n value = this.raw(node2, null, "beforeDecl");\n } else if (value) {\n value = value.replace(/\\S/g, "");\n }\n return value;\n }\n rawBeforeDecl(root2, node2) {\n let value;\n root2.walkDecls((i2) => {\n if (typeof i2.raws.before !== "undefined") {\n value = i2.raws.before;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n });\n if (typeof value === "undefined") {\n value = this.raw(node2, null, "beforeRule");\n } else if (value) {\n value = value.replace(/\\S/g, "");\n }\n return value;\n }\n rawBeforeOpen(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.type !== "decl") {\n value = i2.raws.between;\n if (typeof value !== "undefined") return false;\n }\n });\n return value;\n }\n rawBeforeRule(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && (i2.parent !== root2 || root2.first !== i2)) {\n if (typeof i2.raws.before !== "undefined") {\n value = i2.raws.before;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, "");\n return value;\n }\n rawColon(root2) {\n let value;\n root2.walkDecls((i2) => {\n if (typeof i2.raws.between !== "undefined") {\n value = i2.raws.between.replace(/[^\\s:]/g, "");\n return false;\n }\n });\n return value;\n }\n rawEmptyBody(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && i2.nodes.length === 0) {\n value = i2.raws.after;\n if (typeof value !== "undefined") return false;\n }\n });\n return value;\n }\n rawIndent(root2) {\n if (root2.raws.indent) return root2.raws.indent;\n let value;\n root2.walk((i2) => {\n let p = i2.parent;\n if (p && p !== root2 && p.parent && p.parent === root2) {\n if (typeof i2.raws.before !== "undefined") {\n let parts = i2.raws.before.split("\\n");\n value = parts[parts.length - 1];\n value = value.replace(/\\S/g, "");\n return false;\n }\n }\n });\n return value;\n }\n rawSemicolon(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && i2.nodes.length && i2.last.type === "decl") {\n value = i2.raws.semicolon;\n if (typeof value !== "undefined") return false;\n }\n });\n return value;\n }\n rawValue(node2, prop) {\n let value = node2[prop];\n let raw = node2.raws[prop];\n if (raw && raw.value === value) {\n return raw.raw;\n }\n return value;\n }\n root(node2) {\n this.body(node2);\n if (node2.raws.after) this.builder(node2.raws.after);\n }\n rule(node2) {\n this.block(node2, this.rawValue(node2, "selector"));\n if (node2.raws.ownSemicolon) {\n this.builder(node2.raws.ownSemicolon, node2, "end");\n }\n }\n stringify(node2, semicolon) {\n if (!this[node2.type]) {\n throw new Error(\n "Unknown AST node type " + node2.type + ". Maybe you need to change PostCSS stringifier."\n );\n }\n this[node2.type](node2, semicolon);\n }\n};\nvar stringifier$1 = Stringifier$2$1;\nStringifier$2$1.default = Stringifier$2$1;\nlet Stringifier$1$1 = stringifier$1;\nfunction stringify$4$1(node2, builder) {\n let str = new Stringifier$1$1(builder);\n str.stringify(node2);\n}\nvar stringify_1$1 = stringify$4$1;\nstringify$4$1.default = stringify$4$1;\nlet { isClean: isClean$2$1, my: my$2$1 } = symbols$1;\nlet CssSyntaxError$2$1 = cssSyntaxError$1;\nlet Stringifier2$1 = stringifier$1;\nlet stringify$3$1 = stringify_1$1;\nfunction cloneNode$1(obj, parent) {\n let cloned = new obj.constructor();\n for (let i2 in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i2)) {\n continue;\n }\n if (i2 === "proxyCache") continue;\n let value = obj[i2];\n let type = typeof value;\n if (i2 === "parent" && type === "object") {\n if (parent) cloned[i2] = parent;\n } else if (i2 === "source") {\n cloned[i2] = value;\n } else if (Array.isArray(value)) {\n cloned[i2] = value.map((j) => cloneNode$1(j, cloned));\n } else {\n if (type === "object" && value !== null) value = cloneNode$1(value);\n cloned[i2] = value;\n }\n }\n return cloned;\n}\nlet Node$5$1 = class Node2 {\n constructor(defaults = {}) {\n this.raws = {};\n this[isClean$2$1] = false;\n this[my$2$1] = true;\n for (let name in defaults) {\n if (name === "nodes") {\n this.nodes = [];\n for (let node2 of defaults[name]) {\n if (typeof node2.clone === "function") {\n this.append(node2.clone());\n } else {\n this.append(node2);\n }\n }\n } else {\n this[name] = defaults[name];\n }\n }\n }\n addToError(error) {\n error.postcssNode = this;\n if (error.stack && this.source && /\\n\\s{4}at /.test(error.stack)) {\n let s2 = this.source;\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s2.input.from}:${s2.start.line}:${s2.start.column}$&`\n );\n }\n return error;\n }\n after(add) {\n this.parent.insertAfter(this, add);\n return this;\n }\n assign(overrides = {}) {\n for (let name in overrides) {\n this[name] = overrides[name];\n }\n return this;\n }\n before(add) {\n this.parent.insertBefore(this, add);\n return this;\n }\n cleanRaws(keepBetween) {\n delete this.raws.before;\n delete this.raws.after;\n if (!keepBetween) delete this.raws.between;\n }\n clone(overrides = {}) {\n let cloned = cloneNode$1(this);\n for (let name in overrides) {\n cloned[name] = overrides[name];\n }\n return cloned;\n }\n cloneAfter(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertAfter(this, cloned);\n return cloned;\n }\n cloneBefore(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertBefore(this, cloned);\n return cloned;\n }\n error(message, opts = {}) {\n if (this.source) {\n let { end, start } = this.rangeBy(opts);\n return this.source.input.error(\n message,\n { column: start.column, line: start.line },\n { column: end.column, line: end.line },\n opts\n );\n }\n return new CssSyntaxError$2$1(message);\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === "proxyOf") {\n return node2;\n } else if (prop === "root") {\n return () => node2.root().toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || /* c8 ignore next */\n prop === "text") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n markDirty() {\n if (this[isClean$2$1]) {\n this[isClean$2$1] = false;\n let next = this;\n while (next = next.parent) {\n next[isClean$2$1] = false;\n }\n }\n }\n next() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 + 1];\n }\n positionBy(opts, stringRepresentation) {\n let pos = this.source.start;\n if (opts.index) {\n pos = this.positionInside(opts.index, stringRepresentation);\n } else if (opts.word) {\n stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) pos = this.positionInside(index2, stringRepresentation);\n }\n return pos;\n }\n positionInside(index2, stringRepresentation) {\n let string = stringRepresentation || this.toString();\n let column = this.source.start.column;\n let line = this.source.start.line;\n for (let i2 = 0; i2 < index2; i2++) {\n if (string[i2] === "\\n") {\n column = 1;\n line += 1;\n } else {\n column += 1;\n }\n }\n return { column, line };\n }\n prev() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 - 1];\n }\n rangeBy(opts) {\n let start = {\n column: this.source.start.column,\n line: this.source.start.line\n };\n let end = this.source.end ? {\n column: this.source.end.column + 1,\n line: this.source.end.line\n } : {\n column: start.column + 1,\n line: start.line\n };\n if (opts.word) {\n let stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) {\n start = this.positionInside(index2, stringRepresentation);\n end = this.positionInside(index2 + opts.word.length, stringRepresentation);\n }\n } else {\n if (opts.start) {\n start = {\n column: opts.start.column,\n line: opts.start.line\n };\n } else if (opts.index) {\n start = this.positionInside(opts.index);\n }\n if (opts.end) {\n end = {\n column: opts.end.column,\n line: opts.end.line\n };\n } else if (typeof opts.endIndex === "number") {\n end = this.positionInside(opts.endIndex);\n } else if (opts.index) {\n end = this.positionInside(opts.index + 1);\n }\n }\n if (end.line < start.line || end.line === start.line && end.column <= start.column) {\n end = { column: start.column + 1, line: start.line };\n }\n return { end, start };\n }\n raw(prop, defaultType) {\n let str = new Stringifier2$1();\n return str.raw(this, prop, defaultType);\n }\n remove() {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n this.parent = void 0;\n return this;\n }\n replaceWith(...nodes) {\n if (this.parent) {\n let bookmark = this;\n let foundSelf = false;\n for (let node2 of nodes) {\n if (node2 === this) {\n foundSelf = true;\n } else if (foundSelf) {\n this.parent.insertAfter(bookmark, node2);\n bookmark = node2;\n } else {\n this.parent.insertBefore(bookmark, node2);\n }\n }\n if (!foundSelf) {\n this.remove();\n }\n }\n return this;\n }\n root() {\n let result2 = this;\n while (result2.parent && result2.parent.type !== "document") {\n result2 = result2.parent;\n }\n return result2;\n }\n toJSON(_, inputs) {\n let fixed = {};\n let emitInputs = inputs == null;\n inputs = inputs || /* @__PURE__ */ new Map();\n let inputsNextIndex = 0;\n for (let name in this) {\n if (!Object.prototype.hasOwnProperty.call(this, name)) {\n continue;\n }\n if (name === "parent" || name === "proxyCache") continue;\n let value = this[name];\n if (Array.isArray(value)) {\n fixed[name] = value.map((i2) => {\n if (typeof i2 === "object" && i2.toJSON) {\n return i2.toJSON(null, inputs);\n } else {\n return i2;\n }\n });\n } else if (typeof value === "object" && value.toJSON) {\n fixed[name] = value.toJSON(null, inputs);\n } else if (name === "source") {\n let inputId = inputs.get(value.input);\n if (inputId == null) {\n inputId = inputsNextIndex;\n inputs.set(value.input, inputsNextIndex);\n inputsNextIndex++;\n }\n fixed[name] = {\n end: value.end,\n inputId,\n start: value.start\n };\n } else {\n fixed[name] = value;\n }\n }\n if (emitInputs) {\n fixed.inputs = [...inputs.keys()].map((input2) => input2.toJSON());\n }\n return fixed;\n }\n toProxy() {\n if (!this.proxyCache) {\n this.proxyCache = new Proxy(this, this.getProxyProcessor());\n }\n return this.proxyCache;\n }\n toString(stringifier2 = stringify$3$1) {\n if (stringifier2.stringify) stringifier2 = stringifier2.stringify;\n let result2 = "";\n stringifier2(this, (i2) => {\n result2 += i2;\n });\n return result2;\n }\n warn(result2, text, opts) {\n let data = { node: this };\n for (let i2 in opts) data[i2] = opts[i2];\n return result2.warn(text, data);\n }\n get proxyOf() {\n return this;\n }\n};\nvar node$1 = Node$5$1;\nNode$5$1.default = Node$5$1;\nlet Node$4$1 = node$1;\nlet Declaration$4$1 = class Declaration extends Node$4$1 {\n constructor(defaults) {\n if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {\n defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });\n }\n super(defaults);\n this.type = "decl";\n }\n get variable() {\n return this.prop.startsWith("--") || this.prop[0] === "$";\n }\n};\nvar declaration$1 = Declaration$4$1;\nDeclaration$4$1.default = Declaration$4$1;\nlet urlAlphabet$1 = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";\nlet customAlphabet$1 = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = "";\n let i2 = size;\n while (i2--) {\n id += alphabet[Math.random() * alphabet.length | 0];\n }\n return id;\n };\n};\nlet nanoid$1$1 = (size = 21) => {\n let id = "";\n let i2 = size;\n while (i2--) {\n id += urlAlphabet$1[Math.random() * 64 | 0];\n }\n return id;\n};\nvar nonSecure$1 = { nanoid: nanoid$1$1, customAlphabet: customAlphabet$1 };\nlet { SourceMapConsumer: SourceMapConsumer$2$1, SourceMapGenerator: SourceMapGenerator$2$1 } = require$$2$1;\nlet { existsSync: existsSync$1, readFileSync: readFileSync$1 } = require$$2$1;\nlet { dirname: dirname$1$1, join: join$1 } = require$$2$1;\nfunction fromBase64$1(str) {\n if (Buffer) {\n return Buffer.from(str, "base64").toString();\n } else {\n return window.atob(str);\n }\n}\nlet PreviousMap$2$1 = class PreviousMap {\n constructor(css, opts) {\n if (opts.map === false) return;\n this.loadAnnotation(css);\n this.inline = this.startWith(this.annotation, "data:");\n let prev = opts.map ? opts.map.prev : void 0;\n let text = this.loadMap(opts.from, prev);\n if (!this.mapFile && opts.from) {\n this.mapFile = opts.from;\n }\n if (this.mapFile) this.root = dirname$1$1(this.mapFile);\n if (text) this.text = text;\n }\n consumer() {\n if (!this.consumerCache) {\n this.consumerCache = new SourceMapConsumer$2$1(this.text);\n }\n return this.consumerCache;\n }\n decodeInline(text) {\n let baseCharsetUri = /^data:application\\/json;charset=utf-?8;base64,/;\n let baseUri = /^data:application\\/json;base64,/;\n let charsetUri = /^data:application\\/json;charset=utf-?8,/;\n let uri = /^data:application\\/json,/;\n if (charsetUri.test(text) || uri.test(text)) {\n return decodeURIComponent(text.substr(RegExp.lastMatch.length));\n }\n if (baseCharsetUri.test(text) || baseUri.test(text)) {\n return fromBase64$1(text.substr(RegExp.lastMatch.length));\n }\n let encoding = text.match(/data:application\\/json;([^,]+),/)[1];\n throw new Error("Unsupported source map encoding " + encoding);\n }\n getAnnotationURL(sourceMapString) {\n return sourceMapString.replace(/^\\/\\*\\s*# sourceMappingURL=/, "").trim();\n }\n isMap(map) {\n if (typeof map !== "object") return false;\n return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);\n }\n loadAnnotation(css) {\n let comments = css.match(/\\/\\*\\s*# sourceMappingURL=/gm);\n if (!comments) return;\n let start = css.lastIndexOf(comments.pop());\n let end = css.indexOf("*/", start);\n if (start > -1 && end > -1) {\n this.annotation = this.getAnnotationURL(css.substring(start, end));\n }\n }\n loadFile(path) {\n this.root = dirname$1$1(path);\n if (existsSync$1(path)) {\n this.mapFile = path;\n return readFileSync$1(path, "utf-8").toString().trim();\n }\n }\n loadMap(file, prev) {\n if (prev === false) return false;\n if (prev) {\n if (typeof prev === "string") {\n return prev;\n } else if (typeof prev === "function") {\n let prevPath = prev(file);\n if (prevPath) {\n let map = this.loadFile(prevPath);\n if (!map) {\n throw new Error(\n "Unable to load previous source map: " + prevPath.toString()\n );\n }\n return map;\n }\n } else if (prev instanceof SourceMapConsumer$2$1) {\n return SourceMapGenerator$2$1.fromSourceMap(prev).toString();\n } else if (prev instanceof SourceMapGenerator$2$1) {\n return prev.toString();\n } else if (this.isMap(prev)) {\n return JSON.stringify(prev);\n } else {\n throw new Error(\n "Unsupported previous source map format: " + prev.toString()\n );\n }\n } else if (this.inline) {\n return this.decodeInline(this.annotation);\n } else if (this.annotation) {\n let map = this.annotation;\n if (file) map = join$1(dirname$1$1(file), map);\n return this.loadFile(map);\n }\n }\n startWith(string, start) {\n if (!string) return false;\n return string.substr(0, start.length) === start;\n }\n withContent() {\n return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);\n }\n};\nvar previousMap$1 = PreviousMap$2$1;\nPreviousMap$2$1.default = PreviousMap$2$1;\nlet { SourceMapConsumer: SourceMapConsumer$1$1, SourceMapGenerator: SourceMapGenerator$1$1 } = require$$2$1;\nlet { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1$1 } = require$$2$1;\nlet { isAbsolute: isAbsolute$1, resolve: resolve$1$1 } = require$$2$1;\nlet { nanoid: nanoid$2 } = nonSecure$1;\nlet terminalHighlight$2 = require$$2$1;\nlet CssSyntaxError$1$1 = cssSyntaxError$1;\nlet PreviousMap$1$1 = previousMap$1;\nlet fromOffsetCache$1 = Symbol("fromOffsetCache");\nlet sourceMapAvailable$1$1 = Boolean(SourceMapConsumer$1$1 && SourceMapGenerator$1$1);\nlet pathAvailable$1$1 = Boolean(resolve$1$1 && isAbsolute$1);\nlet Input$4$1 = class Input {\n constructor(css, opts = {}) {\n if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {\n throw new Error(`PostCSS received ${css} instead of CSS string`);\n }\n this.css = css.toString();\n if (this.css[0] === "\\uFEFF" || this.css[0] === "\\uFFFE") {\n this.hasBOM = true;\n this.css = this.css.slice(1);\n } else {\n this.hasBOM = false;\n }\n if (opts.from) {\n if (!pathAvailable$1$1 || /^\\w+:\\/\\//.test(opts.from) || isAbsolute$1(opts.from)) {\n this.file = opts.from;\n } else {\n this.file = resolve$1$1(opts.from);\n }\n }\n if (pathAvailable$1$1 && sourceMapAvailable$1$1) {\n let map = new PreviousMap$1$1(this.css, opts);\n if (map.text) {\n this.map = map;\n let file = map.consumer().file;\n if (!this.file && file) this.file = this.mapResolve(file);\n }\n }\n if (!this.file) {\n this.id = "<input css " + nanoid$2(6) + ">";\n }\n if (this.map) this.map.file = this.from;\n }\n error(message, line, column, opts = {}) {\n let result2, endLine, endColumn;\n if (line && typeof line === "object") {\n let start = line;\n let end = column;\n if (typeof start.offset === "number") {\n let pos = this.fromOffset(start.offset);\n line = pos.line;\n column = pos.col;\n } else {\n line = start.line;\n column = start.column;\n }\n if (typeof end.offset === "number") {\n let pos = this.fromOffset(end.offset);\n endLine = pos.line;\n endColumn = pos.col;\n } else {\n endLine = end.line;\n endColumn = end.column;\n }\n } else if (!column) {\n let pos = this.fromOffset(line);\n line = pos.line;\n column = pos.col;\n }\n let origin = this.origin(line, column, endLine, endColumn);\n if (origin) {\n result2 = new CssSyntaxError$1$1(\n message,\n origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },\n origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },\n origin.source,\n origin.file,\n opts.plugin\n );\n } else {\n result2 = new CssSyntaxError$1$1(\n message,\n endLine === void 0 ? line : { column, line },\n endLine === void 0 ? column : { column: endColumn, line: endLine },\n this.css,\n this.file,\n opts.plugin\n );\n }\n result2.input = { column, endColumn, endLine, line, source: this.css };\n if (this.file) {\n if (pathToFileURL$1$1) {\n result2.input.url = pathToFileURL$1$1(this.file).toString();\n }\n result2.input.file = this.file;\n }\n return result2;\n }\n fromOffset(offset) {\n let lastLine, lineToIndex;\n if (!this[fromOffsetCache$1]) {\n let lines = this.css.split("\\n");\n lineToIndex = new Array(lines.length);\n let prevIndex = 0;\n for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {\n lineToIndex[i2] = prevIndex;\n prevIndex += lines[i2].length + 1;\n }\n this[fromOffsetCache$1] = lineToIndex;\n } else {\n lineToIndex = this[fromOffsetCache$1];\n }\n lastLine = lineToIndex[lineToIndex.length - 1];\n let min = 0;\n if (offset >= lastLine) {\n min = lineToIndex.length - 1;\n } else {\n let max = lineToIndex.length - 2;\n let mid;\n while (min < max) {\n mid = min + (max - min >> 1);\n if (offset < lineToIndex[mid]) {\n max = mid - 1;\n } else if (offset >= lineToIndex[mid + 1]) {\n min = mid + 1;\n } else {\n min = mid;\n break;\n }\n }\n }\n return {\n col: offset - lineToIndex[min] + 1,\n line: min + 1\n };\n }\n mapResolve(file) {\n if (/^\\w+:\\/\\//.test(file)) {\n return file;\n }\n return resolve$1$1(this.map.consumer().sourceRoot || this.map.root || ".", file);\n }\n origin(line, column, endLine, endColumn) {\n if (!this.map) return false;\n let consumer = this.map.consumer();\n let from = consumer.originalPositionFor({ column, line });\n if (!from.source) return false;\n let to;\n if (typeof endLine === "number") {\n to = consumer.originalPositionFor({ column: endColumn, line: endLine });\n }\n let fromUrl;\n if (isAbsolute$1(from.source)) {\n fromUrl = pathToFileURL$1$1(from.source);\n } else {\n fromUrl = new URL(\n from.source,\n this.map.consumer().sourceRoot || pathToFileURL$1$1(this.map.mapFile)\n );\n }\n let result2 = {\n column: from.column,\n endColumn: to && to.column,\n endLine: to && to.line,\n line: from.line,\n url: fromUrl.toString()\n };\n if (fromUrl.protocol === "file:") {\n if (fileURLToPath$1) {\n result2.file = fileURLToPath$1(fromUrl);\n } else {\n throw new Error(`file: protocol is not available in this PostCSS build`);\n }\n }\n let source = consumer.sourceContentFor(from.source);\n if (source) result2.source = source;\n return result2;\n }\n toJSON() {\n let json = {};\n for (let name of ["hasBOM", "css", "file", "id"]) {\n if (this[name] != null) {\n json[name] = this[name];\n }\n }\n if (this.map) {\n json.map = __spreadValues({}, this.map);\n if (json.map.consumerCache) {\n json.map.consumerCache = void 0;\n }\n }\n return json;\n }\n get from() {\n return this.file || this.id;\n }\n};\nvar input$1 = Input$4$1;\nInput$4$1.default = Input$4$1;\nif (terminalHighlight$2 && terminalHighlight$2.registerInput) {\n terminalHighlight$2.registerInput(Input$4$1);\n}\nlet { SourceMapConsumer: SourceMapConsumer$3, SourceMapGenerator: SourceMapGenerator$3 } = require$$2$1;\nlet { dirname: dirname$2, relative: relative$1, resolve: resolve$2, sep: sep$1 } = require$$2$1;\nlet { pathToFileURL: pathToFileURL$2 } = require$$2$1;\nlet Input$3$1 = input$1;\nlet sourceMapAvailable$2 = Boolean(SourceMapConsumer$3 && SourceMapGenerator$3);\nlet pathAvailable$2 = Boolean(dirname$2 && resolve$2 && relative$1 && sep$1);\nlet MapGenerator$2$1 = class MapGenerator {\n constructor(stringify2, root2, opts, cssString) {\n this.stringify = stringify2;\n this.mapOpts = opts.map || {};\n this.root = root2;\n this.opts = opts;\n this.css = cssString;\n this.originalCSS = cssString;\n this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;\n this.memoizedFileURLs = /* @__PURE__ */ new Map();\n this.memoizedPaths = /* @__PURE__ */ new Map();\n this.memoizedURLs = /* @__PURE__ */ new Map();\n }\n addAnnotation() {\n let content;\n if (this.isInline()) {\n content = "data:application/json;base64," + this.toBase64(this.map.toString());\n } else if (typeof this.mapOpts.annotation === "string") {\n content = this.mapOpts.annotation;\n } else if (typeof this.mapOpts.annotation === "function") {\n content = this.mapOpts.annotation(this.opts.to, this.root);\n } else {\n content = this.outputFile() + ".map";\n }\n let eol = "\\n";\n if (this.css.includes("\\r\\n")) eol = "\\r\\n";\n this.css += eol + "/*# sourceMappingURL=" + content + " */";\n }\n applyPrevMaps() {\n for (let prev of this.previous()) {\n let from = this.toUrl(this.path(prev.file));\n let root2 = prev.root || dirname$2(prev.file);\n let map;\n if (this.mapOpts.sourcesContent === false) {\n map = new SourceMapConsumer$3(prev.text);\n if (map.sourcesContent) {\n map.sourcesContent = null;\n }\n } else {\n map = prev.consumer();\n }\n this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));\n }\n }\n clearAnnotation() {\n if (this.mapOpts.annotation === false) return;\n if (this.root) {\n let node2;\n for (let i2 = this.root.nodes.length - 1; i2 >= 0; i2--) {\n node2 = this.root.nodes[i2];\n if (node2.type !== "comment") continue;\n if (node2.text.indexOf("# sourceMappingURL=") === 0) {\n this.root.removeChild(i2);\n }\n }\n } else if (this.css) {\n this.css = this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm, "");\n }\n }\n generate() {\n this.clearAnnotation();\n if (pathAvailable$2 && sourceMapAvailable$2 && this.isMap()) {\n return this.generateMap();\n } else {\n let result2 = "";\n this.stringify(this.root, (i2) => {\n result2 += i2;\n });\n return [result2];\n }\n }\n generateMap() {\n if (this.root) {\n this.generateString();\n } else if (this.previous().length === 1) {\n let prev = this.previous()[0].consumer();\n prev.file = this.outputFile();\n this.map = SourceMapGenerator$3.fromSourceMap(prev, {\n ignoreInvalidMapping: true\n });\n } else {\n this.map = new SourceMapGenerator$3({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n this.map.addMapping({\n generated: { column: 0, line: 1 },\n original: { column: 0, line: 1 },\n source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"\n });\n }\n if (this.isSourcesContent()) this.setSourcesContent();\n if (this.root && this.previous().length > 0) this.applyPrevMaps();\n if (this.isAnnotation()) this.addAnnotation();\n if (this.isInline()) {\n return [this.css];\n } else {\n return [this.css, this.map];\n }\n }\n generateString() {\n this.css = "";\n this.map = new SourceMapGenerator$3({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n let line = 1;\n let column = 1;\n let noSource = "<no source>";\n let mapping = {\n generated: { column: 0, line: 0 },\n original: { column: 0, line: 0 },\n source: ""\n };\n let lines, last;\n this.stringify(this.root, (str, node2, type) => {\n this.css += str;\n if (node2 && type !== "end") {\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n if (node2.source && node2.source.start) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.start.line;\n mapping.original.column = node2.source.start.column - 1;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n this.map.addMapping(mapping);\n }\n }\n lines = str.match(/\\n/g);\n if (lines) {\n line += lines.length;\n last = str.lastIndexOf("\\n");\n column = str.length - last;\n } else {\n column += str.length;\n }\n if (node2 && type !== "start") {\n let p = node2.parent || { raws: {} };\n let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;\n if (!childless || node2 !== p.last || p.raws.semicolon) {\n if (node2.source && node2.source.end) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.end.line;\n mapping.original.column = node2.source.end.column - 1;\n mapping.generated.line = line;\n mapping.generated.column = column - 2;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n this.map.addMapping(mapping);\n }\n }\n }\n });\n }\n isAnnotation() {\n if (this.isInline()) {\n return true;\n }\n if (typeof this.mapOpts.annotation !== "undefined") {\n return this.mapOpts.annotation;\n }\n if (this.previous().length) {\n return this.previous().some((i2) => i2.annotation);\n }\n return true;\n }\n isInline() {\n if (typeof this.mapOpts.inline !== "undefined") {\n return this.mapOpts.inline;\n }\n let annotation = this.mapOpts.annotation;\n if (typeof annotation !== "undefined" && annotation !== true) {\n return false;\n }\n if (this.previous().length) {\n return this.previous().some((i2) => i2.inline);\n }\n return true;\n }\n isMap() {\n if (typeof this.opts.map !== "undefined") {\n return !!this.opts.map;\n }\n return this.previous().length > 0;\n }\n isSourcesContent() {\n if (typeof this.mapOpts.sourcesContent !== "undefined") {\n return this.mapOpts.sourcesContent;\n }\n if (this.previous().length) {\n return this.previous().some((i2) => i2.withContent());\n }\n return true;\n }\n outputFile() {\n if (this.opts.to) {\n return this.path(this.opts.to);\n } else if (this.opts.from) {\n return this.path(this.opts.from);\n } else {\n return "to.css";\n }\n }\n path(file) {\n if (this.mapOpts.absolute) return file;\n if (file.charCodeAt(0) === 60) return file;\n if (/^\\w+:\\/\\//.test(file)) return file;\n let cached = this.memoizedPaths.get(file);\n if (cached) return cached;\n let from = this.opts.to ? dirname$2(this.opts.to) : ".";\n if (typeof this.mapOpts.annotation === "string") {\n from = dirname$2(resolve$2(from, this.mapOpts.annotation));\n }\n let path = relative$1(from, file);\n this.memoizedPaths.set(file, path);\n return path;\n }\n previous() {\n if (!this.previousMaps) {\n this.previousMaps = [];\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source && node2.source.input.map) {\n let map = node2.source.input.map;\n if (!this.previousMaps.includes(map)) {\n this.previousMaps.push(map);\n }\n }\n });\n } else {\n let input2 = new Input$3$1(this.originalCSS, this.opts);\n if (input2.map) this.previousMaps.push(input2.map);\n }\n }\n return this.previousMaps;\n }\n setSourcesContent() {\n let already = {};\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source) {\n let from = node2.source.input.from;\n if (from && !already[from]) {\n already[from] = true;\n let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));\n this.map.setSourceContent(fromUrl, node2.source.input.css);\n }\n }\n });\n } else if (this.css) {\n let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";\n this.map.setSourceContent(from, this.css);\n }\n }\n sourcePath(node2) {\n if (this.mapOpts.from) {\n return this.toUrl(this.mapOpts.from);\n } else if (this.usesFileUrls) {\n return this.toFileUrl(node2.source.input.from);\n } else {\n return this.toUrl(this.path(node2.source.input.from));\n }\n }\n toBase64(str) {\n if (Buffer) {\n return Buffer.from(str).toString("base64");\n } else {\n return window.btoa(unescape(encodeURIComponent(str)));\n }\n }\n toFileUrl(path) {\n let cached = this.memoizedFileURLs.get(path);\n if (cached) return cached;\n if (pathToFileURL$2) {\n let fileURL = pathToFileURL$2(path).toString();\n this.memoizedFileURLs.set(path, fileURL);\n return fileURL;\n } else {\n throw new Error(\n "`map.absolute` option is not available in this PostCSS build"\n );\n }\n }\n toUrl(path) {\n let cached = this.memoizedURLs.get(path);\n if (cached) return cached;\n if (sep$1 === "\\\\") {\n path = path.replace(/\\\\/g, "/");\n }\n let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);\n this.memoizedURLs.set(path, url);\n return url;\n }\n};\nvar mapGenerator$1 = MapGenerator$2$1;\nlet Node$3$1 = node$1;\nlet Comment$4$1 = class Comment extends Node$3$1 {\n constructor(defaults) {\n super(defaults);\n this.type = "comment";\n }\n};\nvar comment$1 = Comment$4$1;\nComment$4$1.default = Comment$4$1;\nlet { isClean: isClean$1$1, my: my$1$1 } = symbols$1;\nlet Declaration$3$1 = declaration$1;\nlet Comment$3$1 = comment$1;\nlet Node$2$1 = node$1;\nlet parse$4$1;\nlet Rule$4$1;\nlet AtRule$4$1;\nlet Root$6$1;\nfunction cleanSource$1(nodes) {\n return nodes.map((i2) => {\n if (i2.nodes) i2.nodes = cleanSource$1(i2.nodes);\n delete i2.source;\n return i2;\n });\n}\nfunction markDirtyUp$1(node2) {\n node2[isClean$1$1] = false;\n if (node2.proxyOf.nodes) {\n for (let i2 of node2.proxyOf.nodes) {\n markDirtyUp$1(i2);\n }\n }\n}\nlet Container$7$1 = class Container extends Node$2$1 {\n append(...children) {\n for (let child of children) {\n let nodes = this.normalize(child, this.last);\n for (let node2 of nodes) this.proxyOf.nodes.push(node2);\n }\n this.markDirty();\n return this;\n }\n cleanRaws(keepBetween) {\n super.cleanRaws(keepBetween);\n if (this.nodes) {\n for (let node2 of this.nodes) node2.cleanRaws(keepBetween);\n }\n }\n each(callback) {\n if (!this.proxyOf.nodes) return void 0;\n let iterator = this.getIterator();\n let index2, result2;\n while (this.indexes[iterator] < this.proxyOf.nodes.length) {\n index2 = this.indexes[iterator];\n result2 = callback(this.proxyOf.nodes[index2], index2);\n if (result2 === false) break;\n this.indexes[iterator] += 1;\n }\n delete this.indexes[iterator];\n return result2;\n }\n every(condition) {\n return this.nodes.every(condition);\n }\n getIterator() {\n if (!this.lastEach) this.lastEach = 0;\n if (!this.indexes) this.indexes = {};\n this.lastEach += 1;\n let iterator = this.lastEach;\n this.indexes[iterator] = 0;\n return iterator;\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === "proxyOf") {\n return node2;\n } else if (!node2[prop]) {\n return node2[prop];\n } else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {\n return (...args) => {\n return node2[prop](\n ...args.map((i2) => {\n if (typeof i2 === "function") {\n return (child, index2) => i2(child.toProxy(), index2);\n } else {\n return i2;\n }\n })\n );\n };\n } else if (prop === "every" || prop === "some") {\n return (cb) => {\n return node2[prop](\n (child, ...other) => cb(child.toProxy(), ...other)\n );\n };\n } else if (prop === "root") {\n return () => node2.root().toProxy();\n } else if (prop === "nodes") {\n return node2.nodes.map((i2) => i2.toProxy());\n } else if (prop === "first" || prop === "last") {\n return node2[prop].toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === "name" || prop === "params" || prop === "selector") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n index(child) {\n if (typeof child === "number") return child;\n if (child.proxyOf) child = child.proxyOf;\n return this.proxyOf.nodes.indexOf(child);\n }\n insertAfter(exist, add) {\n let existIndex = this.index(exist);\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex < index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n insertBefore(exist, add) {\n let existIndex = this.index(exist);\n let type = existIndex === 0 ? "prepend" : false;\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex <= index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n normalize(nodes, sample) {\n if (typeof nodes === "string") {\n nodes = cleanSource$1(parse$4$1(nodes).nodes);\n } else if (typeof nodes === "undefined") {\n nodes = [];\n } else if (Array.isArray(nodes)) {\n nodes = nodes.slice(0);\n for (let i2 of nodes) {\n if (i2.parent) i2.parent.removeChild(i2, "ignore");\n }\n } else if (nodes.type === "root" && this.type !== "document") {\n nodes = nodes.nodes.slice(0);\n for (let i2 of nodes) {\n if (i2.parent) i2.parent.removeChild(i2, "ignore");\n }\n } else if (nodes.type) {\n nodes = [nodes];\n } else if (nodes.prop) {\n if (typeof nodes.value === "undefined") {\n throw new Error("Value field is missed in node creation");\n } else if (typeof nodes.value !== "string") {\n nodes.value = String(nodes.value);\n }\n nodes = [new Declaration$3$1(nodes)];\n } else if (nodes.selector) {\n nodes = [new Rule$4$1(nodes)];\n } else if (nodes.name) {\n nodes = [new AtRule$4$1(nodes)];\n } else if (nodes.text) {\n nodes = [new Comment$3$1(nodes)];\n } else {\n throw new Error("Unknown node type in node creation");\n }\n let processed = nodes.map((i2) => {\n if (!i2[my$1$1]) Container.rebuild(i2);\n i2 = i2.proxyOf;\n if (i2.parent) i2.parent.removeChild(i2);\n if (i2[isClean$1$1]) markDirtyUp$1(i2);\n if (typeof i2.raws.before === "undefined") {\n if (sample && typeof sample.raws.before !== "undefined") {\n i2.raws.before = sample.raws.before.replace(/\\S/g, "");\n }\n }\n i2.parent = this.proxyOf;\n return i2;\n });\n return processed;\n }\n prepend(...children) {\n children = children.reverse();\n for (let child of children) {\n let nodes = this.normalize(child, this.first, "prepend").reverse();\n for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);\n for (let id in this.indexes) {\n this.indexes[id] = this.indexes[id] + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n push(child) {\n child.parent = this;\n this.proxyOf.nodes.push(child);\n return this;\n }\n removeAll() {\n for (let node2 of this.proxyOf.nodes) node2.parent = void 0;\n this.proxyOf.nodes = [];\n this.markDirty();\n return this;\n }\n removeChild(child) {\n child = this.index(child);\n this.proxyOf.nodes[child].parent = void 0;\n this.proxyOf.nodes.splice(child, 1);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (index2 >= child) {\n this.indexes[id] = index2 - 1;\n }\n }\n this.markDirty();\n return this;\n }\n replaceValues(pattern, opts, callback) {\n if (!callback) {\n callback = opts;\n opts = {};\n }\n this.walkDecls((decl) => {\n if (opts.props && !opts.props.includes(decl.prop)) return;\n if (opts.fast && !decl.value.includes(opts.fast)) return;\n decl.value = decl.value.replace(pattern, callback);\n });\n this.markDirty();\n return this;\n }\n some(condition) {\n return this.nodes.some(condition);\n }\n walk(callback) {\n return this.each((child, i2) => {\n let result2;\n try {\n result2 = callback(child, i2);\n } catch (e2) {\n throw child.addToError(e2);\n }\n if (result2 !== false && child.walk) {\n result2 = child.walk(callback);\n }\n return result2;\n });\n }\n walkAtRules(name, callback) {\n if (!callback) {\n callback = name;\n return this.walk((child, i2) => {\n if (child.type === "atrule") {\n return callback(child, i2);\n }\n });\n }\n if (name instanceof RegExp) {\n return this.walk((child, i2) => {\n if (child.type === "atrule" && name.test(child.name)) {\n return callback(child, i2);\n }\n });\n }\n return this.walk((child, i2) => {\n if (child.type === "atrule" && child.name === name) {\n return callback(child, i2);\n }\n });\n }\n walkComments(callback) {\n return this.walk((child, i2) => {\n if (child.type === "comment") {\n return callback(child, i2);\n }\n });\n }\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop;\n return this.walk((child, i2) => {\n if (child.type === "decl") {\n return callback(child, i2);\n }\n });\n }\n if (prop instanceof RegExp) {\n return this.walk((child, i2) => {\n if (child.type === "decl" && prop.test(child.prop)) {\n return callback(child, i2);\n }\n });\n }\n return this.walk((child, i2) => {\n if (child.type === "decl" && child.prop === prop) {\n return callback(child, i2);\n }\n });\n }\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector;\n return this.walk((child, i2) => {\n if (child.type === "rule") {\n return callback(child, i2);\n }\n });\n }\n if (selector instanceof RegExp) {\n return this.walk((child, i2) => {\n if (child.type === "rule" && selector.test(child.selector)) {\n return callback(child, i2);\n }\n });\n }\n return this.walk((child, i2) => {\n if (child.type === "rule" && child.selector === selector) {\n return callback(child, i2);\n }\n });\n }\n get first() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[0];\n }\n get last() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];\n }\n};\nContainer$7$1.registerParse = (dependant) => {\n parse$4$1 = dependant;\n};\nContainer$7$1.registerRule = (dependant) => {\n Rule$4$1 = dependant;\n};\nContainer$7$1.registerAtRule = (dependant) => {\n AtRule$4$1 = dependant;\n};\nContainer$7$1.registerRoot = (dependant) => {\n Root$6$1 = dependant;\n};\nvar container$1 = Container$7$1;\nContainer$7$1.default = Container$7$1;\nContainer$7$1.rebuild = (node2) => {\n if (node2.type === "atrule") {\n Object.setPrototypeOf(node2, AtRule$4$1.prototype);\n } else if (node2.type === "rule") {\n Object.setPrototypeOf(node2, Rule$4$1.prototype);\n } else if (node2.type === "decl") {\n Object.setPrototypeOf(node2, Declaration$3$1.prototype);\n } else if (node2.type === "comment") {\n Object.setPrototypeOf(node2, Comment$3$1.prototype);\n } else if (node2.type === "root") {\n Object.setPrototypeOf(node2, Root$6$1.prototype);\n }\n node2[my$1$1] = true;\n if (node2.nodes) {\n node2.nodes.forEach((child) => {\n Container$7$1.rebuild(child);\n });\n }\n};\nlet Container$6$1 = container$1;\nlet LazyResult$4$1;\nlet Processor$3$1;\nlet Document$3$1 = class Document2 extends Container$6$1 {\n constructor(defaults) {\n super(__spreadValues({ type: "document" }, defaults));\n if (!this.nodes) {\n this.nodes = [];\n }\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$4$1(new Processor$3$1(), this, opts);\n return lazy.stringify();\n }\n};\nDocument$3$1.registerLazyResult = (dependant) => {\n LazyResult$4$1 = dependant;\n};\nDocument$3$1.registerProcessor = (dependant) => {\n Processor$3$1 = dependant;\n};\nvar document$1$1 = Document$3$1;\nDocument$3$1.default = Document$3$1;\nlet printed$1 = {};\nvar warnOnce$2$1 = function warnOnce(message) {\n if (printed$1[message]) return;\n printed$1[message] = true;\n if (typeof console !== "undefined" && console.warn) {\n console.warn(message);\n }\n};\nlet Warning$2$1 = class Warning {\n constructor(text, opts = {}) {\n this.type = "warning";\n this.text = text;\n if (opts.node && opts.node.source) {\n let range = opts.node.rangeBy(opts);\n this.line = range.start.line;\n this.column = range.start.column;\n this.endLine = range.end.line;\n this.endColumn = range.end.column;\n }\n for (let opt in opts) this[opt] = opts[opt];\n }\n toString() {\n if (this.node) {\n return this.node.error(this.text, {\n index: this.index,\n plugin: this.plugin,\n word: this.word\n }).message;\n }\n if (this.plugin) {\n return this.plugin + ": " + this.text;\n }\n return this.text;\n }\n};\nvar warning$1 = Warning$2$1;\nWarning$2$1.default = Warning$2$1;\nlet Warning$1$1 = warning$1;\nlet Result$3$1 = class Result {\n constructor(processor2, root2, opts) {\n this.processor = processor2;\n this.messages = [];\n this.root = root2;\n this.opts = opts;\n this.css = void 0;\n this.map = void 0;\n }\n toString() {\n return this.css;\n }\n warn(text, opts = {}) {\n if (!opts.plugin) {\n if (this.lastPlugin && this.lastPlugin.postcssPlugin) {\n opts.plugin = this.lastPlugin.postcssPlugin;\n }\n }\n let warning2 = new Warning$1$1(text, opts);\n this.messages.push(warning2);\n return warning2;\n }\n warnings() {\n return this.messages.filter((i2) => i2.type === "warning");\n }\n get content() {\n return this.css;\n }\n};\nvar result$1 = Result$3$1;\nResult$3$1.default = Result$3$1;\nconst SINGLE_QUOTE$1 = "\'".charCodeAt(0);\nconst DOUBLE_QUOTE$1 = \'"\'.charCodeAt(0);\nconst BACKSLASH$1 = "\\\\".charCodeAt(0);\nconst SLASH$1 = "/".charCodeAt(0);\nconst NEWLINE$1 = "\\n".charCodeAt(0);\nconst SPACE$1 = " ".charCodeAt(0);\nconst FEED$1 = "\\f".charCodeAt(0);\nconst TAB$1 = " ".charCodeAt(0);\nconst CR$1 = "\\r".charCodeAt(0);\nconst OPEN_SQUARE$1 = "[".charCodeAt(0);\nconst CLOSE_SQUARE$1 = "]".charCodeAt(0);\nconst OPEN_PARENTHESES$1 = "(".charCodeAt(0);\nconst CLOSE_PARENTHESES$1 = ")".charCodeAt(0);\nconst OPEN_CURLY$1 = "{".charCodeAt(0);\nconst CLOSE_CURLY$1 = "}".charCodeAt(0);\nconst SEMICOLON$1 = ";".charCodeAt(0);\nconst ASTERISK$1 = "*".charCodeAt(0);\nconst COLON$1 = ":".charCodeAt(0);\nconst AT$1 = "@".charCodeAt(0);\nconst RE_AT_END$1 = /[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g;\nconst RE_WORD_END$1 = /[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g;\nconst RE_BAD_BRACKET$1 = /.[\\r\\n"\'(/\\\\]/;\nconst RE_HEX_ESCAPE$1 = /[\\da-f]/i;\nvar tokenize$1 = function tokenizer(input2, options = {}) {\n let css = input2.css.valueOf();\n let ignore = options.ignoreErrors;\n let code, next, quote, content, escape;\n let escaped, escapePos, prev, n2, currentToken;\n let length = css.length;\n let pos = 0;\n let buffer = [];\n let returned = [];\n function position() {\n return pos;\n }\n function unclosed(what) {\n throw input2.error("Unclosed " + what, pos);\n }\n function endOfFile() {\n return returned.length === 0 && pos >= length;\n }\n function nextToken(opts) {\n if (returned.length) return returned.pop();\n if (pos >= length) return;\n let ignoreUnclosed = opts ? opts.ignoreUnclosed : false;\n code = css.charCodeAt(pos);\n switch (code) {\n case NEWLINE$1:\n case SPACE$1:\n case TAB$1:\n case CR$1:\n case FEED$1: {\n next = pos;\n do {\n next += 1;\n code = css.charCodeAt(next);\n } while (code === SPACE$1 || code === NEWLINE$1 || code === TAB$1 || code === CR$1 || code === FEED$1);\n currentToken = ["space", css.slice(pos, next)];\n pos = next - 1;\n break;\n }\n case OPEN_SQUARE$1:\n case CLOSE_SQUARE$1:\n case OPEN_CURLY$1:\n case CLOSE_CURLY$1:\n case COLON$1:\n case SEMICOLON$1:\n case CLOSE_PARENTHESES$1: {\n let controlChar = String.fromCharCode(code);\n currentToken = [controlChar, controlChar, pos];\n break;\n }\n case OPEN_PARENTHESES$1: {\n prev = buffer.length ? buffer.pop()[1] : "";\n n2 = css.charCodeAt(pos + 1);\n if (prev === "url" && n2 !== SINGLE_QUOTE$1 && n2 !== DOUBLE_QUOTE$1 && n2 !== SPACE$1 && n2 !== NEWLINE$1 && n2 !== TAB$1 && n2 !== FEED$1 && n2 !== CR$1) {\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(")", next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos;\n break;\n } else {\n unclosed("bracket");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH$1) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = ["brackets", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n next = css.indexOf(")", pos + 1);\n content = css.slice(pos, next + 1);\n if (next === -1 || RE_BAD_BRACKET$1.test(content)) {\n currentToken = ["(", "(", pos];\n } else {\n currentToken = ["brackets", content, pos, next];\n pos = next;\n }\n }\n break;\n }\n case SINGLE_QUOTE$1:\n case DOUBLE_QUOTE$1: {\n quote = code === SINGLE_QUOTE$1 ? "\'" : \'"\';\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(quote, next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos + 1;\n break;\n } else {\n unclosed("string");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH$1) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = ["string", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case AT$1: {\n RE_AT_END$1.lastIndex = pos + 1;\n RE_AT_END$1.test(css);\n if (RE_AT_END$1.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_AT_END$1.lastIndex - 2;\n }\n currentToken = ["at-word", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case BACKSLASH$1: {\n next = pos;\n escape = true;\n while (css.charCodeAt(next + 1) === BACKSLASH$1) {\n next += 1;\n escape = !escape;\n }\n code = css.charCodeAt(next + 1);\n if (escape && code !== SLASH$1 && code !== SPACE$1 && code !== NEWLINE$1 && code !== TAB$1 && code !== CR$1 && code !== FEED$1) {\n next += 1;\n if (RE_HEX_ESCAPE$1.test(css.charAt(next))) {\n while (RE_HEX_ESCAPE$1.test(css.charAt(next + 1))) {\n next += 1;\n }\n if (css.charCodeAt(next + 1) === SPACE$1) {\n next += 1;\n }\n }\n }\n currentToken = ["word", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n default: {\n if (code === SLASH$1 && css.charCodeAt(pos + 1) === ASTERISK$1) {\n next = css.indexOf("*/", pos + 2) + 1;\n if (next === 0) {\n if (ignore || ignoreUnclosed) {\n next = css.length;\n } else {\n unclosed("comment");\n }\n }\n currentToken = ["comment", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n RE_WORD_END$1.lastIndex = pos + 1;\n RE_WORD_END$1.test(css);\n if (RE_WORD_END$1.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_WORD_END$1.lastIndex - 2;\n }\n currentToken = ["word", css.slice(pos, next + 1), pos, next];\n buffer.push(currentToken);\n pos = next;\n }\n break;\n }\n }\n pos++;\n return currentToken;\n }\n function back(token) {\n returned.push(token);\n }\n return {\n back,\n endOfFile,\n nextToken,\n position\n };\n};\nlet Container$5$1 = container$1;\nlet AtRule$3$1 = class AtRule extends Container$5$1 {\n constructor(defaults) {\n super(defaults);\n this.type = "atrule";\n }\n append(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.append(...children);\n }\n prepend(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.prepend(...children);\n }\n};\nvar atRule$1 = AtRule$3$1;\nAtRule$3$1.default = AtRule$3$1;\nContainer$5$1.registerAtRule(AtRule$3$1);\nlet Container$4$1 = container$1;\nlet LazyResult$3$1;\nlet Processor$2$1;\nlet Root$5$1 = class Root extends Container$4$1 {\n constructor(defaults) {\n super(defaults);\n this.type = "root";\n if (!this.nodes) this.nodes = [];\n }\n normalize(child, sample, type) {\n let nodes = super.normalize(child);\n if (sample) {\n if (type === "prepend") {\n if (this.nodes.length > 1) {\n sample.raws.before = this.nodes[1].raws.before;\n } else {\n delete sample.raws.before;\n }\n } else if (this.first !== sample) {\n for (let node2 of nodes) {\n node2.raws.before = sample.raws.before;\n }\n }\n }\n return nodes;\n }\n removeChild(child, ignore) {\n let index2 = this.index(child);\n if (!ignore && index2 === 0 && this.nodes.length > 1) {\n this.nodes[1].raws.before = this.nodes[index2].raws.before;\n }\n return super.removeChild(child);\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$3$1(new Processor$2$1(), this, opts);\n return lazy.stringify();\n }\n};\nRoot$5$1.registerLazyResult = (dependant) => {\n LazyResult$3$1 = dependant;\n};\nRoot$5$1.registerProcessor = (dependant) => {\n Processor$2$1 = dependant;\n};\nvar root$1 = Root$5$1;\nRoot$5$1.default = Root$5$1;\nContainer$4$1.registerRoot(Root$5$1);\nlet list$2$1 = {\n comma(string) {\n return list$2$1.split(string, [","], true);\n },\n space(string) {\n let spaces = [" ", "\\n", " "];\n return list$2$1.split(string, spaces);\n },\n split(string, separators, last) {\n let array = [];\n let current = "";\n let split = false;\n let func = 0;\n let inQuote = false;\n let prevQuote = "";\n let escape = false;\n for (let letter of string) {\n if (escape) {\n escape = false;\n } else if (letter === "\\\\") {\n escape = true;\n } else if (inQuote) {\n if (letter === prevQuote) {\n inQuote = false;\n }\n } else if (letter === \'"\' || letter === "\'") {\n inQuote = true;\n prevQuote = letter;\n } else if (letter === "(") {\n func += 1;\n } else if (letter === ")") {\n if (func > 0) func -= 1;\n } else if (func === 0) {\n if (separators.includes(letter)) split = true;\n }\n if (split) {\n if (current !== "") array.push(current.trim());\n current = "";\n split = false;\n } else {\n current += letter;\n }\n }\n if (last || current !== "") array.push(current.trim());\n return array;\n }\n};\nvar list_1$1 = list$2$1;\nlist$2$1.default = list$2$1;\nlet Container$3$1 = container$1;\nlet list$1$1 = list_1$1;\nlet Rule$3$1 = class Rule extends Container$3$1 {\n constructor(defaults) {\n super(defaults);\n this.type = "rule";\n if (!this.nodes) this.nodes = [];\n }\n get selectors() {\n return list$1$1.comma(this.selector);\n }\n set selectors(values) {\n let match = this.selector ? this.selector.match(/,\\s*/) : null;\n let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");\n this.selector = values.join(sep2);\n }\n};\nvar rule$1 = Rule$3$1;\nRule$3$1.default = Rule$3$1;\nContainer$3$1.registerRule(Rule$3$1);\nlet Declaration$2$1 = declaration$1;\nlet tokenizer2$1 = tokenize$1;\nlet Comment$2$1 = comment$1;\nlet AtRule$2$1 = atRule$1;\nlet Root$4$1 = root$1;\nlet Rule$2$1 = rule$1;\nconst SAFE_COMMENT_NEIGHBOR$1 = {\n empty: true,\n space: true\n};\nfunction findLastWithPosition$1(tokens) {\n for (let i2 = tokens.length - 1; i2 >= 0; i2--) {\n let token = tokens[i2];\n let pos = token[3] || token[2];\n if (pos) return pos;\n }\n}\nlet Parser$1$1 = class Parser {\n constructor(input2) {\n this.input = input2;\n this.root = new Root$4$1();\n this.current = this.root;\n this.spaces = "";\n this.semicolon = false;\n this.createTokenizer();\n this.root.source = { input: input2, start: { column: 1, line: 1, offset: 0 } };\n }\n atrule(token) {\n let node2 = new AtRule$2$1();\n node2.name = token[1].slice(1);\n if (node2.name === "") {\n this.unnamedAtrule(node2, token);\n }\n this.init(node2, token[2]);\n let type;\n let prev;\n let shift;\n let last = false;\n let open = false;\n let params = [];\n let brackets = [];\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n type = token[0];\n if (type === "(" || type === "[") {\n brackets.push(type === "(" ? ")" : "]");\n } else if (type === "{" && brackets.length > 0) {\n brackets.push("}");\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n }\n if (brackets.length === 0) {\n if (type === ";") {\n node2.source.end = this.getPosition(token[2]);\n node2.source.end.offset++;\n this.semicolon = true;\n break;\n } else if (type === "{") {\n open = true;\n break;\n } else if (type === "}") {\n if (params.length > 0) {\n shift = params.length - 1;\n prev = params[shift];\n while (prev && prev[0] === "space") {\n prev = params[--shift];\n }\n if (prev) {\n node2.source.end = this.getPosition(prev[3] || prev[2]);\n node2.source.end.offset++;\n }\n }\n this.end(token);\n break;\n } else {\n params.push(token);\n }\n } else {\n params.push(token);\n }\n if (this.tokenizer.endOfFile()) {\n last = true;\n break;\n }\n }\n node2.raws.between = this.spacesAndCommentsFromEnd(params);\n if (params.length) {\n node2.raws.afterName = this.spacesAndCommentsFromStart(params);\n this.raw(node2, "params", params);\n if (last) {\n token = params[params.length - 1];\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n this.spaces = node2.raws.between;\n node2.raws.between = "";\n }\n } else {\n node2.raws.afterName = "";\n node2.params = "";\n }\n if (open) {\n node2.nodes = [];\n this.current = node2;\n }\n }\n checkMissedSemicolon(tokens) {\n let colon = this.colon(tokens);\n if (colon === false) return;\n let founded = 0;\n let token;\n for (let j = colon - 1; j >= 0; j--) {\n token = tokens[j];\n if (token[0] !== "space") {\n founded += 1;\n if (founded === 2) break;\n }\n }\n throw this.input.error(\n "Missed semicolon",\n token[0] === "word" ? token[3] + 1 : token[2]\n );\n }\n colon(tokens) {\n let brackets = 0;\n let token, type, prev;\n for (let [i2, element] of tokens.entries()) {\n token = element;\n type = token[0];\n if (type === "(") {\n brackets += 1;\n }\n if (type === ")") {\n brackets -= 1;\n }\n if (brackets === 0 && type === ":") {\n if (!prev) {\n this.doubleColon(token);\n } else if (prev[0] === "word" && prev[1] === "progid") {\n continue;\n } else {\n return i2;\n }\n }\n prev = token;\n }\n return false;\n }\n comment(token) {\n let node2 = new Comment$2$1();\n this.init(node2, token[2]);\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n let text = token[1].slice(2, -2);\n if (/^\\s*$/.test(text)) {\n node2.text = "";\n node2.raws.left = text;\n node2.raws.right = "";\n } else {\n let match = text.match(/^(\\s*)([^]*\\S)(\\s*)$/);\n node2.text = match[2];\n node2.raws.left = match[1];\n node2.raws.right = match[3];\n }\n }\n createTokenizer() {\n this.tokenizer = tokenizer2$1(this.input);\n }\n decl(tokens, customProperty) {\n let node2 = new Declaration$2$1();\n this.init(node2, tokens[0][2]);\n let last = tokens[tokens.length - 1];\n if (last[0] === ";") {\n this.semicolon = true;\n tokens.pop();\n }\n node2.source.end = this.getPosition(\n last[3] || last[2] || findLastWithPosition$1(tokens)\n );\n node2.source.end.offset++;\n while (tokens[0][0] !== "word") {\n if (tokens.length === 1) this.unknownWord(tokens);\n node2.raws.before += tokens.shift()[1];\n }\n node2.source.start = this.getPosition(tokens[0][2]);\n node2.prop = "";\n while (tokens.length) {\n let type = tokens[0][0];\n if (type === ":" || type === "space" || type === "comment") {\n break;\n }\n node2.prop += tokens.shift()[1];\n }\n node2.raws.between = "";\n let token;\n while (tokens.length) {\n token = tokens.shift();\n if (token[0] === ":") {\n node2.raws.between += token[1];\n break;\n } else {\n if (token[0] === "word" && /\\w/.test(token[1])) {\n this.unknownWord([token]);\n }\n node2.raws.between += token[1];\n }\n }\n if (node2.prop[0] === "_" || node2.prop[0] === "*") {\n node2.raws.before += node2.prop[0];\n node2.prop = node2.prop.slice(1);\n }\n let firstSpaces = [];\n let next;\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== "space" && next !== "comment") break;\n firstSpaces.push(tokens.shift());\n }\n this.precheckMissedSemicolon(tokens);\n for (let i2 = tokens.length - 1; i2 >= 0; i2--) {\n token = tokens[i2];\n if (token[1].toLowerCase() === "!important") {\n node2.important = true;\n let string = this.stringFrom(tokens, i2);\n string = this.spacesFromEnd(tokens) + string;\n if (string !== " !important") node2.raws.important = string;\n break;\n } else if (token[1].toLowerCase() === "important") {\n let cache = tokens.slice(0);\n let str = "";\n for (let j = i2; j > 0; j--) {\n let type = cache[j][0];\n if (str.trim().indexOf("!") === 0 && type !== "space") {\n break;\n }\n str = cache.pop()[1] + str;\n }\n if (str.trim().indexOf("!") === 0) {\n node2.important = true;\n node2.raws.important = str;\n tokens = cache;\n }\n }\n if (token[0] !== "space" && token[0] !== "comment") {\n break;\n }\n }\n let hasWord = tokens.some((i2) => i2[0] !== "space" && i2[0] !== "comment");\n if (hasWord) {\n node2.raws.between += firstSpaces.map((i2) => i2[1]).join("");\n firstSpaces = [];\n }\n this.raw(node2, "value", firstSpaces.concat(tokens), customProperty);\n if (node2.value.includes(":") && !customProperty) {\n this.checkMissedSemicolon(tokens);\n }\n }\n doubleColon(token) {\n throw this.input.error(\n "Double colon",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n emptyRule(token) {\n let node2 = new Rule$2$1();\n this.init(node2, token[2]);\n node2.selector = "";\n node2.raws.between = "";\n this.current = node2;\n }\n end(token) {\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.semicolon = false;\n this.current.raws.after = (this.current.raws.after || "") + this.spaces;\n this.spaces = "";\n if (this.current.parent) {\n this.current.source.end = this.getPosition(token[2]);\n this.current.source.end.offset++;\n this.current = this.current.parent;\n } else {\n this.unexpectedClose(token);\n }\n }\n endFile() {\n if (this.current.parent) this.unclosedBlock();\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.current.raws.after = (this.current.raws.after || "") + this.spaces;\n this.root.source.end = this.getPosition(this.tokenizer.position());\n }\n freeSemicolon(token) {\n this.spaces += token[1];\n if (this.current.nodes) {\n let prev = this.current.nodes[this.current.nodes.length - 1];\n if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {\n prev.raws.ownSemicolon = this.spaces;\n this.spaces = "";\n }\n }\n }\n // Helpers\n getPosition(offset) {\n let pos = this.input.fromOffset(offset);\n return {\n column: pos.col,\n line: pos.line,\n offset\n };\n }\n init(node2, offset) {\n this.current.push(node2);\n node2.source = {\n input: this.input,\n start: this.getPosition(offset)\n };\n node2.raws.before = this.spaces;\n this.spaces = "";\n if (node2.type !== "comment") this.semicolon = false;\n }\n other(start) {\n let end = false;\n let type = null;\n let colon = false;\n let bracket = null;\n let brackets = [];\n let customProperty = start[1].startsWith("--");\n let tokens = [];\n let token = start;\n while (token) {\n type = token[0];\n tokens.push(token);\n if (type === "(" || type === "[") {\n if (!bracket) bracket = token;\n brackets.push(type === "(" ? ")" : "]");\n } else if (customProperty && colon && type === "{") {\n if (!bracket) bracket = token;\n brackets.push("}");\n } else if (brackets.length === 0) {\n if (type === ";") {\n if (colon) {\n this.decl(tokens, customProperty);\n return;\n } else {\n break;\n }\n } else if (type === "{") {\n this.rule(tokens);\n return;\n } else if (type === "}") {\n this.tokenizer.back(tokens.pop());\n end = true;\n break;\n } else if (type === ":") {\n colon = true;\n }\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n if (brackets.length === 0) bracket = null;\n }\n token = this.tokenizer.nextToken();\n }\n if (this.tokenizer.endOfFile()) end = true;\n if (brackets.length > 0) this.unclosedBracket(bracket);\n if (end && colon) {\n if (!customProperty) {\n while (tokens.length) {\n token = tokens[tokens.length - 1][0];\n if (token !== "space" && token !== "comment") break;\n this.tokenizer.back(tokens.pop());\n }\n }\n this.decl(tokens, customProperty);\n } else {\n this.unknownWord(tokens);\n }\n }\n parse() {\n let token;\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n switch (token[0]) {\n case "space":\n this.spaces += token[1];\n break;\n case ";":\n this.freeSemicolon(token);\n break;\n case "}":\n this.end(token);\n break;\n case "comment":\n this.comment(token);\n break;\n case "at-word":\n this.atrule(token);\n break;\n case "{":\n this.emptyRule(token);\n break;\n default:\n this.other(token);\n break;\n }\n }\n this.endFile();\n }\n precheckMissedSemicolon() {\n }\n raw(node2, prop, tokens, customProperty) {\n let token, type;\n let length = tokens.length;\n let value = "";\n let clean = true;\n let next, prev;\n for (let i2 = 0; i2 < length; i2 += 1) {\n token = tokens[i2];\n type = token[0];\n if (type === "space" && i2 === length - 1 && !customProperty) {\n clean = false;\n } else if (type === "comment") {\n prev = tokens[i2 - 1] ? tokens[i2 - 1][0] : "empty";\n next = tokens[i2 + 1] ? tokens[i2 + 1][0] : "empty";\n if (!SAFE_COMMENT_NEIGHBOR$1[prev] && !SAFE_COMMENT_NEIGHBOR$1[next]) {\n if (value.slice(-1) === ",") {\n clean = false;\n } else {\n value += token[1];\n }\n } else {\n clean = false;\n }\n } else {\n value += token[1];\n }\n }\n if (!clean) {\n let raw = tokens.reduce((all, i2) => all + i2[1], "");\n node2.raws[prop] = { raw, value };\n }\n node2[prop] = value;\n }\n rule(tokens) {\n tokens.pop();\n let node2 = new Rule$2$1();\n this.init(node2, tokens[0][2]);\n node2.raws.between = this.spacesAndCommentsFromEnd(tokens);\n this.raw(node2, "selector", tokens);\n this.current = node2;\n }\n spacesAndCommentsFromEnd(tokens) {\n let lastTokenType;\n let spaces = "";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== "space" && lastTokenType !== "comment") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n // Errors\n spacesAndCommentsFromStart(tokens) {\n let next;\n let spaces = "";\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== "space" && next !== "comment") break;\n spaces += tokens.shift()[1];\n }\n return spaces;\n }\n spacesFromEnd(tokens) {\n let lastTokenType;\n let spaces = "";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== "space") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n stringFrom(tokens, from) {\n let result2 = "";\n for (let i2 = from; i2 < tokens.length; i2++) {\n result2 += tokens[i2][1];\n }\n tokens.splice(from, tokens.length - from);\n return result2;\n }\n unclosedBlock() {\n let pos = this.current.source.start;\n throw this.input.error("Unclosed block", pos.line, pos.column);\n }\n unclosedBracket(bracket) {\n throw this.input.error(\n "Unclosed bracket",\n { offset: bracket[2] },\n { offset: bracket[2] + 1 }\n );\n }\n unexpectedClose(token) {\n throw this.input.error(\n "Unexpected }",\n { offset: token[2] },\n { offset: token[2] + 1 }\n );\n }\n unknownWord(tokens) {\n throw this.input.error(\n "Unknown word",\n { offset: tokens[0][2] },\n { offset: tokens[0][2] + tokens[0][1].length }\n );\n }\n unnamedAtrule(node2, token) {\n throw this.input.error(\n "At-rule without name",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n};\nvar parser$1 = Parser$1$1;\nlet Container$2$1 = container$1;\nlet Parser2$1 = parser$1;\nlet Input$2$1 = input$1;\nfunction parse$3$1(css, opts) {\n let input2 = new Input$2$1(css, opts);\n let parser2 = new Parser2$1(input2);\n try {\n parser2.parse();\n } catch (e2) {\n if (true) {\n if (e2.name === "CssSyntaxError" && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e2.message += "\\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";\n } else if (/\\.sass/i.test(opts.from)) {\n e2.message += "\\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser";\n } else if (/\\.less$/i.test(opts.from)) {\n e2.message += "\\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser";\n }\n }\n }\n throw e2;\n }\n return parser2.root;\n}\nvar parse_1$1 = parse$3$1;\nparse$3$1.default = parse$3$1;\nContainer$2$1.registerParse(parse$3$1);\nlet { isClean: isClean$3, my: my$3 } = symbols$1;\nlet MapGenerator$1$1 = mapGenerator$1;\nlet stringify$2$1 = stringify_1$1;\nlet Container$1$1 = container$1;\nlet Document$2$1 = document$1$1;\nlet warnOnce$1$1 = warnOnce$2$1;\nlet Result$2$1 = result$1;\nlet parse$2$1 = parse_1$1;\nlet Root$3$1 = root$1;\nconst TYPE_TO_CLASS_NAME$1 = {\n atrule: "AtRule",\n comment: "Comment",\n decl: "Declaration",\n document: "Document",\n root: "Root",\n rule: "Rule"\n};\nconst PLUGIN_PROPS$1 = {\n AtRule: true,\n AtRuleExit: true,\n Comment: true,\n CommentExit: true,\n Declaration: true,\n DeclarationExit: true,\n Document: true,\n DocumentExit: true,\n Once: true,\n OnceExit: true,\n postcssPlugin: true,\n prepare: true,\n Root: true,\n RootExit: true,\n Rule: true,\n RuleExit: true\n};\nconst NOT_VISITORS$1 = {\n Once: true,\n postcssPlugin: true,\n prepare: true\n};\nconst CHILDREN$1 = 0;\nfunction isPromise$1(obj) {\n return typeof obj === "object" && typeof obj.then === "function";\n}\nfunction getEvents$1(node2) {\n let key = false;\n let type = TYPE_TO_CLASS_NAME$1[node2.type];\n if (node2.type === "decl") {\n key = node2.prop.toLowerCase();\n } else if (node2.type === "atrule") {\n key = node2.name.toLowerCase();\n }\n if (key && node2.append) {\n return [\n type,\n type + "-" + key,\n CHILDREN$1,\n type + "Exit",\n type + "Exit-" + key\n ];\n } else if (key) {\n return [type, type + "-" + key, type + "Exit", type + "Exit-" + key];\n } else if (node2.append) {\n return [type, CHILDREN$1, type + "Exit"];\n } else {\n return [type, type + "Exit"];\n }\n}\nfunction toStack$1(node2) {\n let events;\n if (node2.type === "document") {\n events = ["Document", CHILDREN$1, "DocumentExit"];\n } else if (node2.type === "root") {\n events = ["Root", CHILDREN$1, "RootExit"];\n } else {\n events = getEvents$1(node2);\n }\n return {\n eventIndex: 0,\n events,\n iterator: 0,\n node: node2,\n visitorIndex: 0,\n visitors: []\n };\n}\nfunction cleanMarks$1(node2) {\n node2[isClean$3] = false;\n if (node2.nodes) node2.nodes.forEach((i2) => cleanMarks$1(i2));\n return node2;\n}\nlet postcss$2$1 = {};\nlet LazyResult$2$1 = class LazyResult {\n constructor(processor2, css, opts) {\n this.stringified = false;\n this.processed = false;\n let root2;\n if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {\n root2 = cleanMarks$1(css);\n } else if (css instanceof LazyResult || css instanceof Result$2$1) {\n root2 = cleanMarks$1(css.root);\n if (css.map) {\n if (typeof opts.map === "undefined") opts.map = {};\n if (!opts.map.inline) opts.map.inline = false;\n opts.map.prev = css.map;\n }\n } else {\n let parser2 = parse$2$1;\n if (opts.syntax) parser2 = opts.syntax.parse;\n if (opts.parser) parser2 = opts.parser;\n if (parser2.parse) parser2 = parser2.parse;\n try {\n root2 = parser2(css, opts);\n } catch (error) {\n this.processed = true;\n this.error = error;\n }\n if (root2 && !root2[my$3]) {\n Container$1$1.rebuild(root2);\n }\n }\n this.result = new Result$2$1(processor2, root2, opts);\n this.helpers = __spreadProps(__spreadValues({}, postcss$2$1), { postcss: postcss$2$1, result: this.result });\n this.plugins = this.processor.plugins.map((plugin22) => {\n if (typeof plugin22 === "object" && plugin22.prepare) {\n return __spreadValues(__spreadValues({}, plugin22), plugin22.prepare(this.result));\n } else {\n return plugin22;\n }\n });\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n if (this.processed) return Promise.resolve(this.result);\n if (!this.processing) {\n this.processing = this.runAsync();\n }\n return this.processing;\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n getAsyncError() {\n throw new Error("Use process(css).then(cb) to work with async plugins");\n }\n handleError(error, node2) {\n let plugin22 = this.result.lastPlugin;\n try {\n if (node2) node2.addToError(error);\n this.error = error;\n if (error.name === "CssSyntaxError" && !error.plugin) {\n error.plugin = plugin22.postcssPlugin;\n error.setMessage();\n } else if (plugin22.postcssVersion) {\n if (true) {\n let pluginName = plugin22.postcssPlugin;\n let pluginVer = plugin22.postcssVersion;\n let runtimeVer = this.result.processor.version;\n let a2 = pluginVer.split(".");\n let b = runtimeVer.split(".");\n if (a2[0] !== b[0] || parseInt(a2[1]) > parseInt(b[1])) {\n console.error(\n "Unknown error from PostCSS plugin. Your current PostCSS version is " + runtimeVer + ", but " + pluginName + " uses " + pluginVer + ". Perhaps this is the source of the error below."\n );\n }\n }\n }\n } catch (err) {\n if (console && console.error) console.error(err);\n }\n return error;\n }\n prepareVisitors() {\n this.listeners = {};\n let add = (plugin22, type, cb) => {\n if (!this.listeners[type]) this.listeners[type] = [];\n this.listeners[type].push([plugin22, cb]);\n };\n for (let plugin22 of this.plugins) {\n if (typeof plugin22 === "object") {\n for (let event in plugin22) {\n if (!PLUGIN_PROPS$1[event] && /^[A-Z]/.test(event)) {\n throw new Error(\n `Unknown event ${event} in ${plugin22.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`\n );\n }\n if (!NOT_VISITORS$1[event]) {\n if (typeof plugin22[event] === "object") {\n for (let filter in plugin22[event]) {\n if (filter === "*") {\n add(plugin22, event, plugin22[event][filter]);\n } else {\n add(\n plugin22,\n event + "-" + filter.toLowerCase(),\n plugin22[event][filter]\n );\n }\n }\n } else if (typeof plugin22[event] === "function") {\n add(plugin22, event, plugin22[event]);\n }\n }\n }\n }\n }\n this.hasListener = Object.keys(this.listeners).length > 0;\n }\n async runAsync() {\n this.plugin = 0;\n for (let i2 = 0; i2 < this.plugins.length; i2++) {\n let plugin22 = this.plugins[i2];\n let promise = this.runOnRoot(plugin22);\n if (isPromise$1(promise)) {\n try {\n await promise;\n } catch (error) {\n throw this.handleError(error);\n }\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean$3]) {\n root2[isClean$3] = true;\n let stack = [toStack$1(root2)];\n while (stack.length > 0) {\n let promise = this.visitTick(stack);\n if (isPromise$1(promise)) {\n try {\n await promise;\n } catch (e2) {\n let node2 = stack[stack.length - 1].node;\n throw this.handleError(e2, node2);\n }\n }\n }\n }\n if (this.listeners.OnceExit) {\n for (let [plugin22, visitor] of this.listeners.OnceExit) {\n this.result.lastPlugin = plugin22;\n try {\n if (root2.type === "document") {\n let roots = root2.nodes.map(\n (subRoot) => visitor(subRoot, this.helpers)\n );\n await Promise.all(roots);\n } else {\n await visitor(root2, this.helpers);\n }\n } catch (e2) {\n throw this.handleError(e2);\n }\n }\n }\n }\n this.processed = true;\n return this.stringify();\n }\n runOnRoot(plugin22) {\n this.result.lastPlugin = plugin22;\n try {\n if (typeof plugin22 === "object" && plugin22.Once) {\n if (this.result.root.type === "document") {\n let roots = this.result.root.nodes.map(\n (root2) => plugin22.Once(root2, this.helpers)\n );\n if (isPromise$1(roots[0])) {\n return Promise.all(roots);\n }\n return roots;\n }\n return plugin22.Once(this.result.root, this.helpers);\n } else if (typeof plugin22 === "function") {\n return plugin22(this.result.root, this.result);\n }\n } catch (error) {\n throw this.handleError(error);\n }\n }\n stringify() {\n if (this.error) throw this.error;\n if (this.stringified) return this.result;\n this.stringified = true;\n this.sync();\n let opts = this.result.opts;\n let str = stringify$2$1;\n if (opts.syntax) str = opts.syntax.stringify;\n if (opts.stringifier) str = opts.stringifier;\n if (str.stringify) str = str.stringify;\n let map = new MapGenerator$1$1(str, this.result.root, this.result.opts);\n let data = map.generate();\n this.result.css = data[0];\n this.result.map = data[1];\n return this.result;\n }\n sync() {\n if (this.error) throw this.error;\n if (this.processed) return this.result;\n this.processed = true;\n if (this.processing) {\n throw this.getAsyncError();\n }\n for (let plugin22 of this.plugins) {\n let promise = this.runOnRoot(plugin22);\n if (isPromise$1(promise)) {\n throw this.getAsyncError();\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean$3]) {\n root2[isClean$3] = true;\n this.walkSync(root2);\n }\n if (this.listeners.OnceExit) {\n if (root2.type === "document") {\n for (let subRoot of root2.nodes) {\n this.visitSync(this.listeners.OnceExit, subRoot);\n }\n } else {\n this.visitSync(this.listeners.OnceExit, root2);\n }\n }\n }\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (true) {\n if (!("from" in this.opts)) {\n warnOnce$1$1(\n "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this.css;\n }\n visitSync(visitors, node2) {\n for (let [plugin22, visitor] of visitors) {\n this.result.lastPlugin = plugin22;\n let promise;\n try {\n promise = visitor(node2, this.helpers);\n } catch (e2) {\n throw this.handleError(e2, node2.proxyOf);\n }\n if (node2.type !== "root" && node2.type !== "document" && !node2.parent) {\n return true;\n }\n if (isPromise$1(promise)) {\n throw this.getAsyncError();\n }\n }\n }\n visitTick(stack) {\n let visit2 = stack[stack.length - 1];\n let { node: node2, visitors } = visit2;\n if (node2.type !== "root" && node2.type !== "document" && !node2.parent) {\n stack.pop();\n return;\n }\n if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {\n let [plugin22, visitor] = visitors[visit2.visitorIndex];\n visit2.visitorIndex += 1;\n if (visit2.visitorIndex === visitors.length) {\n visit2.visitors = [];\n visit2.visitorIndex = 0;\n }\n this.result.lastPlugin = plugin22;\n try {\n return visitor(node2.toProxy(), this.helpers);\n } catch (e2) {\n throw this.handleError(e2, node2);\n }\n }\n if (visit2.iterator !== 0) {\n let iterator = visit2.iterator;\n let child;\n while (child = node2.nodes[node2.indexes[iterator]]) {\n node2.indexes[iterator] += 1;\n if (!child[isClean$3]) {\n child[isClean$3] = true;\n stack.push(toStack$1(child));\n return;\n }\n }\n visit2.iterator = 0;\n delete node2.indexes[iterator];\n }\n let events = visit2.events;\n while (visit2.eventIndex < events.length) {\n let event = events[visit2.eventIndex];\n visit2.eventIndex += 1;\n if (event === CHILDREN$1) {\n if (node2.nodes && node2.nodes.length) {\n node2[isClean$3] = true;\n visit2.iterator = node2.getIterator();\n }\n return;\n } else if (this.listeners[event]) {\n visit2.visitors = this.listeners[event];\n return;\n }\n }\n stack.pop();\n }\n walkSync(node2) {\n node2[isClean$3] = true;\n let events = getEvents$1(node2);\n for (let event of events) {\n if (event === CHILDREN$1) {\n if (node2.nodes) {\n node2.each((child) => {\n if (!child[isClean$3]) this.walkSync(child);\n });\n }\n } else {\n let visitors = this.listeners[event];\n if (visitors) {\n if (this.visitSync(visitors, node2.toProxy())) return;\n }\n }\n }\n }\n warnings() {\n return this.sync().warnings();\n }\n get content() {\n return this.stringify().content;\n }\n get css() {\n return this.stringify().css;\n }\n get map() {\n return this.stringify().map;\n }\n get messages() {\n return this.sync().messages;\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n return this.sync().root;\n }\n get [Symbol.toStringTag]() {\n return "LazyResult";\n }\n};\nLazyResult$2$1.registerPostcss = (dependant) => {\n postcss$2$1 = dependant;\n};\nvar lazyResult$1 = LazyResult$2$1;\nLazyResult$2$1.default = LazyResult$2$1;\nRoot$3$1.registerLazyResult(LazyResult$2$1);\nDocument$2$1.registerLazyResult(LazyResult$2$1);\nlet MapGenerator2$1 = mapGenerator$1;\nlet stringify$1$1 = stringify_1$1;\nlet warnOnce2$1 = warnOnce$2$1;\nlet parse$1$1 = parse_1$1;\nconst Result$1$1 = result$1;\nlet NoWorkResult$1$1 = class NoWorkResult {\n constructor(processor2, css, opts) {\n css = css.toString();\n this.stringified = false;\n this._processor = processor2;\n this._css = css;\n this._opts = opts;\n this._map = void 0;\n let root2;\n let str = stringify$1$1;\n this.result = new Result$1$1(this._processor, root2, this._opts);\n this.result.css = css;\n let self = this;\n Object.defineProperty(this.result, "root", {\n get() {\n return self.root;\n }\n });\n let map = new MapGenerator2$1(str, root2, this._opts, css);\n if (map.isMap()) {\n let [generatedCSS, generatedMap] = map.generate();\n if (generatedCSS) {\n this.result.css = generatedCSS;\n }\n if (generatedMap) {\n this.result.map = generatedMap;\n }\n } else {\n map.clearAnnotation();\n this.result.css = map.css;\n }\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n return Promise.resolve(this.result);\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n sync() {\n if (this.error) throw this.error;\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (true) {\n if (!("from" in this._opts)) {\n warnOnce2$1(\n "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this._css;\n }\n warnings() {\n return [];\n }\n get content() {\n return this.result.css;\n }\n get css() {\n return this.result.css;\n }\n get map() {\n return this.result.map;\n }\n get messages() {\n return [];\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n if (this._root) {\n return this._root;\n }\n let root2;\n let parser2 = parse$1$1;\n try {\n root2 = parser2(this._css, this._opts);\n } catch (error) {\n this.error = error;\n }\n if (this.error) {\n throw this.error;\n } else {\n this._root = root2;\n return root2;\n }\n }\n get [Symbol.toStringTag]() {\n return "NoWorkResult";\n }\n};\nvar noWorkResult$1 = NoWorkResult$1$1;\nNoWorkResult$1$1.default = NoWorkResult$1$1;\nlet NoWorkResult2$1 = noWorkResult$1;\nlet LazyResult$1$1 = lazyResult$1;\nlet Document$1$1 = document$1$1;\nlet Root$2$1 = root$1;\nlet Processor$1$1 = class Processor {\n constructor(plugins = []) {\n this.version = "8.4.38";\n this.plugins = this.normalize(plugins);\n }\n normalize(plugins) {\n let normalized = [];\n for (let i2 of plugins) {\n if (i2.postcss === true) {\n i2 = i2();\n } else if (i2.postcss) {\n i2 = i2.postcss;\n }\n if (typeof i2 === "object" && Array.isArray(i2.plugins)) {\n normalized = normalized.concat(i2.plugins);\n } else if (typeof i2 === "object" && i2.postcssPlugin) {\n normalized.push(i2);\n } else if (typeof i2 === "function") {\n normalized.push(i2);\n } else if (typeof i2 === "object" && (i2.parse || i2.stringify)) {\n if (true) {\n throw new Error(\n "PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation."\n );\n }\n } else {\n throw new Error(i2 + " is not a PostCSS plugin");\n }\n }\n return normalized;\n }\n process(css, opts = {}) {\n if (!this.plugins.length && !opts.parser && !opts.stringifier && !opts.syntax) {\n return new NoWorkResult2$1(this, css, opts);\n } else {\n return new LazyResult$1$1(this, css, opts);\n }\n }\n use(plugin22) {\n this.plugins = this.plugins.concat(this.normalize([plugin22]));\n return this;\n }\n};\nvar processor$1 = Processor$1$1;\nProcessor$1$1.default = Processor$1$1;\nRoot$2$1.registerProcessor(Processor$1$1);\nDocument$1$1.registerProcessor(Processor$1$1);\nlet Declaration$1$1 = declaration$1;\nlet PreviousMap2$1 = previousMap$1;\nlet Comment$1$1 = comment$1;\nlet AtRule$1$1 = atRule$1;\nlet Input$1$1 = input$1;\nlet Root$1$1 = root$1;\nlet Rule$1$1 = rule$1;\nfunction fromJSON$1$1(json, inputs) {\n if (Array.isArray(json)) return json.map((n2) => fromJSON$1$1(n2));\n let _a2 = json, { inputs: ownInputs } = _a2, defaults = __objRest(_a2, ["inputs"]);\n if (ownInputs) {\n inputs = [];\n for (let input2 of ownInputs) {\n let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$1$1.prototype });\n if (inputHydrated.map) {\n inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {\n __proto__: PreviousMap2$1.prototype\n });\n }\n inputs.push(inputHydrated);\n }\n }\n if (defaults.nodes) {\n defaults.nodes = json.nodes.map((n2) => fromJSON$1$1(n2, inputs));\n }\n if (defaults.source) {\n let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);\n defaults.source = source;\n if (inputId != null) {\n defaults.source.input = inputs[inputId];\n }\n }\n if (defaults.type === "root") {\n return new Root$1$1(defaults);\n } else if (defaults.type === "decl") {\n return new Declaration$1$1(defaults);\n } else if (defaults.type === "rule") {\n return new Rule$1$1(defaults);\n } else if (defaults.type === "comment") {\n return new Comment$1$1(defaults);\n } else if (defaults.type === "atrule") {\n return new AtRule$1$1(defaults);\n } else {\n throw new Error("Unknown node type: " + json.type);\n }\n}\nvar fromJSON_1$1 = fromJSON$1$1;\nfromJSON$1$1.default = fromJSON$1$1;\nlet CssSyntaxError2$1 = cssSyntaxError$1;\nlet Declaration2$1 = declaration$1;\nlet LazyResult2$1 = lazyResult$1;\nlet Container2$1 = container$1;\nlet Processor2$1 = processor$1;\nlet stringify$5 = stringify_1$1;\nlet fromJSON$2 = fromJSON_1$1;\nlet Document22 = document$1$1;\nlet Warning2$1 = warning$1;\nlet Comment2$1 = comment$1;\nlet AtRule2$1 = atRule$1;\nlet Result2$1 = result$1;\nlet Input2$1 = input$1;\nlet parse$5 = parse_1$1;\nlet list$3 = list_1$1;\nlet Rule2$1 = rule$1;\nlet Root2$1 = root$1;\nlet Node$1$1 = node$1;\nfunction postcss$3(...plugins) {\n if (plugins.length === 1 && Array.isArray(plugins[0])) {\n plugins = plugins[0];\n }\n return new Processor2$1(plugins);\n}\npostcss$3.plugin = function plugin(name, initializer) {\n let warningPrinted = false;\n function creator(...args) {\n if (console && console.warn && !warningPrinted) {\n warningPrinted = true;\n console.warn(\n name + ": postcss.plugin was deprecated. Migration guide:\\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"\n );\n if (process.env.LANG && process.env.LANG.startsWith("cn")) {\n console.warn(\n name + ": \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\\nhttps://www.w3ctech.com/topic/2226"\n );\n }\n }\n let transformer = initializer(...args);\n transformer.postcssPlugin = name;\n transformer.postcssVersion = new Processor2$1().version;\n return transformer;\n }\n let cache;\n Object.defineProperty(creator, "postcss", {\n get() {\n if (!cache) cache = creator();\n return cache;\n }\n });\n creator.process = function(css, processOpts, pluginOpts) {\n return postcss$3([creator(pluginOpts)]).process(css, processOpts);\n };\n return creator;\n};\npostcss$3.stringify = stringify$5;\npostcss$3.parse = parse$5;\npostcss$3.fromJSON = fromJSON$2;\npostcss$3.list = list$3;\npostcss$3.comment = (defaults) => new Comment2$1(defaults);\npostcss$3.atRule = (defaults) => new AtRule2$1(defaults);\npostcss$3.decl = (defaults) => new Declaration2$1(defaults);\npostcss$3.rule = (defaults) => new Rule2$1(defaults);\npostcss$3.root = (defaults) => new Root2$1(defaults);\npostcss$3.document = (defaults) => new Document22(defaults);\npostcss$3.CssSyntaxError = CssSyntaxError2$1;\npostcss$3.Declaration = Declaration2$1;\npostcss$3.Container = Container2$1;\npostcss$3.Processor = Processor2$1;\npostcss$3.Document = Document22;\npostcss$3.Comment = Comment2$1;\npostcss$3.Warning = Warning2$1;\npostcss$3.AtRule = AtRule2$1;\npostcss$3.Result = Result2$1;\npostcss$3.Input = Input2$1;\npostcss$3.Rule = Rule2$1;\npostcss$3.Root = Root2$1;\npostcss$3.Node = Node$1$1;\nLazyResult2$1.registerPostcss(postcss$3);\nvar postcss_1$1 = postcss$3;\npostcss$3.default = postcss$3;\nconst postcss$1$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(postcss_1$1);\npostcss$1$1.stringify;\npostcss$1$1.fromJSON;\npostcss$1$1.plugin;\npostcss$1$1.parse;\npostcss$1$1.list;\npostcss$1$1.document;\npostcss$1$1.comment;\npostcss$1$1.atRule;\npostcss$1$1.rule;\npostcss$1$1.decl;\npostcss$1$1.root;\npostcss$1$1.CssSyntaxError;\npostcss$1$1.Declaration;\npostcss$1$1.Container;\npostcss$1$1.Processor;\npostcss$1$1.Document;\npostcss$1$1.Comment;\npostcss$1$1.Warning;\npostcss$1$1.AtRule;\npostcss$1$1.Result;\npostcss$1$1.Input;\npostcss$1$1.Rule;\npostcss$1$1.Root;\npostcss$1$1.Node;\nvar __defProp22 = Object.defineProperty;\nvar __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField2 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);\nconst interactiveEvents = [\n "change",\n "submit",\n "dragstart",\n "drop",\n "pointerdown",\n "pointerup",\n "input",\n "keydown",\n "keyup",\n "keypress",\n "mouseenter",\n "mouseleave",\n "mouseup",\n "mousedown",\n "click",\n "contextmenu",\n "dblclick",\n "focus",\n "blur",\n "touchstart",\n "touchmove",\n "touchend",\n "touchcancel"\n];\nconst inlineEventAttributes = [\n "onclick",\n "ondblclick",\n "onmousedown",\n "onmouseup",\n "onmouseover",\n "onmouseout",\n "onmousemove",\n "onfocus",\n "onblur",\n "onkeydown",\n "onkeypress",\n "onkeyup",\n "onchange",\n "oninput",\n "onsubmit",\n "onreset",\n "onselect",\n "oncontextmenu",\n "ontouchstart",\n "ontouchmove",\n "ontouchend",\n "ontouchcancel"\n];\nconst interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();\nconst originalAddEventListener = EventTarget.prototype.addEventListener;\nEventTarget.prototype.addEventListener = function(type, listener, options) {\n originalAddEventListener.call(this, type, listener, options);\n if (this instanceof Element) {\n const eventType = type.toLowerCase();\n if (interactiveEvents.includes(eventType)) {\n interactiveElementsRegistry.add(this);\n }\n }\n};\nconst originalRemoveEventListener = EventTarget.prototype.removeEventListener;\nEventTarget.prototype.removeEventListener = function(type, listener, options) {\n originalRemoveEventListener.call(this, type, listener, options);\n};\nfunction inspectInlineEventHandlers() {\n const allElements = document.querySelectorAll("*");\n allElements.forEach((el) => {\n inlineEventAttributes.forEach((attr) => {\n if (el.hasAttribute(attr)) {\n interactiveElementsRegistry.add(el);\n }\n });\n });\n}\nif (document.readyState === "complete" || document.readyState === "interactive") {\n inspectInlineEventHandlers();\n} else {\n document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);\n}\nfunction getDefaultExportFromCjs(x2) {\n return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;\n}\nfunction getAugmentedNamespace(n2) {\n if (n2.__esModule) return n2;\n var f2 = n2.default;\n if (typeof f2 == "function") {\n var a2 = function a22() {\n if (this instanceof a22) {\n return Reflect.construct(f2, arguments, this.constructor);\n }\n return f2.apply(this, arguments);\n };\n a2.prototype = f2.prototype;\n } else a2 = {};\n Object.defineProperty(a2, "__esModule", { value: true });\n Object.keys(n2).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n2, k);\n Object.defineProperty(a2, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n2[k];\n }\n });\n });\n return a2;\n}\nvar picocolors_browser = { exports: {} };\nvar x = String;\nvar create = function() {\n return { isColorSupported: false, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x };\n};\npicocolors_browser.exports = create();\npicocolors_browser.exports.createColors = create;\nvar picocolors_browserExports = picocolors_browser.exports;\nconst __viteBrowserExternal = {};\nconst __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n default: __viteBrowserExternal\n}, Symbol.toStringTag, { value: "Module" }));\nconst require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);\nlet pico = picocolors_browserExports;\nlet terminalHighlight$1 = require$$2;\nlet CssSyntaxError$3 = class CssSyntaxError2 extends Error {\n constructor(message, line, column, source, file, plugin22) {\n super(message);\n this.name = "CssSyntaxError";\n this.reason = message;\n if (file) {\n this.file = file;\n }\n if (source) {\n this.source = source;\n }\n if (plugin22) {\n this.plugin = plugin22;\n }\n if (typeof line !== "undefined" && typeof column !== "undefined") {\n if (typeof line === "number") {\n this.line = line;\n this.column = column;\n } else {\n this.line = line.line;\n this.column = line.column;\n this.endLine = column.line;\n this.endColumn = column.column;\n }\n }\n this.setMessage();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CssSyntaxError2);\n }\n }\n setMessage() {\n this.message = this.plugin ? this.plugin + ": " : "";\n this.message += this.file ? this.file : "<css input>";\n if (typeof this.line !== "undefined") {\n this.message += ":" + this.line + ":" + this.column;\n }\n this.message += ": " + this.reason;\n }\n showSourceCode(color) {\n if (!this.source) return "";\n let css = this.source;\n if (color == null) color = pico.isColorSupported;\n if (terminalHighlight$1) {\n if (color) css = terminalHighlight$1(css);\n }\n let lines = css.split(/\\r?\\n/);\n let start = Math.max(this.line - 3, 0);\n let end = Math.min(this.line + 2, lines.length);\n let maxWidth = String(end).length;\n let mark, aside;\n if (color) {\n let { bold, gray, red } = pico.createColors(true);\n mark = (text) => bold(red(text));\n aside = (text) => gray(text);\n } else {\n mark = aside = (str) => str;\n }\n return lines.slice(start, end).map((line, index2) => {\n let number = start + 1 + index2;\n let gutter = " " + (" " + number).slice(-maxWidth) + " | ";\n if (number === this.line) {\n let spacing = aside(gutter.replace(/\\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\\t]/g, " ");\n return mark(">") + aside(gutter) + line + "\\n " + spacing + mark("^");\n }\n return " " + aside(gutter) + line;\n }).join("\\n");\n }\n toString() {\n let code = this.showSourceCode();\n if (code) {\n code = "\\n\\n" + code + "\\n";\n }\n return this.name + ": " + this.message + code;\n }\n};\nvar cssSyntaxError = CssSyntaxError$3;\nCssSyntaxError$3.default = CssSyntaxError$3;\nvar symbols = {};\nsymbols.isClean = Symbol("isClean");\nsymbols.my = Symbol("my");\nconst DEFAULT_RAW = {\n after: "\\n",\n beforeClose: "\\n",\n beforeComment: "\\n",\n beforeDecl: "\\n",\n beforeOpen: " ",\n beforeRule: "\\n",\n colon: ": ",\n commentLeft: " ",\n commentRight: " ",\n emptyBody: "",\n indent: " ",\n semicolon: false\n};\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1);\n}\nlet Stringifier$2 = class Stringifier2 {\n constructor(builder) {\n this.builder = builder;\n }\n atrule(node2, semicolon) {\n let name = "@" + node2.name;\n let params = node2.params ? this.rawValue(node2, "params") : "";\n if (typeof node2.raws.afterName !== "undefined") {\n name += node2.raws.afterName;\n } else if (params) {\n name += " ";\n }\n if (node2.nodes) {\n this.block(node2, name + params);\n } else {\n let end = (node2.raws.between || "") + (semicolon ? ";" : "");\n this.builder(name + params + end, node2);\n }\n }\n beforeAfter(node2, detect) {\n let value;\n if (node2.type === "decl") {\n value = this.raw(node2, null, "beforeDecl");\n } else if (node2.type === "comment") {\n value = this.raw(node2, null, "beforeComment");\n } else if (detect === "before") {\n value = this.raw(node2, null, "beforeRule");\n } else {\n value = this.raw(node2, null, "beforeClose");\n }\n let buf = node2.parent;\n let depth = 0;\n while (buf && buf.type !== "root") {\n depth += 1;\n buf = buf.parent;\n }\n if (value.includes("\\n")) {\n let indent = this.raw(node2, null, "indent");\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent;\n }\n }\n return value;\n }\n block(node2, start) {\n let between = this.raw(node2, "between", "beforeOpen");\n this.builder(start + between + "{", node2, "start");\n let after;\n if (node2.nodes && node2.nodes.length) {\n this.body(node2);\n after = this.raw(node2, "after");\n } else {\n after = this.raw(node2, "after", "emptyBody");\n }\n if (after) this.builder(after);\n this.builder("}", node2, "end");\n }\n body(node2) {\n let last = node2.nodes.length - 1;\n while (last > 0) {\n if (node2.nodes[last].type !== "comment") break;\n last -= 1;\n }\n let semicolon = this.raw(node2, "semicolon");\n for (let i2 = 0; i2 < node2.nodes.length; i2++) {\n let child = node2.nodes[i2];\n let before = this.raw(child, "before");\n if (before) this.builder(before);\n this.stringify(child, last !== i2 || semicolon);\n }\n }\n comment(node2) {\n let left = this.raw(node2, "left", "commentLeft");\n let right = this.raw(node2, "right", "commentRight");\n this.builder("/*" + left + node2.text + right + "*/", node2);\n }\n decl(node2, semicolon) {\n let between = this.raw(node2, "between", "colon");\n let string = node2.prop + between + this.rawValue(node2, "value");\n if (node2.important) {\n string += node2.raws.important || " !important";\n }\n if (semicolon) string += ";";\n this.builder(string, node2);\n }\n document(node2) {\n this.body(node2);\n }\n raw(node2, own, detect) {\n let value;\n if (!detect) detect = own;\n if (own) {\n value = node2.raws[own];\n if (typeof value !== "undefined") return value;\n }\n let parent = node2.parent;\n if (detect === "before") {\n if (!parent || parent.type === "root" && parent.first === node2) {\n return "";\n }\n if (parent && parent.type === "document") {\n return "";\n }\n }\n if (!parent) return DEFAULT_RAW[detect];\n let root2 = node2.root();\n if (!root2.rawCache) root2.rawCache = {};\n if (typeof root2.rawCache[detect] !== "undefined") {\n return root2.rawCache[detect];\n }\n if (detect === "before" || detect === "after") {\n return this.beforeAfter(node2, detect);\n } else {\n let method = "raw" + capitalize(detect);\n if (this[method]) {\n value = this[method](root2, node2);\n } else {\n root2.walk((i2) => {\n value = i2.raws[own];\n if (typeof value !== "undefined") return false;\n });\n }\n }\n if (typeof value === "undefined") value = DEFAULT_RAW[detect];\n root2.rawCache[detect] = value;\n return value;\n }\n rawBeforeClose(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && i2.nodes.length > 0) {\n if (typeof i2.raws.after !== "undefined") {\n value = i2.raws.after;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, "");\n return value;\n }\n rawBeforeComment(root2, node2) {\n let value;\n root2.walkComments((i2) => {\n if (typeof i2.raws.before !== "undefined") {\n value = i2.raws.before;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n });\n if (typeof value === "undefined") {\n value = this.raw(node2, null, "beforeDecl");\n } else if (value) {\n value = value.replace(/\\S/g, "");\n }\n return value;\n }\n rawBeforeDecl(root2, node2) {\n let value;\n root2.walkDecls((i2) => {\n if (typeof i2.raws.before !== "undefined") {\n value = i2.raws.before;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n });\n if (typeof value === "undefined") {\n value = this.raw(node2, null, "beforeRule");\n } else if (value) {\n value = value.replace(/\\S/g, "");\n }\n return value;\n }\n rawBeforeOpen(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.type !== "decl") {\n value = i2.raws.between;\n if (typeof value !== "undefined") return false;\n }\n });\n return value;\n }\n rawBeforeRule(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && (i2.parent !== root2 || root2.first !== i2)) {\n if (typeof i2.raws.before !== "undefined") {\n value = i2.raws.before;\n if (value.includes("\\n")) {\n value = value.replace(/[^\\n]+$/, "");\n }\n return false;\n }\n }\n });\n if (value) value = value.replace(/\\S/g, "");\n return value;\n }\n rawColon(root2) {\n let value;\n root2.walkDecls((i2) => {\n if (typeof i2.raws.between !== "undefined") {\n value = i2.raws.between.replace(/[^\\s:]/g, "");\n return false;\n }\n });\n return value;\n }\n rawEmptyBody(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && i2.nodes.length === 0) {\n value = i2.raws.after;\n if (typeof value !== "undefined") return false;\n }\n });\n return value;\n }\n rawIndent(root2) {\n if (root2.raws.indent) return root2.raws.indent;\n let value;\n root2.walk((i2) => {\n let p = i2.parent;\n if (p && p !== root2 && p.parent && p.parent === root2) {\n if (typeof i2.raws.before !== "undefined") {\n let parts = i2.raws.before.split("\\n");\n value = parts[parts.length - 1];\n value = value.replace(/\\S/g, "");\n return false;\n }\n }\n });\n return value;\n }\n rawSemicolon(root2) {\n let value;\n root2.walk((i2) => {\n if (i2.nodes && i2.nodes.length && i2.last.type === "decl") {\n value = i2.raws.semicolon;\n if (typeof value !== "undefined") return false;\n }\n });\n return value;\n }\n rawValue(node2, prop) {\n let value = node2[prop];\n let raw = node2.raws[prop];\n if (raw && raw.value === value) {\n return raw.raw;\n }\n return value;\n }\n root(node2) {\n this.body(node2);\n if (node2.raws.after) this.builder(node2.raws.after);\n }\n rule(node2) {\n this.block(node2, this.rawValue(node2, "selector"));\n if (node2.raws.ownSemicolon) {\n this.builder(node2.raws.ownSemicolon, node2, "end");\n }\n }\n stringify(node2, semicolon) {\n if (!this[node2.type]) {\n throw new Error(\n "Unknown AST node type " + node2.type + ". Maybe you need to change PostCSS stringifier."\n );\n }\n this[node2.type](node2, semicolon);\n }\n};\nvar stringifier = Stringifier$2;\nStringifier$2.default = Stringifier$2;\nlet Stringifier$1 = stringifier;\nfunction stringify$4(node2, builder) {\n let str = new Stringifier$1(builder);\n str.stringify(node2);\n}\nvar stringify_1 = stringify$4;\nstringify$4.default = stringify$4;\nlet { isClean: isClean$2, my: my$2 } = symbols;\nlet CssSyntaxError$2 = cssSyntaxError;\nlet Stringifier22 = stringifier;\nlet stringify$3 = stringify_1;\nfunction cloneNode(obj, parent) {\n let cloned = new obj.constructor();\n for (let i2 in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i2)) {\n continue;\n }\n if (i2 === "proxyCache") continue;\n let value = obj[i2];\n let type = typeof value;\n if (i2 === "parent" && type === "object") {\n if (parent) cloned[i2] = parent;\n } else if (i2 === "source") {\n cloned[i2] = value;\n } else if (Array.isArray(value)) {\n cloned[i2] = value.map((j) => cloneNode(j, cloned));\n } else {\n if (type === "object" && value !== null) value = cloneNode(value);\n cloned[i2] = value;\n }\n }\n return cloned;\n}\nlet Node$5 = class Node22 {\n constructor(defaults = {}) {\n this.raws = {};\n this[isClean$2] = false;\n this[my$2] = true;\n for (let name in defaults) {\n if (name === "nodes") {\n this.nodes = [];\n for (let node2 of defaults[name]) {\n if (typeof node2.clone === "function") {\n this.append(node2.clone());\n } else {\n this.append(node2);\n }\n }\n } else {\n this[name] = defaults[name];\n }\n }\n }\n addToError(error) {\n error.postcssNode = this;\n if (error.stack && this.source && /\\n\\s{4}at /.test(error.stack)) {\n let s2 = this.source;\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s2.input.from}:${s2.start.line}:${s2.start.column}$&`\n );\n }\n return error;\n }\n after(add) {\n this.parent.insertAfter(this, add);\n return this;\n }\n assign(overrides = {}) {\n for (let name in overrides) {\n this[name] = overrides[name];\n }\n return this;\n }\n before(add) {\n this.parent.insertBefore(this, add);\n return this;\n }\n cleanRaws(keepBetween) {\n delete this.raws.before;\n delete this.raws.after;\n if (!keepBetween) delete this.raws.between;\n }\n clone(overrides = {}) {\n let cloned = cloneNode(this);\n for (let name in overrides) {\n cloned[name] = overrides[name];\n }\n return cloned;\n }\n cloneAfter(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertAfter(this, cloned);\n return cloned;\n }\n cloneBefore(overrides = {}) {\n let cloned = this.clone(overrides);\n this.parent.insertBefore(this, cloned);\n return cloned;\n }\n error(message, opts = {}) {\n if (this.source) {\n let { end, start } = this.rangeBy(opts);\n return this.source.input.error(\n message,\n { column: start.column, line: start.line },\n { column: end.column, line: end.line },\n opts\n );\n }\n return new CssSyntaxError$2(message);\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === "proxyOf") {\n return node2;\n } else if (prop === "root") {\n return () => node2.root().toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || /* c8 ignore next */\n prop === "text") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n markDirty() {\n if (this[isClean$2]) {\n this[isClean$2] = false;\n let next = this;\n while (next = next.parent) {\n next[isClean$2] = false;\n }\n }\n }\n next() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 + 1];\n }\n positionBy(opts, stringRepresentation) {\n let pos = this.source.start;\n if (opts.index) {\n pos = this.positionInside(opts.index, stringRepresentation);\n } else if (opts.word) {\n stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) pos = this.positionInside(index2, stringRepresentation);\n }\n return pos;\n }\n positionInside(index2, stringRepresentation) {\n let string = stringRepresentation || this.toString();\n let column = this.source.start.column;\n let line = this.source.start.line;\n for (let i2 = 0; i2 < index2; i2++) {\n if (string[i2] === "\\n") {\n column = 1;\n line += 1;\n } else {\n column += 1;\n }\n }\n return { column, line };\n }\n prev() {\n if (!this.parent) return void 0;\n let index2 = this.parent.index(this);\n return this.parent.nodes[index2 - 1];\n }\n rangeBy(opts) {\n let start = {\n column: this.source.start.column,\n line: this.source.start.line\n };\n let end = this.source.end ? {\n column: this.source.end.column + 1,\n line: this.source.end.line\n } : {\n column: start.column + 1,\n line: start.line\n };\n if (opts.word) {\n let stringRepresentation = this.toString();\n let index2 = stringRepresentation.indexOf(opts.word);\n if (index2 !== -1) {\n start = this.positionInside(index2, stringRepresentation);\n end = this.positionInside(index2 + opts.word.length, stringRepresentation);\n }\n } else {\n if (opts.start) {\n start = {\n column: opts.start.column,\n line: opts.start.line\n };\n } else if (opts.index) {\n start = this.positionInside(opts.index);\n }\n if (opts.end) {\n end = {\n column: opts.end.column,\n line: opts.end.line\n };\n } else if (typeof opts.endIndex === "number") {\n end = this.positionInside(opts.endIndex);\n } else if (opts.index) {\n end = this.positionInside(opts.index + 1);\n }\n }\n if (end.line < start.line || end.line === start.line && end.column <= start.column) {\n end = { column: start.column + 1, line: start.line };\n }\n return { end, start };\n }\n raw(prop, defaultType) {\n let str = new Stringifier22();\n return str.raw(this, prop, defaultType);\n }\n remove() {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n this.parent = void 0;\n return this;\n }\n replaceWith(...nodes) {\n if (this.parent) {\n let bookmark = this;\n let foundSelf = false;\n for (let node2 of nodes) {\n if (node2 === this) {\n foundSelf = true;\n } else if (foundSelf) {\n this.parent.insertAfter(bookmark, node2);\n bookmark = node2;\n } else {\n this.parent.insertBefore(bookmark, node2);\n }\n }\n if (!foundSelf) {\n this.remove();\n }\n }\n return this;\n }\n root() {\n let result2 = this;\n while (result2.parent && result2.parent.type !== "document") {\n result2 = result2.parent;\n }\n return result2;\n }\n toJSON(_, inputs) {\n let fixed = {};\n let emitInputs = inputs == null;\n inputs = inputs || /* @__PURE__ */ new Map();\n let inputsNextIndex = 0;\n for (let name in this) {\n if (!Object.prototype.hasOwnProperty.call(this, name)) {\n continue;\n }\n if (name === "parent" || name === "proxyCache") continue;\n let value = this[name];\n if (Array.isArray(value)) {\n fixed[name] = value.map((i2) => {\n if (typeof i2 === "object" && i2.toJSON) {\n return i2.toJSON(null, inputs);\n } else {\n return i2;\n }\n });\n } else if (typeof value === "object" && value.toJSON) {\n fixed[name] = value.toJSON(null, inputs);\n } else if (name === "source") {\n let inputId = inputs.get(value.input);\n if (inputId == null) {\n inputId = inputsNextIndex;\n inputs.set(value.input, inputsNextIndex);\n inputsNextIndex++;\n }\n fixed[name] = {\n end: value.end,\n inputId,\n start: value.start\n };\n } else {\n fixed[name] = value;\n }\n }\n if (emitInputs) {\n fixed.inputs = [...inputs.keys()].map((input2) => input2.toJSON());\n }\n return fixed;\n }\n toProxy() {\n if (!this.proxyCache) {\n this.proxyCache = new Proxy(this, this.getProxyProcessor());\n }\n return this.proxyCache;\n }\n toString(stringifier2 = stringify$3) {\n if (stringifier2.stringify) stringifier2 = stringifier2.stringify;\n let result2 = "";\n stringifier2(this, (i2) => {\n result2 += i2;\n });\n return result2;\n }\n warn(result2, text, opts) {\n let data = { node: this };\n for (let i2 in opts) data[i2] = opts[i2];\n return result2.warn(text, data);\n }\n get proxyOf() {\n return this;\n }\n};\nvar node = Node$5;\nNode$5.default = Node$5;\nlet Node$4 = node;\nlet Declaration$4 = class Declaration2 extends Node$4 {\n constructor(defaults) {\n if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {\n defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });\n }\n super(defaults);\n this.type = "decl";\n }\n get variable() {\n return this.prop.startsWith("--") || this.prop[0] === "$";\n }\n};\nvar declaration = Declaration$4;\nDeclaration$4.default = Declaration$4;\nlet urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";\nlet customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = "";\n let i2 = size;\n while (i2--) {\n id += alphabet[Math.random() * alphabet.length | 0];\n }\n return id;\n };\n};\nlet nanoid$1 = (size = 21) => {\n let id = "";\n let i2 = size;\n while (i2--) {\n id += urlAlphabet[Math.random() * 64 | 0];\n }\n return id;\n};\nvar nonSecure = { nanoid: nanoid$1, customAlphabet };\nlet { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;\nlet { existsSync, readFileSync } = require$$2;\nlet { dirname: dirname$1, join } = require$$2;\nfunction fromBase64(str) {\n if (Buffer) {\n return Buffer.from(str, "base64").toString();\n } else {\n return window.atob(str);\n }\n}\nlet PreviousMap$2 = class PreviousMap2 {\n constructor(css, opts) {\n if (opts.map === false) return;\n this.loadAnnotation(css);\n this.inline = this.startWith(this.annotation, "data:");\n let prev = opts.map ? opts.map.prev : void 0;\n let text = this.loadMap(opts.from, prev);\n if (!this.mapFile && opts.from) {\n this.mapFile = opts.from;\n }\n if (this.mapFile) this.root = dirname$1(this.mapFile);\n if (text) this.text = text;\n }\n consumer() {\n if (!this.consumerCache) {\n this.consumerCache = new SourceMapConsumer$2(this.text);\n }\n return this.consumerCache;\n }\n decodeInline(text) {\n let baseCharsetUri = /^data:application\\/json;charset=utf-?8;base64,/;\n let baseUri = /^data:application\\/json;base64,/;\n let charsetUri = /^data:application\\/json;charset=utf-?8,/;\n let uri = /^data:application\\/json,/;\n if (charsetUri.test(text) || uri.test(text)) {\n return decodeURIComponent(text.substr(RegExp.lastMatch.length));\n }\n if (baseCharsetUri.test(text) || baseUri.test(text)) {\n return fromBase64(text.substr(RegExp.lastMatch.length));\n }\n let encoding = text.match(/data:application\\/json;([^,]+),/)[1];\n throw new Error("Unsupported source map encoding " + encoding);\n }\n getAnnotationURL(sourceMapString) {\n return sourceMapString.replace(/^\\/\\*\\s*# sourceMappingURL=/, "").trim();\n }\n isMap(map) {\n if (typeof map !== "object") return false;\n return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);\n }\n loadAnnotation(css) {\n let comments = css.match(/\\/\\*\\s*# sourceMappingURL=/gm);\n if (!comments) return;\n let start = css.lastIndexOf(comments.pop());\n let end = css.indexOf("*/", start);\n if (start > -1 && end > -1) {\n this.annotation = this.getAnnotationURL(css.substring(start, end));\n }\n }\n loadFile(path) {\n this.root = dirname$1(path);\n if (existsSync(path)) {\n this.mapFile = path;\n return readFileSync(path, "utf-8").toString().trim();\n }\n }\n loadMap(file, prev) {\n if (prev === false) return false;\n if (prev) {\n if (typeof prev === "string") {\n return prev;\n } else if (typeof prev === "function") {\n let prevPath = prev(file);\n if (prevPath) {\n let map = this.loadFile(prevPath);\n if (!map) {\n throw new Error(\n "Unable to load previous source map: " + prevPath.toString()\n );\n }\n return map;\n }\n } else if (prev instanceof SourceMapConsumer$2) {\n return SourceMapGenerator$2.fromSourceMap(prev).toString();\n } else if (prev instanceof SourceMapGenerator$2) {\n return prev.toString();\n } else if (this.isMap(prev)) {\n return JSON.stringify(prev);\n } else {\n throw new Error(\n "Unsupported previous source map format: " + prev.toString()\n );\n }\n } else if (this.inline) {\n return this.decodeInline(this.annotation);\n } else if (this.annotation) {\n let map = this.annotation;\n if (file) map = join(dirname$1(file), map);\n return this.loadFile(map);\n }\n }\n startWith(string, start) {\n if (!string) return false;\n return string.substr(0, start.length) === start;\n }\n withContent() {\n return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);\n }\n};\nvar previousMap = PreviousMap$2;\nPreviousMap$2.default = PreviousMap$2;\nlet { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;\nlet { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;\nlet { isAbsolute, resolve: resolve$1 } = require$$2;\nlet { nanoid } = nonSecure;\nlet terminalHighlight = require$$2;\nlet CssSyntaxError$1 = cssSyntaxError;\nlet PreviousMap$1 = previousMap;\nlet fromOffsetCache = Symbol("fromOffsetCache");\nlet sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);\nlet pathAvailable$1 = Boolean(resolve$1 && isAbsolute);\nlet Input$4 = class Input2 {\n constructor(css, opts = {}) {\n if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {\n throw new Error(`PostCSS received ${css} instead of CSS string`);\n }\n this.css = css.toString();\n if (this.css[0] === "\\uFEFF" || this.css[0] === "\\uFFFE") {\n this.hasBOM = true;\n this.css = this.css.slice(1);\n } else {\n this.hasBOM = false;\n }\n if (opts.from) {\n if (!pathAvailable$1 || /^\\w+:\\/\\//.test(opts.from) || isAbsolute(opts.from)) {\n this.file = opts.from;\n } else {\n this.file = resolve$1(opts.from);\n }\n }\n if (pathAvailable$1 && sourceMapAvailable$1) {\n let map = new PreviousMap$1(this.css, opts);\n if (map.text) {\n this.map = map;\n let file = map.consumer().file;\n if (!this.file && file) this.file = this.mapResolve(file);\n }\n }\n if (!this.file) {\n this.id = "<input css " + nanoid(6) + ">";\n }\n if (this.map) this.map.file = this.from;\n }\n error(message, line, column, opts = {}) {\n let result2, endLine, endColumn;\n if (line && typeof line === "object") {\n let start = line;\n let end = column;\n if (typeof start.offset === "number") {\n let pos = this.fromOffset(start.offset);\n line = pos.line;\n column = pos.col;\n } else {\n line = start.line;\n column = start.column;\n }\n if (typeof end.offset === "number") {\n let pos = this.fromOffset(end.offset);\n endLine = pos.line;\n endColumn = pos.col;\n } else {\n endLine = end.line;\n endColumn = end.column;\n }\n } else if (!column) {\n let pos = this.fromOffset(line);\n line = pos.line;\n column = pos.col;\n }\n let origin = this.origin(line, column, endLine, endColumn);\n if (origin) {\n result2 = new CssSyntaxError$1(\n message,\n origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },\n origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },\n origin.source,\n origin.file,\n opts.plugin\n );\n } else {\n result2 = new CssSyntaxError$1(\n message,\n endLine === void 0 ? line : { column, line },\n endLine === void 0 ? column : { column: endColumn, line: endLine },\n this.css,\n this.file,\n opts.plugin\n );\n }\n result2.input = { column, endColumn, endLine, line, source: this.css };\n if (this.file) {\n if (pathToFileURL$1) {\n result2.input.url = pathToFileURL$1(this.file).toString();\n }\n result2.input.file = this.file;\n }\n return result2;\n }\n fromOffset(offset) {\n let lastLine, lineToIndex;\n if (!this[fromOffsetCache]) {\n let lines = this.css.split("\\n");\n lineToIndex = new Array(lines.length);\n let prevIndex = 0;\n for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {\n lineToIndex[i2] = prevIndex;\n prevIndex += lines[i2].length + 1;\n }\n this[fromOffsetCache] = lineToIndex;\n } else {\n lineToIndex = this[fromOffsetCache];\n }\n lastLine = lineToIndex[lineToIndex.length - 1];\n let min = 0;\n if (offset >= lastLine) {\n min = lineToIndex.length - 1;\n } else {\n let max = lineToIndex.length - 2;\n let mid;\n while (min < max) {\n mid = min + (max - min >> 1);\n if (offset < lineToIndex[mid]) {\n max = mid - 1;\n } else if (offset >= lineToIndex[mid + 1]) {\n min = mid + 1;\n } else {\n min = mid;\n break;\n }\n }\n }\n return {\n col: offset - lineToIndex[min] + 1,\n line: min + 1\n };\n }\n mapResolve(file) {\n if (/^\\w+:\\/\\//.test(file)) {\n return file;\n }\n return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);\n }\n origin(line, column, endLine, endColumn) {\n if (!this.map) return false;\n let consumer = this.map.consumer();\n let from = consumer.originalPositionFor({ column, line });\n if (!from.source) return false;\n let to;\n if (typeof endLine === "number") {\n to = consumer.originalPositionFor({ column: endColumn, line: endLine });\n }\n let fromUrl;\n if (isAbsolute(from.source)) {\n fromUrl = pathToFileURL$1(from.source);\n } else {\n fromUrl = new URL(\n from.source,\n this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)\n );\n }\n let result2 = {\n column: from.column,\n endColumn: to && to.column,\n endLine: to && to.line,\n line: from.line,\n url: fromUrl.toString()\n };\n if (fromUrl.protocol === "file:") {\n if (fileURLToPath) {\n result2.file = fileURLToPath(fromUrl);\n } else {\n throw new Error(`file: protocol is not available in this PostCSS build`);\n }\n }\n let source = consumer.sourceContentFor(from.source);\n if (source) result2.source = source;\n return result2;\n }\n toJSON() {\n let json = {};\n for (let name of ["hasBOM", "css", "file", "id"]) {\n if (this[name] != null) {\n json[name] = this[name];\n }\n }\n if (this.map) {\n json.map = __spreadValues({}, this.map);\n if (json.map.consumerCache) {\n json.map.consumerCache = void 0;\n }\n }\n return json;\n }\n get from() {\n return this.file || this.id;\n }\n};\nvar input = Input$4;\nInput$4.default = Input$4;\nif (terminalHighlight && terminalHighlight.registerInput) {\n terminalHighlight.registerInput(Input$4);\n}\nlet { SourceMapConsumer, SourceMapGenerator } = require$$2;\nlet { dirname, relative, resolve, sep } = require$$2;\nlet { pathToFileURL } = require$$2;\nlet Input$3 = input;\nlet sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);\nlet pathAvailable = Boolean(dirname && resolve && relative && sep);\nlet MapGenerator$2 = class MapGenerator2 {\n constructor(stringify2, root2, opts, cssString) {\n this.stringify = stringify2;\n this.mapOpts = opts.map || {};\n this.root = root2;\n this.opts = opts;\n this.css = cssString;\n this.originalCSS = cssString;\n this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;\n this.memoizedFileURLs = /* @__PURE__ */ new Map();\n this.memoizedPaths = /* @__PURE__ */ new Map();\n this.memoizedURLs = /* @__PURE__ */ new Map();\n }\n addAnnotation() {\n let content;\n if (this.isInline()) {\n content = "data:application/json;base64," + this.toBase64(this.map.toString());\n } else if (typeof this.mapOpts.annotation === "string") {\n content = this.mapOpts.annotation;\n } else if (typeof this.mapOpts.annotation === "function") {\n content = this.mapOpts.annotation(this.opts.to, this.root);\n } else {\n content = this.outputFile() + ".map";\n }\n let eol = "\\n";\n if (this.css.includes("\\r\\n")) eol = "\\r\\n";\n this.css += eol + "/*# sourceMappingURL=" + content + " */";\n }\n applyPrevMaps() {\n for (let prev of this.previous()) {\n let from = this.toUrl(this.path(prev.file));\n let root2 = prev.root || dirname(prev.file);\n let map;\n if (this.mapOpts.sourcesContent === false) {\n map = new SourceMapConsumer(prev.text);\n if (map.sourcesContent) {\n map.sourcesContent = null;\n }\n } else {\n map = prev.consumer();\n }\n this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));\n }\n }\n clearAnnotation() {\n if (this.mapOpts.annotation === false) return;\n if (this.root) {\n let node2;\n for (let i2 = this.root.nodes.length - 1; i2 >= 0; i2--) {\n node2 = this.root.nodes[i2];\n if (node2.type !== "comment") continue;\n if (node2.text.indexOf("# sourceMappingURL=") === 0) {\n this.root.removeChild(i2);\n }\n }\n } else if (this.css) {\n this.css = this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm, "");\n }\n }\n generate() {\n this.clearAnnotation();\n if (pathAvailable && sourceMapAvailable && this.isMap()) {\n return this.generateMap();\n } else {\n let result2 = "";\n this.stringify(this.root, (i2) => {\n result2 += i2;\n });\n return [result2];\n }\n }\n generateMap() {\n if (this.root) {\n this.generateString();\n } else if (this.previous().length === 1) {\n let prev = this.previous()[0].consumer();\n prev.file = this.outputFile();\n this.map = SourceMapGenerator.fromSourceMap(prev, {\n ignoreInvalidMapping: true\n });\n } else {\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n this.map.addMapping({\n generated: { column: 0, line: 1 },\n original: { column: 0, line: 1 },\n source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"\n });\n }\n if (this.isSourcesContent()) this.setSourcesContent();\n if (this.root && this.previous().length > 0) this.applyPrevMaps();\n if (this.isAnnotation()) this.addAnnotation();\n if (this.isInline()) {\n return [this.css];\n } else {\n return [this.css, this.map];\n }\n }\n generateString() {\n this.css = "";\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n });\n let line = 1;\n let column = 1;\n let noSource = "<no source>";\n let mapping = {\n generated: { column: 0, line: 0 },\n original: { column: 0, line: 0 },\n source: ""\n };\n let lines, last;\n this.stringify(this.root, (str, node2, type) => {\n this.css += str;\n if (node2 && type !== "end") {\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n if (node2.source && node2.source.start) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.start.line;\n mapping.original.column = node2.source.start.column - 1;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n this.map.addMapping(mapping);\n }\n }\n lines = str.match(/\\n/g);\n if (lines) {\n line += lines.length;\n last = str.lastIndexOf("\\n");\n column = str.length - last;\n } else {\n column += str.length;\n }\n if (node2 && type !== "start") {\n let p = node2.parent || { raws: {} };\n let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;\n if (!childless || node2 !== p.last || p.raws.semicolon) {\n if (node2.source && node2.source.end) {\n mapping.source = this.sourcePath(node2);\n mapping.original.line = node2.source.end.line;\n mapping.original.column = node2.source.end.column - 1;\n mapping.generated.line = line;\n mapping.generated.column = column - 2;\n this.map.addMapping(mapping);\n } else {\n mapping.source = noSource;\n mapping.original.line = 1;\n mapping.original.column = 0;\n mapping.generated.line = line;\n mapping.generated.column = column - 1;\n this.map.addMapping(mapping);\n }\n }\n }\n });\n }\n isAnnotation() {\n if (this.isInline()) {\n return true;\n }\n if (typeof this.mapOpts.annotation !== "undefined") {\n return this.mapOpts.annotation;\n }\n if (this.previous().length) {\n return this.previous().some((i2) => i2.annotation);\n }\n return true;\n }\n isInline() {\n if (typeof this.mapOpts.inline !== "undefined") {\n return this.mapOpts.inline;\n }\n let annotation = this.mapOpts.annotation;\n if (typeof annotation !== "undefined" && annotation !== true) {\n return false;\n }\n if (this.previous().length) {\n return this.previous().some((i2) => i2.inline);\n }\n return true;\n }\n isMap() {\n if (typeof this.opts.map !== "undefined") {\n return !!this.opts.map;\n }\n return this.previous().length > 0;\n }\n isSourcesContent() {\n if (typeof this.mapOpts.sourcesContent !== "undefined") {\n return this.mapOpts.sourcesContent;\n }\n if (this.previous().length) {\n return this.previous().some((i2) => i2.withContent());\n }\n return true;\n }\n outputFile() {\n if (this.opts.to) {\n return this.path(this.opts.to);\n } else if (this.opts.from) {\n return this.path(this.opts.from);\n } else {\n return "to.css";\n }\n }\n path(file) {\n if (this.mapOpts.absolute) return file;\n if (file.charCodeAt(0) === 60) return file;\n if (/^\\w+:\\/\\//.test(file)) return file;\n let cached = this.memoizedPaths.get(file);\n if (cached) return cached;\n let from = this.opts.to ? dirname(this.opts.to) : ".";\n if (typeof this.mapOpts.annotation === "string") {\n from = dirname(resolve(from, this.mapOpts.annotation));\n }\n let path = relative(from, file);\n this.memoizedPaths.set(file, path);\n return path;\n }\n previous() {\n if (!this.previousMaps) {\n this.previousMaps = [];\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source && node2.source.input.map) {\n let map = node2.source.input.map;\n if (!this.previousMaps.includes(map)) {\n this.previousMaps.push(map);\n }\n }\n });\n } else {\n let input2 = new Input$3(this.originalCSS, this.opts);\n if (input2.map) this.previousMaps.push(input2.map);\n }\n }\n return this.previousMaps;\n }\n setSourcesContent() {\n let already = {};\n if (this.root) {\n this.root.walk((node2) => {\n if (node2.source) {\n let from = node2.source.input.from;\n if (from && !already[from]) {\n already[from] = true;\n let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));\n this.map.setSourceContent(fromUrl, node2.source.input.css);\n }\n }\n });\n } else if (this.css) {\n let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";\n this.map.setSourceContent(from, this.css);\n }\n }\n sourcePath(node2) {\n if (this.mapOpts.from) {\n return this.toUrl(this.mapOpts.from);\n } else if (this.usesFileUrls) {\n return this.toFileUrl(node2.source.input.from);\n } else {\n return this.toUrl(this.path(node2.source.input.from));\n }\n }\n toBase64(str) {\n if (Buffer) {\n return Buffer.from(str).toString("base64");\n } else {\n return window.btoa(unescape(encodeURIComponent(str)));\n }\n }\n toFileUrl(path) {\n let cached = this.memoizedFileURLs.get(path);\n if (cached) return cached;\n if (pathToFileURL) {\n let fileURL = pathToFileURL(path).toString();\n this.memoizedFileURLs.set(path, fileURL);\n return fileURL;\n } else {\n throw new Error(\n "`map.absolute` option is not available in this PostCSS build"\n );\n }\n }\n toUrl(path) {\n let cached = this.memoizedURLs.get(path);\n if (cached) return cached;\n if (sep === "\\\\") {\n path = path.replace(/\\\\/g, "/");\n }\n let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);\n this.memoizedURLs.set(path, url);\n return url;\n }\n};\nvar mapGenerator = MapGenerator$2;\nlet Node$3 = node;\nlet Comment$4 = class Comment2 extends Node$3 {\n constructor(defaults) {\n super(defaults);\n this.type = "comment";\n }\n};\nvar comment = Comment$4;\nComment$4.default = Comment$4;\nlet { isClean: isClean$1, my: my$1 } = symbols;\nlet Declaration$3 = declaration;\nlet Comment$3 = comment;\nlet Node$2 = node;\nlet parse$4;\nlet Rule$4;\nlet AtRule$4;\nlet Root$6;\nfunction cleanSource(nodes) {\n return nodes.map((i2) => {\n if (i2.nodes) i2.nodes = cleanSource(i2.nodes);\n delete i2.source;\n return i2;\n });\n}\nfunction markDirtyUp(node2) {\n node2[isClean$1] = false;\n if (node2.proxyOf.nodes) {\n for (let i2 of node2.proxyOf.nodes) {\n markDirtyUp(i2);\n }\n }\n}\nlet Container$7 = class Container2 extends Node$2 {\n append(...children) {\n for (let child of children) {\n let nodes = this.normalize(child, this.last);\n for (let node2 of nodes) this.proxyOf.nodes.push(node2);\n }\n this.markDirty();\n return this;\n }\n cleanRaws(keepBetween) {\n super.cleanRaws(keepBetween);\n if (this.nodes) {\n for (let node2 of this.nodes) node2.cleanRaws(keepBetween);\n }\n }\n each(callback) {\n if (!this.proxyOf.nodes) return void 0;\n let iterator = this.getIterator();\n let index2, result2;\n while (this.indexes[iterator] < this.proxyOf.nodes.length) {\n index2 = this.indexes[iterator];\n result2 = callback(this.proxyOf.nodes[index2], index2);\n if (result2 === false) break;\n this.indexes[iterator] += 1;\n }\n delete this.indexes[iterator];\n return result2;\n }\n every(condition) {\n return this.nodes.every(condition);\n }\n getIterator() {\n if (!this.lastEach) this.lastEach = 0;\n if (!this.indexes) this.indexes = {};\n this.lastEach += 1;\n let iterator = this.lastEach;\n this.indexes[iterator] = 0;\n return iterator;\n }\n getProxyProcessor() {\n return {\n get(node2, prop) {\n if (prop === "proxyOf") {\n return node2;\n } else if (!node2[prop]) {\n return node2[prop];\n } else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {\n return (...args) => {\n return node2[prop](\n ...args.map((i2) => {\n if (typeof i2 === "function") {\n return (child, index2) => i2(child.toProxy(), index2);\n } else {\n return i2;\n }\n })\n );\n };\n } else if (prop === "every" || prop === "some") {\n return (cb) => {\n return node2[prop](\n (child, ...other) => cb(child.toProxy(), ...other)\n );\n };\n } else if (prop === "root") {\n return () => node2.root().toProxy();\n } else if (prop === "nodes") {\n return node2.nodes.map((i2) => i2.toProxy());\n } else if (prop === "first" || prop === "last") {\n return node2[prop].toProxy();\n } else {\n return node2[prop];\n }\n },\n set(node2, prop, value) {\n if (node2[prop] === value) return true;\n node2[prop] = value;\n if (prop === "name" || prop === "params" || prop === "selector") {\n node2.markDirty();\n }\n return true;\n }\n };\n }\n index(child) {\n if (typeof child === "number") return child;\n if (child.proxyOf) child = child.proxyOf;\n return this.proxyOf.nodes.indexOf(child);\n }\n insertAfter(exist, add) {\n let existIndex = this.index(exist);\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex < index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n insertBefore(exist, add) {\n let existIndex = this.index(exist);\n let type = existIndex === 0 ? "prepend" : false;\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();\n existIndex = this.index(exist);\n for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (existIndex <= index2) {\n this.indexes[id] = index2 + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n normalize(nodes, sample) {\n if (typeof nodes === "string") {\n nodes = cleanSource(parse$4(nodes).nodes);\n } else if (typeof nodes === "undefined") {\n nodes = [];\n } else if (Array.isArray(nodes)) {\n nodes = nodes.slice(0);\n for (let i2 of nodes) {\n if (i2.parent) i2.parent.removeChild(i2, "ignore");\n }\n } else if (nodes.type === "root" && this.type !== "document") {\n nodes = nodes.nodes.slice(0);\n for (let i2 of nodes) {\n if (i2.parent) i2.parent.removeChild(i2, "ignore");\n }\n } else if (nodes.type) {\n nodes = [nodes];\n } else if (nodes.prop) {\n if (typeof nodes.value === "undefined") {\n throw new Error("Value field is missed in node creation");\n } else if (typeof nodes.value !== "string") {\n nodes.value = String(nodes.value);\n }\n nodes = [new Declaration$3(nodes)];\n } else if (nodes.selector) {\n nodes = [new Rule$4(nodes)];\n } else if (nodes.name) {\n nodes = [new AtRule$4(nodes)];\n } else if (nodes.text) {\n nodes = [new Comment$3(nodes)];\n } else {\n throw new Error("Unknown node type in node creation");\n }\n let processed = nodes.map((i2) => {\n if (!i2[my$1]) Container2.rebuild(i2);\n i2 = i2.proxyOf;\n if (i2.parent) i2.parent.removeChild(i2);\n if (i2[isClean$1]) markDirtyUp(i2);\n if (typeof i2.raws.before === "undefined") {\n if (sample && typeof sample.raws.before !== "undefined") {\n i2.raws.before = sample.raws.before.replace(/\\S/g, "");\n }\n }\n i2.parent = this.proxyOf;\n return i2;\n });\n return processed;\n }\n prepend(...children) {\n children = children.reverse();\n for (let child of children) {\n let nodes = this.normalize(child, this.first, "prepend").reverse();\n for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);\n for (let id in this.indexes) {\n this.indexes[id] = this.indexes[id] + nodes.length;\n }\n }\n this.markDirty();\n return this;\n }\n push(child) {\n child.parent = this;\n this.proxyOf.nodes.push(child);\n return this;\n }\n removeAll() {\n for (let node2 of this.proxyOf.nodes) node2.parent = void 0;\n this.proxyOf.nodes = [];\n this.markDirty();\n return this;\n }\n removeChild(child) {\n child = this.index(child);\n this.proxyOf.nodes[child].parent = void 0;\n this.proxyOf.nodes.splice(child, 1);\n let index2;\n for (let id in this.indexes) {\n index2 = this.indexes[id];\n if (index2 >= child) {\n this.indexes[id] = index2 - 1;\n }\n }\n this.markDirty();\n return this;\n }\n replaceValues(pattern, opts, callback) {\n if (!callback) {\n callback = opts;\n opts = {};\n }\n this.walkDecls((decl) => {\n if (opts.props && !opts.props.includes(decl.prop)) return;\n if (opts.fast && !decl.value.includes(opts.fast)) return;\n decl.value = decl.value.replace(pattern, callback);\n });\n this.markDirty();\n return this;\n }\n some(condition) {\n return this.nodes.some(condition);\n }\n walk(callback) {\n return this.each((child, i2) => {\n let result2;\n try {\n result2 = callback(child, i2);\n } catch (e2) {\n throw child.addToError(e2);\n }\n if (result2 !== false && child.walk) {\n result2 = child.walk(callback);\n }\n return result2;\n });\n }\n walkAtRules(name, callback) {\n if (!callback) {\n callback = name;\n return this.walk((child, i2) => {\n if (child.type === "atrule") {\n return callback(child, i2);\n }\n });\n }\n if (name instanceof RegExp) {\n return this.walk((child, i2) => {\n if (child.type === "atrule" && name.test(child.name)) {\n return callback(child, i2);\n }\n });\n }\n return this.walk((child, i2) => {\n if (child.type === "atrule" && child.name === name) {\n return callback(child, i2);\n }\n });\n }\n walkComments(callback) {\n return this.walk((child, i2) => {\n if (child.type === "comment") {\n return callback(child, i2);\n }\n });\n }\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop;\n return this.walk((child, i2) => {\n if (child.type === "decl") {\n return callback(child, i2);\n }\n });\n }\n if (prop instanceof RegExp) {\n return this.walk((child, i2) => {\n if (child.type === "decl" && prop.test(child.prop)) {\n return callback(child, i2);\n }\n });\n }\n return this.walk((child, i2) => {\n if (child.type === "decl" && child.prop === prop) {\n return callback(child, i2);\n }\n });\n }\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector;\n return this.walk((child, i2) => {\n if (child.type === "rule") {\n return callback(child, i2);\n }\n });\n }\n if (selector instanceof RegExp) {\n return this.walk((child, i2) => {\n if (child.type === "rule" && selector.test(child.selector)) {\n return callback(child, i2);\n }\n });\n }\n return this.walk((child, i2) => {\n if (child.type === "rule" && child.selector === selector) {\n return callback(child, i2);\n }\n });\n }\n get first() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[0];\n }\n get last() {\n if (!this.proxyOf.nodes) return void 0;\n return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];\n }\n};\nContainer$7.registerParse = (dependant) => {\n parse$4 = dependant;\n};\nContainer$7.registerRule = (dependant) => {\n Rule$4 = dependant;\n};\nContainer$7.registerAtRule = (dependant) => {\n AtRule$4 = dependant;\n};\nContainer$7.registerRoot = (dependant) => {\n Root$6 = dependant;\n};\nvar container = Container$7;\nContainer$7.default = Container$7;\nContainer$7.rebuild = (node2) => {\n if (node2.type === "atrule") {\n Object.setPrototypeOf(node2, AtRule$4.prototype);\n } else if (node2.type === "rule") {\n Object.setPrototypeOf(node2, Rule$4.prototype);\n } else if (node2.type === "decl") {\n Object.setPrototypeOf(node2, Declaration$3.prototype);\n } else if (node2.type === "comment") {\n Object.setPrototypeOf(node2, Comment$3.prototype);\n } else if (node2.type === "root") {\n Object.setPrototypeOf(node2, Root$6.prototype);\n }\n node2[my$1] = true;\n if (node2.nodes) {\n node2.nodes.forEach((child) => {\n Container$7.rebuild(child);\n });\n }\n};\nlet Container$6 = container;\nlet LazyResult$4;\nlet Processor$3;\nlet Document$3 = class Document23 extends Container$6 {\n constructor(defaults) {\n super(__spreadValues({ type: "document" }, defaults));\n if (!this.nodes) {\n this.nodes = [];\n }\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$4(new Processor$3(), this, opts);\n return lazy.stringify();\n }\n};\nDocument$3.registerLazyResult = (dependant) => {\n LazyResult$4 = dependant;\n};\nDocument$3.registerProcessor = (dependant) => {\n Processor$3 = dependant;\n};\nvar document$1 = Document$3;\nDocument$3.default = Document$3;\nlet printed = {};\nvar warnOnce$2 = function warnOnce2(message) {\n if (printed[message]) return;\n printed[message] = true;\n if (typeof console !== "undefined" && console.warn) {\n console.warn(message);\n }\n};\nlet Warning$2 = class Warning2 {\n constructor(text, opts = {}) {\n this.type = "warning";\n this.text = text;\n if (opts.node && opts.node.source) {\n let range = opts.node.rangeBy(opts);\n this.line = range.start.line;\n this.column = range.start.column;\n this.endLine = range.end.line;\n this.endColumn = range.end.column;\n }\n for (let opt in opts) this[opt] = opts[opt];\n }\n toString() {\n if (this.node) {\n return this.node.error(this.text, {\n index: this.index,\n plugin: this.plugin,\n word: this.word\n }).message;\n }\n if (this.plugin) {\n return this.plugin + ": " + this.text;\n }\n return this.text;\n }\n};\nvar warning = Warning$2;\nWarning$2.default = Warning$2;\nlet Warning$1 = warning;\nlet Result$3 = class Result2 {\n constructor(processor2, root2, opts) {\n this.processor = processor2;\n this.messages = [];\n this.root = root2;\n this.opts = opts;\n this.css = void 0;\n this.map = void 0;\n }\n toString() {\n return this.css;\n }\n warn(text, opts = {}) {\n if (!opts.plugin) {\n if (this.lastPlugin && this.lastPlugin.postcssPlugin) {\n opts.plugin = this.lastPlugin.postcssPlugin;\n }\n }\n let warning2 = new Warning$1(text, opts);\n this.messages.push(warning2);\n return warning2;\n }\n warnings() {\n return this.messages.filter((i2) => i2.type === "warning");\n }\n get content() {\n return this.css;\n }\n};\nvar result = Result$3;\nResult$3.default = Result$3;\nconst SINGLE_QUOTE = "\'".charCodeAt(0);\nconst DOUBLE_QUOTE = \'"\'.charCodeAt(0);\nconst BACKSLASH = "\\\\".charCodeAt(0);\nconst SLASH = "/".charCodeAt(0);\nconst NEWLINE = "\\n".charCodeAt(0);\nconst SPACE = " ".charCodeAt(0);\nconst FEED = "\\f".charCodeAt(0);\nconst TAB = " ".charCodeAt(0);\nconst CR = "\\r".charCodeAt(0);\nconst OPEN_SQUARE = "[".charCodeAt(0);\nconst CLOSE_SQUARE = "]".charCodeAt(0);\nconst OPEN_PARENTHESES = "(".charCodeAt(0);\nconst CLOSE_PARENTHESES = ")".charCodeAt(0);\nconst OPEN_CURLY = "{".charCodeAt(0);\nconst CLOSE_CURLY = "}".charCodeAt(0);\nconst SEMICOLON = ";".charCodeAt(0);\nconst ASTERISK = "*".charCodeAt(0);\nconst COLON = ":".charCodeAt(0);\nconst AT = "@".charCodeAt(0);\nconst RE_AT_END = /[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g;\nconst RE_WORD_END = /[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g;\nconst RE_BAD_BRACKET = /.[\\r\\n"\'(/\\\\]/;\nconst RE_HEX_ESCAPE = /[\\da-f]/i;\nvar tokenize = function tokenizer2(input2, options = {}) {\n let css = input2.css.valueOf();\n let ignore = options.ignoreErrors;\n let code, next, quote, content, escape;\n let escaped, escapePos, prev, n2, currentToken;\n let length = css.length;\n let pos = 0;\n let buffer = [];\n let returned = [];\n function position() {\n return pos;\n }\n function unclosed(what) {\n throw input2.error("Unclosed " + what, pos);\n }\n function endOfFile() {\n return returned.length === 0 && pos >= length;\n }\n function nextToken(opts) {\n if (returned.length) return returned.pop();\n if (pos >= length) return;\n let ignoreUnclosed = opts ? opts.ignoreUnclosed : false;\n code = css.charCodeAt(pos);\n switch (code) {\n case NEWLINE:\n case SPACE:\n case TAB:\n case CR:\n case FEED: {\n next = pos;\n do {\n next += 1;\n code = css.charCodeAt(next);\n } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);\n currentToken = ["space", css.slice(pos, next)];\n pos = next - 1;\n break;\n }\n case OPEN_SQUARE:\n case CLOSE_SQUARE:\n case OPEN_CURLY:\n case CLOSE_CURLY:\n case COLON:\n case SEMICOLON:\n case CLOSE_PARENTHESES: {\n let controlChar = String.fromCharCode(code);\n currentToken = [controlChar, controlChar, pos];\n break;\n }\n case OPEN_PARENTHESES: {\n prev = buffer.length ? buffer.pop()[1] : "";\n n2 = css.charCodeAt(pos + 1);\n if (prev === "url" && n2 !== SINGLE_QUOTE && n2 !== DOUBLE_QUOTE && n2 !== SPACE && n2 !== NEWLINE && n2 !== TAB && n2 !== FEED && n2 !== CR) {\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(")", next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos;\n break;\n } else {\n unclosed("bracket");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = ["brackets", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n next = css.indexOf(")", pos + 1);\n content = css.slice(pos, next + 1);\n if (next === -1 || RE_BAD_BRACKET.test(content)) {\n currentToken = ["(", "(", pos];\n } else {\n currentToken = ["brackets", content, pos, next];\n pos = next;\n }\n }\n break;\n }\n case SINGLE_QUOTE:\n case DOUBLE_QUOTE: {\n quote = code === SINGLE_QUOTE ? "\'" : \'"\';\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(quote, next + 1);\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos + 1;\n break;\n } else {\n unclosed("string");\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n currentToken = ["string", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case AT: {\n RE_AT_END.lastIndex = pos + 1;\n RE_AT_END.test(css);\n if (RE_AT_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_AT_END.lastIndex - 2;\n }\n currentToken = ["at-word", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n case BACKSLASH: {\n next = pos;\n escape = true;\n while (css.charCodeAt(next + 1) === BACKSLASH) {\n next += 1;\n escape = !escape;\n }\n code = css.charCodeAt(next + 1);\n if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {\n next += 1;\n if (RE_HEX_ESCAPE.test(css.charAt(next))) {\n while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {\n next += 1;\n }\n if (css.charCodeAt(next + 1) === SPACE) {\n next += 1;\n }\n }\n }\n currentToken = ["word", css.slice(pos, next + 1), pos, next];\n pos = next;\n break;\n }\n default: {\n if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {\n next = css.indexOf("*/", pos + 2) + 1;\n if (next === 0) {\n if (ignore || ignoreUnclosed) {\n next = css.length;\n } else {\n unclosed("comment");\n }\n }\n currentToken = ["comment", css.slice(pos, next + 1), pos, next];\n pos = next;\n } else {\n RE_WORD_END.lastIndex = pos + 1;\n RE_WORD_END.test(css);\n if (RE_WORD_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_WORD_END.lastIndex - 2;\n }\n currentToken = ["word", css.slice(pos, next + 1), pos, next];\n buffer.push(currentToken);\n pos = next;\n }\n break;\n }\n }\n pos++;\n return currentToken;\n }\n function back(token) {\n returned.push(token);\n }\n return {\n back,\n endOfFile,\n nextToken,\n position\n };\n};\nlet Container$5 = container;\nlet AtRule$3 = class AtRule2 extends Container$5 {\n constructor(defaults) {\n super(defaults);\n this.type = "atrule";\n }\n append(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.append(...children);\n }\n prepend(...children) {\n if (!this.proxyOf.nodes) this.nodes = [];\n return super.prepend(...children);\n }\n};\nvar atRule = AtRule$3;\nAtRule$3.default = AtRule$3;\nContainer$5.registerAtRule(AtRule$3);\nlet Container$4 = container;\nlet LazyResult$3;\nlet Processor$2;\nlet Root$5 = class Root2 extends Container$4 {\n constructor(defaults) {\n super(defaults);\n this.type = "root";\n if (!this.nodes) this.nodes = [];\n }\n normalize(child, sample, type) {\n let nodes = super.normalize(child);\n if (sample) {\n if (type === "prepend") {\n if (this.nodes.length > 1) {\n sample.raws.before = this.nodes[1].raws.before;\n } else {\n delete sample.raws.before;\n }\n } else if (this.first !== sample) {\n for (let node2 of nodes) {\n node2.raws.before = sample.raws.before;\n }\n }\n }\n return nodes;\n }\n removeChild(child, ignore) {\n let index2 = this.index(child);\n if (!ignore && index2 === 0 && this.nodes.length > 1) {\n this.nodes[1].raws.before = this.nodes[index2].raws.before;\n }\n return super.removeChild(child);\n }\n toResult(opts = {}) {\n let lazy = new LazyResult$3(new Processor$2(), this, opts);\n return lazy.stringify();\n }\n};\nRoot$5.registerLazyResult = (dependant) => {\n LazyResult$3 = dependant;\n};\nRoot$5.registerProcessor = (dependant) => {\n Processor$2 = dependant;\n};\nvar root = Root$5;\nRoot$5.default = Root$5;\nContainer$4.registerRoot(Root$5);\nlet list$2 = {\n comma(string) {\n return list$2.split(string, [","], true);\n },\n space(string) {\n let spaces = [" ", "\\n", " "];\n return list$2.split(string, spaces);\n },\n split(string, separators, last) {\n let array = [];\n let current = "";\n let split = false;\n let func = 0;\n let inQuote = false;\n let prevQuote = "";\n let escape = false;\n for (let letter of string) {\n if (escape) {\n escape = false;\n } else if (letter === "\\\\") {\n escape = true;\n } else if (inQuote) {\n if (letter === prevQuote) {\n inQuote = false;\n }\n } else if (letter === \'"\' || letter === "\'") {\n inQuote = true;\n prevQuote = letter;\n } else if (letter === "(") {\n func += 1;\n } else if (letter === ")") {\n if (func > 0) func -= 1;\n } else if (func === 0) {\n if (separators.includes(letter)) split = true;\n }\n if (split) {\n if (current !== "") array.push(current.trim());\n current = "";\n split = false;\n } else {\n current += letter;\n }\n }\n if (last || current !== "") array.push(current.trim());\n return array;\n }\n};\nvar list_1 = list$2;\nlist$2.default = list$2;\nlet Container$3 = container;\nlet list$1 = list_1;\nlet Rule$3 = class Rule2 extends Container$3 {\n constructor(defaults) {\n super(defaults);\n this.type = "rule";\n if (!this.nodes) this.nodes = [];\n }\n get selectors() {\n return list$1.comma(this.selector);\n }\n set selectors(values) {\n let match = this.selector ? this.selector.match(/,\\s*/) : null;\n let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");\n this.selector = values.join(sep2);\n }\n};\nvar rule = Rule$3;\nRule$3.default = Rule$3;\nContainer$3.registerRule(Rule$3);\nlet Declaration$2 = declaration;\nlet tokenizer22 = tokenize;\nlet Comment$2 = comment;\nlet AtRule$2 = atRule;\nlet Root$4 = root;\nlet Rule$2 = rule;\nconst SAFE_COMMENT_NEIGHBOR = {\n empty: true,\n space: true\n};\nfunction findLastWithPosition(tokens) {\n for (let i2 = tokens.length - 1; i2 >= 0; i2--) {\n let token = tokens[i2];\n let pos = token[3] || token[2];\n if (pos) return pos;\n }\n}\nlet Parser$1 = class Parser2 {\n constructor(input2) {\n this.input = input2;\n this.root = new Root$4();\n this.current = this.root;\n this.spaces = "";\n this.semicolon = false;\n this.createTokenizer();\n this.root.source = { input: input2, start: { column: 1, line: 1, offset: 0 } };\n }\n atrule(token) {\n let node2 = new AtRule$2();\n node2.name = token[1].slice(1);\n if (node2.name === "") {\n this.unnamedAtrule(node2, token);\n }\n this.init(node2, token[2]);\n let type;\n let prev;\n let shift;\n let last = false;\n let open = false;\n let params = [];\n let brackets = [];\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n type = token[0];\n if (type === "(" || type === "[") {\n brackets.push(type === "(" ? ")" : "]");\n } else if (type === "{" && brackets.length > 0) {\n brackets.push("}");\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n }\n if (brackets.length === 0) {\n if (type === ";") {\n node2.source.end = this.getPosition(token[2]);\n node2.source.end.offset++;\n this.semicolon = true;\n break;\n } else if (type === "{") {\n open = true;\n break;\n } else if (type === "}") {\n if (params.length > 0) {\n shift = params.length - 1;\n prev = params[shift];\n while (prev && prev[0] === "space") {\n prev = params[--shift];\n }\n if (prev) {\n node2.source.end = this.getPosition(prev[3] || prev[2]);\n node2.source.end.offset++;\n }\n }\n this.end(token);\n break;\n } else {\n params.push(token);\n }\n } else {\n params.push(token);\n }\n if (this.tokenizer.endOfFile()) {\n last = true;\n break;\n }\n }\n node2.raws.between = this.spacesAndCommentsFromEnd(params);\n if (params.length) {\n node2.raws.afterName = this.spacesAndCommentsFromStart(params);\n this.raw(node2, "params", params);\n if (last) {\n token = params[params.length - 1];\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n this.spaces = node2.raws.between;\n node2.raws.between = "";\n }\n } else {\n node2.raws.afterName = "";\n node2.params = "";\n }\n if (open) {\n node2.nodes = [];\n this.current = node2;\n }\n }\n checkMissedSemicolon(tokens) {\n let colon = this.colon(tokens);\n if (colon === false) return;\n let founded = 0;\n let token;\n for (let j = colon - 1; j >= 0; j--) {\n token = tokens[j];\n if (token[0] !== "space") {\n founded += 1;\n if (founded === 2) break;\n }\n }\n throw this.input.error(\n "Missed semicolon",\n token[0] === "word" ? token[3] + 1 : token[2]\n );\n }\n colon(tokens) {\n let brackets = 0;\n let token, type, prev;\n for (let [i2, element] of tokens.entries()) {\n token = element;\n type = token[0];\n if (type === "(") {\n brackets += 1;\n }\n if (type === ")") {\n brackets -= 1;\n }\n if (brackets === 0 && type === ":") {\n if (!prev) {\n this.doubleColon(token);\n } else if (prev[0] === "word" && prev[1] === "progid") {\n continue;\n } else {\n return i2;\n }\n }\n prev = token;\n }\n return false;\n }\n comment(token) {\n let node2 = new Comment$2();\n this.init(node2, token[2]);\n node2.source.end = this.getPosition(token[3] || token[2]);\n node2.source.end.offset++;\n let text = token[1].slice(2, -2);\n if (/^\\s*$/.test(text)) {\n node2.text = "";\n node2.raws.left = text;\n node2.raws.right = "";\n } else {\n let match = text.match(/^(\\s*)([^]*\\S)(\\s*)$/);\n node2.text = match[2];\n node2.raws.left = match[1];\n node2.raws.right = match[3];\n }\n }\n createTokenizer() {\n this.tokenizer = tokenizer22(this.input);\n }\n decl(tokens, customProperty) {\n let node2 = new Declaration$2();\n this.init(node2, tokens[0][2]);\n let last = tokens[tokens.length - 1];\n if (last[0] === ";") {\n this.semicolon = true;\n tokens.pop();\n }\n node2.source.end = this.getPosition(\n last[3] || last[2] || findLastWithPosition(tokens)\n );\n node2.source.end.offset++;\n while (tokens[0][0] !== "word") {\n if (tokens.length === 1) this.unknownWord(tokens);\n node2.raws.before += tokens.shift()[1];\n }\n node2.source.start = this.getPosition(tokens[0][2]);\n node2.prop = "";\n while (tokens.length) {\n let type = tokens[0][0];\n if (type === ":" || type === "space" || type === "comment") {\n break;\n }\n node2.prop += tokens.shift()[1];\n }\n node2.raws.between = "";\n let token;\n while (tokens.length) {\n token = tokens.shift();\n if (token[0] === ":") {\n node2.raws.between += token[1];\n break;\n } else {\n if (token[0] === "word" && /\\w/.test(token[1])) {\n this.unknownWord([token]);\n }\n node2.raws.between += token[1];\n }\n }\n if (node2.prop[0] === "_" || node2.prop[0] === "*") {\n node2.raws.before += node2.prop[0];\n node2.prop = node2.prop.slice(1);\n }\n let firstSpaces = [];\n let next;\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== "space" && next !== "comment") break;\n firstSpaces.push(tokens.shift());\n }\n this.precheckMissedSemicolon(tokens);\n for (let i2 = tokens.length - 1; i2 >= 0; i2--) {\n token = tokens[i2];\n if (token[1].toLowerCase() === "!important") {\n node2.important = true;\n let string = this.stringFrom(tokens, i2);\n string = this.spacesFromEnd(tokens) + string;\n if (string !== " !important") node2.raws.important = string;\n break;\n } else if (token[1].toLowerCase() === "important") {\n let cache = tokens.slice(0);\n let str = "";\n for (let j = i2; j > 0; j--) {\n let type = cache[j][0];\n if (str.trim().indexOf("!") === 0 && type !== "space") {\n break;\n }\n str = cache.pop()[1] + str;\n }\n if (str.trim().indexOf("!") === 0) {\n node2.important = true;\n node2.raws.important = str;\n tokens = cache;\n }\n }\n if (token[0] !== "space" && token[0] !== "comment") {\n break;\n }\n }\n let hasWord = tokens.some((i2) => i2[0] !== "space" && i2[0] !== "comment");\n if (hasWord) {\n node2.raws.between += firstSpaces.map((i2) => i2[1]).join("");\n firstSpaces = [];\n }\n this.raw(node2, "value", firstSpaces.concat(tokens), customProperty);\n if (node2.value.includes(":") && !customProperty) {\n this.checkMissedSemicolon(tokens);\n }\n }\n doubleColon(token) {\n throw this.input.error(\n "Double colon",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n emptyRule(token) {\n let node2 = new Rule$2();\n this.init(node2, token[2]);\n node2.selector = "";\n node2.raws.between = "";\n this.current = node2;\n }\n end(token) {\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.semicolon = false;\n this.current.raws.after = (this.current.raws.after || "") + this.spaces;\n this.spaces = "";\n if (this.current.parent) {\n this.current.source.end = this.getPosition(token[2]);\n this.current.source.end.offset++;\n this.current = this.current.parent;\n } else {\n this.unexpectedClose(token);\n }\n }\n endFile() {\n if (this.current.parent) this.unclosedBlock();\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.current.raws.after = (this.current.raws.after || "") + this.spaces;\n this.root.source.end = this.getPosition(this.tokenizer.position());\n }\n freeSemicolon(token) {\n this.spaces += token[1];\n if (this.current.nodes) {\n let prev = this.current.nodes[this.current.nodes.length - 1];\n if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {\n prev.raws.ownSemicolon = this.spaces;\n this.spaces = "";\n }\n }\n }\n // Helpers\n getPosition(offset) {\n let pos = this.input.fromOffset(offset);\n return {\n column: pos.col,\n line: pos.line,\n offset\n };\n }\n init(node2, offset) {\n this.current.push(node2);\n node2.source = {\n input: this.input,\n start: this.getPosition(offset)\n };\n node2.raws.before = this.spaces;\n this.spaces = "";\n if (node2.type !== "comment") this.semicolon = false;\n }\n other(start) {\n let end = false;\n let type = null;\n let colon = false;\n let bracket = null;\n let brackets = [];\n let customProperty = start[1].startsWith("--");\n let tokens = [];\n let token = start;\n while (token) {\n type = token[0];\n tokens.push(token);\n if (type === "(" || type === "[") {\n if (!bracket) bracket = token;\n brackets.push(type === "(" ? ")" : "]");\n } else if (customProperty && colon && type === "{") {\n if (!bracket) bracket = token;\n brackets.push("}");\n } else if (brackets.length === 0) {\n if (type === ";") {\n if (colon) {\n this.decl(tokens, customProperty);\n return;\n } else {\n break;\n }\n } else if (type === "{") {\n this.rule(tokens);\n return;\n } else if (type === "}") {\n this.tokenizer.back(tokens.pop());\n end = true;\n break;\n } else if (type === ":") {\n colon = true;\n }\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n if (brackets.length === 0) bracket = null;\n }\n token = this.tokenizer.nextToken();\n }\n if (this.tokenizer.endOfFile()) end = true;\n if (brackets.length > 0) this.unclosedBracket(bracket);\n if (end && colon) {\n if (!customProperty) {\n while (tokens.length) {\n token = tokens[tokens.length - 1][0];\n if (token !== "space" && token !== "comment") break;\n this.tokenizer.back(tokens.pop());\n }\n }\n this.decl(tokens, customProperty);\n } else {\n this.unknownWord(tokens);\n }\n }\n parse() {\n let token;\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken();\n switch (token[0]) {\n case "space":\n this.spaces += token[1];\n break;\n case ";":\n this.freeSemicolon(token);\n break;\n case "}":\n this.end(token);\n break;\n case "comment":\n this.comment(token);\n break;\n case "at-word":\n this.atrule(token);\n break;\n case "{":\n this.emptyRule(token);\n break;\n default:\n this.other(token);\n break;\n }\n }\n this.endFile();\n }\n precheckMissedSemicolon() {\n }\n raw(node2, prop, tokens, customProperty) {\n let token, type;\n let length = tokens.length;\n let value = "";\n let clean = true;\n let next, prev;\n for (let i2 = 0; i2 < length; i2 += 1) {\n token = tokens[i2];\n type = token[0];\n if (type === "space" && i2 === length - 1 && !customProperty) {\n clean = false;\n } else if (type === "comment") {\n prev = tokens[i2 - 1] ? tokens[i2 - 1][0] : "empty";\n next = tokens[i2 + 1] ? tokens[i2 + 1][0] : "empty";\n if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {\n if (value.slice(-1) === ",") {\n clean = false;\n } else {\n value += token[1];\n }\n } else {\n clean = false;\n }\n } else {\n value += token[1];\n }\n }\n if (!clean) {\n let raw = tokens.reduce((all, i2) => all + i2[1], "");\n node2.raws[prop] = { raw, value };\n }\n node2[prop] = value;\n }\n rule(tokens) {\n tokens.pop();\n let node2 = new Rule$2();\n this.init(node2, tokens[0][2]);\n node2.raws.between = this.spacesAndCommentsFromEnd(tokens);\n this.raw(node2, "selector", tokens);\n this.current = node2;\n }\n spacesAndCommentsFromEnd(tokens) {\n let lastTokenType;\n let spaces = "";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== "space" && lastTokenType !== "comment") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n // Errors\n spacesAndCommentsFromStart(tokens) {\n let next;\n let spaces = "";\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== "space" && next !== "comment") break;\n spaces += tokens.shift()[1];\n }\n return spaces;\n }\n spacesFromEnd(tokens) {\n let lastTokenType;\n let spaces = "";\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== "space") break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n stringFrom(tokens, from) {\n let result2 = "";\n for (let i2 = from; i2 < tokens.length; i2++) {\n result2 += tokens[i2][1];\n }\n tokens.splice(from, tokens.length - from);\n return result2;\n }\n unclosedBlock() {\n let pos = this.current.source.start;\n throw this.input.error("Unclosed block", pos.line, pos.column);\n }\n unclosedBracket(bracket) {\n throw this.input.error(\n "Unclosed bracket",\n { offset: bracket[2] },\n { offset: bracket[2] + 1 }\n );\n }\n unexpectedClose(token) {\n throw this.input.error(\n "Unexpected }",\n { offset: token[2] },\n { offset: token[2] + 1 }\n );\n }\n unknownWord(tokens) {\n throw this.input.error(\n "Unknown word",\n { offset: tokens[0][2] },\n { offset: tokens[0][2] + tokens[0][1].length }\n );\n }\n unnamedAtrule(node2, token) {\n throw this.input.error(\n "At-rule without name",\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n );\n }\n};\nvar parser = Parser$1;\nlet Container$2 = container;\nlet Parser22 = parser;\nlet Input$2 = input;\nfunction parse$3(css, opts) {\n let input2 = new Input$2(css, opts);\n let parser2 = new Parser22(input2);\n try {\n parser2.parse();\n } catch (e2) {\n if (true) {\n if (e2.name === "CssSyntaxError" && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e2.message += "\\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";\n } else if (/\\.sass/i.test(opts.from)) {\n e2.message += "\\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser";\n } else if (/\\.less$/i.test(opts.from)) {\n e2.message += "\\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser";\n }\n }\n }\n throw e2;\n }\n return parser2.root;\n}\nvar parse_1 = parse$3;\nparse$3.default = parse$3;\nContainer$2.registerParse(parse$3);\nlet { isClean, my } = symbols;\nlet MapGenerator$1 = mapGenerator;\nlet stringify$2 = stringify_1;\nlet Container$1 = container;\nlet Document$2 = document$1;\nlet warnOnce$1 = warnOnce$2;\nlet Result$2 = result;\nlet parse$2 = parse_1;\nlet Root$3 = root;\nconst TYPE_TO_CLASS_NAME = {\n atrule: "AtRule",\n comment: "Comment",\n decl: "Declaration",\n document: "Document",\n root: "Root",\n rule: "Rule"\n};\nconst PLUGIN_PROPS = {\n AtRule: true,\n AtRuleExit: true,\n Comment: true,\n CommentExit: true,\n Declaration: true,\n DeclarationExit: true,\n Document: true,\n DocumentExit: true,\n Once: true,\n OnceExit: true,\n postcssPlugin: true,\n prepare: true,\n Root: true,\n RootExit: true,\n Rule: true,\n RuleExit: true\n};\nconst NOT_VISITORS = {\n Once: true,\n postcssPlugin: true,\n prepare: true\n};\nconst CHILDREN = 0;\nfunction isPromise(obj) {\n return typeof obj === "object" && typeof obj.then === "function";\n}\nfunction getEvents(node2) {\n let key = false;\n let type = TYPE_TO_CLASS_NAME[node2.type];\n if (node2.type === "decl") {\n key = node2.prop.toLowerCase();\n } else if (node2.type === "atrule") {\n key = node2.name.toLowerCase();\n }\n if (key && node2.append) {\n return [\n type,\n type + "-" + key,\n CHILDREN,\n type + "Exit",\n type + "Exit-" + key\n ];\n } else if (key) {\n return [type, type + "-" + key, type + "Exit", type + "Exit-" + key];\n } else if (node2.append) {\n return [type, CHILDREN, type + "Exit"];\n } else {\n return [type, type + "Exit"];\n }\n}\nfunction toStack(node2) {\n let events;\n if (node2.type === "document") {\n events = ["Document", CHILDREN, "DocumentExit"];\n } else if (node2.type === "root") {\n events = ["Root", CHILDREN, "RootExit"];\n } else {\n events = getEvents(node2);\n }\n return {\n eventIndex: 0,\n events,\n iterator: 0,\n node: node2,\n visitorIndex: 0,\n visitors: []\n };\n}\nfunction cleanMarks(node2) {\n node2[isClean] = false;\n if (node2.nodes) node2.nodes.forEach((i2) => cleanMarks(i2));\n return node2;\n}\nlet postcss$2 = {};\nlet LazyResult$2 = class LazyResult2 {\n constructor(processor2, css, opts) {\n this.stringified = false;\n this.processed = false;\n let root2;\n if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {\n root2 = cleanMarks(css);\n } else if (css instanceof LazyResult2 || css instanceof Result$2) {\n root2 = cleanMarks(css.root);\n if (css.map) {\n if (typeof opts.map === "undefined") opts.map = {};\n if (!opts.map.inline) opts.map.inline = false;\n opts.map.prev = css.map;\n }\n } else {\n let parser2 = parse$2;\n if (opts.syntax) parser2 = opts.syntax.parse;\n if (opts.parser) parser2 = opts.parser;\n if (parser2.parse) parser2 = parser2.parse;\n try {\n root2 = parser2(css, opts);\n } catch (error) {\n this.processed = true;\n this.error = error;\n }\n if (root2 && !root2[my]) {\n Container$1.rebuild(root2);\n }\n }\n this.result = new Result$2(processor2, root2, opts);\n this.helpers = __spreadProps(__spreadValues({}, postcss$2), { postcss: postcss$2, result: this.result });\n this.plugins = this.processor.plugins.map((plugin22) => {\n if (typeof plugin22 === "object" && plugin22.prepare) {\n return __spreadValues(__spreadValues({}, plugin22), plugin22.prepare(this.result));\n } else {\n return plugin22;\n }\n });\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n if (this.processed) return Promise.resolve(this.result);\n if (!this.processing) {\n this.processing = this.runAsync();\n }\n return this.processing;\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n getAsyncError() {\n throw new Error("Use process(css).then(cb) to work with async plugins");\n }\n handleError(error, node2) {\n let plugin22 = this.result.lastPlugin;\n try {\n if (node2) node2.addToError(error);\n this.error = error;\n if (error.name === "CssSyntaxError" && !error.plugin) {\n error.plugin = plugin22.postcssPlugin;\n error.setMessage();\n } else if (plugin22.postcssVersion) {\n if (true) {\n let pluginName = plugin22.postcssPlugin;\n let pluginVer = plugin22.postcssVersion;\n let runtimeVer = this.result.processor.version;\n let a2 = pluginVer.split(".");\n let b = runtimeVer.split(".");\n if (a2[0] !== b[0] || parseInt(a2[1]) > parseInt(b[1])) {\n console.error(\n "Unknown error from PostCSS plugin. Your current PostCSS version is " + runtimeVer + ", but " + pluginName + " uses " + pluginVer + ". Perhaps this is the source of the error below."\n );\n }\n }\n }\n } catch (err) {\n if (console && console.error) console.error(err);\n }\n return error;\n }\n prepareVisitors() {\n this.listeners = {};\n let add = (plugin22, type, cb) => {\n if (!this.listeners[type]) this.listeners[type] = [];\n this.listeners[type].push([plugin22, cb]);\n };\n for (let plugin22 of this.plugins) {\n if (typeof plugin22 === "object") {\n for (let event in plugin22) {\n if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {\n throw new Error(\n `Unknown event ${event} in ${plugin22.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`\n );\n }\n if (!NOT_VISITORS[event]) {\n if (typeof plugin22[event] === "object") {\n for (let filter in plugin22[event]) {\n if (filter === "*") {\n add(plugin22, event, plugin22[event][filter]);\n } else {\n add(\n plugin22,\n event + "-" + filter.toLowerCase(),\n plugin22[event][filter]\n );\n }\n }\n } else if (typeof plugin22[event] === "function") {\n add(plugin22, event, plugin22[event]);\n }\n }\n }\n }\n }\n this.hasListener = Object.keys(this.listeners).length > 0;\n }\n async runAsync() {\n this.plugin = 0;\n for (let i2 = 0; i2 < this.plugins.length; i2++) {\n let plugin22 = this.plugins[i2];\n let promise = this.runOnRoot(plugin22);\n if (isPromise(promise)) {\n try {\n await promise;\n } catch (error) {\n throw this.handleError(error);\n }\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean]) {\n root2[isClean] = true;\n let stack = [toStack(root2)];\n while (stack.length > 0) {\n let promise = this.visitTick(stack);\n if (isPromise(promise)) {\n try {\n await promise;\n } catch (e2) {\n let node2 = stack[stack.length - 1].node;\n throw this.handleError(e2, node2);\n }\n }\n }\n }\n if (this.listeners.OnceExit) {\n for (let [plugin22, visitor] of this.listeners.OnceExit) {\n this.result.lastPlugin = plugin22;\n try {\n if (root2.type === "document") {\n let roots = root2.nodes.map(\n (subRoot) => visitor(subRoot, this.helpers)\n );\n await Promise.all(roots);\n } else {\n await visitor(root2, this.helpers);\n }\n } catch (e2) {\n throw this.handleError(e2);\n }\n }\n }\n }\n this.processed = true;\n return this.stringify();\n }\n runOnRoot(plugin22) {\n this.result.lastPlugin = plugin22;\n try {\n if (typeof plugin22 === "object" && plugin22.Once) {\n if (this.result.root.type === "document") {\n let roots = this.result.root.nodes.map(\n (root2) => plugin22.Once(root2, this.helpers)\n );\n if (isPromise(roots[0])) {\n return Promise.all(roots);\n }\n return roots;\n }\n return plugin22.Once(this.result.root, this.helpers);\n } else if (typeof plugin22 === "function") {\n return plugin22(this.result.root, this.result);\n }\n } catch (error) {\n throw this.handleError(error);\n }\n }\n stringify() {\n if (this.error) throw this.error;\n if (this.stringified) return this.result;\n this.stringified = true;\n this.sync();\n let opts = this.result.opts;\n let str = stringify$2;\n if (opts.syntax) str = opts.syntax.stringify;\n if (opts.stringifier) str = opts.stringifier;\n if (str.stringify) str = str.stringify;\n let map = new MapGenerator$1(str, this.result.root, this.result.opts);\n let data = map.generate();\n this.result.css = data[0];\n this.result.map = data[1];\n return this.result;\n }\n sync() {\n if (this.error) throw this.error;\n if (this.processed) return this.result;\n this.processed = true;\n if (this.processing) {\n throw this.getAsyncError();\n }\n for (let plugin22 of this.plugins) {\n let promise = this.runOnRoot(plugin22);\n if (isPromise(promise)) {\n throw this.getAsyncError();\n }\n }\n this.prepareVisitors();\n if (this.hasListener) {\n let root2 = this.result.root;\n while (!root2[isClean]) {\n root2[isClean] = true;\n this.walkSync(root2);\n }\n if (this.listeners.OnceExit) {\n if (root2.type === "document") {\n for (let subRoot of root2.nodes) {\n this.visitSync(this.listeners.OnceExit, subRoot);\n }\n } else {\n this.visitSync(this.listeners.OnceExit, root2);\n }\n }\n }\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (true) {\n if (!("from" in this.opts)) {\n warnOnce$1(\n "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this.css;\n }\n visitSync(visitors, node2) {\n for (let [plugin22, visitor] of visitors) {\n this.result.lastPlugin = plugin22;\n let promise;\n try {\n promise = visitor(node2, this.helpers);\n } catch (e2) {\n throw this.handleError(e2, node2.proxyOf);\n }\n if (node2.type !== "root" && node2.type !== "document" && !node2.parent) {\n return true;\n }\n if (isPromise(promise)) {\n throw this.getAsyncError();\n }\n }\n }\n visitTick(stack) {\n let visit2 = stack[stack.length - 1];\n let { node: node2, visitors } = visit2;\n if (node2.type !== "root" && node2.type !== "document" && !node2.parent) {\n stack.pop();\n return;\n }\n if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {\n let [plugin22, visitor] = visitors[visit2.visitorIndex];\n visit2.visitorIndex += 1;\n if (visit2.visitorIndex === visitors.length) {\n visit2.visitors = [];\n visit2.visitorIndex = 0;\n }\n this.result.lastPlugin = plugin22;\n try {\n return visitor(node2.toProxy(), this.helpers);\n } catch (e2) {\n throw this.handleError(e2, node2);\n }\n }\n if (visit2.iterator !== 0) {\n let iterator = visit2.iterator;\n let child;\n while (child = node2.nodes[node2.indexes[iterator]]) {\n node2.indexes[iterator] += 1;\n if (!child[isClean]) {\n child[isClean] = true;\n stack.push(toStack(child));\n return;\n }\n }\n visit2.iterator = 0;\n delete node2.indexes[iterator];\n }\n let events = visit2.events;\n while (visit2.eventIndex < events.length) {\n let event = events[visit2.eventIndex];\n visit2.eventIndex += 1;\n if (event === CHILDREN) {\n if (node2.nodes && node2.nodes.length) {\n node2[isClean] = true;\n visit2.iterator = node2.getIterator();\n }\n return;\n } else if (this.listeners[event]) {\n visit2.visitors = this.listeners[event];\n return;\n }\n }\n stack.pop();\n }\n walkSync(node2) {\n node2[isClean] = true;\n let events = getEvents(node2);\n for (let event of events) {\n if (event === CHILDREN) {\n if (node2.nodes) {\n node2.each((child) => {\n if (!child[isClean]) this.walkSync(child);\n });\n }\n } else {\n let visitors = this.listeners[event];\n if (visitors) {\n if (this.visitSync(visitors, node2.toProxy())) return;\n }\n }\n }\n }\n warnings() {\n return this.sync().warnings();\n }\n get content() {\n return this.stringify().content;\n }\n get css() {\n return this.stringify().css;\n }\n get map() {\n return this.stringify().map;\n }\n get messages() {\n return this.sync().messages;\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n return this.sync().root;\n }\n get [Symbol.toStringTag]() {\n return "LazyResult";\n }\n};\nLazyResult$2.registerPostcss = (dependant) => {\n postcss$2 = dependant;\n};\nvar lazyResult = LazyResult$2;\nLazyResult$2.default = LazyResult$2;\nRoot$3.registerLazyResult(LazyResult$2);\nDocument$2.registerLazyResult(LazyResult$2);\nlet MapGenerator22 = mapGenerator;\nlet stringify$1 = stringify_1;\nlet warnOnce22 = warnOnce$2;\nlet parse$1 = parse_1;\nconst Result$1 = result;\nlet NoWorkResult$1 = class NoWorkResult2 {\n constructor(processor2, css, opts) {\n css = css.toString();\n this.stringified = false;\n this._processor = processor2;\n this._css = css;\n this._opts = opts;\n this._map = void 0;\n let root2;\n let str = stringify$1;\n this.result = new Result$1(this._processor, root2, this._opts);\n this.result.css = css;\n let self = this;\n Object.defineProperty(this.result, "root", {\n get() {\n return self.root;\n }\n });\n let map = new MapGenerator22(str, root2, this._opts, css);\n if (map.isMap()) {\n let [generatedCSS, generatedMap] = map.generate();\n if (generatedCSS) {\n this.result.css = generatedCSS;\n }\n if (generatedMap) {\n this.result.map = generatedMap;\n }\n } else {\n map.clearAnnotation();\n this.result.css = map.css;\n }\n }\n async() {\n if (this.error) return Promise.reject(this.error);\n return Promise.resolve(this.result);\n }\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n finally(onFinally) {\n return this.async().then(onFinally, onFinally);\n }\n sync() {\n if (this.error) throw this.error;\n return this.result;\n }\n then(onFulfilled, onRejected) {\n if (true) {\n if (!("from" in this._opts)) {\n warnOnce22(\n "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."\n );\n }\n }\n return this.async().then(onFulfilled, onRejected);\n }\n toString() {\n return this._css;\n }\n warnings() {\n return [];\n }\n get content() {\n return this.result.css;\n }\n get css() {\n return this.result.css;\n }\n get map() {\n return this.result.map;\n }\n get messages() {\n return [];\n }\n get opts() {\n return this.result.opts;\n }\n get processor() {\n return this.result.processor;\n }\n get root() {\n if (this._root) {\n return this._root;\n }\n let root2;\n let parser2 = parse$1;\n try {\n root2 = parser2(this._css, this._opts);\n } catch (error) {\n this.error = error;\n }\n if (this.error) {\n throw this.error;\n } else {\n this._root = root2;\n return root2;\n }\n }\n get [Symbol.toStringTag]() {\n return "NoWorkResult";\n }\n};\nvar noWorkResult = NoWorkResult$1;\nNoWorkResult$1.default = NoWorkResult$1;\nlet NoWorkResult22 = noWorkResult;\nlet LazyResult$1 = lazyResult;\nlet Document$1 = document$1;\nlet Root$2 = root;\nlet Processor$1 = class Processor2 {\n constructor(plugins = []) {\n this.version = "8.4.38";\n this.plugins = this.normalize(plugins);\n }\n normalize(plugins) {\n let normalized = [];\n for (let i2 of plugins) {\n if (i2.postcss === true) {\n i2 = i2();\n } else if (i2.postcss) {\n i2 = i2.postcss;\n }\n if (typeof i2 === "object" && Array.isArray(i2.plugins)) {\n normalized = normalized.concat(i2.plugins);\n } else if (typeof i2 === "object" && i2.postcssPlugin) {\n normalized.push(i2);\n } else if (typeof i2 === "function") {\n normalized.push(i2);\n } else if (typeof i2 === "object" && (i2.parse || i2.stringify)) {\n if (true) {\n throw new Error(\n "PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation."\n );\n }\n } else {\n throw new Error(i2 + " is not a PostCSS plugin");\n }\n }\n return normalized;\n }\n process(css, opts = {}) {\n if (!this.plugins.length && !opts.parser && !opts.stringifier && !opts.syntax) {\n return new NoWorkResult22(this, css, opts);\n } else {\n return new LazyResult$1(this, css, opts);\n }\n }\n use(plugin22) {\n this.plugins = this.plugins.concat(this.normalize([plugin22]));\n return this;\n }\n};\nvar processor = Processor$1;\nProcessor$1.default = Processor$1;\nRoot$2.registerProcessor(Processor$1);\nDocument$1.registerProcessor(Processor$1);\nlet Declaration$1 = declaration;\nlet PreviousMap22 = previousMap;\nlet Comment$1 = comment;\nlet AtRule$1 = atRule;\nlet Input$1 = input;\nlet Root$1 = root;\nlet Rule$1 = rule;\nfunction fromJSON$1(json, inputs) {\n if (Array.isArray(json)) return json.map((n2) => fromJSON$1(n2));\n let _a2 = json, { inputs: ownInputs } = _a2, defaults = __objRest(_a2, ["inputs"]);\n if (ownInputs) {\n inputs = [];\n for (let input2 of ownInputs) {\n let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$1.prototype });\n if (inputHydrated.map) {\n inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {\n __proto__: PreviousMap22.prototype\n });\n }\n inputs.push(inputHydrated);\n }\n }\n if (defaults.nodes) {\n defaults.nodes = json.nodes.map((n2) => fromJSON$1(n2, inputs));\n }\n if (defaults.source) {\n let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);\n defaults.source = source;\n if (inputId != null) {\n defaults.source.input = inputs[inputId];\n }\n }\n if (defaults.type === "root") {\n return new Root$1(defaults);\n } else if (defaults.type === "decl") {\n return new Declaration$1(defaults);\n } else if (defaults.type === "rule") {\n return new Rule$1(defaults);\n } else if (defaults.type === "comment") {\n return new Comment$1(defaults);\n } else if (defaults.type === "atrule") {\n return new AtRule$1(defaults);\n } else {\n throw new Error("Unknown node type: " + json.type);\n }\n}\nvar fromJSON_1 = fromJSON$1;\nfromJSON$1.default = fromJSON$1;\nlet CssSyntaxError22 = cssSyntaxError;\nlet Declaration22 = declaration;\nlet LazyResult22 = lazyResult;\nlet Container22 = container;\nlet Processor22 = processor;\nlet stringify = stringify_1;\nlet fromJSON = fromJSON_1;\nlet Document222 = document$1;\nlet Warning22 = warning;\nlet Comment22 = comment;\nlet AtRule22 = atRule;\nlet Result22 = result;\nlet Input22 = input;\nlet parse = parse_1;\nlet list = list_1;\nlet Rule22 = rule;\nlet Root22 = root;\nlet Node$1 = node;\nfunction postcss(...plugins) {\n if (plugins.length === 1 && Array.isArray(plugins[0])) {\n plugins = plugins[0];\n }\n return new Processor22(plugins);\n}\npostcss.plugin = function plugin2(name, initializer) {\n let warningPrinted = false;\n function creator(...args) {\n if (console && console.warn && !warningPrinted) {\n warningPrinted = true;\n console.warn(\n name + ": postcss.plugin was deprecated. Migration guide:\\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"\n );\n if (process.env.LANG && process.env.LANG.startsWith("cn")) {\n console.warn(\n name + ": \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\\nhttps://www.w3ctech.com/topic/2226"\n );\n }\n }\n let transformer = initializer(...args);\n transformer.postcssPlugin = name;\n transformer.postcssVersion = new Processor22().version;\n return transformer;\n }\n let cache;\n Object.defineProperty(creator, "postcss", {\n get() {\n if (!cache) cache = creator();\n return cache;\n }\n });\n creator.process = function(css, processOpts, pluginOpts) {\n return postcss([creator(pluginOpts)]).process(css, processOpts);\n };\n return creator;\n};\npostcss.stringify = stringify;\npostcss.parse = parse;\npostcss.fromJSON = fromJSON;\npostcss.list = list;\npostcss.comment = (defaults) => new Comment22(defaults);\npostcss.atRule = (defaults) => new AtRule22(defaults);\npostcss.decl = (defaults) => new Declaration22(defaults);\npostcss.rule = (defaults) => new Rule22(defaults);\npostcss.root = (defaults) => new Root22(defaults);\npostcss.document = (defaults) => new Document222(defaults);\npostcss.CssSyntaxError = CssSyntaxError22;\npostcss.Declaration = Declaration22;\npostcss.Container = Container22;\npostcss.Processor = Processor22;\npostcss.Document = Document222;\npostcss.Comment = Comment22;\npostcss.Warning = Warning22;\npostcss.AtRule = AtRule22;\npostcss.Result = Result22;\npostcss.Input = Input22;\npostcss.Rule = Rule22;\npostcss.Root = Root22;\npostcss.Node = Node$1;\nLazyResult22.registerPostcss(postcss);\nvar postcss_1 = postcss;\npostcss.default = postcss;\nconst postcss$1 = /* @__PURE__ */ getDefaultExportFromCjs(postcss_1);\npostcss$1.stringify;\npostcss$1.fromJSON;\npostcss$1.plugin;\npostcss$1.parse;\npostcss$1.list;\npostcss$1.document;\npostcss$1.comment;\npostcss$1.atRule;\npostcss$1.rule;\npostcss$1.decl;\npostcss$1.root;\npostcss$1.CssSyntaxError;\npostcss$1.Declaration;\npostcss$1.Container;\npostcss$1.Processor;\npostcss$1.Document;\npostcss$1.Comment;\npostcss$1.Warning;\npostcss$1.AtRule;\npostcss$1.Result;\npostcss$1.Input;\npostcss$1.Rule;\npostcss$1.Root;\npostcss$1.Node;\nclass BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n constructor(..._args) {\n __publicField2(this, "parentElement", null);\n __publicField2(this, "parentNode", null);\n __publicField2(this, "ownerDocument");\n __publicField2(this, "firstChild", null);\n __publicField2(this, "lastChild", null);\n __publicField2(this, "previousSibling", null);\n __publicField2(this, "nextSibling", null);\n __publicField2(this, "ELEMENT_NODE", 1);\n __publicField2(this, "TEXT_NODE", 3);\n __publicField2(this, "nodeType");\n __publicField2(this, "nodeName");\n __publicField2(this, "RRNodeType");\n }\n get childNodes() {\n const childNodes2 = [];\n let childIterator = this.firstChild;\n while (childIterator) {\n childNodes2.push(childIterator);\n childIterator = childIterator.nextSibling;\n }\n return childNodes2;\n }\n contains(node2) {\n if (!(node2 instanceof BaseRRNode)) return false;\n else if (node2.ownerDocument !== this.ownerDocument) return false;\n else if (node2 === this) return true;\n while (node2.parentNode) {\n if (node2.parentNode === this) return true;\n node2 = node2.parentNode;\n }\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n appendChild(_newChild) {\n throw new Error(\n `RRDomException: Failed to execute \'appendChild\' on \'RRNode\': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n insertBefore(_newChild, _refChild) {\n throw new Error(\n `RRDomException: Failed to execute \'insertBefore\' on \'RRNode\': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n removeChild(_node) {\n throw new Error(\n `RRDomException: Failed to execute \'removeChild\' on \'RRNode\': This RRNode type does not support this method.`\n );\n }\n toString() {\n return "RRNode";\n }\n}\nconst testableAccessors = {\n Node: ["childNodes", "parentNode", "parentElement", "textContent"],\n ShadowRoot: ["host", "styleSheets"],\n Element: ["shadowRoot", "querySelector", "querySelectorAll"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: ["contains", "getRootNode"],\n ShadowRoot: ["getSelection"],\n Element: [],\n MutationObserver: ["constructor"]\n};\nconst untaintedBasePrototype = {};\nconst isAngularZonePresent = () => {\n return !!globalThis.Zone;\n};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a2, _b;\n return Boolean(\n (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes("[native code]")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a2;\n return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement("iframe");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch (e) {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a2;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a2.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== "function") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n2) {\n return getUntaintedAccessor("Node", n2, "childNodes");\n}\nfunction parentNode(n2) {\n return getUntaintedAccessor("Node", n2, "parentNode");\n}\nfunction parentElement(n2) {\n return getUntaintedAccessor("Node", n2, "parentElement");\n}\nfunction textContent(n2) {\n return getUntaintedAccessor("Node", n2, "textContent");\n}\nfunction contains(n2, other) {\n return getUntaintedMethod("Node", n2, "contains")(other);\n}\nfunction getRootNode(n2) {\n return getUntaintedMethod("Node", n2, "getRootNode")();\n}\nfunction host(n2) {\n if (!n2 || !("host" in n2)) return null;\n return getUntaintedAccessor("ShadowRoot", n2, "host");\n}\nfunction styleSheets(n2) {\n return n2.styleSheets;\n}\nfunction shadowRoot(n2) {\n if (!n2 || !("shadowRoot" in n2)) return null;\n return getUntaintedAccessor("Element", n2, "shadowRoot");\n}\nfunction querySelector(n2, selectors) {\n return getUntaintedAccessor("Element", n2, "querySelector")(selectors);\n}\nfunction querySelectorAll(n2, selectors) {\n return getUntaintedAccessor("Element", n2, "querySelectorAll")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype("MutationObserver").constructor;\n}\nfunction patch(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === "function") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch (e) {\n return () => {\n };\n }\n}\nfunction describeNode(el) {\n const tag = el.tagName.toLowerCase();\n const id = el.id ? `#${el.id}` : "";\n const classes = el.classList.length ? "." + Array.from(el.classList).join(".") : "";\n return `${tag}${id}${classes}`;\n}\nfunction getElementVisibility(el) {\n var _a3;\n var _a2, _b;\n const win = (_a3 = (_a2 = el.ownerDocument) == null ? void 0 : _a2.defaultView) != null ? _a3 : window;\n const rect = el.getBoundingClientRect();\n const viewportWidth = win.innerWidth || win.document.documentElement.clientWidth || 0;\n const viewportHeight = win.innerHeight || win.document.documentElement.clientHeight || 0;\n const isRectVisible = rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;\n const style = (_b = win.getComputedStyle) == null ? void 0 : _b.call(win, el);\n const isStyleVisible2 = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;\n const isVisible = isStyleVisible2 && isRectVisible;\n let ratio = 0;\n if (isVisible) {\n const xOverlap = Math.max(\n 0,\n Math.min(rect.right, viewportWidth) - Math.max(rect.left, 0)\n );\n const yOverlap = Math.max(\n 0,\n Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0)\n );\n const intersectionArea = xOverlap * yOverlap;\n const elementArea = rect.width * rect.height;\n ratio = elementArea > 0 ? intersectionArea / elementArea : 0;\n }\n return {\n isVisible,\n ratio\n };\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor,\n patch,\n describeNode,\n getElementVisibility\n};\nfunction on(type, fn, target = document) {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\nconst DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\\r\\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\\nor you can use record.mirror to access the mirror instance during recording.";\nlet _mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n};\nif (typeof window !== "undefined" && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === "map") {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n}\nfunction throttle(func, wait, options = {}) {\n let timeout = null;\n let previous = 0;\n return function(...args) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n const context = this;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\nfunction hookSetter(target, key, d, isRevoked, win = window) {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked ? d : {\n set(value) {\n setTimeout(() => {\n d.set.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n }\n }\n );\n return () => hookSetter(target, key, original || {}, true);\n}\nfunction nowTimestamp() {\n return Math.round(performance.timeOrigin + performance.now());\n}\nfunction getWindowScroll(win = window) {\n var _a2, _b, _c, _d;\n const doc = win.document;\n return {\n left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc.documentElement.scrollLeft || (doc == null ? void 0 : doc.body) && ((_a2 = index.parentElement(doc.body)) == null ? void 0 : _a2.scrollLeft) || ((_b = doc == null ? void 0 : doc.body) == null ? void 0 : _b.scrollLeft) || 0,\n top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : (doc == null ? void 0 : doc.documentElement.scrollTop) || (doc == null ? void 0 : doc.body) && ((_c = index.parentElement(doc.body)) == null ? void 0 : _c.scrollTop) || ((_d = doc == null ? void 0 : doc.body) == null ? void 0 : _d.scrollTop) || 0\n };\n}\nfunction getWindowHeight(win = window) {\n const doc = win.document;\n return win.innerHeight || doc.documentElement && doc.documentElement.clientHeight || doc.body && doc.body.clientHeight || 0;\n}\nfunction getWindowWidth(win = window) {\n const doc = win.document;\n return win.innerWidth || doc.documentElement && doc.documentElement.clientWidth || doc.body && doc.body.clientWidth || 0;\n}\nfunction closestElementOfNode(node2) {\n if (!node2) {\n return null;\n }\n const el = node2.nodeType === node2.ELEMENT_NODE ? node2 : index.parentElement(node2);\n return el;\n}\nfunction isBlocked(node2, blockClass, blockSelector, checkAncestors) {\n if (!node2) {\n return false;\n }\n const el = closestElementOfNode(node2);\n if (!el) {\n return false;\n }\n try {\n if (typeof blockClass === "string") {\n if (el.classList.contains(blockClass)) return true;\n if (checkAncestors && el.closest("." + blockClass) !== null) return true;\n } else {\n if (classMatchesRegex(el, blockClass, checkAncestors)) return true;\n }\n } catch (e2) {\n }\n if (blockSelector) {\n if (el.matches(blockSelector)) return true;\n if (checkAncestors && el.closest(blockSelector) !== null) return true;\n }\n return false;\n}\nfunction isSerialized(n2, mirror2) {\n return mirror2.getId(n2) !== -1;\n}\nfunction isIgnored(n2, mirror2, slimDOMOptions) {\n if (n2.tagName === "TITLE" && slimDOMOptions.headTitleMutations) {\n return true;\n }\n return mirror2.getId(n2) === IGNORED_NODE;\n}\nfunction isAncestorRemoved(target, mirror2) {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror2.getId(target);\n if (!mirror2.has(id)) {\n return true;\n }\n const parent = index.parentNode(target);\n if (parent && parent.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n if (!parent) {\n return true;\n }\n return isAncestorRemoved(parent, mirror2);\n}\nfunction legacy_isTouchEvent(event) {\n return Boolean(event.changedTouches);\n}\nfunction polyfill$1(win = window) {\n if ("NodeList" in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = Array.prototype.forEach;\n }\n if ("DOMTokenList" in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = Array.prototype.forEach;\n }\n}\nfunction isSerializedIframe(n2, mirror2) {\n return Boolean(n2.nodeName === "IFRAME" && mirror2.getMeta(n2));\n}\nfunction isSerializedStylesheet(n2, mirror2) {\n return Boolean(\n n2.nodeName === "LINK" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute("rel") === "stylesheet" && mirror2.getMeta(n2)\n );\n}\nfunction hasShadowRoot(n2) {\n if (!n2) return false;\n if (n2 instanceof BaseRRNode && "shadowRoot" in n2) {\n return Boolean(n2.shadowRoot);\n }\n return Boolean(index.shadowRoot(n2));\n}\nclass StyleSheetMirror {\n constructor() {\n __publicField(this, "id", 1);\n __publicField(this, "styleIDMap", /* @__PURE__ */ new WeakMap());\n __publicField(this, "idStyleMap", /* @__PURE__ */ new Map());\n }\n getId(stylesheet) {\n var _a2;\n return (_a2 = this.styleIDMap.get(stylesheet)) != null ? _a2 : -1;\n }\n has(stylesheet) {\n return this.styleIDMap.has(stylesheet);\n }\n /**\n * @returns If the stylesheet is in the mirror, returns the id of the stylesheet. If not, return the new assigned id.\n */\n add(stylesheet, id) {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId;\n if (id === void 0) {\n newId = this.id++;\n } else newId = id;\n this.styleIDMap.set(stylesheet, newId);\n this.idStyleMap.set(newId, stylesheet);\n return newId;\n }\n getStyle(id) {\n return this.idStyleMap.get(id) || null;\n }\n reset() {\n this.styleIDMap = /* @__PURE__ */ new WeakMap();\n this.idStyleMap = /* @__PURE__ */ new Map();\n this.id = 1;\n }\n generateId() {\n return this.id++;\n }\n}\nfunction getShadowHost(n2) {\n var _a2;\n let shadowHost = null;\n if ("getRootNode" in n2 && ((_a2 = index.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n2)))\n shadowHost = index.host(index.getRootNode(n2));\n return shadowHost;\n}\nfunction getRootShadowHost(n2) {\n let rootShadowHost = n2;\n let shadowHost;\n while (shadowHost = getShadowHost(rootShadowHost))\n rootShadowHost = shadowHost;\n return rootShadowHost;\n}\nfunction shadowHostInDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n2);\n return index.contains(doc, shadowHost);\n}\nfunction inDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n return index.contains(doc, n2) || shadowHostInDom(n2);\n}\nvar EventType = /* @__PURE__ */ ((EventType2) => {\n EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";\n EventType2[EventType2["Load"] = 1] = "Load";\n EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";\n EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";\n EventType2[EventType2["Meta"] = 4] = "Meta";\n EventType2[EventType2["Custom"] = 5] = "Custom";\n EventType2[EventType2["Plugin"] = 6] = "Plugin";\n return EventType2;\n})(EventType || {});\nvar IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {\n IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";\n IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";\n IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";\n IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";\n IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";\n IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";\n IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";\n IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";\n IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";\n IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";\n IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";\n IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";\n IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";\n IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";\n IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";\n IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";\n IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";\n IncrementalSource2[IncrementalSource2["VisibilityMutation"] = 17] = "VisibilityMutation";\n return IncrementalSource2;\n})(IncrementalSource || {});\nvar MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {\n MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";\n MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";\n MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";\n MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";\n MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";\n MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";\n MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";\n MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";\n MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";\n MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";\n MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";\n return MouseInteractions2;\n})(MouseInteractions || {});\nvar PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {\n PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse";\n PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen";\n PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";\n return PointerTypes2;\n})(PointerTypes || {});\nvar CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {\n CanvasContext2[CanvasContext2["2D"] = 0] = "2D";\n CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";\n CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";\n return CanvasContext2;\n})(CanvasContext || {});\nvar MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {\n MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";\n MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";\n MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";\n MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";\n MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";\n return MediaInteractions2;\n})(MediaInteractions || {});\nvar NodeType = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2["Document"] = 0] = "Document";\n NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";\n NodeType2[NodeType2["Element"] = 2] = "Element";\n NodeType2[NodeType2["Text"] = 3] = "Text";\n NodeType2[NodeType2["CDATA"] = 4] = "CDATA";\n NodeType2[NodeType2["Comment"] = 5] = "Comment";\n return NodeType2;\n})(NodeType || {});\nfunction isNodeInLinkedList(n2) {\n return "__ln" in n2;\n}\nclass DoubleLinkedList {\n constructor() {\n __publicField(this, "length", 0);\n __publicField(this, "head", null);\n __publicField(this, "tail", null);\n }\n get(position) {\n if (position >= this.length) {\n throw new Error("Position outside of list range");\n }\n let current = this.head;\n for (let index2 = 0; index2 < position; index2++) {\n current = (current == null ? void 0 : current.next) || null;\n }\n return current;\n }\n addNode(n2) {\n const node2 = {\n value: n2,\n previous: null,\n next: null\n };\n n2.__ln = node2;\n if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {\n const current = n2.previousSibling.__ln.next;\n node2.next = current;\n node2.previous = n2.previousSibling.__ln;\n n2.previousSibling.__ln.next = node2;\n if (current) {\n current.previous = node2;\n }\n } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {\n const current = n2.nextSibling.__ln.previous;\n node2.previous = current;\n node2.next = n2.nextSibling.__ln;\n n2.nextSibling.__ln.previous = node2;\n if (current) {\n current.next = node2;\n }\n } else {\n if (this.head) {\n this.head.previous = node2;\n }\n node2.next = this.head;\n this.head = node2;\n }\n if (node2.next === null) {\n this.tail = node2;\n }\n this.length++;\n }\n removeNode(n2) {\n const current = n2.__ln;\n if (!this.head) {\n return;\n }\n if (!current.previous) {\n this.head = current.next;\n if (this.head) {\n this.head.previous = null;\n } else {\n this.tail = null;\n }\n } else {\n current.previous.next = current.next;\n if (current.next) {\n current.next.previous = current.previous;\n } else {\n this.tail = current.previous;\n }\n }\n if (n2.__ln) {\n delete n2.__ln;\n }\n this.length--;\n }\n}\nconst moveKey = (id, parentId) => `${id}@${parentId}`;\nclass MutationBuffer {\n constructor() {\n __publicField(this, "frozen", false);\n __publicField(this, "locked", false);\n __publicField(this, "texts", []);\n __publicField(this, "attributes", []);\n __publicField(this, "attributeMap", /* @__PURE__ */ new WeakMap());\n __publicField(this, "removes", []);\n __publicField(this, "mapRemoves", []);\n __publicField(this, "movedMap", {});\n __publicField(this, "addedSet", /* @__PURE__ */ new Set());\n __publicField(this, "movedSet", /* @__PURE__ */ new Set());\n __publicField(this, "droppedSet", /* @__PURE__ */ new Set());\n __publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());\n __publicField(this, "mutationCb");\n __publicField(this, "blockClass");\n __publicField(this, "blockSelector");\n __publicField(this, "maskTextClass");\n __publicField(this, "maskTextSelector");\n __publicField(this, "excludeAttribute");\n __publicField(this, "inlineStylesheet");\n __publicField(this, "maskInputOptions");\n __publicField(this, "maskTextFn");\n __publicField(this, "maskInputFn");\n __publicField(this, "keepIframeSrcFn");\n __publicField(this, "recordCanvas");\n __publicField(this, "inlineImages");\n __publicField(this, "slimDOMOptions");\n __publicField(this, "dataURLOptions");\n __publicField(this, "doc");\n __publicField(this, "mirror");\n __publicField(this, "iframeManager");\n __publicField(this, "stylesheetManager");\n __publicField(this, "shadowDomManager");\n __publicField(this, "canvasManager");\n __publicField(this, "visibilityManager");\n __publicField(this, "processedNodeManager");\n __publicField(this, "unattachedDoc");\n __publicField(this, "processMutations", (mutations) => {\n mutations.forEach(this.processMutation);\n this.emit();\n });\n __publicField(this, "emit", () => {\n if (this.frozen || this.locked) {\n return;\n }\n const adds = [];\n const addedIds = /* @__PURE__ */ new Set();\n const addList = new DoubleLinkedList();\n const getNextId = (n2) => {\n let ns = n2;\n let nextId = IGNORED_NODE;\n while (nextId === IGNORED_NODE) {\n ns = ns && ns.nextSibling;\n nextId = ns && this.mirror.getId(ns);\n }\n return nextId;\n };\n const pushAdd = (n2) => {\n const parent = index.parentNode(n2);\n if (!parent || !inDom(n2)) {\n return;\n }\n let cssCaptured = false;\n if (n2.nodeType === Node.TEXT_NODE) {\n const parentTag = parent.tagName;\n if (parentTag === "TEXTAREA") {\n return;\n } else if (parentTag === "STYLE" && this.addedSet.has(parent)) {\n cssCaptured = true;\n }\n }\n const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);\n const nextId = getNextId(n2);\n if (parentId === -1 || nextId === -1) {\n return addList.addNode(n2);\n }\n const sn = serializeNodeWithId(n2, {\n doc: this.doc,\n mirror: this.mirror,\n blockClass: this.blockClass,\n blockSelector: this.blockSelector,\n maskTextClass: this.maskTextClass,\n maskTextSelector: this.maskTextSelector,\n excludeAttribute: this.excludeAttribute,\n skipChild: true,\n newlyAddedElement: true,\n inlineStylesheet: this.inlineStylesheet,\n maskInputOptions: this.maskInputOptions,\n maskTextFn: this.maskTextFn,\n maskInputFn: this.maskInputFn,\n slimDOMOptions: this.slimDOMOptions,\n dataURLOptions: this.dataURLOptions,\n recordCanvas: this.recordCanvas,\n inlineImages: this.inlineImages,\n onSerialize: (currentN) => {\n if (isSerializedIframe(currentN, this.mirror)) {\n this.iframeManager.addIframe(currentN);\n }\n if (isSerializedStylesheet(currentN, this.mirror)) {\n this.stylesheetManager.trackLinkElement(\n currentN\n );\n }\n if (hasShadowRoot(n2)) {\n this.shadowDomManager.addShadowRoot(index.shadowRoot(n2), this.doc);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n this.iframeManager.attachIframe(iframe, childSn);\n this.shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (link, childSn) => {\n this.stylesheetManager.attachLinkElement(link, childSn);\n },\n cssCaptured\n });\n if (sn) {\n adds.push({\n parentId,\n nextId,\n node: sn\n });\n addedIds.add(sn.id);\n }\n };\n while (this.mapRemoves.length) {\n this.mirror.removeNodeFromMap(this.mapRemoves.shift());\n }\n for (const n2 of this.movedSet) {\n if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n !this.movedSet.has(index.parentNode(n2))) {\n continue;\n }\n pushAdd(n2);\n }\n for (const n2 of this.addedSet) {\n if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {\n pushAdd(n2);\n } else if (isAncestorInSet(this.movedSet, n2)) {\n pushAdd(n2);\n } else {\n this.droppedSet.add(n2);\n }\n }\n let candidate = null;\n while (addList.length) {\n let node2 = null;\n if (candidate) {\n const parentId = this.mirror.getId(index.parentNode(candidate.value));\n const nextId = getNextId(candidate.value);\n if (parentId !== -1 && nextId !== -1) {\n node2 = candidate;\n }\n }\n if (!node2) {\n let tailNode = addList.tail;\n while (tailNode) {\n const _node = tailNode;\n tailNode = tailNode.previous;\n if (_node) {\n const parentId = this.mirror.getId(index.parentNode(_node.value));\n const nextId = getNextId(_node.value);\n if (nextId === -1) continue;\n else if (parentId !== -1) {\n node2 = _node;\n break;\n } else {\n const unhandledNode = _node.value;\n const parent = index.parentNode(unhandledNode);\n if (parent && parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowHost = index.host(parent);\n const parentId2 = this.mirror.getId(shadowHost);\n if (parentId2 !== -1) {\n node2 = _node;\n break;\n }\n }\n }\n }\n }\n }\n if (!node2) {\n while (addList.head) {\n addList.removeNode(addList.head.value);\n }\n break;\n }\n candidate = node2.previous;\n addList.removeNode(node2.value);\n pushAdd(node2.value);\n }\n const payload = {\n texts: this.texts.map((text) => {\n const n2 = text.node;\n const parent = index.parentNode(n2);\n if (parent && parent.tagName === "TEXTAREA") {\n this.genTextAreaValueMutation(parent);\n }\n return {\n id: this.mirror.getId(n2),\n value: text.value\n };\n }).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),\n attributes: this.attributes.map((attribute) => {\n const { attributes } = attribute;\n if (typeof attributes.style === "string") {\n const diffAsStr = JSON.stringify(attribute.styleDiff);\n const unchangedAsStr = JSON.stringify(attribute._unchangedStyles);\n if (diffAsStr.length < attributes.style.length) {\n if ((diffAsStr + unchangedAsStr).split("var(").length === attributes.style.split("var(").length) {\n attributes.style = attribute.styleDiff;\n }\n }\n }\n return {\n id: this.mirror.getId(attribute.node),\n attributes\n };\n }).filter((attribute) => !addedIds.has(attribute.id)).filter((attribute) => this.mirror.has(attribute.id)),\n removes: this.removes,\n adds\n };\n if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {\n return;\n }\n this.texts = [];\n this.attributes = [];\n this.attributeMap = /* @__PURE__ */ new WeakMap();\n this.removes = [];\n this.addedSet = /* @__PURE__ */ new Set();\n this.movedSet = /* @__PURE__ */ new Set();\n this.droppedSet = /* @__PURE__ */ new Set();\n this.removesSubTreeCache = /* @__PURE__ */ new Set();\n this.movedMap = {};\n this.mutationCb(payload);\n });\n __publicField(this, "genTextAreaValueMutation", (textarea) => {\n let item = this.attributeMap.get(textarea);\n if (!item) {\n item = {\n node: textarea,\n attributes: {},\n styleDiff: {},\n _unchangedStyles: {}\n };\n this.attributes.push(item);\n this.attributeMap.set(textarea, item);\n }\n const value = Array.from(\n index.childNodes(textarea),\n (cn) => index.textContent(cn) || ""\n ).join("");\n item.attributes.value = maskInputValue({\n element: textarea,\n maskInputOptions: this.maskInputOptions,\n tagName: textarea.tagName,\n type: getInputType(textarea),\n value,\n maskInputFn: this.maskInputFn\n });\n });\n __publicField(this, "processMutation", (m) => {\n if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {\n return;\n }\n switch (m.type) {\n case "characterData": {\n const value = index.textContent(m.target);\n if (!isBlocked(m.target, this.blockClass, this.blockSelector, false) && value !== m.oldValue) {\n this.texts.push({\n value: needMaskingText(\n m.target,\n this.maskTextClass,\n this.maskTextSelector,\n true\n // checkAncestors\n ) && value ? this.maskTextFn ? this.maskTextFn(value, closestElementOfNode(m.target)) : value.replace(/[\\S]/g, "*") : value,\n node: m.target\n });\n }\n break;\n }\n case "attributes": {\n const target = m.target;\n let attributeName = m.attributeName;\n let value = m.target.getAttribute(attributeName);\n const attrKey = attributeName;\n const propValue = target[attrKey];\n const isBooleanAttr = typeof propValue === "boolean";\n const inDOM = document.contains(target);\n const isVisible = isElementVisible(target);\n const isExcludeAttributeName = isExcludeAttribute(attributeName, this.excludeAttribute);\n const isPhantomAttributeMutation = value === null && // текущего атрибута нет\n !target.hasAttribute(attributeName) && // явно подтверждаем отсутствие\n m.oldValue !== null && // раньше он был\n (propValue === "" || // свойство = пустая строка\n propValue === null || // или null\n typeof propValue === "undefined");\n if (isPhantomAttributeMutation) {\n console.debug(\n `[${nowTimestamp()}] [rrweb:record/mutation] \\u26D4 phantom attribute mutation ignored`,\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call\n node: index.describeNode(target),\n tag: target.tagName,\n nodeType: target.nodeType,\n attribute: attributeName,\n value,\n oldValue: m.oldValue,\n excludeAttribute: this.excludeAttribute,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n propValue,\n isBooleanAttr,\n inDOM,\n isVisible,\n isExcludeAttributeName\n }\n );\n return;\n }\n if (isExcludeAttribute(attributeName, this.excludeAttribute)) {\n console.debug(\n `[${nowTimestamp()}] [rrweb:record/mutation] \\u26D4 excluded attribute mutation ignored`,\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call\n node: index.describeNode(target),\n tag: target.tagName,\n nodeType: target.nodeType,\n attribute: attributeName,\n value,\n oldValue: m.oldValue,\n excludeAttribute: this.excludeAttribute,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n propValue,\n isBooleanAttr,\n inDOM,\n isVisible,\n isExcludeAttributeName\n }\n );\n return;\n }\n if (attributeName === "value") {\n const type = getInputType(target);\n value = maskInputValue({\n element: target,\n maskInputOptions: this.maskInputOptions,\n tagName: target.tagName,\n type,\n value,\n maskInputFn: this.maskInputFn\n });\n }\n if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || value === m.oldValue) {\n return;\n }\n let item = this.attributeMap.get(m.target);\n if (target.tagName === "IFRAME" && attributeName === "src" && !this.keepIframeSrcFn(value)) {\n if (!target.contentDocument) {\n attributeName = "rr_src";\n } else {\n return;\n }\n }\n if (!item) {\n item = {\n node: m.target,\n attributes: {},\n styleDiff: {},\n _unchangedStyles: {}\n };\n this.attributes.push(item);\n this.attributeMap.set(m.target, item);\n }\n if (attributeName === "type" && target.tagName === "INPUT" && (m.oldValue || "").toLowerCase() === "password") {\n target.setAttribute("data-rr-is-password", "true");\n }\n if (!ignoreAttribute(target.tagName, attributeName)) {\n item.attributes[attributeName] = transformAttribute(\n this.doc,\n toLowerCase(target.tagName),\n toLowerCase(attributeName),\n value\n );\n const isSuspiciousClassMutation = attributeName !== "class" && (m.oldValue === null || // ранее не было класса\n value === "" || // класс удалён\n value !== m.oldValue);\n if (isSuspiciousClassMutation) {\n console.debug(\n `[${nowTimestamp()}] [rrweb:record/mutation] \\u26A0\\uFE0F suspicious attribute mutation`,\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call\n reason: [\n value === m.oldValue ? "no change in value" : null,\n value === propValue ? "mirrored in DOM property" : null,\n value === item.attributes[attributeName] ? "redundant assignment" : null\n ].filter(Boolean).join(", ") || "uncategorized",\n node: index.describeNode(target),\n tag: target.tagName,\n nodeType: target.nodeType,\n attribute: attributeName,\n value,\n oldValue: m.oldValue,\n transformedValue: item.attributes[attributeName],\n excludeAttribute: this.excludeAttribute,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n propValue,\n isBooleanAttr,\n inDOM,\n isVisible,\n isExcludeAttributeName\n }\n );\n }\n if (attributeName === "style") {\n if (!this.unattachedDoc) {\n try {\n this.unattachedDoc = document.implementation.createHTMLDocument();\n } catch (e2) {\n this.unattachedDoc = this.doc;\n }\n }\n const old = this.unattachedDoc.createElement("span");\n if (m.oldValue) {\n old.setAttribute("style", m.oldValue);\n }\n for (const pname of Array.from(target.style)) {\n const newValue = target.style.getPropertyValue(pname);\n const newPriority = target.style.getPropertyPriority(pname);\n if (newValue !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) {\n if (newPriority === "") {\n item.styleDiff[pname] = newValue;\n } else {\n item.styleDiff[pname] = [newValue, newPriority];\n }\n } else {\n item._unchangedStyles[pname] = [newValue, newPriority];\n }\n }\n for (const pname of Array.from(old.style)) {\n if (target.style.getPropertyValue(pname) === "") {\n item.styleDiff[pname] = false;\n }\n }\n } else if (attributeName === "open" && target.tagName === "DIALOG") {\n if (target.matches("dialog:modal")) {\n item.attributes["rr_open_mode"] = "modal";\n } else {\n item.attributes["rr_open_mode"] = "non-modal";\n }\n }\n }\n break;\n }\n case "childList": {\n if (isBlocked(m.target, this.blockClass, this.blockSelector, true))\n return;\n if (m.target.tagName === "TEXTAREA") {\n this.genTextAreaValueMutation(m.target);\n return;\n }\n m.addedNodes.forEach((n2) => this.genAdds(n2, m.target));\n m.removedNodes.forEach((n2) => {\n const nodeId = this.mirror.getId(n2);\n const parentId = isShadowRoot(m.target) ? this.mirror.getId(index.host(m.target)) : this.mirror.getId(m.target);\n if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || isIgnored(n2, this.mirror, this.slimDOMOptions) || !isSerialized(n2, this.mirror)) {\n return;\n }\n if (this.addedSet.has(n2)) {\n deepDelete(this.addedSet, n2);\n this.droppedSet.add(n2);\n } else if (this.addedSet.has(m.target) && nodeId === -1) ;\n else if (isAncestorRemoved(m.target, this.mirror)) ;\n else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) {\n deepDelete(this.movedSet, n2);\n } else {\n this.removes.push({\n parentId,\n id: nodeId,\n isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0\n });\n processRemoves(n2, this.removesSubTreeCache);\n }\n this.mapRemoves.push(n2);\n });\n break;\n }\n }\n });\n __publicField(this, "genAdds", (n2, target) => {\n if (this.processedNodeManager.inOtherBuffer(n2, this)) return;\n if (this.addedSet.has(n2) || this.movedSet.has(n2)) return;\n if (this.mirror.hasNode(n2)) {\n if (isIgnored(n2, this.mirror, this.slimDOMOptions)) {\n return;\n }\n this.movedSet.add(n2);\n let targetId = null;\n if (target && this.mirror.hasNode(target)) {\n targetId = this.mirror.getId(target);\n }\n if (targetId && targetId !== -1) {\n this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true;\n }\n } else {\n this.addedSet.add(n2);\n this.droppedSet.delete(n2);\n }\n if (!isBlocked(n2, this.blockClass, this.blockSelector, false)) {\n index.childNodes(n2).forEach((childN) => this.genAdds(childN));\n if (hasShadowRoot(n2)) {\n index.childNodes(index.shadowRoot(n2)).forEach((childN) => {\n this.processedNodeManager.add(childN, this);\n this.genAdds(childN, n2);\n });\n }\n }\n });\n }\n init(options) {\n [\n "mutationCb",\n "blockClass",\n "blockSelector",\n "maskTextClass",\n "maskTextSelector",\n "excludeAttribute",\n "inlineStylesheet",\n "maskInputOptions",\n "maskTextFn",\n "maskInputFn",\n "keepIframeSrcFn",\n "recordCanvas",\n "inlineImages",\n "slimDOMOptions",\n "dataURLOptions",\n "doc",\n "mirror",\n "iframeManager",\n "stylesheetManager",\n "shadowDomManager",\n "canvasManager",\n "visibilityManager",\n "processedNodeManager"\n ].forEach((key) => {\n this[key] = options[key];\n });\n }\n freeze() {\n this.frozen = true;\n this.canvasManager.freeze();\n this.visibilityManager.freeze();\n }\n unfreeze() {\n this.frozen = false;\n this.canvasManager.unfreeze();\n this.visibilityManager.unfreeze();\n this.emit();\n }\n isFrozen() {\n return this.frozen;\n }\n lock() {\n this.locked = true;\n this.canvasManager.lock();\n this.visibilityManager.lock();\n }\n unlock() {\n this.locked = false;\n this.canvasManager.unlock();\n this.visibilityManager.unlock();\n this.emit();\n }\n reset() {\n this.shadowDomManager.reset();\n this.canvasManager.reset();\n this.visibilityManager.reset();\n }\n}\nfunction deepDelete(addsSet, n2) {\n addsSet.delete(n2);\n index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));\n}\nfunction processRemoves(n2, cache) {\n const queue = [n2];\n while (queue.length) {\n const next = queue.pop();\n if (cache.has(next)) continue;\n cache.add(next);\n index.childNodes(next).forEach((n22) => queue.push(n22));\n }\n return;\n}\nfunction isParentRemoved(removes, n2, mirror2) {\n if (removes.size === 0) return false;\n return _isParentRemoved(removes, n2);\n}\nfunction _isParentRemoved(removes, n2, _mirror2) {\n const node2 = index.parentNode(n2);\n if (!node2) return false;\n return removes.has(node2);\n}\nfunction isAncestorInSet(set, n2) {\n if (set.size === 0) return false;\n return _isAncestorInSet(set, n2);\n}\nfunction _isAncestorInSet(set, n2) {\n const parent = index.parentNode(n2);\n if (!parent) {\n return false;\n }\n if (set.has(parent)) {\n return true;\n }\n return _isAncestorInSet(set, parent);\n}\nlet errorHandler;\nfunction registerErrorHandler(handler) {\n errorHandler = handler;\n}\nfunction unregisterErrorHandler() {\n errorHandler = void 0;\n}\nconst callbackWrapper = (cb) => {\n if (!errorHandler) {\n return cb;\n }\n const rrwebWrapped = (...rest) => {\n try {\n return cb(...rest);\n } catch (error) {\n if (errorHandler && errorHandler(error) === true) {\n return;\n }\n throw error;\n }\n };\n return rrwebWrapped;\n};\nconst mutationBuffers = [];\nfunction getEventTarget(event) {\n try {\n if ("composedPath" in event) {\n const path = event.composedPath();\n if (path.length) {\n return path[0];\n }\n } else if ("path" in event && event.path.length) {\n return event.path[0];\n }\n } catch (e) {\n }\n return event && event.target;\n}\nfunction initMutationObserver(options, rootEl) {\n const mutationBuffer = new MutationBuffer();\n mutationBuffers.push(mutationBuffer);\n mutationBuffer.init(options);\n const observer = new (mutationObserverCtor())(\n callbackWrapper(mutationBuffer.processMutations.bind(mutationBuffer))\n );\n observer.observe(rootEl, {\n attributes: true,\n attributeOldValue: true,\n characterData: true,\n characterDataOldValue: true,\n childList: true,\n subtree: true\n });\n return observer;\n}\nfunction initMoveObserver({\n mousemoveCb,\n sampling,\n doc,\n mirror: mirror2\n}) {\n if (sampling.mousemove === false) {\n return () => {\n };\n }\n const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50;\n const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500;\n let positions = [];\n let timeBaseline;\n const wrappedCb = throttle(\n callbackWrapper(\n (source) => {\n const totalOffset = Date.now() - timeBaseline;\n mousemoveCb(\n positions.map((p) => {\n p.timeOffset -= totalOffset;\n return p;\n }),\n source\n );\n positions = [];\n timeBaseline = null;\n }\n ),\n callbackThreshold\n );\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt;\n if (!timeBaseline) {\n timeBaseline = nowTimestamp();\n }\n positions.push({\n x: clientX,\n y: clientY,\n id: mirror2.getId(target),\n timeOffset: nowTimestamp() - timeBaseline\n });\n wrappedCb(\n typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove\n );\n }),\n threshold,\n {\n trailing: false\n }\n )\n );\n const handlers = [\n on("mousemove", updatePosition, doc),\n on("touchmove", updatePosition, doc),\n on("drag", updatePosition, doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initMouseInteractionObserver({\n mouseInteractionCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n sampling\n}) {\n if (sampling.mouseInteraction === false) {\n return () => {\n console.debug("MouseInteractionObserver: No operation needed");\n };\n }\n const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;\n const handlers = [];\n let currentPointerType = null;\n const getHandler = (eventKey) => {\n return (event) => {\n const target = getEventTarget(event);\n if (isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n let pointerType = null;\n let thisEventKey = eventKey;\n if ("pointerType" in event) {\n switch (event.pointerType) {\n case "mouse":\n pointerType = PointerTypes.Mouse;\n break;\n case "touch":\n pointerType = PointerTypes.Touch;\n break;\n case "pen":\n pointerType = PointerTypes.Pen;\n break;\n }\n if (pointerType === PointerTypes.Touch) {\n if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) {\n thisEventKey = "TouchStart";\n } else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) {\n thisEventKey = "TouchEnd";\n }\n } else if (pointerType === PointerTypes.Pen) ;\n } else if (legacy_isTouchEvent(event)) {\n pointerType = PointerTypes.Touch;\n }\n if (pointerType !== null) {\n currentPointerType = pointerType;\n if (thisEventKey.startsWith("Touch") && pointerType === PointerTypes.Touch || thisEventKey.startsWith("Mouse") && pointerType === PointerTypes.Mouse) {\n pointerType = null;\n }\n } else if (MouseInteractions[eventKey] === MouseInteractions.Click) {\n pointerType = currentPointerType;\n currentPointerType = null;\n }\n const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;\n if (!e2) {\n return;\n }\n const id = mirror2.getId(target);\n const { clientX, clientY } = e2;\n callbackWrapper(mouseInteractionCb)(__spreadValues({\n type: MouseInteractions[thisEventKey],\n id,\n x: clientX,\n y: clientY\n }, pointerType !== null && { pointerType }));\n };\n };\n Object.keys(MouseInteractions).filter(\n (key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false\n ).forEach((eventKey) => {\n let eventName = toLowerCase(eventKey);\n const handler = getHandler(eventKey);\n if (window.PointerEvent) {\n switch (MouseInteractions[eventKey]) {\n case MouseInteractions.MouseDown:\n case MouseInteractions.MouseUp:\n eventName = eventName.replace(\n "mouse",\n "pointer"\n );\n break;\n case MouseInteractions.TouchStart:\n case MouseInteractions.TouchEnd:\n return;\n }\n }\n handlers.push(on(eventName, handler, doc));\n });\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initScrollObserver({\n scrollCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n sampling\n}) {\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n if (!target || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n const id = mirror2.getId(target);\n if (target === doc && doc.defaultView) {\n const scrollLeftTop = getWindowScroll(doc.defaultView);\n scrollCb({\n id,\n x: scrollLeftTop.left,\n y: scrollLeftTop.top\n });\n } else {\n scrollCb({\n id,\n x: target.scrollLeft,\n y: target.scrollTop\n });\n }\n }),\n sampling.scroll || 100\n )\n );\n return on("scroll", updatePosition, doc);\n}\nfunction initViewportResizeObserver({ viewportResizeCb }, { win }) {\n let lastH = -1;\n let lastW = -1;\n const updateDimension = callbackWrapper(\n throttle(\n callbackWrapper(() => {\n const height = getWindowHeight();\n const width = getWindowWidth();\n if (lastH !== height || lastW !== width) {\n viewportResizeCb({\n width: Number(width),\n height: Number(height)\n });\n lastH = height;\n lastW = width;\n }\n }),\n 200\n )\n );\n return on("resize", updateDimension, win);\n}\nconst INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];\nconst lastInputValueMap = /* @__PURE__ */ new WeakMap();\nfunction initInputObserver({\n inputCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n ignoreClass,\n ignoreSelector,\n maskInputOptions,\n maskInputFn,\n sampling,\n userTriggeredOnInput\n}) {\n function eventHandler(event) {\n let target = getEventTarget(event);\n const userTriggered = event.isTrusted;\n const tagName = target && target.tagName;\n if (target && tagName === "OPTION") {\n target = index.parentElement(target);\n }\n if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n if (target.classList.contains(ignoreClass) || ignoreSelector && target.matches(ignoreSelector)) {\n return;\n }\n let text = target.value;\n let isChecked = false;\n const type = getInputType(target) || "";\n if (type === "radio" || type === "checkbox") {\n isChecked = target.checked;\n } else if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {\n text = maskInputValue({\n element: target,\n maskInputOptions,\n tagName,\n type,\n value: text,\n maskInputFn\n });\n }\n cbWithDedup(\n target,\n userTriggeredOnInput ? { text, isChecked, userTriggered } : { text, isChecked }\n );\n const name = target.name;\n if (type === "radio" && name && isChecked) {\n doc.querySelectorAll(`input[type="radio"][name="${name}"]`).forEach((el) => {\n if (el !== target) {\n const text2 = el.value;\n cbWithDedup(\n el,\n userTriggeredOnInput ? { text: text2, isChecked: !isChecked, userTriggered: false } : { text: text2, isChecked: !isChecked }\n );\n }\n });\n }\n }\n function cbWithDedup(target, v2) {\n const lastInputValue = lastInputValueMap.get(target);\n const el = target;\n const hasPlaceholder = el.hasAttribute("placeholder");\n const isEmpty = el.value === "";\n const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;\n const isNonUser = !v2.userTriggered;\n const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";\n const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);\n const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");\n const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);\n const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;\n const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;\n if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {\n return;\n }\n if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {\n lastInputValueMap.set(target, v2);\n const id = mirror2.getId(target);\n callbackWrapper(inputCb)(__spreadProps(__spreadValues({}, v2), {\n id\n }));\n }\n }\n const events = sampling.input === "last" ? ["change"] : ["input", "change"];\n const handlers = events.map(\n (eventName) => on(eventName, callbackWrapper(eventHandler), doc)\n );\n const currentWindow = doc.defaultView;\n if (!currentWindow) {\n return () => {\n handlers.forEach((h) => h());\n };\n }\n const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(\n currentWindow.HTMLInputElement.prototype,\n "value"\n );\n const hookProperties = [\n [currentWindow.HTMLInputElement.prototype, "value"],\n [currentWindow.HTMLInputElement.prototype, "checked"],\n [currentWindow.HTMLSelectElement.prototype, "value"],\n [currentWindow.HTMLTextAreaElement.prototype, "value"],\n // Some UI library use selectedIndex to set select value\n [currentWindow.HTMLSelectElement.prototype, "selectedIndex"],\n [currentWindow.HTMLOptionElement.prototype, "selected"]\n ];\n if (propertyDescriptor && propertyDescriptor.set) {\n handlers.push(\n ...hookProperties.map(\n (p) => hookSetter(\n p[0],\n p[1],\n {\n set() {\n callbackWrapper(eventHandler)({\n target: this,\n isTrusted: false\n // userTriggered to false as this could well be programmatic\n });\n }\n },\n false,\n currentWindow\n )\n )\n );\n }\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction getNestedCSSRulePositions(rule2) {\n const positions = [];\n function recurse(childRule, pos) {\n if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) {\n const rules2 = Array.from(\n childRule.parentRule.cssRules\n );\n const index2 = rules2.indexOf(childRule);\n pos.unshift(index2);\n } else if (childRule.parentStyleSheet) {\n const rules2 = Array.from(childRule.parentStyleSheet.cssRules);\n const index2 = rules2.indexOf(childRule);\n pos.unshift(index2);\n }\n return pos;\n }\n return recurse(rule2, positions);\n}\nfunction getIdAndStyleId(sheet, mirror2, styleMirror) {\n let id, styleId;\n if (!sheet) return {};\n if (sheet.ownerNode) id = mirror2.getId(sheet.ownerNode);\n else styleId = styleMirror.getId(sheet);\n return {\n styleId,\n id\n };\n}\nfunction initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) {\n if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {\n return () => {\n };\n }\n const insertRule = win.CSSStyleSheet.prototype.insertRule;\n win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule2, index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [{ rule: rule2, index: index2 }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n win.CSSStyleSheet.prototype.addRule = function(selector, styleBlock, index2 = this.cssRules.length) {\n const rule2 = `${selector} { ${styleBlock} }`;\n return win.CSSStyleSheet.prototype.insertRule.apply(this, [rule2, index2]);\n };\n const deleteRule = win.CSSStyleSheet.prototype.deleteRule;\n win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [{ index: index2 }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n win.CSSStyleSheet.prototype.removeRule = function(index2) {\n return win.CSSStyleSheet.prototype.deleteRule.apply(this, [index2]);\n };\n let replace;\n if (win.CSSStyleSheet.prototype.replace) {\n replace = win.CSSStyleSheet.prototype.replace;\n win.CSSStyleSheet.prototype.replace = new Proxy(replace, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replace: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n let replaceSync;\n if (win.CSSStyleSheet.prototype.replaceSync) {\n replaceSync = win.CSSStyleSheet.prototype.replaceSync;\n win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replaceSync: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n const supportedNestedCSSRuleTypes = {};\n if (canMonkeyPatchNestedCSSRule("CSSGroupingRule")) {\n supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;\n } else {\n if (canMonkeyPatchNestedCSSRule("CSSMediaRule")) {\n supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;\n }\n if (canMonkeyPatchNestedCSSRule("CSSConditionRule")) {\n supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;\n }\n if (canMonkeyPatchNestedCSSRule("CSSSupportsRule")) {\n supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;\n }\n }\n const unmodifiedFunctions = {};\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n unmodifiedFunctions[typeKey] = {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n insertRule: type.prototype.insertRule,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n deleteRule: type.prototype.deleteRule\n };\n type.prototype.insertRule = new Proxy(\n unmodifiedFunctions[typeKey].insertRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule2, index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [\n {\n rule: rule2,\n index: [\n ...getNestedCSSRulePositions(thisArg),\n index2 || 0\n // defaults to 0\n ]\n }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n type.prototype.deleteRule = new Proxy(\n unmodifiedFunctions[typeKey].deleteRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index2] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [\n { index: [...getNestedCSSRulePositions(thisArg), index2] }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n });\n return callbackWrapper(() => {\n win.CSSStyleSheet.prototype.insertRule = insertRule;\n win.CSSStyleSheet.prototype.deleteRule = deleteRule;\n replace && (win.CSSStyleSheet.prototype.replace = replace);\n replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;\n type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;\n });\n });\n}\nfunction initAdoptedStyleSheetObserver({\n mirror: mirror2,\n stylesheetManager\n}, host2) {\n var _a2, _b, _c;\n let hostId = null;\n if (host2.nodeName === "#document") hostId = mirror2.getId(host2);\n else hostId = mirror2.getId(index.host(host2));\n const patchTarget = host2.nodeName === "#document" ? (_a2 = host2.defaultView) == null ? void 0 : _a2.Document : (_c = (_b = host2.ownerDocument) == null ? void 0 : _b.defaultView) == null ? void 0 : _c.ShadowRoot;\n const originalPropertyDescriptor = (patchTarget == null ? void 0 : patchTarget.prototype) ? Object.getOwnPropertyDescriptor(\n patchTarget == null ? void 0 : patchTarget.prototype,\n "adoptedStyleSheets"\n ) : void 0;\n if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor)\n return () => {\n };\n Object.defineProperty(host2, "adoptedStyleSheets", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n get() {\n var _a3;\n return (_a3 = originalPropertyDescriptor.get) == null ? void 0 : _a3.call(this);\n },\n set(sheets) {\n var _a3;\n const result2 = (_a3 = originalPropertyDescriptor.set) == null ? void 0 : _a3.call(this, sheets);\n if (hostId !== null && hostId !== -1) {\n try {\n stylesheetManager.adoptStyleSheets(sheets, hostId);\n } catch (e2) {\n }\n }\n return result2;\n }\n });\n return callbackWrapper(() => {\n Object.defineProperty(host2, "adoptedStyleSheets", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n get: originalPropertyDescriptor.get,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n set: originalPropertyDescriptor.set\n });\n });\n}\nfunction initStyleDeclarationObserver({\n styleDeclarationCb,\n mirror: mirror2,\n ignoreCSSAttributes,\n stylesheetManager\n}, { win }) {\n const setProperty = win.CSSStyleDeclaration.prototype.setProperty;\n win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n var _a2;\n const [property, value, priority] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return setProperty.apply(thisArg, [property, value, priority]);\n }\n const { id, styleId } = getIdAndStyleId(\n (_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n set: {\n property,\n value,\n priority\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n var _a2;\n const [property] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return removeProperty.apply(thisArg, [property]);\n }\n const { id, styleId } = getIdAndStyleId(\n (_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n remove: {\n property\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n return callbackWrapper(() => {\n win.CSSStyleDeclaration.prototype.setProperty = setProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;\n });\n}\nfunction initMediaInteractionObserver({\n mediaInteractionCb,\n blockClass,\n blockSelector,\n mirror: mirror2,\n sampling,\n doc\n}) {\n const handler = callbackWrapper(\n (type) => throttle(\n callbackWrapper((event) => {\n const target = getEventTarget(event);\n if (!target || isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n const { currentTime, volume, muted, playbackRate, loop } = target;\n mediaInteractionCb({\n type,\n id: mirror2.getId(target),\n currentTime,\n volume,\n muted,\n playbackRate,\n loop\n });\n }),\n sampling.media || 500\n )\n );\n const handlers = [\n on("play", handler(MediaInteractions.Play), doc),\n on("pause", handler(MediaInteractions.Pause), doc),\n on("seeked", handler(MediaInteractions.Seeked), doc),\n on("volumechange", handler(MediaInteractions.VolumeChange), doc),\n on("ratechange", handler(MediaInteractions.RateChange), doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initFontObserver({ fontCb, doc }) {\n const win = doc.defaultView;\n if (!win) {\n return () => {\n };\n }\n const handlers = [];\n const fontMap = /* @__PURE__ */ new WeakMap();\n const originalFontFace = win.FontFace;\n win.FontFace = function FontFace2(family, source, descriptors) {\n const fontFace = new originalFontFace(family, source, descriptors);\n fontMap.set(fontFace, {\n family,\n buffer: typeof source !== "string",\n descriptors,\n fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source)))\n });\n return fontFace;\n };\n const restoreHandler = patch(\n doc.fonts,\n "add",\n function(original) {\n return function(fontFace) {\n setTimeout(\n callbackWrapper(() => {\n const p = fontMap.get(fontFace);\n if (p) {\n fontCb(p);\n fontMap.delete(fontFace);\n }\n }),\n 0\n );\n return original.apply(this, [fontFace]);\n };\n }\n );\n handlers.push(() => {\n win.FontFace = originalFontFace;\n });\n handlers.push(restoreHandler);\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initSelectionObserver(param) {\n const { doc, mirror: mirror2, blockClass, blockSelector, selectionCb } = param;\n let collapsed = true;\n const updateSelection = callbackWrapper(() => {\n const selection = doc.getSelection();\n if (!selection || collapsed && (selection == null ? void 0 : selection.isCollapsed)) return;\n collapsed = selection.isCollapsed || false;\n const ranges = [];\n const count = selection.rangeCount || 0;\n for (let i2 = 0; i2 < count; i2++) {\n const range = selection.getRangeAt(i2);\n const { startContainer, startOffset, endContainer, endOffset } = range;\n const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);\n if (blocked) continue;\n ranges.push({\n start: mirror2.getId(startContainer),\n startOffset,\n end: mirror2.getId(endContainer),\n endOffset\n });\n }\n selectionCb({ ranges });\n });\n updateSelection();\n return on("selectionchange", updateSelection);\n}\nfunction initCustomElementObserver({\n doc,\n customElementCb\n}) {\n const win = doc.defaultView;\n if (!win || !win.customElements) return () => {\n };\n const restoreHandler = patch(\n win.customElements,\n "define",\n function(original) {\n return function(name, constructor, options) {\n try {\n customElementCb({\n define: {\n name\n }\n });\n } catch (e2) {\n console.warn(`Custom element callback failed for ${name}`);\n }\n return original.apply(this, [name, constructor, options]);\n };\n }\n );\n return restoreHandler;\n}\nfunction mergeHooks(o2, hooks) {\n const {\n mutationCb,\n mousemoveCb,\n mouseInteractionCb,\n scrollCb,\n viewportResizeCb,\n inputCb,\n mediaInteractionCb,\n styleSheetRuleCb,\n styleDeclarationCb,\n canvasMutationCb,\n visibilityMutationCb,\n fontCb,\n selectionCb,\n customElementCb\n } = o2;\n o2.mutationCb = (...p) => {\n if (hooks.mutation) {\n hooks.mutation(...p);\n }\n mutationCb(...p);\n };\n o2.mousemoveCb = (...p) => {\n if (hooks.mousemove) {\n hooks.mousemove(...p);\n }\n mousemoveCb(...p);\n };\n o2.mouseInteractionCb = (...p) => {\n if (hooks.mouseInteraction) {\n hooks.mouseInteraction(...p);\n }\n mouseInteractionCb(...p);\n };\n o2.scrollCb = (...p) => {\n if (hooks.scroll) {\n hooks.scroll(...p);\n }\n scrollCb(...p);\n };\n o2.viewportResizeCb = (...p) => {\n if (hooks.viewportResize) {\n hooks.viewportResize(...p);\n }\n viewportResizeCb(...p);\n };\n o2.inputCb = (...p) => {\n if (hooks.input) {\n hooks.input(...p);\n }\n inputCb(...p);\n };\n o2.mediaInteractionCb = (...p) => {\n if (hooks.mediaInteaction) {\n hooks.mediaInteaction(...p);\n }\n mediaInteractionCb(...p);\n };\n o2.styleSheetRuleCb = (...p) => {\n if (hooks.styleSheetRule) {\n hooks.styleSheetRule(...p);\n }\n styleSheetRuleCb(...p);\n };\n o2.styleDeclarationCb = (...p) => {\n if (hooks.styleDeclaration) {\n hooks.styleDeclaration(...p);\n }\n styleDeclarationCb(...p);\n };\n o2.canvasMutationCb = (...p) => {\n if (hooks.canvasMutation) {\n hooks.canvasMutation(...p);\n }\n canvasMutationCb(...p);\n };\n o2.visibilityMutationCb = (...p) => {\n if (hooks.visibilityMutation) {\n hooks.visibilityMutation(...p);\n }\n visibilityMutationCb(...p);\n };\n o2.fontCb = (...p) => {\n if (hooks.font) {\n hooks.font(...p);\n }\n fontCb(...p);\n };\n o2.selectionCb = (...p) => {\n if (hooks.selection) {\n hooks.selection(...p);\n }\n selectionCb(...p);\n };\n o2.customElementCb = (...c2) => {\n if (hooks.customElement) {\n hooks.customElement(...c2);\n }\n customElementCb(...c2);\n };\n}\nfunction initObservers(o2, hooks = {}) {\n const currentWindow = o2.doc.defaultView;\n if (!currentWindow) {\n return () => {\n };\n }\n mergeHooks(o2, hooks);\n let mutationObserver;\n if (o2.recordDOM) {\n mutationObserver = initMutationObserver(o2, o2.doc);\n }\n const mousemoveHandler = initMoveObserver(o2);\n const mouseInteractionHandler = initMouseInteractionObserver(o2);\n const scrollHandler = initScrollObserver(o2);\n const viewportResizeHandler = initViewportResizeObserver(o2, {\n win: currentWindow\n });\n const inputHandler = initInputObserver(o2);\n const mediaInteractionHandler = initMediaInteractionObserver(o2);\n let styleSheetObserver = () => {\n };\n let adoptedStyleSheetObserver = () => {\n };\n let styleDeclarationObserver = () => {\n };\n let fontObserver = () => {\n };\n if (o2.recordDOM) {\n styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow });\n adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc);\n styleDeclarationObserver = initStyleDeclarationObserver(o2, {\n win: currentWindow\n });\n if (o2.collectFonts) {\n fontObserver = initFontObserver(o2);\n }\n }\n const selectionObserver = initSelectionObserver(o2);\n const customElementObserver = initCustomElementObserver(o2);\n const pluginHandlers = [];\n for (const plugin3 of o2.plugins) {\n pluginHandlers.push(\n plugin3.observer(plugin3.callback, currentWindow, plugin3.options)\n );\n }\n return callbackWrapper(() => {\n mutationBuffers.forEach((b) => b.reset());\n mutationObserver == null ? void 0 : mutationObserver.disconnect();\n mousemoveHandler();\n mouseInteractionHandler();\n scrollHandler();\n viewportResizeHandler();\n inputHandler();\n mediaInteractionHandler();\n styleSheetObserver();\n adoptedStyleSheetObserver();\n styleDeclarationObserver();\n fontObserver();\n selectionObserver();\n customElementObserver();\n pluginHandlers.forEach((h) => h());\n });\n}\nfunction hasNestedCSSRule(prop) {\n return typeof window[prop] !== "undefined";\n}\nfunction canMonkeyPatchNestedCSSRule(prop) {\n return Boolean(\n typeof window[prop] !== "undefined" && // Note: Generally, this check _shouldn\'t_ be necessary\n // However, in some scenarios (e.g. jsdom) this can sometimes fail, so we check for it here\n window[prop].prototype && "insertRule" in window[prop].prototype && "deleteRule" in window[prop].prototype\n );\n}\nclass CrossOriginIframeMirror {\n constructor(generateIdFn) {\n __publicField(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());\n __publicField(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());\n this.generateIdFn = generateIdFn;\n }\n getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {\n const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);\n let id = idToRemoteIdMap.get(remoteId);\n if (!id) {\n id = this.generateIdFn();\n idToRemoteIdMap.set(remoteId, id);\n remoteIdToIdMap.set(id, remoteId);\n }\n return id;\n }\n getIds(iframe, remoteId) {\n const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return remoteId.map(\n (id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap)\n );\n }\n getRemoteId(iframe, id, map) {\n const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);\n if (typeof id !== "number") return id;\n const remoteId = remoteIdToIdMap.get(id);\n if (!remoteId) return -1;\n return remoteId;\n }\n getRemoteIds(iframe, ids) {\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));\n }\n reset(iframe) {\n if (!iframe) {\n this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();\n this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();\n return;\n }\n this.iframeIdToRemoteIdMap.delete(iframe);\n this.iframeRemoteIdToIdMap.delete(iframe);\n }\n getIdToRemoteIdMap(iframe) {\n let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);\n if (!idToRemoteIdMap) {\n idToRemoteIdMap = /* @__PURE__ */ new Map();\n this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);\n }\n return idToRemoteIdMap;\n }\n getRemoteIdToIdMap(iframe) {\n let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);\n if (!remoteIdToIdMap) {\n remoteIdToIdMap = /* @__PURE__ */ new Map();\n this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);\n }\n return remoteIdToIdMap;\n }\n}\nclass IframeManager {\n constructor(options) {\n __publicField(this, "iframes", /* @__PURE__ */ new WeakMap());\n __publicField(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());\n __publicField(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));\n __publicField(this, "crossOriginIframeStyleMirror");\n __publicField(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());\n __publicField(this, "mirror");\n __publicField(this, "mutationCb");\n __publicField(this, "wrappedEmit");\n __publicField(this, "loadListener");\n __publicField(this, "stylesheetManager");\n __publicField(this, "recordCrossOriginIframes");\n this.mutationCb = options.mutationCb;\n this.wrappedEmit = options.wrappedEmit;\n this.stylesheetManager = options.stylesheetManager;\n this.recordCrossOriginIframes = options.recordCrossOriginIframes;\n this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(\n this.stylesheetManager.styleMirror.generateId.bind(\n this.stylesheetManager.styleMirror\n )\n );\n this.mirror = options.mirror;\n if (this.recordCrossOriginIframes) {\n window.addEventListener("message", this.handleMessage.bind(this));\n }\n }\n addIframe(iframeEl) {\n this.iframes.set(iframeEl, true);\n if (iframeEl.contentWindow)\n this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);\n }\n addLoadListener(cb) {\n this.loadListener = cb;\n }\n attachIframe(iframeEl, childSn) {\n var _a2, _b;\n this.mutationCb({\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: childSn\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n });\n if (this.recordCrossOriginIframes)\n (_a2 = iframeEl.contentWindow) == null ? void 0 : _a2.addEventListener(\n "message",\n this.handleMessage.bind(this)\n );\n (_b = this.loadListener) == null ? void 0 : _b.call(this, iframeEl);\n if (iframeEl.contentDocument && iframeEl.contentDocument.adoptedStyleSheets && iframeEl.contentDocument.adoptedStyleSheets.length > 0)\n this.stylesheetManager.adoptStyleSheets(\n iframeEl.contentDocument.adoptedStyleSheets,\n this.mirror.getId(iframeEl.contentDocument)\n );\n }\n handleMessage(message) {\n const crossOriginMessageEvent = message;\n if (crossOriginMessageEvent.data.type !== "rrweb" || // To filter out the rrweb messages which are forwarded by some sites.\n crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin)\n return;\n const iframeSourceWindow = message.source;\n if (!iframeSourceWindow) return;\n const iframeEl = this.crossOriginIframeMap.get(message.source);\n if (!iframeEl) return;\n const transformedEvent = this.transformCrossOriginEvent(\n iframeEl,\n crossOriginMessageEvent.data.event\n );\n if (transformedEvent)\n this.wrappedEmit(\n transformedEvent,\n crossOriginMessageEvent.data.isCheckout\n );\n }\n transformCrossOriginEvent(iframeEl, e2) {\n var _a2;\n switch (e2.type) {\n case EventType.FullSnapshot: {\n this.crossOriginIframeMirror.reset(iframeEl);\n this.crossOriginIframeStyleMirror.reset(iframeEl);\n this.replaceIdOnNode(e2.data.node, iframeEl);\n const rootId = e2.data.node.id;\n this.crossOriginIframeRootIdMap.set(iframeEl, rootId);\n this.patchRootIdOnNode(e2.data.node, rootId);\n return {\n timestamp: e2.timestamp,\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: e2.data.node\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n }\n };\n }\n case EventType.Meta:\n case EventType.Load:\n case EventType.DomContentLoaded: {\n return false;\n }\n case EventType.Plugin: {\n return e2;\n }\n case EventType.Custom: {\n this.replaceIds(\n e2.data.payload,\n iframeEl,\n ["id", "parentId", "previousId", "nextId"]\n );\n return e2;\n }\n case EventType.IncrementalSnapshot: {\n switch (e2.data.source) {\n case IncrementalSource.Mutation: {\n e2.data.adds.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\n "parentId",\n "nextId",\n "previousId"\n ]);\n this.replaceIdOnNode(n2.node, iframeEl);\n const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);\n rootId && this.patchRootIdOnNode(n2.node, rootId);\n });\n e2.data.removes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, ["parentId", "id"]);\n });\n e2.data.attributes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, ["id"]);\n });\n e2.data.texts.forEach((n2) => {\n this.replaceIds(n2, iframeEl, ["id"]);\n });\n return e2;\n }\n case IncrementalSource.Drag:\n case IncrementalSource.TouchMove:\n case IncrementalSource.MouseMove: {\n e2.data.positions.forEach((p) => {\n this.replaceIds(p, iframeEl, ["id"]);\n });\n return e2;\n }\n case IncrementalSource.ViewportResize: {\n return false;\n }\n case IncrementalSource.MediaInteraction:\n case IncrementalSource.MouseInteraction:\n case IncrementalSource.Scroll:\n case IncrementalSource.CanvasMutation:\n case IncrementalSource.Input: {\n this.replaceIds(e2.data, iframeEl, ["id"]);\n return e2;\n }\n case IncrementalSource.StyleSheetRule:\n case IncrementalSource.StyleDeclaration: {\n this.replaceIds(e2.data, iframeEl, ["id"]);\n this.replaceStyleIds(e2.data, iframeEl, ["styleId"]);\n return e2;\n }\n case IncrementalSource.Font: {\n return e2;\n }\n case IncrementalSource.Selection: {\n e2.data.ranges.forEach((range) => {\n this.replaceIds(range, iframeEl, ["start", "end"]);\n });\n return e2;\n }\n case IncrementalSource.AdoptedStyleSheet: {\n this.replaceIds(e2.data, iframeEl, ["id"]);\n this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]);\n (_a2 = e2.data.styles) == null ? void 0 : _a2.forEach((style) => {\n this.replaceStyleIds(style, iframeEl, ["styleId"]);\n });\n return e2;\n }\n }\n }\n }\n return false;\n }\n replace(iframeMirror, obj, iframeEl, keys) {\n for (const key of keys) {\n if (!Array.isArray(obj[key]) && typeof obj[key] !== "number") continue;\n if (Array.isArray(obj[key])) {\n obj[key] = iframeMirror.getIds(\n iframeEl,\n obj[key]\n );\n } else {\n obj[key] = iframeMirror.getId(iframeEl, obj[key]);\n }\n }\n return obj;\n }\n replaceIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);\n }\n replaceStyleIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);\n }\n replaceIdOnNode(node2, iframeEl) {\n this.replaceIds(node2, iframeEl, ["id", "rootId"]);\n if ("childNodes" in node2) {\n node2.childNodes.forEach((child) => {\n this.replaceIdOnNode(child, iframeEl);\n });\n }\n }\n patchRootIdOnNode(node2, rootId) {\n if (node2.type !== NodeType.Document && !node2.rootId) node2.rootId = rootId;\n if ("childNodes" in node2) {\n node2.childNodes.forEach((child) => {\n this.patchRootIdOnNode(child, rootId);\n });\n }\n }\n}\nclass ShadowDomManager {\n constructor(options) {\n __publicField(this, "shadowDoms", /* @__PURE__ */ new WeakSet());\n __publicField(this, "mutationCb");\n __publicField(this, "scrollCb");\n __publicField(this, "bypassOptions");\n __publicField(this, "mirror");\n __publicField(this, "restoreHandlers", []);\n this.mutationCb = options.mutationCb;\n this.scrollCb = options.scrollCb;\n this.bypassOptions = options.bypassOptions;\n this.mirror = options.mirror;\n this.init();\n }\n init() {\n this.reset();\n this.patchAttachShadow(Element, document);\n }\n addShadowRoot(shadowRoot2, doc) {\n if (!isNativeShadowDom(shadowRoot2)) return;\n if (this.shadowDoms.has(shadowRoot2)) return;\n this.shadowDoms.add(shadowRoot2);\n const observer = initMutationObserver(\n __spreadProps(__spreadValues({}, this.bypassOptions), {\n doc,\n mutationCb: this.mutationCb,\n mirror: this.mirror,\n shadowDomManager: this\n }),\n shadowRoot2\n );\n this.restoreHandlers.push(() => observer.disconnect());\n this.restoreHandlers.push(\n initScrollObserver(__spreadProps(__spreadValues({}, this.bypassOptions), {\n scrollCb: this.scrollCb,\n // https://gist.github.com/praveenpuglia/0832da687ed5a5d7a0907046c9ef1813\n // scroll is not allowed to pass the boundary, so we need to listen the shadow document\n doc: shadowRoot2,\n mirror: this.mirror\n }))\n );\n setTimeout(() => {\n if (shadowRoot2.adoptedStyleSheets && shadowRoot2.adoptedStyleSheets.length > 0)\n this.bypassOptions.stylesheetManager.adoptStyleSheets(\n shadowRoot2.adoptedStyleSheets,\n this.mirror.getId(index.host(shadowRoot2))\n );\n this.restoreHandlers.push(\n initAdoptedStyleSheetObserver(\n {\n mirror: this.mirror,\n stylesheetManager: this.bypassOptions.stylesheetManager\n },\n shadowRoot2\n )\n );\n }, 0);\n }\n /**\n * Monkey patch \'attachShadow\' of an IFrameElement to observe newly added shadow doms.\n */\n observeAttachShadow(iframeElement) {\n if (!iframeElement.contentWindow || !iframeElement.contentDocument) return;\n this.patchAttachShadow(\n iframeElement.contentWindow.Element,\n iframeElement.contentDocument\n );\n }\n /**\n * Patch \'attachShadow\' to observe newly added shadow doms.\n */\n patchAttachShadow(element, doc) {\n const manager = this;\n this.restoreHandlers.push(\n patch(\n element.prototype,\n "attachShadow",\n function(original) {\n return function(option) {\n const sRoot = original.call(this, option);\n const shadowRootEl = index.shadowRoot(this);\n if (shadowRootEl && inDom(this))\n manager.addShadowRoot(shadowRootEl, doc);\n return sRoot;\n };\n }\n )\n );\n }\n reset() {\n this.restoreHandlers.forEach((handler) => {\n try {\n handler();\n } catch (e2) {\n }\n });\n this.restoreHandlers = [];\n this.shadowDoms = /* @__PURE__ */ new WeakSet();\n }\n}\nvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\nvar lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\nfor (var i$1 = 0; i$1 < chars.length; i$1++) {\n lookup[chars.charCodeAt(i$1)] = i$1;\n}\nvar encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n};\nconst canvasVarMap = /* @__PURE__ */ new Map();\nfunction variableListFor$1(ctx, ctor) {\n let contextMap = canvasVarMap.get(ctx);\n if (!contextMap) {\n contextMap = /* @__PURE__ */ new Map();\n canvasVarMap.set(ctx, contextMap);\n }\n if (!contextMap.has(ctor)) {\n contextMap.set(ctor, []);\n }\n return contextMap.get(ctor);\n}\nconst saveWebGLVar = (value, win, ctx) => {\n if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === "object"))\n return;\n const name = value.constructor.name;\n const list2 = variableListFor$1(ctx, name);\n let index2 = list2.indexOf(value);\n if (index2 === -1) {\n index2 = list2.length;\n list2.push(value);\n }\n return index2;\n};\nfunction serializeArg(value, win, ctx) {\n if (value instanceof Array) {\n return value.map((arg) => serializeArg(arg, win, ctx));\n } else if (value === null) {\n return value;\n } else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [Object.values(value)]\n };\n } else if (\n // SharedArrayBuffer disabled on most browsers due to spectre.\n // More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/SharedArrayBuffer\n // value instanceof SharedArrayBuffer ||\n value instanceof ArrayBuffer\n ) {\n const name = value.constructor.name;\n const base64 = encode(value);\n return {\n rr_type: name,\n base64\n };\n } else if (value instanceof DataView) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [\n serializeArg(value.buffer, win, ctx),\n value.byteOffset,\n value.byteLength\n ]\n };\n } else if (value instanceof HTMLImageElement) {\n const name = value.constructor.name;\n const { src } = value;\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof HTMLCanvasElement) {\n const name = "HTMLImageElement";\n const src = value.toDataURL();\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof ImageData) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [serializeArg(value.data, win, ctx), value.width, value.height]\n };\n } else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {\n const name = value.constructor.name;\n const index2 = saveWebGLVar(value, win, ctx);\n return {\n rr_type: name,\n index: index2\n };\n }\n return value;\n}\nconst serializeArgs = (args, win, ctx) => {\n return args.map((arg) => serializeArg(arg, win, ctx));\n};\nconst isInstanceOfWebGLObject = (value, win) => {\n const webGLConstructorNames = [\n "WebGLActiveInfo",\n "WebGLBuffer",\n "WebGLFramebuffer",\n "WebGLProgram",\n "WebGLRenderbuffer",\n "WebGLShader",\n "WebGLShaderPrecisionFormat",\n "WebGLTexture",\n "WebGLUniformLocation",\n "WebGLVertexArrayObject",\n // In old Chrome versions, value won\'t be an instanceof WebGLVertexArrayObject.\n "WebGLVertexArrayObjectOES"\n ];\n const supportedWebGLConstructorNames = webGLConstructorNames.filter(\n (name) => typeof win[name] === "function"\n );\n return Boolean(\n supportedWebGLConstructorNames.find(\n (name) => value instanceof win[name]\n )\n );\n};\nfunction initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {\n const handlers = [];\n const props2D = Object.getOwnPropertyNames(\n win.CanvasRenderingContext2D.prototype\n );\n for (const prop of props2D) {\n try {\n if (typeof win.CanvasRenderingContext2D.prototype[prop] !== "function") {\n continue;\n }\n const restoreHandler = patch(\n win.CanvasRenderingContext2D.prototype,\n prop,\n function(original) {\n return function(...args) {\n if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {\n setTimeout(() => {\n const recordArgs = serializeArgs(args, win, this);\n cb(this.canvas, {\n type: CanvasContext["2D"],\n property: prop,\n args: recordArgs\n });\n }, 0);\n }\n return original.apply(this, args);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch (e) {\n const hookHandler = hookSetter(\n win.CanvasRenderingContext2D.prototype,\n prop,\n {\n set(v2) {\n cb(this.canvas, {\n type: CanvasContext["2D"],\n property: prop,\n args: [v2],\n setter: true\n });\n }\n }\n );\n handlers.push(hookHandler);\n }\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction getNormalizedContextName(contextType) {\n return contextType === "experimental-webgl" ? "webgl" : contextType;\n}\nfunction initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDrawingBufferToTrue) {\n const handlers = [];\n try {\n const restoreHandler = patch(\n win.HTMLCanvasElement.prototype,\n "getContext",\n function(original) {\n return function(contextType, ...args) {\n if (!isBlocked(this, blockClass, blockSelector, true)) {\n const ctxName = getNormalizedContextName(contextType);\n if (!("__context" in this)) this.__context = ctxName;\n if (setPreserveDrawingBufferToTrue && ["webgl", "webgl2"].includes(ctxName)) {\n if (args[0] && typeof args[0] === "object") {\n const contextAttributes = args[0];\n if (!contextAttributes.preserveDrawingBuffer) {\n contextAttributes.preserveDrawingBuffer = true;\n }\n } else {\n args.splice(0, 1, {\n preserveDrawingBuffer: true\n });\n }\n }\n }\n return original.apply(this, [contextType, ...args]);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch (e) {\n console.error("failed to patch HTMLCanvasElement.prototype.getContext");\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {\n const handlers = [];\n const props = Object.getOwnPropertyNames(prototype);\n for (const prop of props) {\n if (\n //prop.startsWith(\'get\') || // e.g. getProgramParameter, but too risky\n [\n "isContextLost",\n "canvas",\n "drawingBufferWidth",\n "drawingBufferHeight"\n ].includes(prop)\n ) {\n continue;\n }\n try {\n if (typeof prototype[prop] !== "function") {\n continue;\n }\n const restoreHandler = patch(\n prototype,\n prop,\n function(original) {\n return function(...args) {\n const result2 = original.apply(this, args);\n saveWebGLVar(result2, win, this);\n if ("tagName" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, true)) {\n const recordArgs = serializeArgs(args, win, this);\n const mutation = {\n type,\n property: prop,\n args: recordArgs\n };\n cb(this.canvas, mutation);\n }\n return result2;\n };\n }\n );\n handlers.push(restoreHandler);\n } catch (e) {\n const hookHandler = hookSetter(prototype, prop, {\n set(v2) {\n cb(this.canvas, {\n type,\n property: prop,\n args: [v2],\n setter: true\n });\n }\n });\n handlers.push(hookHandler);\n }\n }\n return handlers;\n}\nfunction initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {\n const handlers = [];\n handlers.push(\n ...patchGLPrototype(\n win.WebGLRenderingContext.prototype,\n CanvasContext.WebGL,\n cb,\n blockClass,\n blockSelector,\n win\n )\n );\n if (typeof win.WebGL2RenderingContext !== "undefined") {\n handlers.push(\n ...patchGLPrototype(\n win.WebGL2RenderingContext.prototype,\n CanvasContext.WebGL2,\n cb,\n blockClass,\n blockSelector,\n win\n )\n );\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nconst encodedJs = "KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=";\nconst decodeBase64 = (base64) => Uint8Array.from(atob(base64), (c2) => c2.charCodeAt(0));\nconst blob = typeof window !== "undefined" && window.Blob && new Blob([decodeBase64(encodedJs)], { type: "text/javascript;charset=utf-8" });\nfunction WorkerWrapper(options) {\n let objURL;\n try {\n objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);\n if (!objURL) throw "";\n const worker = new Worker(objURL, {\n name: options == null ? void 0 : options.name\n });\n worker.addEventListener("error", () => {\n (window.URL || window.webkitURL).revokeObjectURL(objURL);\n });\n return worker;\n } catch (e2) {\n return new Worker(\n "data:text/javascript;base64," + encodedJs,\n {\n name: options == null ? void 0 : options.name\n }\n );\n } finally {\n objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);\n }\n}\nclass CanvasManager {\n constructor(options) {\n __publicField(this, "pendingCanvasMutations", /* @__PURE__ */ new Map());\n __publicField(this, "rafStamps", { latestId: 0, invokeId: null });\n __publicField(this, "mirror");\n __publicField(this, "mutationCb");\n __publicField(this, "resetObservers");\n __publicField(this, "frozen", false);\n __publicField(this, "locked", false);\n __publicField(this, "processMutation", (target, mutation) => {\n const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;\n if (newFrame || !this.rafStamps.invokeId)\n this.rafStamps.invokeId = this.rafStamps.latestId;\n if (!this.pendingCanvasMutations.has(target)) {\n this.pendingCanvasMutations.set(target, []);\n }\n this.pendingCanvasMutations.get(target).push(mutation);\n });\n const {\n sampling = "all",\n win,\n blockClass,\n blockSelector,\n recordCanvas,\n dataURLOptions\n } = options;\n this.mutationCb = options.mutationCb;\n this.mirror = options.mirror;\n if (recordCanvas && sampling === "all")\n this.initCanvasMutationObserver(win, blockClass, blockSelector);\n if (recordCanvas && typeof sampling === "number")\n this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {\n dataURLOptions\n });\n }\n reset() {\n this.pendingCanvasMutations.clear();\n this.resetObservers && this.resetObservers();\n }\n freeze() {\n this.frozen = true;\n }\n unfreeze() {\n this.frozen = false;\n }\n lock() {\n this.locked = true;\n }\n unlock() {\n this.locked = false;\n }\n initCanvasFPSObserver(fps, win, blockClass, blockSelector, options) {\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n true\n );\n const snapshotInProgressMap = /* @__PURE__ */ new Map();\n const worker = new WorkerWrapper();\n worker.onmessage = (e2) => {\n const { id } = e2.data;\n snapshotInProgressMap.set(id, false);\n if (!("base64" in e2.data)) return;\n const { base64, type, width, height } = e2.data;\n this.mutationCb({\n id,\n type: CanvasContext["2D"],\n commands: [\n {\n property: "clearRect",\n // wipe canvas\n args: [0, 0, width, height]\n },\n {\n property: "drawImage",\n // draws (semi-transparent) image\n args: [\n {\n rr_type: "ImageBitmap",\n args: [\n {\n rr_type: "Blob",\n data: [{ rr_type: "ArrayBuffer", base64 }],\n type\n }\n ]\n },\n 0,\n 0\n ]\n }\n ]\n });\n };\n const timeBetweenSnapshots = 1e3 / fps;\n let lastSnapshotTime = 0;\n let rafId;\n const getCanvas = () => {\n const matchedCanvas = [];\n win.document.querySelectorAll("canvas").forEach((canvas) => {\n if (!isBlocked(canvas, blockClass, blockSelector, true)) {\n matchedCanvas.push(canvas);\n }\n });\n return matchedCanvas;\n };\n const takeCanvasSnapshots = (timestamp) => {\n if (lastSnapshotTime && timestamp - lastSnapshotTime < timeBetweenSnapshots) {\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n return;\n }\n lastSnapshotTime = timestamp;\n getCanvas().forEach(async (canvas) => {\n var _a2;\n const id = this.mirror.getId(canvas);\n if (snapshotInProgressMap.get(id)) return;\n if (canvas.width === 0 || canvas.height === 0) return;\n snapshotInProgressMap.set(id, true);\n if (["webgl", "webgl2"].includes(canvas.__context)) {\n const context = canvas.getContext(canvas.__context);\n if (((_a2 = context == null ? void 0 : context.getContextAttributes()) == null ? void 0 : _a2.preserveDrawingBuffer) === false) {\n context.clear(context.COLOR_BUFFER_BIT);\n }\n }\n const bitmap = await createImageBitmap(canvas);\n worker.postMessage(\n {\n id,\n bitmap,\n width: canvas.width,\n height: canvas.height,\n dataURLOptions: options.dataURLOptions\n },\n [bitmap]\n );\n });\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n };\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n this.resetObservers = () => {\n canvasContextReset();\n cancelAnimationFrame(rafId);\n };\n }\n initCanvasMutationObserver(win, blockClass, blockSelector) {\n this.startRAFTimestamping();\n this.startPendingCanvasMutationFlusher();\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n false\n );\n const canvas2DReset = initCanvas2DMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector\n );\n const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector\n );\n this.resetObservers = () => {\n canvasContextReset();\n canvas2DReset();\n canvasWebGL1and2Reset();\n };\n }\n startPendingCanvasMutationFlusher() {\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n startRAFTimestamping() {\n const setLatestRAFTimestamp = (timestamp) => {\n this.rafStamps.latestId = timestamp;\n requestAnimationFrame(setLatestRAFTimestamp);\n };\n requestAnimationFrame(setLatestRAFTimestamp);\n }\n flushPendingCanvasMutations() {\n this.pendingCanvasMutations.forEach(\n (_values, canvas) => {\n const id = this.mirror.getId(canvas);\n this.flushPendingCanvasMutationFor(canvas, id);\n }\n );\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n flushPendingCanvasMutationFor(canvas, id) {\n if (this.frozen || this.locked) {\n return;\n }\n const valuesWithType = this.pendingCanvasMutations.get(canvas);\n if (!valuesWithType || id === -1) return;\n const values = valuesWithType.map((value) => {\n const _a2 = value, { type: type2 } = _a2, rest = __objRest(_a2, ["type"]);\n return rest;\n });\n const { type } = valuesWithType[0];\n this.mutationCb({ id, type, commands: values });\n this.pendingCanvasMutations.delete(canvas);\n }\n}\nclass StylesheetManager {\n constructor(options) {\n __publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());\n __publicField(this, "mutationCb");\n __publicField(this, "adoptedStyleSheetCb");\n __publicField(this, "styleMirror", new StyleSheetMirror());\n this.mutationCb = options.mutationCb;\n this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;\n }\n attachLinkElement(linkEl, childSn) {\n if ("_cssText" in childSn.attributes)\n this.mutationCb({\n adds: [],\n removes: [],\n texts: [],\n attributes: [\n {\n id: childSn.id,\n attributes: childSn.attributes\n }\n ]\n });\n this.trackLinkElement(linkEl);\n }\n trackLinkElement(linkEl) {\n if (this.trackedLinkElements.has(linkEl)) return;\n this.trackedLinkElements.add(linkEl);\n this.trackStylesheetInLinkElement(linkEl);\n }\n adoptStyleSheets(sheets, hostId) {\n if (sheets.length === 0) return;\n const adoptedStyleSheetData = {\n id: hostId,\n styleIds: []\n };\n const styles = [];\n for (const sheet of sheets) {\n let styleId;\n if (!this.styleMirror.has(sheet)) {\n styleId = this.styleMirror.add(sheet);\n styles.push({\n styleId,\n rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({\n rule: stringifyRule(r2, sheet.href),\n index: index2\n }))\n });\n } else styleId = this.styleMirror.getId(sheet);\n adoptedStyleSheetData.styleIds.push(styleId);\n }\n if (styles.length > 0) adoptedStyleSheetData.styles = styles;\n this.adoptedStyleSheetCb(adoptedStyleSheetData);\n }\n reset() {\n this.styleMirror.reset();\n this.trackedLinkElements = /* @__PURE__ */ new WeakSet();\n }\n // TODO: take snapshot on stylesheet reload by applying event listener\n trackStylesheetInLinkElement(_linkEl) {\n }\n}\nclass ProcessedNodeManager {\n constructor() {\n __publicField(this, "nodeMap", /* @__PURE__ */ new WeakMap());\n __publicField(this, "active", false);\n }\n inOtherBuffer(node2, thisBuffer) {\n const buffers = this.nodeMap.get(node2);\n return buffers && Array.from(buffers).some((buffer) => buffer !== thisBuffer);\n }\n add(node2, buffer) {\n if (!this.active) {\n this.active = true;\n requestAnimationFrame(() => {\n this.nodeMap = /* @__PURE__ */ new WeakMap();\n this.active = false;\n });\n }\n this.nodeMap.set(node2, (this.nodeMap.get(node2) || /* @__PURE__ */ new Set()).add(buffer));\n }\n destroy() {\n }\n}\nfunction computeVisibility(elements, previous, options) {\n var _a2, _b, _c, _d, _e, _f;\n const root2 = (_a2 = options == null ? void 0 : options.root) != null ? _a2 : null;\n const threshold = (_b = options == null ? void 0 : options.threshold) != null ? _b : 0.5;\n const sensitivity = (_c = options == null ? void 0 : options.sensitivity) != null ? _c : 0.05;\n const rootMarginFn = parseRootMargin((_d = options == null ? void 0 : options.rootMargin) != null ? _d : "0px");\n const current = /* @__PURE__ */ new Map();\n const rootRect = getRootRect(root2);\n const expandedRoot = expandRootRect(rootRect, rootMarginFn);\n for (const el of elements) {\n const elRect = el.getBoundingClientRect();\n let intersectionRect = emptyRect();\n let intersectionRatio = 0;\n if (elRect.width > 0 && elRect.height > 0) {\n intersectionRect = computeIntersectionRect(elRect, expandedRoot);\n intersectionRatio = computeIntersectionRatio(elRect, intersectionRect);\n intersectionRatio = Math.round(intersectionRatio * 100) / 100;\n }\n const isStyle = isStyleVisible(el);\n const old = (_e = previous.get(el)) != null ? _e : null;\n const prevRatio = (_f = old == null ? void 0 : old.intersectionRatio) != null ? _f : 0;\n const currRatio = intersectionRatio;\n const wasVisible = (old == null ? void 0 : old.isStyleVisible) && prevRatio > threshold;\n const nowVisible = isStyle && currRatio > threshold;\n const changed = !old || wasVisible !== nowVisible || wasVisible !== nowVisible && Math.abs(currRatio - prevRatio) > sensitivity;\n if (changed) {\n current.set(el, {\n target: el,\n isVisible: nowVisible,\n isStyleVisible: isStyle,\n intersectionRatio: currRatio,\n intersectionRect,\n oldValue: old\n });\n } else {\n current.set(el, old);\n }\n }\n return current;\n}\nfunction parseRootMargin(marginStr) {\n const parts = marginStr.trim().split(/\\s+/);\n const getValue = (val, size) => val.endsWith("%") ? parseFloat(val) / 100 * size : parseFloat(val) || 0;\n return function(rootRect) {\n const top = getValue(parts[0] || "0px", rootRect.height);\n const right = getValue(parts[1] || parts[0] || "0px", rootRect.width);\n const bottom = getValue(parts[2] || parts[0] || "0px", rootRect.height);\n const left = getValue(parts[3] || parts[1] || parts[0] || "0px", rootRect.width);\n return { top, right, bottom, left, width: 0, height: 0 };\n };\n}\nfunction getRootRect(root2) {\n return root2 ? root2.getBoundingClientRect() : new DOMRect(0, 0, window.innerWidth, window.innerHeight);\n}\nfunction expandRootRect(rect, marginFn) {\n const margin = marginFn(rect);\n return new DOMRect(\n rect.left - margin.left,\n rect.top - margin.top,\n rect.width + margin.left + margin.right,\n rect.height + margin.top + margin.bottom\n );\n}\nfunction computeIntersectionRect(a2, b) {\n const top = Math.max(a2.top, b.top);\n const left = Math.max(a2.left, b.left);\n const bottom = Math.min(a2.bottom, b.bottom);\n const right = Math.min(a2.right, b.right);\n const width = Math.max(0, right - left);\n const height = Math.max(0, bottom - top);\n return { top, left, bottom, right, width, height };\n}\nfunction computeIntersectionRatio(elRect, intersectionRect) {\n const elArea = elRect.width * elRect.height;\n const intArea = intersectionRect.width * intersectionRect.height;\n return elArea > 0 ? intArea / elArea : 0;\n}\nfunction emptyRect() {\n return { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0 };\n}\nfunction isStyleVisible(el) {\n const style = getComputedStyle(el);\n return style && style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity || "1") > 0;\n}\nclass VisibilityManager {\n constructor(options) {\n var _a2, _b, _c, _d, _e, _f;\n __publicField(this, "frozen", false);\n __publicField(this, "locked", false);\n __publicField(this, "pending", /* @__PURE__ */ new Map());\n __publicField(this, "mirror");\n __publicField(this, "mutationCb");\n __publicField(this, "rafId", null);\n __publicField(this, "rafThrottle");\n __publicField(this, "lastFlushTime", 0);\n __publicField(this, "elements", /* @__PURE__ */ new Set());\n __publicField(this, "previousState", /* @__PURE__ */ new Map());\n __publicField(this, "root", null);\n __publicField(this, "threshold");\n __publicField(this, "sensitivity");\n __publicField(this, "rootMargin");\n __publicField(this, "hasInitialized", false);\n __publicField(this, "mode", "none");\n __publicField(this, "debounce", 50);\n __publicField(this, "throttle", 100);\n __publicField(this, "buffer", /* @__PURE__ */ new Map());\n __publicField(this, "debounceTimer", null);\n __publicField(this, "lastThrottleTime", 0);\n __publicField(this, "disabled", false);\n __publicField(this, "notifyActivity");\n const { doc, mirror: mirror2, sampling, mutationCb, notifyActivity } = options;\n this.mirror = mirror2;\n this.mutationCb = mutationCb;\n this.notifyActivity = notifyActivity;\n this.rootMargin = "0px";\n if (sampling === false) {\n this.disabled = true;\n return;\n }\n const visibilitySampling = typeof sampling === "object" && sampling !== null ? sampling : {};\n this.mode = (_a2 = visibilitySampling == null ? void 0 : visibilitySampling.mode) != null ? _a2 : "none";\n this.debounce = Number((_b = visibilitySampling == null ? void 0 : visibilitySampling.debounce) != null ? _b : 100);\n this.throttle = Number((_c = visibilitySampling == null ? void 0 : visibilitySampling.throttle) != null ? _c : 100);\n this.threshold = Number((_d = visibilitySampling == null ? void 0 : visibilitySampling.threshold) != null ? _d : 0.5);\n this.sensitivity = Number((_e = visibilitySampling == null ? void 0 : visibilitySampling.sensitivity) != null ? _e : 0.05);\n this.rafThrottle = Number((_f = visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) != null ? _f : 100);\n doc.querySelectorAll("*").forEach((el) => this.observe(el));\n const mo = new MutationObserver((mutations) => {\n mutations.forEach((m) => {\n m.addedNodes.forEach((n2) => {\n if (n2.nodeType === Node.ELEMENT_NODE) {\n this.observe(n2);\n n2.querySelectorAll("*").forEach((el) => this.observe(el));\n }\n });\n m.removedNodes.forEach((n2) => {\n if (n2.nodeType === Node.ELEMENT_NODE) {\n this.unobserve(n2);\n }\n });\n });\n });\n mo.observe(doc.body, { childList: true, subtree: true });\n this.startPendingFlushLoop();\n }\n startPendingFlushLoop() {\n if (this.disabled) return;\n const loop = (timestamp) => {\n if (timestamp - this.lastFlushTime >= this.rafThrottle) {\n this.lastFlushTime = timestamp;\n this.flushPendingVisibilityMutations();\n }\n this.rafId = requestAnimationFrame(loop);\n };\n this.rafId = requestAnimationFrame(loop);\n }\n flushPendingVisibilityMutations() {\n if (this.disabled) return;\n if (this.frozen || this.locked || this.elements.size === 0) return;\n const state = computeVisibility(this.elements, this.previousState, {\n root: this.root,\n threshold: this.threshold,\n sensitivity: this.sensitivity,\n rootMargin: this.rootMargin\n });\n for (const [el, entry] of state.entries()) {\n const old = this.previousState.get(el);\n const changed = !old || old.isVisible !== entry.isVisible || Math.abs(old.intersectionRatio - entry.intersectionRatio) > this.sensitivity;\n if (changed) {\n const id = this.mirror.getId(el);\n if (id !== -1) {\n this.buffer.set(el, {\n id,\n isVisible: entry.isVisible,\n ratio: entry.intersectionRatio\n });\n }\n this.previousState.set(el, entry);\n }\n }\n this.previousState = state;\n if (!this.hasInitialized) {\n this.hasInitialized = true;\n this.buffer.clear();\n return;\n }\n this.scheduleEmit();\n }\n scheduleEmit() {\n if (this.mode === "debounce") {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = setTimeout(() => this.flushBuffer(), this.debounce);\n } else if (this.mode === "throttle") {\n const now = performance.now();\n if (now - this.lastThrottleTime >= this.throttle) {\n this.lastThrottleTime = now;\n this.flushBuffer();\n }\n } else {\n this.flushBuffer();\n }\n }\n flushBuffer() {\n var _a2;\n if (this.buffer.size === 0) return;\n (_a2 = this.notifyActivity) == null ? void 0 : _a2.call(this, this.buffer.size);\n this.mutationCb({ mutations: Array.from(this.buffer.values()) });\n this.buffer.clear();\n }\n observe(el) {\n if (this.disabled) return;\n this.elements.add(el);\n }\n unobserve(el) {\n if (this.disabled) return;\n this.elements.delete(el);\n this.previousState.delete(el);\n this.pending.delete(el);\n }\n freeze() {\n this.frozen = true;\n }\n unfreeze() {\n this.frozen = false;\n }\n lock() {\n this.locked = true;\n }\n unlock() {\n this.locked = false;\n }\n reset() {\n this.elements.clear();\n this.previousState.clear();\n this.pending.clear();\n if (this.rafId) cancelAnimationFrame(this.rafId);\n }\n}\nlet wrappedEmit;\nlet takeFullSnapshot$1;\nlet canvasManager;\nlet visibilityManager;\nlet recording = false;\nconst customEventQueue = [];\nlet flushCustomEventQueue;\ntry {\n if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {\n const cleanFrame = document.createElement("iframe");\n document.body.appendChild(cleanFrame);\n Array.from = ((_a = cleanFrame.contentWindow) == null ? void 0 : _a.Array.from) || Array.from;\n document.body.removeChild(cleanFrame);\n }\n} catch (err) {\n console.debug("Unable to override Array.from", err);\n}\nconst mirror = createMirror$2();\nfunction record(options = {}) {\n const {\n emit,\n checkoutEveryNms,\n checkoutEveryNth,\n checkoutEveryNvm,\n blockClass = "rr-block",\n blockSelector = null,\n ignoreClass = "rr-ignore",\n ignoreSelector = null,\n excludeAttribute: _excludeAttribute,\n maskTextClass = "rr-mask",\n maskTextSelector = null,\n inlineStylesheet = true,\n maskAllInputs,\n maskInputOptions: _maskInputOptions,\n slimDOMOptions: _slimDOMOptions,\n maskInputFn,\n maskTextFn,\n hooks,\n packFn,\n sampling = {},\n dataURLOptions = {},\n mousemoveWait,\n recordDOM = true,\n recordCanvas = false,\n recordCrossOriginIframes = false,\n recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",\n flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",\n userTriggeredOnInput = false,\n collectFonts = false,\n inlineImages = false,\n plugins,\n keepIframeSrcFn = () => false,\n ignoreCSSAttributes = /* @__PURE__ */ new Set([]),\n errorHandler: errorHandler2\n } = options;\n registerErrorHandler(errorHandler2);\n const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;\n let passEmitsToParent = false;\n if (!inEmittingFrame) {\n try {\n if (window.parent.document) {\n passEmitsToParent = false;\n }\n } catch (e2) {\n passEmitsToParent = true;\n }\n }\n if (inEmittingFrame && !emit) {\n throw new Error("emit function is required");\n }\n if (!inEmittingFrame && !passEmitsToParent) {\n return () => {\n };\n }\n if (mousemoveWait !== void 0 && sampling.mousemove === void 0) {\n sampling.mousemove = mousemoveWait;\n }\n mirror.reset();\n const excludeAttribute = _excludeAttribute === void 0 ? /.^/ : _excludeAttribute;\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n "datetime-local": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n password: true\n } : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };\n const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaVerification: true,\n // the following are off for slimDOMOptions === true,\n // as they destroy some (hidden) info:\n headMetaAuthorship: _slimDOMOptions === "all",\n headMetaDescKeywords: _slimDOMOptions === "all",\n headTitleMutations: _slimDOMOptions === "all"\n } : _slimDOMOptions ? _slimDOMOptions : {};\n polyfill$1();\n let lastFullSnapshotEvent;\n let incrementalSnapshotCount = 0;\n let recentVisibilityChanges = 0;\n const onVisibilityActivity = (count) => {\n recentVisibilityChanges += count;\n };\n const eventProcessor = (e2) => {\n for (const plugin3 of plugins || []) {\n if (plugin3.eventProcessor) {\n e2 = plugin3.eventProcessor(e2);\n }\n }\n if (packFn && // Disable packing events which will be emitted to parent frames.\n !passEmitsToParent) {\n e2 = packFn(e2);\n }\n return e2;\n };\n wrappedEmit = (r2, isCheckout) => {\n var _a2;\n const e2 = r2;\n e2.timestamp = nowTimestamp();\n if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {\n mutationBuffers.forEach((buf) => buf.unfreeze());\n }\n if (inEmittingFrame) {\n emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);\n } else if (passEmitsToParent) {\n const message = {\n type: "rrweb",\n event: eventProcessor(e2),\n origin: window.location.origin,\n isCheckout\n };\n window.parent.postMessage(message, "*");\n }\n if (e2.type === EventType.FullSnapshot) {\n lastFullSnapshotEvent = e2;\n incrementalSnapshotCount = 0;\n } else if (e2.type === EventType.IncrementalSnapshot) {\n if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) {\n return;\n }\n incrementalSnapshotCount++;\n const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;\n const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;\n const exceedVisibility = checkoutEveryNvm && recentVisibilityChanges >= checkoutEveryNvm;\n if (exceedCount || exceedTime || exceedVisibility) {\n if (exceedVisibility) {\n recentVisibilityChanges = 0;\n }\n takeFullSnapshot$1(true);\n }\n }\n };\n const wrappedMutationEmit = (m) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.Mutation\n }, m)\n });\n };\n const wrappedScrollEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.Scroll\n }, p)\n });\n const wrappedCanvasMutationEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.CanvasMutation\n }, p)\n });\n const wrappedVisibilityMutationEmit = (p) => {\n var _a2;\n (_a2 = hooks == null ? void 0 : hooks.visibilityMutation) == null ? void 0 : _a2.call(hooks, p);\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.VisibilityMutation\n }, p)\n });\n };\n const wrappedAdoptedStyleSheetEmit = (a2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.AdoptedStyleSheet\n }, a2)\n });\n const stylesheetManager = new StylesheetManager({\n mutationCb: wrappedMutationEmit,\n adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit\n });\n const iframeManager = new IframeManager({\n mirror,\n mutationCb: wrappedMutationEmit,\n stylesheetManager,\n recordCrossOriginIframes,\n wrappedEmit\n });\n for (const plugin3 of plugins || []) {\n if (plugin3.getMirror)\n plugin3.getMirror({\n nodeMirror: mirror,\n crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,\n crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror\n });\n }\n const processedNodeManager = new ProcessedNodeManager();\n canvasManager = new CanvasManager({\n recordCanvas,\n mutationCb: wrappedCanvasMutationEmit,\n win: window,\n blockClass,\n blockSelector,\n mirror,\n sampling: sampling.canvas,\n dataURLOptions\n });\n visibilityManager = new VisibilityManager({\n doc: window.document,\n mirror,\n sampling: sampling.visibility,\n mutationCb: wrappedVisibilityMutationEmit,\n notifyActivity: onVisibilityActivity\n });\n const shadowDomManager = new ShadowDomManager({\n mutationCb: wrappedMutationEmit,\n scrollCb: wrappedScrollEmit,\n bypassOptions: {\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n inlineStylesheet,\n maskInputOptions,\n dataURLOptions,\n maskTextFn,\n maskInputFn,\n recordCanvas,\n inlineImages,\n sampling,\n slimDOMOptions,\n iframeManager,\n stylesheetManager,\n canvasManager,\n visibilityManager,\n keepIframeSrcFn,\n processedNodeManager\n },\n mirror\n });\n takeFullSnapshot$1 = (isCheckout = false) => {\n if (!recordDOM) {\n return;\n }\n wrappedEmit(\n {\n type: EventType.Meta,\n data: {\n href: window.location.href,\n width: getWindowWidth(),\n height: getWindowHeight()\n }\n },\n isCheckout\n );\n stylesheetManager.reset();\n shadowDomManager.init();\n mutationBuffers.forEach((buf) => buf.lock());\n const node2 = snapshot(document, {\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n inlineStylesheet,\n maskAllInputs: maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOM: slimDOMOptions,\n dataURLOptions,\n recordCanvas,\n inlineImages,\n onSerialize: (n2) => {\n if (isSerializedIframe(n2, mirror)) {\n iframeManager.addIframe(n2);\n }\n if (isSerializedStylesheet(n2, mirror)) {\n stylesheetManager.trackLinkElement(n2);\n }\n if (hasShadowRoot(n2)) {\n shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n iframeManager.attachIframe(iframe, childSn);\n shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (linkEl, childSn) => {\n stylesheetManager.attachLinkElement(linkEl, childSn);\n },\n keepIframeSrcFn\n });\n if (!node2) {\n return console.warn("Failed to snapshot the document");\n }\n wrappedEmit(\n {\n type: EventType.FullSnapshot,\n data: {\n node: node2,\n initialOffset: getWindowScroll(window)\n }\n },\n isCheckout\n );\n mutationBuffers.forEach((buf) => buf.unlock());\n if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)\n stylesheetManager.adoptStyleSheets(\n document.adoptedStyleSheets,\n mirror.getId(document)\n );\n };\n flushCustomEventQueue = () => {\n for (const e2 of customEventQueue) {\n wrappedEmit(e2);\n }\n customEventQueue.length = 0;\n };\n try {\n const handlers = [];\n const observe = (doc) => {\n var _a2;\n return callbackWrapper(initObservers)(\n {\n mutationCb: wrappedMutationEmit,\n mousemoveCb: (positions, source) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source,\n positions\n }\n }),\n mouseInteractionCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.MouseInteraction\n }, d)\n }),\n scrollCb: wrappedScrollEmit,\n viewportResizeCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.ViewportResize\n }, d)\n }),\n inputCb: (v2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.Input\n }, v2)\n }),\n mediaInteractionCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.MediaInteraction\n }, p)\n }),\n styleSheetRuleCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.StyleSheetRule\n }, r2)\n }),\n styleDeclarationCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.StyleDeclaration\n }, r2)\n }),\n canvasMutationCb: wrappedCanvasMutationEmit,\n visibilityMutationCb: wrappedVisibilityMutationEmit,\n fontCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.Font\n }, p)\n }),\n selectionCb: (p) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.Selection\n }, p)\n });\n },\n customElementCb: (c2) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: __spreadValues({\n source: IncrementalSource.CustomElement\n }, c2)\n });\n },\n blockClass,\n ignoreClass,\n ignoreSelector,\n maskTextClass,\n maskTextSelector,\n excludeAttribute,\n maskInputOptions,\n inlineStylesheet,\n sampling,\n recordDOM,\n recordCanvas,\n inlineImages,\n userTriggeredOnInput,\n collectFonts,\n doc,\n maskInputFn,\n maskTextFn,\n keepIframeSrcFn,\n blockSelector,\n slimDOMOptions,\n dataURLOptions,\n mirror,\n iframeManager,\n stylesheetManager,\n shadowDomManager,\n processedNodeManager,\n canvasManager,\n visibilityManager,\n ignoreCSSAttributes,\n plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({\n observer: p.observer,\n options: p.options,\n callback: (payload) => wrappedEmit({\n type: EventType.Plugin,\n data: {\n plugin: p.name,\n payload\n }\n })\n }))) || []\n },\n hooks\n );\n };\n iframeManager.addLoadListener((iframeEl) => {\n try {\n handlers.push(observe(iframeEl.contentDocument));\n } catch (error) {\n console.warn(error);\n }\n });\n const init = () => {\n if (flushCustomEvent === "before") {\n flushCustomEventQueue();\n }\n takeFullSnapshot$1();\n handlers.push(observe(document));\n recording = true;\n if (flushCustomEvent === "after") {\n flushCustomEventQueue();\n }\n };\n if (document.readyState === "interactive" || document.readyState === "complete") {\n init();\n } else {\n handlers.push(\n on("DOMContentLoaded", () => {\n wrappedEmit({\n type: EventType.DomContentLoaded,\n data: {}\n });\n if (recordAfter === "DOMContentLoaded") init();\n })\n );\n handlers.push(\n on(\n "load",\n () => {\n wrappedEmit({\n type: EventType.Load,\n data: {}\n });\n if (recordAfter === "load") init();\n },\n window\n )\n );\n }\n return () => {\n flushCustomEventQueue();\n handlers.forEach((h) => h());\n processedNodeManager.destroy();\n recording = false;\n unregisterErrorHandler();\n };\n } catch (error) {\n console.warn(error);\n }\n}\nrecord.flushCustomEventQueue = () => {\n console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);\n flushCustomEventQueue();\n};\nrecord.addCustomEvent = (tag, payload) => {\n const customEvent = {\n type: EventType.Custom,\n data: {\n tag,\n payload\n }\n };\n if (!recording) {\n console.warn(`[rrweb] CustomEvent buffered before/after recording start: ${tag}`);\n customEventQueue.push(customEvent);\n return;\n }\n wrappedEmit(customEvent);\n};\nrecord.freezePage = () => {\n mutationBuffers.forEach((buf) => buf.freeze());\n};\nrecord.takeFullSnapshot = (isCheckout) => {\n if (!recording) {\n throw new Error("please take full snapshot after start recording");\n }\n takeFullSnapshot$1(isCheckout);\n};\nrecord.mirror = mirror;\nvar n;\n!function(t2) {\n t2[t2.NotStarted = 0] = "NotStarted", t2[t2.Running = 1] = "Running", t2[t2.Stopped = 2] = "Stopped";\n}(n || (n = {}));\nexports.record = record;\nif (typeof module.exports == "object" && typeof exports == "object") {\n var __cp = (to, from, except, desc) => {\n if ((from && typeof from === "object") || typeof from === "function") {\n for (let key of Object.getOwnPropertyNames(from)) {\n if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)\n Object.defineProperty(to, key, {\n get: () => from[key],\n enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,\n });\n }\n }\n return to;\n };\n module.exports = __cp(module.exports, exports);\n}\nreturn module.exports;\n}))\n//# sourceMappingURL=rrweb-record.umd.cjs.map\n';
132
+ class RRWebRecorder {
133
+ constructor() {
134
+ __publicField(this, "recordFn", null);
135
+ __publicField(this, "stopFn", null);
136
+ __publicField(this, "targetWindow", null);
137
+ __publicField(this, "context");
138
+ __publicField(this, "eventCounter", 0);
139
+ __publicField(this, "events", []);
140
+ __publicField(this, "pendingEvents", []);
141
+ this.context = {
142
+ pushEvent: (event) => this.events.push(event)
143
+ };
144
+ }
145
+ handleEmit(event) {
146
+ if (event.type === 0 || event.type === 1) {
147
+ return;
148
+ }
149
+ const rrEvent = {
150
+ ...event
151
+ };
152
+ this.context.pushEvent(rrEvent);
153
+ }
154
+ inject(win) {
155
+ const w = win;
156
+ this.targetWindow = win;
157
+ if (w.rrweb) {
158
+ this.recordFn = w.rrweb.record ?? null;
159
+ return;
160
+ }
161
+ const script = win.document.createElement("script");
162
+ script.type = "text/javascript";
163
+ script.innerHTML = rrSrc;
164
+ win.document.head.appendChild(script);
165
+ const recheck = win.rrweb;
166
+ if (!recheck || !recheck.record) {
167
+ console.error(`🟡 [rrweb] Failed to load rrweb.record`);
168
+ return;
169
+ }
170
+ this.recordFn = recheck.record;
171
+ }
172
+ start() {
173
+ if (!this.targetWindow || !this.recordFn) {
174
+ console.warn(`🟡 [rrweb] Not ready to start`);
175
+ return;
176
+ }
177
+ if (this.stopFn) {
178
+ console.warn(`🟡 [rrweb] Already recording`);
179
+ return;
180
+ }
181
+ this.stopFn = this.recordFn({
182
+ emit: (event) => this.handleEmit(event),
183
+ checkoutEveryNvm: 10,
184
+ plugins: [
185
+ getRecordSequentialIdPlugin({
186
+ key: "id",
187
+ getId: () => ++this.eventCounter
188
+ })
189
+ ],
190
+ // includeAttribute: /data-(cy|test(id)?|cypress|highlight-el|cypress-el)/i,
191
+ maskInputOptions: { password: true },
192
+ slimDOMOptions: "all",
193
+ inlineStylesheet: true,
194
+ sampling: {
195
+ mousemove: false,
196
+ mouseInteraction: {
197
+ MouseUp: false,
198
+ MouseDown: false,
199
+ Click: true,
200
+ ContextMenu: true,
201
+ DblClick: true,
202
+ Focus: true,
203
+ Blur: true,
204
+ TouchStart: false,
205
+ TouchEnd: false
206
+ },
207
+ scroll: 1e3,
208
+ media: 1e3,
209
+ input: "last",
210
+ canvas: "all",
211
+ visibility: {
212
+ mode: "debounce",
213
+ debounce: 100,
214
+ threshold: 0.5,
215
+ sensitivity: 0.05,
216
+ rafThrottle: 50
217
+ }
218
+ },
219
+ recordDOM: true,
220
+ recordCanvas: true,
221
+ collectFonts: true,
222
+ inlineImages: true,
223
+ flushCustomEvent: "after",
224
+ recordAfter: "DOMContentLoaded"
225
+ });
226
+ this.flush();
227
+ }
228
+ stop() {
229
+ var _a;
230
+ this.flush();
231
+ (_a = this.stopFn) == null ? void 0 : _a.call(this);
232
+ this.stopFn = null;
233
+ }
234
+ reset() {
235
+ this.eventCounter = 0;
236
+ this.events = [];
237
+ this.stop();
238
+ this.context = {
239
+ pushEvent: (event) => this.events.push(event)
240
+ };
241
+ }
242
+ flush() {
243
+ if (!this.recordFn) return;
244
+ const stillPending = [];
245
+ for (const evt of this.pendingEvents) {
246
+ try {
247
+ this.recordFn.addCustomEvent(evt.tag, evt.payload);
248
+ } catch (err) {
249
+ console.warn(`[rrweb] flush failed for custom event: ${evt.tag}`);
250
+ stillPending.push(evt);
251
+ }
252
+ }
253
+ this.pendingEvents = stillPending;
254
+ }
255
+ addCustomEvent(tag, payload) {
256
+ const event = { tag, payload };
257
+ if (!this.recordFn || !this.stopFn) {
258
+ console.warn(`[rrweb] queued custom event (recorder not ready): ${tag}`);
259
+ this.pendingEvents.push(event);
260
+ return;
261
+ }
262
+ try {
263
+ this.recordFn.addCustomEvent(tag, payload);
264
+ } catch (error) {
265
+ console.warn(`[rrweb] error adding custom event: ${tag}`, error);
266
+ this.pendingEvents.push(event);
267
+ }
268
+ }
269
+ isRecordingReady() {
270
+ return !!this.recordFn && !!this.stopFn;
271
+ }
272
+ getEvents() {
273
+ return this.events;
274
+ }
275
+ getMirror() {
276
+ var _a;
277
+ return (_a = this.recordFn) == null ? void 0 : _a.mirror;
278
+ }
279
+ bind(ctx) {
280
+ this.context = ctx;
281
+ }
282
+ setEventCounter(value) {
283
+ this.eventCounter = value;
284
+ }
285
+ }
286
+ const recorder = new RRWebRecorder();
287
+ const registerCypressEventListeners = () => {
288
+ Cypress.on("test:before:run", onTestBeforeRun).on("log:added", onLogAdded).on("log:changed", onLogChanged).on("window:before:load", onWindowBeforeLoad).on("window:before:unload", onWindowBeforeUnload).on("window:unload", onWindowUnload).on("window:load", onWindowLoad).on("command:enqueued", onCommandEnqueued).on("command:start", onCommandStart).on("command:end", onCommandEnd).on("command:retry", onCommandRetry).on("skipped:command:end", onSkippedCommandEnd).on("test:after:run", onTestAfterRun).on("command:failed", onCommandFailed).on("command:queue:end", onCommandQueueEnd).on("fail", onFail);
289
+ afterEach(() => {
290
+ const currentTest = Cypress.currentTest;
291
+ if (!currentTest) return;
292
+ const testKey = getTestKey({ titlePath: () => currentTest.titlePath });
293
+ const ctx = getCurrentTestContext(testKey);
294
+ if (!ctx) return;
295
+ ctx.recorderEvents.map((event) => {
296
+ if (event.type !== 5) return event;
297
+ const liveCommand = ctx.commandLiveRefs.get(event.data.payload.id);
298
+ event.data.payload.state = (liveCommand == null ? void 0 : liveCommand.state) ?? "unknown";
299
+ event.data.payload.args = safeSerializeArray(liveCommand == null ? void 0 : liveCommand.get("args"));
300
+ event.data.payload.query = liveCommand == null ? void 0 : liveCommand.get("query");
301
+ event.data.payload.timeout = liveCommand == null ? void 0 : liveCommand.get("timeout");
302
+ event.data.payload.name = liveCommand == null ? void 0 : liveCommand.get("name");
303
+ event.data.payload.type = liveCommand == null ? void 0 : liveCommand.get("type");
304
+ if (liveCommand == null ? void 0 : liveCommand.get("prev")) {
305
+ event.data.payload.prev = {
306
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
307
+ // @ts-ignore
308
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
309
+ state: liveCommand == null ? void 0 : liveCommand.get("prev").state,
310
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
311
+ // @ts-ignore
312
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
313
+ name: liveCommand == null ? void 0 : liveCommand.get("prev").get("name"),
314
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
315
+ // @ts-ignore
316
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
317
+ args: safeSerializeArray(liveCommand == null ? void 0 : liveCommand.get("prev").get("args")),
318
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
319
+ // @ts-ignore
320
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
321
+ type: liveCommand == null ? void 0 : liveCommand.get("prev").get("type"),
322
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
323
+ // @ts-ignore
324
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
325
+ query: liveCommand == null ? void 0 : liveCommand.get("prev").get("query"),
326
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
327
+ // @ts-ignore
328
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
329
+ id: liveCommand == null ? void 0 : liveCommand.get("prev").get("id")
330
+ };
331
+ }
332
+ if (liveCommand == null ? void 0 : liveCommand.get("next")) {
333
+ event.data.payload.next = {
334
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
335
+ // @ts-ignore
336
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
337
+ state: liveCommand == null ? void 0 : liveCommand.get("next").state,
338
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
339
+ // @ts-ignore
340
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
341
+ name: liveCommand == null ? void 0 : liveCommand.get("next").get("name"),
342
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
343
+ // @ts-ignore
344
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
345
+ args: safeSerializeArray(liveCommand == null ? void 0 : liveCommand.get("next").get("args")),
346
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
347
+ // @ts-ignore
348
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
349
+ type: liveCommand == null ? void 0 : liveCommand.get("next").get("type"),
350
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
351
+ // @ts-ignore
352
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
353
+ query: liveCommand == null ? void 0 : liveCommand.get("next").get("query"),
354
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
355
+ // @ts-ignore
356
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument
357
+ id: liveCommand == null ? void 0 : liveCommand.get("next").get("id")
358
+ };
359
+ }
360
+ return event;
361
+ });
362
+ console.debug(`🟡 [${Date.now()}] [cypress] afterEach:`, ctx.recorderEvents);
363
+ const testRunResult = mapTestRunContextToResult(ctx);
364
+ cy.task("saveRRWebReport", testRunResult, { log: false });
365
+ });
366
+ Cypress.Commands.overwrite("type", (originalFn, subject, text, options) => {
367
+ return originalFn(subject, text, options).then(() => {
368
+ if (Cypress.dom.isElement(subject[0])) {
369
+ const el = subject[0];
370
+ if (el) {
371
+ el.dispatchEvent(new Event("input", { bubbles: true }));
372
+ el.dispatchEvent(new Event("change", { bubbles: true }));
373
+ }
374
+ }
375
+ });
376
+ });
377
+ };
378
+ const onTestBeforeRun = (attributes, test) => {
379
+ const testKey = getTestKey(test);
380
+ const testRunContext = {
381
+ spec: Cypress.spec,
382
+ test,
383
+ browser: Cypress.browser,
384
+ autWindow: null,
385
+ waitForPaint: () => Promise.resolve(void 0),
386
+ paintComplete: false,
387
+ recorderEvents: [],
388
+ commandLiveRefs: /* @__PURE__ */ new Map()
389
+ };
390
+ setCurrentTestContext(testKey, testRunContext);
391
+ recorder.bind({
392
+ pushEvent: (event) => {
393
+ console.debug(`🟡 [${Date.now()}] [cypress] pushEvent`, event);
394
+ testRunContext.recorderEvents.push(event);
395
+ if (event.type === 5) {
396
+ const liveCommand = testRunContext.commandLiveRefs.get(event.data.payload.id);
397
+ const subject = liveCommand == null ? void 0 : liveCommand.get("subject");
398
+ const selector = (subject == null ? void 0 : subject.selector) ?? buildSelector(subject);
399
+ const mirror = recorder.getMirror();
400
+ const element = mirror == null ? void 0 : mirror.getMeta(subject == null ? void 0 : subject[0]);
401
+ event.data.payload.element = {
402
+ ...element,
403
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
404
+ selector,
405
+ childNodes: []
406
+ };
407
+ }
408
+ }
409
+ });
410
+ };
411
+ const onLogAdded = (attributes, log) => {
412
+ };
413
+ const onLogChanged = (attributes, log) => {
414
+ };
415
+ const onWindowBeforeUnload = (event) => {
416
+ };
417
+ const onWindowUnload = (event) => {
418
+ try {
419
+ recorder.stop();
420
+ } catch (e) {
421
+ }
422
+ };
423
+ const onWindowBeforeLoad = (win) => {
424
+ recorder.inject(win);
425
+ const currentTest = Cypress.currentTest;
426
+ if (!currentTest) return;
427
+ const testKey = getTestKey({ titlePath: () => currentTest.titlePath });
428
+ const ctx = getCurrentTestContext(testKey);
429
+ if (!ctx) return;
430
+ ctx.autWindow = win;
431
+ ctx.paintComplete = false;
432
+ };
433
+ const onWindowLoad = (win) => {
434
+ recorder.inject(win);
435
+ const currentTest = Cypress.currentTest;
436
+ if (!currentTest) return;
437
+ const testKey = getTestKey({ titlePath: () => currentTest.titlePath });
438
+ const ctx = getCurrentTestContext(testKey);
439
+ if (!ctx) return;
440
+ if (!ctx.autWindow) {
441
+ ctx.autWindow = win;
442
+ ctx.paintComplete = false;
443
+ }
444
+ ctx.waitForPaint = (value) => {
445
+ return new Promise((resolve) => {
446
+ const maxWaitMs = 5e3;
447
+ const captureAfterPaint = () => {
448
+ requestAnimationFrame(() => {
449
+ requestAnimationFrame(() => {
450
+ resolve(value);
451
+ });
452
+ });
453
+ };
454
+ const safeResolve = /* @__PURE__ */ (() => {
455
+ let called = false;
456
+ return () => {
457
+ if (!called) {
458
+ called = true;
459
+ captureAfterPaint();
460
+ }
461
+ };
462
+ })();
463
+ if (["interactive", "complete"].includes(win.document.readyState)) {
464
+ safeResolve();
465
+ } else {
466
+ win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
467
+ win.addEventListener("load", safeResolve, { once: true });
468
+ setTimeout(() => {
469
+ console.warn("⏳ Timeout: forcing resolution");
470
+ safeResolve();
471
+ }, maxWaitMs);
472
+ }
473
+ });
474
+ };
475
+ void ctx.waitForPaint().then(async () => {
476
+ ctx.paintComplete = true;
477
+ recorder.start();
478
+ });
479
+ };
480
+ const onCommandEnqueued = (command) => {
481
+ };
482
+ const onCommandRetry = (command) => {
483
+ };
484
+ const onCommandStart = (command) => {
485
+ const currentTest = Cypress.currentTest;
486
+ if (!currentTest) return;
487
+ const testKey = getTestKey({ titlePath: () => currentTest.titlePath });
488
+ const ctx = getCurrentTestContext(testKey);
489
+ if (!ctx) return;
490
+ ctx.commandLiveRefs.set(command.attributes.id, command);
491
+ };
492
+ const onCommandEnd = (command) => {
493
+ console.debug(`🟡 [${Date.now()}] [cypress] onCommandEnd`, command);
494
+ recorder.addCustomEvent(`${command.attributes.name}`, {
495
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
496
+ id: command.attributes.id
497
+ });
498
+ };
499
+ const onCommandFailed = (command, err) => {
500
+ recorder.addCustomEvent(`${command.attributes.name}`, {
501
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
502
+ id: command.attributes.id
503
+ });
504
+ };
505
+ const onSkippedCommandEnd = (command) => {
506
+ };
507
+ const onCommandQueueEnd = () => {
508
+ };
509
+ const onFail = (error, mocha) => {
510
+ throw error;
511
+ };
512
+ const onTestAfterRun = async (attributes, test) => {
513
+ recorder.stop();
514
+ };
515
+ const registerMochaEventListeners = () => {
516
+ Cypress.mocha.getRunner().on("hook", onHook);
517
+ };
518
+ const onHook = () => {
519
+ };
520
+ const injectMochaHookFunctions = () => {
521
+ beforeEach("", () => {
522
+ });
523
+ afterEach("", () => {
524
+ });
525
+ };
526
+ const enableTestmap = () => {
527
+ registerCypressEventListeners();
528
+ registerMochaEventListeners();
529
+ injectMochaHookFunctions();
530
+ };
531
+ const initializeTestmap = () => {
532
+ enableTestmap();
533
+ };
534
+ export {
535
+ initializeTestmap
536
+ };
537
+ //# sourceMappingURL=rrweb-cypress-plugin.js.map