@drip-apex/sdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/bundle-report.json +584 -226
- package/dist/define.cjs +123 -0
- package/dist/define.cjs.map +7 -0
- package/dist/define.mjs +102 -0
- package/dist/define.mjs.map +7 -0
- package/dist/drip.cjs +19262 -0
- package/dist/drip.cjs.map +7 -0
- package/dist/drip.debug.js +1 -1
- package/dist/drip.debug.js.map +1 -1
- package/dist/drip.heatmap.js +1 -1
- package/dist/drip.heatmap.js.map +1 -1
- package/dist/drip.js +1 -1
- package/dist/drip.js.map +1 -1
- package/dist/drip.live.js +1 -1
- package/dist/drip.live.js.map +1 -1
- package/dist/drip.mjs +19246 -0
- package/dist/drip.mjs.map +7 -0
- package/dist/drip.replay-recorder.js +2 -0
- package/dist/drip.replay-recorder.js.map +1 -0
- package/dist/editor.js +147 -142
- package/dist/editor.js.map +4 -4
- package/dist/flags.cjs +1788 -0
- package/dist/flags.cjs.map +7 -0
- package/dist/flags.mjs +1765 -0
- package/dist/flags.mjs.map +7 -0
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +2 -2
- package/dist/metafiles/define.cjs.meta.json +28 -0
- package/dist/metafiles/define.mjs.meta.json +32 -0
- package/dist/metafiles/drip.cjs.meta.json +3193 -0
- package/dist/metafiles/drip.debug.meta.json +2859 -574
- package/dist/metafiles/drip.heatmap.meta.json +2732 -460
- package/dist/metafiles/drip.live.meta.json +2732 -460
- package/dist/metafiles/drip.meta.json +2859 -574
- package/dist/metafiles/drip.mjs.meta.json +3235 -0
- package/dist/metafiles/drip.replay-recorder.meta.json +82 -0
- package/dist/metafiles/editor.meta.json +67 -27
- package/dist/metafiles/flags.cjs.meta.json +220 -0
- package/dist/metafiles/flags.mjs.meta.json +225 -0
- package/dist/metafiles/index.meta.json +2717 -491
- package/dist/metafiles/index.mjs.meta.json +14 -4
- package/dist/react/index.js +16621 -13539
- package/dist/react/index.js.map +4 -4
- package/dist/sri.json +20 -15
- package/dist/types/activation-runtime.d.ts +91 -0
- package/dist/types/analytics-runtime.d.ts +166 -0
- package/dist/types/antiflicker.d.ts +9 -3
- package/dist/types/assignment-cookie-sync.d.ts +31 -0
- package/dist/types/assignment-runtime.d.ts +257 -0
- package/dist/types/assignment-store.d.ts +4 -8
- package/dist/types/bucket.d.ts +1 -2
- package/dist/types/compact-store.d.ts +1 -0
- package/dist/types/config-runtime.d.ts +313 -0
- package/dist/types/consent-evaluation.d.ts +27 -0
- package/dist/types/css.d.ts +5 -3
- package/dist/types/debug-loader.d.ts +2 -0
- package/dist/types/decide-assignments.d.ts +31 -0
- package/dist/types/delivery-timing.d.ts +8 -0
- package/dist/types/early-interaction-capture.d.ts +79 -0
- package/dist/types/early-reassert.d.ts +32 -0
- package/dist/types/edge-runtime.d.ts +11 -0
- package/dist/types/editor/api.d.ts +3 -0
- package/dist/types/editor/controller.d.ts +3 -1
- package/dist/types/editor/publication-result.d.ts +11 -0
- package/dist/types/editor/types.d.ts +2 -1
- package/dist/types/editor/view-kit.d.ts +1 -1
- package/dist/types/endpoint.d.ts +8 -0
- package/dist/types/exclusion-groups.d.ts +4 -7
- package/dist/types/flags.d.ts +2 -0
- package/dist/types/goal-eligibility.d.ts +4 -0
- package/dist/types/goals.d.ts +10 -1
- package/dist/types/guards.d.ts +7 -7
- package/dist/types/handover.d.ts +12 -1
- package/dist/types/hash.d.ts +8 -4
- package/dist/types/hydration.d.ts +2 -1
- package/dist/types/index.d.ts +24 -128
- package/dist/types/init-test-helpers.d.ts +48 -0
- package/dist/types/inline-bootstrap.d.ts +26 -0
- package/dist/types/js.d.ts +3 -1
- package/dist/types/money.d.ts +12 -0
- package/dist/types/mutate.d.ts +45 -6
- package/dist/types/performance.d.ts +2 -0
- package/dist/types/persistence-decoders.d.ts +12 -0
- package/dist/types/public-api.d.ts +209 -0
- package/dist/types/qa-assistant-state.d.ts +34 -0
- package/dist/types/react/index.d.ts +28 -3
- package/dist/types/reassert-sentinel.d.ts +6 -0
- package/dist/types/redirect.d.ts +48 -0
- package/dist/types/replay-recorder-entry.d.ts +1 -0
- package/dist/types/replay-signal-state.d.ts +6 -0
- package/dist/types/replay-signals.d.ts +13 -0
- package/dist/types/replay.d.ts +110 -0
- package/dist/types/router.d.ts +12 -2
- package/dist/types/runtime-state.d.ts +166 -0
- package/dist/types/sanitize.d.ts +1 -0
- package/dist/types/shadow.d.ts +3 -0
- package/dist/types/shopify-cart.d.ts +25 -1
- package/dist/types/storefront-vitals.d.ts +24 -0
- package/dist/types/targeting-diagnostics.d.ts +1 -0
- package/dist/types/targeting.d.ts +16 -2
- package/dist/types/track.d.ts +15 -1
- package/dist/types/types.d.ts +115 -9
- package/dist/types/wait.d.ts +14 -1
- package/dist/types/weekday-schedule.d.ts +3 -0
- package/package.json +17 -8
- package/src/activation-runtime.ts +2737 -0
- package/src/analytics-runtime.ts +2175 -0
- package/src/antiflicker.test.ts +216 -44
- package/src/antiflicker.ts +103 -28
- package/src/artifact-concurrency.test.ts +1091 -0
- package/src/assignment-cookie-sync.test.ts +202 -0
- package/src/assignment-cookie-sync.ts +189 -0
- package/src/assignment-runtime.ts +3204 -0
- package/src/assignment-store.test.ts +56 -0
- package/src/assignment-store.ts +7 -38
- package/src/bucket.ts +3 -18
- package/src/commerce-analytics-lifecycle.test.ts +75 -15
- package/src/commerce-config-lifecycle.test.ts +81 -1
- package/src/commerce-price-preserve.test.ts +133 -0
- package/src/commerce-price.test.ts +97 -0
- package/src/commerce-price.ts +74 -20
- package/src/commerce-shipping.test.ts +53 -0
- package/src/commerce-shipping.ts +5 -11
- package/src/compact-store.ts +15 -0
- package/src/config-fetch.test.ts +480 -9
- package/src/config-runtime.ts +2070 -0
- package/src/consent-evaluation-cookiescript.test.ts +50 -0
- package/src/consent-evaluation.ts +138 -0
- package/src/css.test.ts +30 -0
- package/src/css.ts +120 -6
- package/src/cwv.test.ts +60 -77
- package/src/debug-loader.test.ts +214 -0
- package/src/debug-loader.ts +41 -0
- package/src/decide-assignments.test.ts +196 -0
- package/src/decide-assignments.ts +204 -0
- package/src/delivery-timing.test.ts +104 -0
- package/src/delivery-timing.ts +89 -0
- package/src/early-interaction-capture.test.ts +451 -0
- package/src/early-interaction-capture.ts +230 -0
- package/src/early-reassert.test.ts +207 -0
- package/src/early-reassert.ts +152 -0
- package/src/edge-adoption.test.ts +435 -0
- package/src/edge-runtime.ts +30 -0
- package/src/editor/api.test.ts +109 -0
- package/src/editor/api.ts +34 -3
- package/src/editor/controller.test.ts +297 -14
- package/src/editor/controller.ts +69 -5
- package/src/editor/index.test.ts +2 -0
- package/src/editor/index.ts +1 -0
- package/src/editor/publication-result.ts +58 -0
- package/src/editor/types.ts +10 -1
- package/src/editor/view-kit.ts +2 -1
- package/src/editor/view.test.ts +108 -0
- package/src/editor/view.ts +49 -7
- package/src/endpoint.test.ts +15 -0
- package/src/endpoint.ts +10 -0
- package/src/exclusion-groups.ts +8 -18
- package/src/flags.test.ts +88 -1
- package/src/flags.ts +29 -29
- package/src/global-runtime-reconciler.test.ts +271 -0
- package/src/goal-eligibility.test.ts +29 -0
- package/src/goal-eligibility.ts +17 -0
- package/src/goals.test.ts +144 -1
- package/src/goals.ts +97 -18
- package/src/guards.test.ts +99 -1
- package/src/guards.ts +34 -15
- package/src/handover-cache-order.test.ts +6 -3
- package/src/handover.test.ts +154 -8
- package/src/handover.ts +122 -12
- package/src/hash.ts +29 -54
- package/src/holdout.test.ts +26 -0
- package/src/hydration.test.ts +73 -2
- package/src/hydration.ts +18 -9
- package/src/index.ts +130 -7287
- package/src/init-analytics.test.ts +1694 -0
- package/src/init-anti-flicker.test.ts +1211 -0
- package/src/init-cart-attributes.test.ts +2003 -0
- package/src/init-config-resolution.test.ts +999 -0
- package/src/init-consent.test.ts +971 -0
- package/src/init-empty.test.ts +11 -5406
- package/src/init-integrations.test.ts +846 -0
- package/src/init-page-activation.test.ts +5064 -0
- package/src/init-qa-loading.test.ts +740 -0
- package/src/init-redirects.test.ts +2156 -0
- package/src/init-test-helpers.ts +287 -0
- package/src/inline-bootstrap.test.ts +184 -0
- package/src/inline-bootstrap.ts +73 -0
- package/src/js.test.ts +51 -1
- package/src/js.ts +86 -2
- package/src/money.test.ts +55 -1
- package/src/money.ts +104 -2
- package/src/money.web-parity.contract.test.ts +85 -0
- package/src/mutate.test.ts +474 -10
- package/src/mutate.ts +739 -230
- package/src/page-trigger.test.ts +218 -8
- package/src/performance.ts +10 -0
- package/src/persistence-decoders.ts +18 -0
- package/src/public-api.ts +1828 -0
- package/src/qa-assistant-state.test.ts +249 -3
- package/src/qa-assistant-state.ts +146 -6
- package/src/qa-assistant-view.test.ts +220 -2
- package/src/qa-assistant-view.ts +102 -5
- package/src/react/index.test.tsx +37 -0
- package/src/react/index.tsx +19 -3
- package/src/reassert-sentinel.test.ts +155 -1
- package/src/reassert-sentinel.ts +168 -8
- package/src/redirect.test.ts +541 -0
- package/src/redirect.ts +572 -0
- package/src/replay-recorder-entry.ts +115 -0
- package/src/replay-signal-state.ts +100 -0
- package/src/replay-signals.test.ts +249 -0
- package/src/replay-signals.ts +151 -0
- package/src/replay.test.ts +764 -0
- package/src/replay.ts +514 -0
- package/src/router.test.ts +61 -2
- package/src/router.ts +50 -12
- package/src/runtime-state.ts +507 -0
- package/src/runtime.test.ts +174 -7
- package/src/runtime.ts +88 -14
- package/src/sanitize.test.ts +34 -0
- package/src/sanitize.ts +23 -12
- package/src/shadow.test.ts +187 -0
- package/src/shadow.ts +99 -0
- package/src/shopify-cart.test.ts +733 -23
- package/src/shopify-cart.ts +402 -49
- package/src/storefront-vitals.test.ts +217 -0
- package/src/storefront-vitals.ts +206 -0
- package/src/surface-signals.ts +6 -0
- package/src/targeting-conformance.test.ts +9 -0
- package/src/targeting-diagnostics.ts +38 -8
- package/src/targeting-parity-corpus.json +559 -0
- package/src/targeting-parity-corpus.test.ts +18 -0
- package/src/targeting.detailed.test.ts +105 -0
- package/src/targeting.test.ts +211 -0
- package/src/targeting.ts +88 -207
- package/src/track.test.ts +147 -0
- package/src/track.ts +125 -26
- package/src/types.ts +120 -13
- package/src/wait.test.ts +23 -0
- package/src/wait.ts +129 -13
- package/src/weekday-delivery.test.ts +56 -0
- package/src/weekday-schedule-parity-corpus.json +92 -0
- package/src/weekday-schedule.test.ts +69 -0
- package/src/weekday-schedule.ts +20 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drip.replay-recorder.js","names":["_a","NodeType2","__defProp","Object","defineProperty","__publicField","obj","key","value","enumerable","configurable","writable","__defNormalProp","NodeType","Document","DocumentType","Element","Text","CDATA","Comment","testableAccessors","Node","ShadowRoot","MutationObserver","testableMethods","untaintedBasePrototype","untaintedBaseIframeCleanup","untaintedAccessorCache","getUntaintedAccessor","instance","accessor","cacheKey","String","call","untaintedPrototype","defaultObj","globalThis","defaultPrototype","prototype","accessorNames","isUntaintedAccessors","every","_b","getOwnPropertyDescriptor","get","toString","includes","methodNames","isUntaintedMethods","method","Zone","iframeEl","document","createElement","style","display","body","appendChild","win","contentWindow","untaintedObject","remove","ua","navigator","userAgent","classList","add","setAttribute","getUntaintedPrototype","untaintedAccessor","Date","now","test","index","n","isElement","nodeType","ELEMENT_NODE","isShadowRoot","hostEl","isNativeShadowDom","shadowRoot2","stringifyStylesheet","s","rules","cssRules","sheetHref","href","ownerNode","baseURI","cssText","replace","fixBrowserCompatibilityIssuesInCSS","Array","from","rule2","stringifyRule","join","isCSSImportRule","importStringified","styleSheet","split","length","statement","JSON","stringify","layerName","push","supportsText","media","mediaText","escapeImportStatement","absolutifyURLs","ruleStringified","isCSSStyleRule","selectorText","cssStringified","fixSafariColons","Mirror","constructor","this","Map","WeakMap","getId","getMeta","id","getNode","idNodeMap","getIds","keys","nodeMetaMap","removeNodeFromMap","delete","childNodes","forEach","childNode","has","hasNode","node2","meta","set","oldNode","reset","maskInputValue","element","maskInputOptions","tagName","type","maskInputFn","text","actualType","toLowerCase","repeat","str","ORIGINAL_ATTRIBUTE_NAME","getInputType","hasAttribute","extractFileExtension","path","baseURL","url","URL","window","location","match","pathname","URL_IN_CSS_REF","URL_PROTOCOL_MATCH","URL_WWW_MATCH","DATA_URI","origin","quote1","path1","quote2","path2","path3","filePath","maybeQuote","indexOf","slice","extractOrigin","filePathNoHash","maybeHash","substring","stack","parts","pop","part","normalizeCssString","_testNoPxNorm","_id","tagNameRegex","RegExp","genId","canvasService","canvasCtx","SRCSET_NOT_SPACES","SRCSET_COMMAS_OR_SPACES","cachedDocument","absoluteToDoc","doc","attributeValue","trim","getHref","isSVGElement","el","ownerSVGElement","customHref","a","startsWith","transformAttribute","name","pos","collectCharacters","regEx","chars","exec","output","descriptorsStr","inParens","c","charAt","getAbsoluteSrcsetString","ignoreAttribute","_value","classMatchesRegex","regex","checkAncestors","eIndex","className","needMaskingText","maskTextClass","maskTextSelector","closest","contains","matches","lowerIfExists","maybeAttr","slimDOMDefaults","_slimDOMOptions","script","comment","headFavicon","headWhitespace","headMetaSocial","headMetaRobots","headMetaHttpEquiv","headMetaVerification","headMetaAuthorship","headMetaDescKeywords","headTitleMutations","serializeNodeWithId","options","mirror","blockClass","blockSelector","skipChild","inlineStylesheet","maskTextFn","slimDOMOptions","dataURLOptions","inlineImages","recordCanvas","onSerialize","onIframeLoad","iframeLoadTimeout","onStylesheetLoad","stylesheetLoadTimeout","keepIframeSrcFn","newlyAddedElement","cssCaptured","needsMask","preserveWhiteSpace","_serializedNode","rootId","docId","getRootId","DOCUMENT_NODE","compatMode","DOCUMENT_TYPE_NODE","publicId","systemId","isCustomElement","needBlock","_isBlockedElement","HTMLFormElement","processedTagName","getValidTagName","attributes","len","i","attr","stylesheet","styleSheets","find","rel","_cssText","sheet","childNodes2","splits","iterCount","cssTextNorm","normFactor","textContent","textContentNorm","jLimit","j","startSubstring","cssNormSplits","splitNorm","prevTextContent","prevMinLength","k","Math","floor","normPart","max","splitCssText","markCssSplits","checked","selected","select","open","rr_open_mode","__context","canvas","ctx","getContext","x","width","y","height","getImageData","originalGetImageData","Uint32Array","min","data","buffer","some","pixel","is2DCanvasBlank","rr_dataURL","toDataURL","quality","canvasDataURL","blankCanvas","image","imageSrc","currentSrc","getAttribute","priorCrossOrigin","crossOrigin","recordInlineImage","removeEventListener","naturalWidth","naturalHeight","drawImage","err","complete","addEventListener","console","warn","removeAttribute","mediaAttributes","rr_mediaState","paused","rr_mediaCurrentTime","currentTime","rr_mediaPlaybackRate","playbackRate","rr_mediaMuted","muted","rr_mediaLoop","loop","rr_mediaVolume","volume","scrollLeft","rr_scrollLeft","scrollTop","rr_scrollTop","getBoundingClientRect","class","rr_width","rr_height","src","contentDocument","rr_src","customElements","isSVG","isCustom","serializeElementNode","TEXT_NODE","parent","parentTagName","textContent2","isStyle","isScript","serializeTextNode","CDATA_SECTION_NODE","COMMENT_NODE","serializeNode","sn","as","property","slimDOMExcluded","serializedNode","assign","recordChild","shadowRootEl","isShadowHost","bypassOptions","childN","serializedChildNode","isShadow","listener","readyState","fired","timer","setTimeout","clearTimeout","blankUrl","onceIframeLoaded","iframeDoc","serializedIframeNode","link","styleSheetLoadTimeout","styleSheetLoaded","onceStylesheetLoaded","serializedLinkNode","source","hasRequiredPicocolors_browser","cssSyntaxError","hasRequiredCssSyntaxError","picocolors_browser","exports","require$$2","__esModule","f","default","a2","Reflect","construct","arguments","apply","d","getAugmentedNamespace","freeze","__proto__","Symbol","toStringTag","requireCssSyntaxError","pico","create","isColorSupported","bold","dim","italic","underline","inverse","hidden","strikethrough","black","red","green","yellow","blue","magenta","cyan","white","gray","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","createColors","requirePicocolors_browser","terminalHighlight","CssSyntaxError","Error","message","line","column","file","plugin","super","reason","endLine","endColumn","setMessage","captureStackTrace","showSourceCode","color","css","mark","aside","lines","start","end","maxWidth","map","index2","number","gutter","spacing","code","hasRequiredSymbols","stringifier","hasRequiredStringifier","stringify_1","hasRequiredStringify","node","hasRequiredNode","declaration","hasRequiredDeclaration","nonSecure","hasRequiredNonSecure","previousMap","hasRequiredPreviousMap","input","hasRequiredInput","mapGenerator","hasRequiredMapGenerator","hasRequiredComment","container","hasRequiredContainer","document$1","hasRequiredDocument","warnOnce","hasRequiredWarnOnce","warning","hasRequiredWarning","result","hasRequiredResult","tokenize","hasRequiredTokenize","atRule","hasRequiredAtRule","root","hasRequiredRoot","list_1","hasRequiredList","rule","hasRequiredRule","parser","hasRequiredParser","parse_1","hasRequiredParse","lazyResult","hasRequiredLazyResult","noWorkResult","hasRequiredNoWorkResult","processor","hasRequiredProcessor","fromJSON_1","hasRequiredFromJSON","postcss_1","hasRequiredPostcss","symbols","requireSymbols","isClean","my","requireStringifier","DEFAULT_RAW","after","beforeClose","beforeComment","beforeDecl","beforeOpen","beforeRule","colon","commentLeft","commentRight","emptyBody","indent","semicolon","Stringifier","builder","atrule","params","rawValue","raws","afterName","nodes","block","between","beforeAfter","detect","raw","buf","depth","step","last","child","before","left","right","decl","string","prop","important","own","first","root2","rawCache","toUpperCase","walk","rawBeforeClose","rawBeforeComment","walkComments","rawBeforeDecl","walkDecls","rawBeforeOpen","rawBeforeRule","rawColon","rawEmptyBody","rawIndent","p","rawSemicolon","ownSemicolon","requireStringify","requireNode","cloneNode","cloned","hasOwnProperty","isArray","defaults","clone","append","addToError","error","postcssNode","insertAfter","overrides","insertBefore","cleanRaws","keepBetween","cloneAfter","cloneBefore","opts","rangeBy","getProxyProcessor","toProxy","markDirty","next","positionBy","stringRepresentation","positionInside","word","prev","endIndex","defaultType","removeChild","replaceWith","bookmark","foundSelf","result2","toJSON","_","inputs","fixed","emitInputs","inputsNextIndex","inputId","input2","proxyCache","Proxy","stringifier2","proxyOf","requireDeclaration","Declaration","variable","requirePreviousMap","SourceMapConsumer","SourceMapGenerator","existsSync","readFileSync","dirname","PreviousMap","loadAnnotation","inline","startWith","annotation","loadMap","mapFile","consumer","consumerCache","decodeInline","decodeURIComponent","substr","lastMatch","Buffer","atob","encoding","getAnnotationURL","sourceMapString","isMap","mappings","_mappings","sections","comments","lastIndexOf","loadFile","fromSourceMap","prevPath","withContent","sourcesContent","requireInput","fileURLToPath","pathToFileURL","isAbsolute","resolve","nanoid","size","random","customAlphabet","alphabet","defaultSize","fromOffsetCache","sourceMapAvailable","pathAvailable","Input","hasBOM","mapResolve","offset","fromOffset","col","lastLine","lineToIndex","prevIndex","l","mid","sourceRoot","to","fromUrl","originalPositionFor","protocol","sourceContentFor","json","registerInput","requireMapGenerator","relative","sep","cssString","mapOpts","originalCSS","usesFileUrls","absolute","memoizedFileURLs","memoizedPaths","memoizedURLs","addAnnotation","content","isInline","toBase64","outputFile","eol","applyPrevMaps","previous","toUrl","applySourceMap","clearAnnotation","generate","generateMap","generateString","ignoreInvalidMapping","addMapping","generated","original","isSourcesContent","setSourcesContent","isAnnotation","noSource","mapping","sourcePath","charCodeAt","cached","previousMaps","already","toFileUrl","setSourceContent","btoa","unescape","encodeURIComponent","fileURL","encodeURI","requireComment","requireContainer","parse","Rule","AtRule","Root","cleanSource","markDirtyUp","Container","children","normalize","each","callback","iterator","getIterator","indexes","condition","lastEach","args","cb","other","exist","existIndex","reverse","splice","sample","selector","rebuild","prepend","unshift","removeAll","replaceValues","pattern","props","fast","e","walkAtRules","walkRules","registerParse","dependant","registerRule","registerAtRule","registerRoot","setPrototypeOf","requireDocument","LazyResult","Processor","toResult","registerLazyResult","registerProcessor","requireWarnOnce","printed","requireWarning","Warning","range","opt","requireResult","Result","processor2","messages","lastPlugin","postcssPlugin","warning2","warnings","filter","requireAtRule","requireRoot","ignore","requireList","list","comma","space","separators","array","current","func","inQuote","prevQuote","escape","letter","requireRule","selectors","values","requireParse","Parser","tokenizer","RE_AT_END","RE_WORD_END","RE_BAD_BRACKET","RE_HEX_ESCAPE","quote","escaped","escapePos","currentToken","valueOf","ignoreErrors","returned","unclosed","what","back","token","endOfFile","nextToken","ignoreUnclosed","controlChar","fromCharCode","lastIndex","position","requireTokenize","SAFE_COMMENT_NEIGHBOR","empty","spaces","createTokenizer","unnamedAtrule","init","shift","brackets","getPosition","spacesAndCommentsFromEnd","spacesAndCommentsFromStart","checkMissedSemicolon","tokens","founded","entries","doubleColon","customProperty","findLastWithPosition","unknownWord","firstSpaces","precheckMissedSemicolon","stringFrom","spacesFromEnd","cache","concat","emptyRule","unexpectedClose","endFile","unclosedBlock","freeSemicolon","bracket","unclosedBracket","clean","reduce","all","lastTokenType","requireParser","parser2","requireLazyResult","MapGenerator","TYPE_TO_CLASS_NAME","PLUGIN_PROPS","AtRuleExit","CommentExit","DeclarationExit","DocumentExit","Once","OnceExit","prepare","RootExit","RuleExit","NOT_VISITORS","isPromise","then","getEvents","toStack","events","eventIndex","visitorIndex","visitors","cleanMarks","postcss2","stringified","processed","syntax","helpers","postcss","plugins","async","Promise","reject","processing","runAsync","onRejected","catch","onFinally","getAsyncError","handleError","postcssVersion","prepareVisitors","listeners","event","version","hasListener","promise","runOnRoot","visitTick","visitor","roots","subRoot","sync","walkSync","visitSync","onFulfilled","visit2","registerPostcss","postcssExports","NoWorkResult","_processor","_css","_opts","_map","self","generatedCSS","generatedMap","_root","requireNoWorkResult","normalized","process","use","requireProcessor","fromJSON","ownInputs","inputHydrated","requireFromJSON","initializer","warningPrinted","creator","env","LANG","transformer","processOpts","pluginOpts","requirePostcss","getDefaultExportFromCjs","Document2","BaseRRNode","_BaseRRNode","_args","childIterator","firstChild","nextSibling","ownerDocument","parentNode","_newChild","_refChild","_node","untaintedMethodCache","getUntaintedMethod","bind","untaintedMethod","nowTimestamp","patch","replacement","wrapped","defineProperties","__rrweb_original__","getTime","on","fn","target","capture","passive","DEPARTED_MIRROR_ACCESS_WARNING","_mirror","throttle","wait","timeout","leading","remaining","context","trailing","hookSetter","isRevoked","getWindowScroll","_c","_d","scrollingElement","pageXOffset","documentElement","dom","top","pageYOffset","getWindowHeight","innerHeight","clientHeight","getWindowWidth","innerWidth","clientWidth","closestElementOfNode","isBlocked","isIgnored","isAncestorRemoved","legacy_isTouchEvent","changedTouches","isSerializedIframe","nodeName","isSerializedStylesheet","hasShadowRoot","shadowRoot","receiver","StyleSheetMirror","styleIDMap","newId","idStyleMap","getStyle","generateId","getShadowHost","shadowHost","DOCUMENT_FRAGMENT_NODE","inDom","rootShadowHost","getRootShadowHost","shadowHostInDom","EventType","EventType2","DomContentLoaded","Load","FullSnapshot","IncrementalSnapshot","Meta","Custom","Plugin","Asset","IncrementalSource","IncrementalSource2","Mutation","MouseMove","MouseInteraction","Scroll","ViewportResize","TouchMove","MediaInteraction","StyleSheetRule","CanvasMutation","Font","Log","Drag","StyleDeclaration","Selection","AdoptedStyleSheet","CustomElement","MouseInteractions","MouseInteractions2","MouseUp","MouseDown","Click","ContextMenu","DblClick","Focus","Blur","TouchStart","TouchMove_Departed","TouchEnd","TouchCancel","PointerTypes","PointerTypes2","Mouse","Pen","Touch","CanvasContext","CanvasContext2","WebGL","WebGL2","MediaInteractions","MediaInteractions2","Play","Pause","Seeked","VolumeChange","RateChange","isNodeInLinkedList","errorHandler","DoubleLinkedList","head","addNode","__ln","previousSibling","tail","removeNode","moveKey","parentId","MutationBuffer","Set","mutations","processMutation","emit","frozen","locked","adds","addedIds","addList","getNextId","ns","nextId","pushAdd","parentTag","addedSet","currentN","iframeManager","addIframe","stylesheetManager","trackLinkElement","shadowDomManager","addShadowRoot","iframe","childSn","attachIframe","observeAttachShadow","attachLinkElement","mapRemoves","movedSet","isParentRemoved","removesSubTreeCache","isAncestorInSet","droppedSet","candidate","tailNode","unhandledNode","payload","texts","genTextAreaValueMutation","attribute","diffAsStr","styleDiff","unchangedAsStr","_unchangedStyles","removes","attributeMap","movedMap","mutationCb","textarea","item","cn","m","oldValue","attributeName","unattachedDoc","implementation","createHTMLDocument","old","pname","newValue","getPropertyValue","newPriority","getPropertyPriority","addedNodes","genAdds","removedNodes","nodeId","isSerialized","deepDelete","queue","processRemoves","processedNodeManager","inOtherBuffer","targetId","canvasManager","unfreeze","isFrozen","lock","unlock","addsSet","_isParentRemoved","_isAncestorInSet","callbackWrapper","rest","mutationBuffers","getEventTarget","composedPath","initMutationObserver","rootEl","mutationBuffer","ObserverCtor","iframeCleanup","observer","processMutations","observe","attributeOldValue","characterData","characterDataOldValue","childList","subtree","initScrollObserver","scrollCb","sampling","evt","defaultView","scrollLeftTop","scroll","INPUT_TAGS","lastInputValueMap","getNestedCSSRulePositions","recurse","childRule","hasNestedCSSRule","parentRule","CSSGroupingRule","CSSMediaRule","CSSSupportsRule","CSSConditionRule","parentStyleSheet","getIdAndStyleId","styleMirror","styleId","initAdoptedStyleSheetObserver","host","hostId","patchTarget","originalPropertyDescriptor","sheets","adoptStyleSheets","initObservers","o","hooks","currentWindow","mousemoveCb","mouseInteractionCb","viewportResizeCb","inputCb","mediaInteractionCb","styleSheetRuleCb","styleDeclarationCb","canvasMutationCb","fontCb","selectionCb","customElementCb","mutation","mousemove","mouseInteraction","viewportResize","mediaInteaction","styleSheetRule","styleDeclaration","canvasMutation","font","selection","customElement","mergeHooks","mutationObserver","cleanupMutationIframe","recordDOM","mousemoveHandler","timeBaseline","threshold","callbackThreshold","mousemoveCallback","positions","wrappedCb","totalOffset","timeOffset","updatePosition","clientX","clientY","DragEvent","MouseEvent","handlers","h","initMoveObserver","mouseInteractionHandler","disableMap","currentPointerType","Number","isNaN","endsWith","eventKey","eventName","handler","pointerType","thisEventKey","getHandler","PointerEvent","initMouseInteractionObserver","scrollHandler","viewportResizeHandler","lastH","lastW","initViewportResizeObserver","inputHandler","ignoreClass","ignoreSelector","userTriggeredOnInput","eventHandler","userTriggered","isTrusted","isChecked","cbWithDedup","querySelectorAll","v","lastInputValue","propertyDescriptor","HTMLInputElement","hookProperties","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement","initInputObserver","mediaInteractionHandler","initMediaInteractionObserver","styleSheetObserver","adoptedStyleSheetObserver","styleDeclarationObserver","fontObserver","CSSStyleSheet","insertRule","thisArg","argumentsList","addRule","styleBlock","replaceSync","deleteRule","removeRule","supportedNestedCSSRuleTypes","canMonkeyPatchNestedCSSRule","unmodifiedFunctions","typeKey","initStyleSheetObserver","ignoreCSSAttributes","setProperty","CSSStyleDeclaration","priority","removeProperty","initStyleDeclarationObserver","collectFonts","fontMap","originalFontFace","FontFace","family","descriptors","fontFace","fontSource","Uint8Array","restoreHandler","fonts","initFontObserver","selectionObserver","param","collapsed","updateSelection","getSelection","isCollapsed","ranges","count","rangeCount","getRangeAt","startContainer","startOffset","endContainer","endOffset","initSelectionObserver","customElementObserver","define","initCustomElementObserver","pluginHandlers","b","disconnect","CrossOriginIframeMirror","generateIdFn","remoteId","idToRemoteMap","remoteToIdMap","idToRemoteIdMap","getIdToRemoteIdMap","remoteIdToIdMap","getRemoteIdToIdMap","getRemoteId","getRemoteIds","ids","iframeIdToRemoteIdMap","iframeRemoteIdToIdMap","IframeManager","wrappedEmit","recordCrossOriginIframes","crossOriginIframeStyleMirror","handleMessage","iframes","crossOriginIframeMap","addLoadListener","loadListener","isAttachIframe","adoptedStyleSheets","crossOriginMessageEvent","transformedEvent","transformCrossOriginEvent","isCheckout","crossOriginIframeMirror","replaceIdOnNode","crossOriginIframeRootIdMap","patchRootIdOnNode","timestamp","replaceIds","replaceStyleIds","styles","iframeMirror","ShadowDomManager","WeakSet","patchAttachShadow","shadowDoms","restoreHandlers","iframeElement","manager","option","sRoot","lookup","canvasVarMap","saveWebGLVar","isInstanceOfWebGLObject","ctor","contextMap","variableListFor","serializeArg","arg","Float32Array","Float64Array","Int32Array","Uint16Array","Int16Array","Int8Array","Uint8ClampedArray","rr_type","ArrayBuffer","base64","arraybuffer","bytes","encode","DataView","byteOffset","byteLength","HTMLImageElement","HTMLCanvasElement","ImageData","serializeArgs","initCanvasContextObserver","setPreserveDrawingBufferToTrue","contextType","ctxName","getNormalizedContextName","contextAttributes","preserveDrawingBuffer","patchGLPrototype","getOwnPropertyNames","recordArgs","hookHandler","setter","Zn","takeFullSnapshot","CanvasManager","latestId","invokeId","rafStamps","pendingCanvasMutations","initCanvasMutationObserver","initCanvasFPSObserver","clear","resetObservers","fps","canvasContextReset","snapshotInProgressMap","worker","ImageBitmapDataURLWorker","onmessage","commands","rafId","timeBetweenSnapshots","lastSnapshotTime","takeCanvasSnapshots","matchedCanvas","getCanvas","getContextAttributes","COLOR_BUFFER_BIT","bitmap","createImageBitmap","postMessage","requestAnimationFrame","cancelAnimationFrame","startRAFTimestamping","startPendingCanvasMutationFlusher","canvas2DReset","props2D","CanvasRenderingContext2D","initCanvas2DMutationObserver","canvasWebGL1and2Reset","WebGLRenderingContext","WebGL2RenderingContext","initCanvasWebGLMutationObserver","flushPendingCanvasMutations","setLatestRAFTimestamp","_values","flushPendingCanvasMutationFor","valuesWithType","StylesheetManager","adoptedStyleSheetCb","linkEl","trackedLinkElements","trackStylesheetInLinkElement","adoptedStyleSheetData","styleIds","CSSRule","r","_linkEl","ProcessedNodeManager","thisBuffer","buffers","nodeMap","active","destroy","recording","cleanFrame","debug","record","checkoutEveryNms","checkoutEveryNth","maskAllInputs","_maskInputOptions","packFn","mousemoveWait","recordAfter","registerErrorHandler","inEmittingFrame","passEmitsToParent","date","email","month","search","tel","time","week","password","NodeList","DOMTokenList","polyfill","lastFullSnapshotEvent","incrementalSnapshotCount","eventProcessor","exceedCount","exceedTime","wrappedMutationEmit","wrappedScrollEmit","wrappedCanvasMutationEmit","getMirror","nodeMirror","slimDOM","snapshot","initialOffset","addCustomEvent","tag","freezePage","t","NotStarted","Running","Stopped","ch2","u8","u16","i32","fleb","fdeb","clim","freb","eb","fl","revfl","revfd","rev","hMap","cd","mb","co","le","rvb","sv","r_1","flt","fdt","flm","fdm","shft","slc","subarray","ec","ind","msg","nt","wbits","wbits16","hTree","t2","et","sort","i0","i1","i2","maxSym","tr","mbt","ln","dt","lft","cst","i2_1","i2_2","i2_3","lc","cl","cli","cln","cls","w","clen","cf","wfblk","out","dat","wblk","final","syms","lf","df","li","bs","bl","dlt","mlb","ddt","mdb","lclt","nlc","lcdt","ndc","lcfreq","_e","lct","mlcb","nlcc","lm","ll","dm","dl","flen","ftlen","dtlen","llm","lcts","it","clct","sym","dst","deo","dflt","lvl","plvl","pre","post","st","z","ceil","lst","msk_1","bs1_1","bs2_1","hsh","lc_1","wi","hv","imod","pimod","rem","ch_1","dif","maxn","maxd","ml","nl","mmd","md","ti","lin","din","dopt","dictionary","dict","newDat","level","mem","log","wcln","fnStr","td","ks","st_1","spInd","ch","bDflt","deflateSync","pbf","deflate","fns","td_1","mrg","wk","transfer","Worker","createObjectURL","Blob","ed","$e$","ev","tl","cbfs","wrkr","terminate","consume","cbify","TextDecoder","decode","stream","finiteNumber","isFinite","normalizeClicks","ts","mutMs","mut_ms","round","normalizeNav","normalizeErrors","normalizeForms","normalizeReplaySignalState","scrollMaxPct","scroll_max_pct","clicks","nav","errors","form_focus","form_submit","selectorFor","stableAttribute","nth","sibling","previousElementSibling","parentElement","formFor","createReplaySignalDeriver","signalState","captureStartedAt","signals","currentUrl","previousUrl","lastUrl","focusedForms","signal","submittedForms","submit","form","accept","click","elapsed","scrollY","scrollHeight","control","submitTarget","_now","BLOCK_SELECTOR","MASK_TEXT_SELECTOR","replaySignals","api","takeSignals","compressSync","compress","compressed","stop","rawEvent","targetForEvent","onError","onUnhandledRejection","errorMessage","onSubmit","__dripReplayRecorder"],"sources":["../../../node_modules/rrweb-snapshot/dist/rrweb-snapshot.js","../../../node_modules/rrdom/dist/rrdom.js","../../../node_modules/utils/dist/utils.js","../../../node_modules/rrweb/src/utils.ts","../../../node_modules/types/dist/types.js","../../../node_modules/rrweb/src/record/mutation.ts","../../../node_modules/rrweb/src/record/error-handler.ts","../../../node_modules/rrweb/src/record/observer.ts","../../../node_modules/rrweb/src/record/cross-origin-iframe-mirror.ts","../../../node_modules/rrweb/src/record/iframe-manager.ts","../../../node_modules/rrweb/src/record/shadow-dom-manager.ts","../../../node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js","../../../node_modules/rrweb/src/record/observers/canvas/serialize-args.ts","../../../node_modules/rrweb/src/record/observers/canvas/canvas.ts","../../../node_modules/rrweb/src/record/observers/canvas/webgl.ts","../../../node_modules/rrweb/src/record/observers/canvas/canvas-manager.ts","../../../node_modules/rrweb/src/record/index.ts","../../../node_modules/rrweb/src/record/observers/canvas/2d.ts","../../../node_modules/rrweb/src/record/stylesheet-manager.ts","../../../node_modules/rrweb/src/record/processed-node-manager.ts","../../../node_modules/@xstate/fsm/es/index.js","../../../node_modules/rrweb/src/replay/index.ts","../../../node_modules/rrweb/src/index.ts","../../../node_modules/fflate/esm/browser.js","../src/replay-signal-state.ts","../src/replay-signals.ts","../src/replay-recorder-entry.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\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 || {});\nconst testableAccessors = {\n Node: [\n \"childNodes\",\n \"parentNode\",\n \"parentElement\",\n \"textContent\",\n \"ownerDocument\"\n ],\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 untaintedBaseIframeCleanup = {};\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 _a, _b;\n return Boolean(\n (_b = (_a = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a.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 _a;\n return typeof defaultPrototype[method] === \"function\" && ((_a = defaultPrototype[method]) == null ? void 0 : _a.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 iframeEl.style.display = \"none\";\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n if (!untaintedObject) {\n iframeEl.remove();\n return defaultPrototype;\n }\n const ua = navigator.userAgent;\n if (ua.includes(\"Safari\") && !ua.includes(\"Chrome\")) {\n iframeEl.classList.add(\"rr-block\");\n iframeEl.setAttribute(\"__rrwebUntaintedMutationObserver\", \"\");\n untaintedBaseIframeCleanup[key] = () => iframeEl.remove();\n } else {\n iframeEl.remove();\n }\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a;\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 = (_a = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a.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 ownerDocument(n) {\n return getUntaintedAccessor(\"Node\", n, \"ownerDocument\");\n}\nfunction childNodes(n) {\n return getUntaintedAccessor(\"Node\", n, \"childNodes\");\n}\nfunction parentNode(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentNode\");\n}\nfunction parentElement(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentElement\");\n}\nfunction textContent(n) {\n return getUntaintedAccessor(\"Node\", n, \"textContent\");\n}\nfunction contains(n, other) {\n return getUntaintedMethod(\"Node\", n, \"contains\")(other);\n}\nfunction getRootNode(n) {\n return getUntaintedMethod(\"Node\", n, \"getRootNode\")();\n}\nfunction host(n) {\n if (!n || !(\"host\" in n)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n, \"host\");\n}\nfunction styleSheets(n) {\n return n.styleSheets;\n}\nfunction shadowRoot(n) {\n if (!n || !(\"shadowRoot\" in n)) return null;\n return getUntaintedAccessor(\"Element\", n, \"shadowRoot\");\n}\nfunction querySelector(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return [\n getUntaintedPrototype(\"MutationObserver\").constructor,\n untaintedBaseIframeCleanup[\"MutationObserver\"] ?? (() => {\n })\n ];\n}\nlet nowTimestamp = Date.now;\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {\n nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();\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 {\n return () => {\n };\n }\n}\nconst index = {\n ownerDocument,\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n nowTimestamp,\n mutationObserverCtor,\n patch\n};\nfunction isElement(n) {\n return n.nodeType === n.ELEMENT_NODE;\n}\nfunction isShadowRoot(n) {\n const hostEl = (\n // anchor and textarea elements also have a `host` property\n // but only shadow roots have a `mode` property\n n && \"host\" in n && \"mode\" in n && index.host(n) || null\n );\n return Boolean(\n hostEl && \"shadowRoot\" in hostEl && index.shadowRoot(hostEl) === n\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(s) {\n try {\n const rules = s.rules || s.cssRules;\n if (!rules) {\n return null;\n }\n let sheetHref = s.href;\n if (!sheetHref && s.ownerNode) {\n sheetHref = s.ownerNode.baseURI;\n }\n const stringifiedRules = Array.from(\n rules,\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(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n) {\n var _a;\n if (!n) return -1;\n const id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;\n return 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(n) {\n return this.nodeMetaMap.get(n) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n) {\n const id = this.getId(n);\n this.idNodeMap.delete(id);\n if (n.childNodes) {\n n.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(n, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n);\n this.nodeMetaMap.set(n, meta);\n }\n replace(id, n) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n, meta);\n }\n this.idNodeMap.set(id, n);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror() {\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 x = 0; x < canvas.width; x += 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 x,\n y,\n Math.min(chunkSize, canvas.width - x),\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 isNodeMetaEqual(a, b) {\n if (!a || !b || a.type !== b.type) return false;\n if (a.type === NodeType.Document)\n return a.compatMode === b.compatMode;\n else if (a.type === NodeType.DocumentType)\n return a.name === b.name && a.publicId === b.publicId && a.systemId === b.systemId;\n else if (a.type === NodeType.Comment || a.type === NodeType.Text || a.type === NodeType.CDATA)\n return a.textContent === b.textContent;\n else if (a.type === NodeType.Element)\n return a.tagName === b.tagName && JSON.stringify(a.attributes) === JSON.stringify(b.attributes) && a.isSVG === b.isSVG && a.needBlock === b.needBlock;\n return false;\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 let url;\n try {\n url = new URL(path, 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 (match == null ? void 0 : match[1]) ?? 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 filePathNoHash = filePath.split(\"#\")[0];\n const maybeHash = filePath.substring(filePathNoHash.length);\n const stack = href.split(\"#\")[0].split(\"/\");\n const parts = filePathNoHash.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(\"/\")}${maybeHash}${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 i = 1; i < childNodes2.length; i++) {\n if (childNodes2[i].textContent && typeof childNodes2[i].textContent === \"string\") {\n const textContentNorm = normalizeCssString(\n childNodes2[i].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[i - 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[i - 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}\nlet _id = 1;\nconst tagNameRegex = new RegExp(\"[^a-z0-9-_:]\");\nconst IGNORED_NODE = -2;\nfunction genId() {\n return _id++;\n}\nfunction getValidTagName(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 chars;\n const match = regEx.exec(attributeValue.substring(pos));\n if (match) {\n chars = match[0];\n pos += chars.length;\n return chars;\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 c = attributeValue.charAt(pos);\n if (c === \"\") {\n output.push((url + descriptorsStr).trim());\n break;\n } else if (!inParens) {\n if (c === \",\") {\n pos += 1;\n output.push((url + descriptorsStr).trim());\n break;\n } else if (c === \"(\") {\n inParens = true;\n }\n } else {\n if (c === \")\") {\n inParens = false;\n }\n }\n descriptorsStr += c;\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 a = cachedDocument.get(doc);\n if (!a) {\n a = doc.createElement(\"a\");\n cachedDocument.set(doc, a);\n }\n if (!customHref) {\n customHref = \"\";\n } else if (customHref.startsWith(\"blob:\") || customHref.startsWith(\"data:\")) {\n return customHref;\n }\n a.setAttribute(\"href\", customHref);\n return a.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\" && [\"table\", \"td\", \"th\"].includes(tagName)) {\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 [\"video\", \"audio\"].includes(tagName) && name === \"autoplay\";\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 (e) {\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.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.parentNode(node2), regex, checkAncestors);\n}\nfunction needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {\n let el;\n if (isElement(node2)) {\n el = node2;\n if (!index.childNodes(el).length) {\n return false;\n }\n } else if (index.parentElement(node2) === null) {\n return false;\n } else {\n el = index.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 (e) {\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(n, options) {\n const {\n doc,\n mirror,\n blockClass,\n blockSelector,\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, mirror);\n switch (n.nodeType) {\n case n.DOCUMENT_NODE:\n if (n.compatMode !== \"CSS1Compat\") {\n return {\n type: NodeType.Document,\n childNodes: [],\n compatMode: n.compatMode\n // probably \"BackCompat\"\n };\n } else {\n return {\n type: NodeType.Document,\n childNodes: []\n };\n }\n case n.DOCUMENT_TYPE_NODE:\n return {\n type: NodeType.DocumentType,\n name: n.name,\n publicId: n.publicId,\n systemId: n.systemId,\n rootId\n };\n case n.ELEMENT_NODE:\n return serializeElementNode(n, {\n doc,\n blockClass,\n blockSelector,\n inlineStylesheet,\n maskInputOptions,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n rootId\n });\n case n.TEXT_NODE:\n return serializeTextNode(n, {\n doc,\n needsMask,\n maskTextFn,\n rootId,\n cssCaptured\n });\n case n.CDATA_SECTION_NODE:\n return {\n type: NodeType.CDATA,\n textContent: \"\",\n rootId\n };\n case n.COMMENT_NODE:\n return {\n type: NodeType.Comment,\n textContent: index.textContent(n) || \"\",\n rootId\n };\n default:\n return false;\n }\n}\nfunction getRootId(doc, mirror) {\n if (!mirror.hasNode(doc)) return void 0;\n const docId = mirror.getId(doc);\n return docId === 1 ? void 0 : docId;\n}\nfunction serializeTextNode(n, options) {\n const { needsMask, maskTextFn, rootId, cssCaptured } = options;\n const parent = index.parentNode(n);\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.textContent(n);\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.parentElement(n)) : textContent2.replace(/[\\S]/g, \"*\");\n }\n return {\n type: NodeType.Text,\n textContent: textContent2 || \"\",\n rootId\n };\n}\nfunction serializeElementNode(n, options) {\n const {\n doc,\n blockClass,\n blockSelector,\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(n, blockClass, blockSelector);\n const tagName = getValidTagName(n);\n let attributes = {};\n const len = n.attributes.length;\n for (let i = 0; i < len; i++) {\n const attr = n.attributes[i];\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((s) => {\n return s.href === n.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\" && n.sheet) {\n let cssText = stringifyStylesheet(\n n.sheet\n );\n if (cssText) {\n if (n.childNodes.length > 1) {\n cssText = markCssSplits(cssText, n);\n }\n attributes._cssText = cssText;\n }\n }\n if ([\"input\", \"textarea\", \"select\"].includes(tagName)) {\n const value = n.value;\n const checked = n.checked;\n if (attributes.type !== \"radio\" && attributes.type !== \"checkbox\" && attributes.type !== \"submit\" && attributes.type !== \"button\" && value) {\n attributes.value = maskInputValue({\n element: n,\n type: getInputType(n),\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 (n.selected && !maskInputOptions[\"select\"]) {\n attributes.selected = true;\n } else {\n delete attributes.selected;\n }\n }\n if (tagName === \"dialog\" && n.open) {\n attributes.rr_open_mode = n.matches(\"dialog:modal\") ? \"modal\" : \"non-modal\";\n }\n if (tagName === \"canvas\" && recordCanvas) {\n if (n.__context === \"2d\") {\n if (!is2DCanvasBlank(n)) {\n attributes.rr_dataURL = n.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n }\n } else if (!(\"__context\" in n)) {\n const canvasDataURL = n.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n const blankCanvas = doc.createElement(\"canvas\");\n blankCanvas.width = n.width;\n blankCanvas.height = n.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 = n;\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 ([\"audio\", \"video\"].includes(tagName)) {\n const mediaAttributes = attributes;\n mediaAttributes.rr_mediaState = n.paused ? \"paused\" : \"played\";\n mediaAttributes.rr_mediaCurrentTime = n.currentTime;\n mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;\n mediaAttributes.rr_mediaMuted = n.muted;\n mediaAttributes.rr_mediaLoop = n.loop;\n mediaAttributes.rr_mediaVolume = n.volume;\n }\n if (!newlyAddedElement) {\n if (n.scrollLeft) {\n attributes.rr_scrollLeft = n.scrollLeft;\n }\n if (n.scrollTop) {\n attributes.rr_scrollTop = n.scrollTop;\n }\n }\n if (needBlock) {\n const { width, height } = n.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 (!n.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 (e) {\n }\n return {\n type: NodeType.Element,\n tagName,\n attributes,\n childNodes: [],\n isSVG: isSVGElement(n) || 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 slimDOMDefaults(_slimDOMOptions) {\n if (_slimDOMOptions === true || _slimDOMOptions === \"all\") {\n return {\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 };\n } else if (_slimDOMOptions) {\n return _slimDOMOptions;\n }\n return {};\n}\nfunction slimDOMExcluded(sn, slimDOMOptions) {\n if (slimDOMOptions.comment && sn.type === NodeType.Comment) {\n return true;\n } else if (sn.type === NodeType.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(n, options) {\n const {\n doc,\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\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 n,\n maskTextClass,\n maskTextSelector,\n checkAncestors\n );\n }\n const _serializedNode = serializeNode(n, {\n doc,\n mirror,\n blockClass,\n blockSelector,\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(n, \"not serialized\");\n return null;\n }\n let id;\n if (mirror.hasNode(n)) {\n id = mirror.getId(n);\n } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.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 mirror.add(n, serializedNode);\n if (id === IGNORED_NODE) {\n return null;\n }\n if (onSerialize) {\n onSerialize(n);\n }\n let recordChild = !skipChild;\n if (serializedNode.type === NodeType.Element) {\n recordChild = recordChild && !serializedNode.needBlock;\n delete serializedNode.needBlock;\n const shadowRootEl = index.shadowRoot(n);\n if (shadowRootEl && isNativeShadowDom(shadowRootEl))\n serializedNode.isShadowHost = true;\n }\n if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {\n if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType.Element && serializedNode.tagName === \"head\") {\n preserveWhiteSpace = false;\n }\n const bypassOptions = {\n doc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\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.Element && serializedNode.tagName === \"textarea\" && serializedNode.attributes.value !== void 0) ;\n else {\n if (serializedNode.type === NodeType.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === \"string\") {\n bypassOptions.cssCaptured = true;\n }\n for (const childN of Array.from(index.childNodes(n))) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n let shadowRootEl = null;\n if (isElement(n) && (shadowRootEl = index.shadowRoot(n))) {\n for (const childN of Array.from(index.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.parentNode(n);\n if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {\n serializedNode.isShadow = true;\n }\n if (serializedNode.type === NodeType.Element && serializedNode.tagName === \"iframe\") {\n onceIframeLoaded(\n n,\n () => {\n const iframeDoc = n.contentDocument;\n if (iframeDoc && onIframeLoad) {\n const serializedIframeNode = serializeNodeWithId(iframeDoc, {\n doc: iframeDoc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\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 n,\n serializedIframeNode\n );\n }\n }\n },\n iframeLoadTimeout\n );\n }\n if (serializedNode.type === NodeType.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 n,\n () => {\n if (onStylesheetLoad) {\n const serializedLinkNode = serializeNodeWithId(n, {\n doc,\n mirror,\n blockClass,\n blockSelector,\n needsMask,\n maskTextClass,\n maskTextSelector,\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 n,\n serializedLinkNode\n );\n }\n }\n },\n stylesheetLoadTimeout\n );\n }\n return serializedNode;\n}\nfunction snapshot(n, options) {\n const {\n mirror = new Mirror(),\n blockClass = \"rr-block\",\n blockSelector = null,\n maskTextClass = \"rr-mask\",\n maskTextSelector = null,\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 = slimDOMDefaults(slimDOM);\n return serializeNodeWithId(n, {\n doc: n,\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\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 visitSnapshot(node2, onVisit) {\n function walk(current) {\n onVisit(current);\n if (current.type === NodeType.Document || current.type === NodeType.Element) {\n current.childNodes.forEach(walk);\n }\n }\n walk(node2);\n}\nfunction cleanupSnapshot() {\n _id = 1;\n}\nconst MEDIA_SELECTOR = /(max|min)-device-(width|height)/;\nconst MEDIA_SELECTOR_GLOBAL = new RegExp(MEDIA_SELECTOR.source, \"g\");\nconst mediaSelectorPlugin = {\n postcssPlugin: \"postcss-custom-selectors\",\n prepare() {\n return {\n postcssPlugin: \"postcss-custom-selectors\",\n AtRule: function(atrule) {\n if (atrule.params.match(MEDIA_SELECTOR_GLOBAL)) {\n atrule.params = atrule.params.replace(MEDIA_SELECTOR_GLOBAL, \"$1-$2\");\n }\n }\n };\n }\n};\nconst pseudoClassPlugin = {\n postcssPlugin: \"postcss-hover-classes\",\n prepare: function() {\n const fixed = [];\n return {\n Rule: function(rule2) {\n if (fixed.indexOf(rule2) !== -1) {\n return;\n }\n fixed.push(rule2);\n rule2.selectors.forEach(function(selector) {\n if (selector.includes(\":hover\")) {\n rule2.selector += \",\\n\" + selector.replace(/:hover/g, \".\\\\:hover\");\n }\n });\n }\n };\n }\n};\nfunction getDefaultExportFromCjs(x) {\n return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, \"default\") ? x[\"default\"] : x;\n}\nfunction getAugmentedNamespace(n) {\n if (n.__esModule) return n;\n var f = n.default;\n if (typeof f == \"function\") {\n var a = function a2() {\n if (this instanceof a2) {\n return Reflect.construct(f, arguments, this.constructor);\n }\n return f.apply(this, arguments);\n };\n a.prototype = f.prototype;\n } else a = {};\n Object.defineProperty(a, \"__esModule\", { value: true });\n Object.keys(n).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n, k);\n Object.defineProperty(a, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n[k];\n }\n });\n });\n return a;\n}\nvar picocolors_browser = { exports: {} };\nvar hasRequiredPicocolors_browser;\nfunction requirePicocolors_browser() {\n if (hasRequiredPicocolors_browser) return picocolors_browser.exports;\n hasRequiredPicocolors_browser = 1;\n var x = String;\n var 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 };\n picocolors_browser.exports = create();\n picocolors_browser.exports.createColors = create;\n return picocolors_browser.exports;\n}\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);\nvar cssSyntaxError;\nvar hasRequiredCssSyntaxError;\nfunction requireCssSyntaxError() {\n if (hasRequiredCssSyntaxError) return cssSyntaxError;\n hasRequiredCssSyntaxError = 1;\n let pico = /* @__PURE__ */ requirePicocolors_browser();\n let terminalHighlight = require$$2;\n class CssSyntaxError extends Error {\n constructor(message, line, column, source, file, plugin) {\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 (plugin) {\n this.plugin = plugin;\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.isColorSupported;\n if (terminalHighlight) {\n if (color) css = terminalHighlight(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 }\n cssSyntaxError = CssSyntaxError;\n CssSyntaxError.default = CssSyntaxError;\n return cssSyntaxError;\n}\nvar symbols = {};\nvar hasRequiredSymbols;\nfunction requireSymbols() {\n if (hasRequiredSymbols) return symbols;\n hasRequiredSymbols = 1;\n symbols.isClean = Symbol(\"isClean\");\n symbols.my = Symbol(\"my\");\n return symbols;\n}\nvar stringifier;\nvar hasRequiredStringifier;\nfunction requireStringifier() {\n if (hasRequiredStringifier) return stringifier;\n hasRequiredStringifier = 1;\n const 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 };\n function capitalize(str) {\n return str[0].toUpperCase() + str.slice(1);\n }\n 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 i = 0; i < node2.nodes.length; i++) {\n let child = node2.nodes[i];\n let before = this.raw(child, \"before\");\n if (before) this.builder(before);\n this.stringify(child, last !== i || 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((i) => {\n value = i.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((i) => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== \"undefined\") {\n value = i.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((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.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((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.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((i) => {\n if (i.type !== \"decl\") {\n value = i.raws.between;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawBeforeRule(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && (i.parent !== root2 || root2.first !== i)) {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.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((i) => {\n if (typeof i.raws.between !== \"undefined\") {\n value = i.raws.between.replace(/[^\\s:]/g, \"\");\n return false;\n }\n });\n return value;\n }\n rawEmptyBody(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.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((i) => {\n let p = i.parent;\n if (p && p !== root2 && p.parent && p.parent === root2) {\n if (typeof i.raws.before !== \"undefined\") {\n let parts = i.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((i) => {\n if (i.nodes && i.nodes.length && i.last.type === \"decl\") {\n value = i.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 }\n stringifier = Stringifier;\n Stringifier.default = Stringifier;\n return stringifier;\n}\nvar stringify_1;\nvar hasRequiredStringify;\nfunction requireStringify() {\n if (hasRequiredStringify) return stringify_1;\n hasRequiredStringify = 1;\n let Stringifier = requireStringifier();\n function stringify(node2, builder) {\n let str = new Stringifier(builder);\n str.stringify(node2);\n }\n stringify_1 = stringify;\n stringify.default = stringify;\n return stringify_1;\n}\nvar node;\nvar hasRequiredNode;\nfunction requireNode() {\n if (hasRequiredNode) return node;\n hasRequiredNode = 1;\n let { isClean, my } = requireSymbols();\n let CssSyntaxError = requireCssSyntaxError();\n let Stringifier = requireStringifier();\n let stringify = requireStringify();\n function cloneNode(obj, parent) {\n let cloned = new obj.constructor();\n for (let i in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i)) {\n continue;\n }\n if (i === \"proxyCache\") continue;\n let value = obj[i];\n let type = typeof value;\n if (i === \"parent\" && type === \"object\") {\n if (parent) cloned[i] = parent;\n } else if (i === \"source\") {\n cloned[i] = value;\n } else if (Array.isArray(value)) {\n cloned[i] = value.map((j) => cloneNode(j, cloned));\n } else {\n if (type === \"object\" && value !== null) value = cloneNode(value);\n cloned[i] = value;\n }\n }\n return cloned;\n }\n class Node {\n constructor(defaults = {}) {\n this.raws = {};\n this[isClean] = false;\n this[my] = 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 s = this.source;\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s.input.from}:${s.start.line}:${s.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(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]) {\n this[isClean] = false;\n let next = this;\n while (next = next.parent) {\n next[isClean] = 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 i = 0; i < index2; i++) {\n if (string[i] === \"\\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 Stringifier();\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((i) => {\n if (typeof i === \"object\" && i.toJSON) {\n return i.toJSON(null, inputs);\n } else {\n return i;\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) {\n if (stringifier2.stringify) stringifier2 = stringifier2.stringify;\n let result2 = \"\";\n stringifier2(this, (i) => {\n result2 += i;\n });\n return result2;\n }\n warn(result2, text, opts) {\n let data = { node: this };\n for (let i in opts) data[i] = opts[i];\n return result2.warn(text, data);\n }\n get proxyOf() {\n return this;\n }\n }\n node = Node;\n Node.default = Node;\n return node;\n}\nvar declaration;\nvar hasRequiredDeclaration;\nfunction requireDeclaration() {\n if (hasRequiredDeclaration) return declaration;\n hasRequiredDeclaration = 1;\n let Node = requireNode();\n class Declaration extends Node {\n constructor(defaults) {\n if (defaults && typeof defaults.value !== \"undefined\" && typeof defaults.value !== \"string\") {\n defaults = { ...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 }\n declaration = Declaration;\n Declaration.default = Declaration;\n return declaration;\n}\nvar nonSecure;\nvar hasRequiredNonSecure;\nfunction requireNonSecure() {\n if (hasRequiredNonSecure) return nonSecure;\n hasRequiredNonSecure = 1;\n let urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\n let customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += alphabet[Math.random() * alphabet.length | 0];\n }\n return id;\n };\n };\n let nanoid = (size = 21) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += urlAlphabet[Math.random() * 64 | 0];\n }\n return id;\n };\n nonSecure = { nanoid, customAlphabet };\n return nonSecure;\n}\nvar previousMap;\nvar hasRequiredPreviousMap;\nfunction requirePreviousMap() {\n if (hasRequiredPreviousMap) return previousMap;\n hasRequiredPreviousMap = 1;\n let { SourceMapConsumer, SourceMapGenerator } = require$$2;\n let { existsSync, readFileSync } = require$$2;\n let { dirname, join } = require$$2;\n function fromBase64(str) {\n if (Buffer) {\n return Buffer.from(str, \"base64\").toString();\n } else {\n return window.atob(str);\n }\n }\n 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(this.mapFile);\n if (text) this.text = text;\n }\n consumer() {\n if (!this.consumerCache) {\n this.consumerCache = new SourceMapConsumer(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(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) {\n return SourceMapGenerator.fromSourceMap(prev).toString();\n } else if (prev instanceof SourceMapGenerator) {\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(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 }\n previousMap = PreviousMap;\n PreviousMap.default = PreviousMap;\n return previousMap;\n}\nvar input;\nvar hasRequiredInput;\nfunction requireInput() {\n if (hasRequiredInput) return input;\n hasRequiredInput = 1;\n let { SourceMapConsumer, SourceMapGenerator } = require$$2;\n let { fileURLToPath, pathToFileURL } = require$$2;\n let { isAbsolute, resolve } = require$$2;\n let { nanoid } = /* @__PURE__ */ requireNonSecure();\n let terminalHighlight = require$$2;\n let CssSyntaxError = requireCssSyntaxError();\n let PreviousMap = requirePreviousMap();\n let fromOffsetCache = Symbol(\"fromOffsetCache\");\n let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);\n let pathAvailable = Boolean(resolve && isAbsolute);\n 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] === \"\") {\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 || /^\\w+:\\/\\//.test(opts.from) || isAbsolute(opts.from)) {\n this.file = opts.from;\n } else {\n this.file = resolve(opts.from);\n }\n }\n if (pathAvailable && sourceMapAvailable) {\n let map = new PreviousMap(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(\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(\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) {\n result2.input.url = pathToFileURL(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 i = 0, l = lines.length; i < l; i++) {\n lineToIndex[i] = prevIndex;\n prevIndex += lines[i].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(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(from.source);\n } else {\n fromUrl = new URL(\n from.source,\n this.map.consumer().sourceRoot || pathToFileURL(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 = { ...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 }\n input = Input;\n Input.default = Input;\n if (terminalHighlight && terminalHighlight.registerInput) {\n terminalHighlight.registerInput(Input);\n }\n return input;\n}\nvar mapGenerator;\nvar hasRequiredMapGenerator;\nfunction requireMapGenerator() {\n if (hasRequiredMapGenerator) return mapGenerator;\n hasRequiredMapGenerator = 1;\n let { SourceMapConsumer, SourceMapGenerator } = require$$2;\n let { dirname, relative, resolve, sep } = require$$2;\n let { pathToFileURL } = require$$2;\n let Input = requireInput();\n let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);\n let pathAvailable = Boolean(dirname && resolve && relative && sep);\n class MapGenerator {\n constructor(stringify, root2, opts, cssString) {\n this.stringify = stringify;\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 i = this.root.nodes.length - 1; i >= 0; i--) {\n node2 = this.root.nodes[i];\n if (node2.type !== \"comment\") continue;\n if (node2.text.indexOf(\"# sourceMappingURL=\") === 0) {\n this.root.removeChild(i);\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, (i) => {\n result2 += i;\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((i) => i.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((i) => i.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((i) => i.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(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 }\n mapGenerator = MapGenerator;\n return mapGenerator;\n}\nvar comment;\nvar hasRequiredComment;\nfunction requireComment() {\n if (hasRequiredComment) return comment;\n hasRequiredComment = 1;\n let Node = requireNode();\n class Comment extends Node {\n constructor(defaults) {\n super(defaults);\n this.type = \"comment\";\n }\n }\n comment = Comment;\n Comment.default = Comment;\n return comment;\n}\nvar container;\nvar hasRequiredContainer;\nfunction requireContainer() {\n if (hasRequiredContainer) return container;\n hasRequiredContainer = 1;\n let { isClean, my } = requireSymbols();\n let Declaration = requireDeclaration();\n let Comment = requireComment();\n let Node = requireNode();\n let parse, Rule, AtRule, Root;\n function cleanSource(nodes) {\n return nodes.map((i) => {\n if (i.nodes) i.nodes = cleanSource(i.nodes);\n delete i.source;\n return i;\n });\n }\n function markDirtyUp(node2) {\n node2[isClean] = false;\n if (node2.proxyOf.nodes) {\n for (let i of node2.proxyOf.nodes) {\n markDirtyUp(i);\n }\n }\n }\n class Container extends Node {\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((i) => {\n if (typeof i === \"function\") {\n return (child, index2) => i(child.toProxy(), index2);\n } else {\n return i;\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((i) => i.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(nodes).nodes);\n } else if (typeof nodes === \"undefined\") {\n nodes = [];\n } else if (Array.isArray(nodes)) {\n nodes = nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"ignore\");\n }\n } else if (nodes.type === \"root\" && this.type !== \"document\") {\n nodes = nodes.nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"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(nodes)];\n } else if (nodes.selector) {\n nodes = [new Rule(nodes)];\n } else if (nodes.name) {\n nodes = [new AtRule(nodes)];\n } else if (nodes.text) {\n nodes = [new Comment(nodes)];\n } else {\n throw new Error(\"Unknown node type in node creation\");\n }\n let processed = nodes.map((i) => {\n if (!i[my]) Container.rebuild(i);\n i = i.proxyOf;\n if (i.parent) i.parent.removeChild(i);\n if (i[isClean]) markDirtyUp(i);\n if (typeof i.raws.before === \"undefined\") {\n if (sample && typeof sample.raws.before !== \"undefined\") {\n i.raws.before = sample.raws.before.replace(/\\S/g, \"\");\n }\n }\n i.parent = this.proxyOf;\n return i;\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, i) => {\n let result2;\n try {\n result2 = callback(child, i);\n } catch (e) {\n throw child.addToError(e);\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, i) => {\n if (child.type === \"atrule\") {\n return callback(child, i);\n }\n });\n }\n if (name instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && name.test(child.name)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && child.name === name) {\n return callback(child, i);\n }\n });\n }\n walkComments(callback) {\n return this.walk((child, i) => {\n if (child.type === \"comment\") {\n return callback(child, i);\n }\n });\n }\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop;\n return this.walk((child, i) => {\n if (child.type === \"decl\") {\n return callback(child, i);\n }\n });\n }\n if (prop instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"decl\" && prop.test(child.prop)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"decl\" && child.prop === prop) {\n return callback(child, i);\n }\n });\n }\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector;\n return this.walk((child, i) => {\n if (child.type === \"rule\") {\n return callback(child, i);\n }\n });\n }\n if (selector instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"rule\" && selector.test(child.selector)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"rule\" && child.selector === selector) {\n return callback(child, i);\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 }\n Container.registerParse = (dependant) => {\n parse = dependant;\n };\n Container.registerRule = (dependant) => {\n Rule = dependant;\n };\n Container.registerAtRule = (dependant) => {\n AtRule = dependant;\n };\n Container.registerRoot = (dependant) => {\n Root = dependant;\n };\n container = Container;\n Container.default = Container;\n Container.rebuild = (node2) => {\n if (node2.type === \"atrule\") {\n Object.setPrototypeOf(node2, AtRule.prototype);\n } else if (node2.type === \"rule\") {\n Object.setPrototypeOf(node2, Rule.prototype);\n } else if (node2.type === \"decl\") {\n Object.setPrototypeOf(node2, Declaration.prototype);\n } else if (node2.type === \"comment\") {\n Object.setPrototypeOf(node2, Comment.prototype);\n } else if (node2.type === \"root\") {\n Object.setPrototypeOf(node2, Root.prototype);\n }\n node2[my] = true;\n if (node2.nodes) {\n node2.nodes.forEach((child) => {\n Container.rebuild(child);\n });\n }\n };\n return container;\n}\nvar document$1;\nvar hasRequiredDocument;\nfunction requireDocument() {\n if (hasRequiredDocument) return document$1;\n hasRequiredDocument = 1;\n let Container = requireContainer();\n let LazyResult, Processor;\n class Document extends Container {\n constructor(defaults) {\n super({ type: \"document\", ...defaults });\n if (!this.nodes) {\n this.nodes = [];\n }\n }\n toResult(opts = {}) {\n let lazy = new LazyResult(new Processor(), this, opts);\n return lazy.stringify();\n }\n }\n Document.registerLazyResult = (dependant) => {\n LazyResult = dependant;\n };\n Document.registerProcessor = (dependant) => {\n Processor = dependant;\n };\n document$1 = Document;\n Document.default = Document;\n return document$1;\n}\nvar warnOnce;\nvar hasRequiredWarnOnce;\nfunction requireWarnOnce() {\n if (hasRequiredWarnOnce) return warnOnce;\n hasRequiredWarnOnce = 1;\n let printed = {};\n warnOnce = 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 };\n return warnOnce;\n}\nvar warning;\nvar hasRequiredWarning;\nfunction requireWarning() {\n if (hasRequiredWarning) return warning;\n hasRequiredWarning = 1;\n 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 }\n warning = Warning;\n Warning.default = Warning;\n return warning;\n}\nvar result;\nvar hasRequiredResult;\nfunction requireResult() {\n if (hasRequiredResult) return result;\n hasRequiredResult = 1;\n let Warning = requireWarning();\n 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(text, opts);\n this.messages.push(warning2);\n return warning2;\n }\n warnings() {\n return this.messages.filter((i) => i.type === \"warning\");\n }\n get content() {\n return this.css;\n }\n }\n result = Result;\n Result.default = Result;\n return result;\n}\nvar tokenize;\nvar hasRequiredTokenize;\nfunction requireTokenize() {\n if (hasRequiredTokenize) return tokenize;\n hasRequiredTokenize = 1;\n const SINGLE_QUOTE = \"'\".charCodeAt(0);\n const DOUBLE_QUOTE = '\"'.charCodeAt(0);\n const BACKSLASH = \"\\\\\".charCodeAt(0);\n const SLASH = \"/\".charCodeAt(0);\n const NEWLINE = \"\\n\".charCodeAt(0);\n const SPACE = \" \".charCodeAt(0);\n const FEED = \"\\f\".charCodeAt(0);\n const TAB = \"\t\".charCodeAt(0);\n const CR = \"\\r\".charCodeAt(0);\n const OPEN_SQUARE = \"[\".charCodeAt(0);\n const CLOSE_SQUARE = \"]\".charCodeAt(0);\n const OPEN_PARENTHESES = \"(\".charCodeAt(0);\n const CLOSE_PARENTHESES = \")\".charCodeAt(0);\n const OPEN_CURLY = \"{\".charCodeAt(0);\n const CLOSE_CURLY = \"}\".charCodeAt(0);\n const SEMICOLON = \";\".charCodeAt(0);\n const ASTERISK = \"*\".charCodeAt(0);\n const COLON = \":\".charCodeAt(0);\n const AT = \"@\".charCodeAt(0);\n const RE_AT_END = /[\\t\\n\\f\\r \"#'()/;[\\\\\\]{}]/g;\n const RE_WORD_END = /[\\t\\n\\f\\r !\"#'():;@[\\\\\\]{}]|\\/(?=\\*)/g;\n const RE_BAD_BRACKET = /.[\\r\\n\"'(/\\\\]/;\n const RE_HEX_ESCAPE = /[\\da-f]/i;\n tokenize = 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, n, 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 n = css.charCodeAt(pos + 1);\n if (prev === \"url\" && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== 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 };\n return tokenize;\n}\nvar atRule;\nvar hasRequiredAtRule;\nfunction requireAtRule() {\n if (hasRequiredAtRule) return atRule;\n hasRequiredAtRule = 1;\n let Container = requireContainer();\n class AtRule extends Container {\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 }\n atRule = AtRule;\n AtRule.default = AtRule;\n Container.registerAtRule(AtRule);\n return atRule;\n}\nvar root;\nvar hasRequiredRoot;\nfunction requireRoot() {\n if (hasRequiredRoot) return root;\n hasRequiredRoot = 1;\n let Container = requireContainer();\n let LazyResult, Processor;\n class Root extends Container {\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(new Processor(), this, opts);\n return lazy.stringify();\n }\n }\n Root.registerLazyResult = (dependant) => {\n LazyResult = dependant;\n };\n Root.registerProcessor = (dependant) => {\n Processor = dependant;\n };\n root = Root;\n Root.default = Root;\n Container.registerRoot(Root);\n return root;\n}\nvar list_1;\nvar hasRequiredList;\nfunction requireList() {\n if (hasRequiredList) return list_1;\n hasRequiredList = 1;\n let list = {\n comma(string) {\n return list.split(string, [\",\"], true);\n },\n space(string) {\n let spaces = [\" \", \"\\n\", \"\t\"];\n return list.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 };\n list_1 = list;\n list.default = list;\n return list_1;\n}\nvar rule;\nvar hasRequiredRule;\nfunction requireRule() {\n if (hasRequiredRule) return rule;\n hasRequiredRule = 1;\n let Container = requireContainer();\n let list = requireList();\n class Rule extends Container {\n constructor(defaults) {\n super(defaults);\n this.type = \"rule\";\n if (!this.nodes) this.nodes = [];\n }\n get selectors() {\n return list.comma(this.selector);\n }\n set selectors(values) {\n let match = this.selector ? this.selector.match(/,\\s*/) : null;\n let sep = match ? match[0] : \",\" + this.raw(\"between\", \"beforeOpen\");\n this.selector = values.join(sep);\n }\n }\n rule = Rule;\n Rule.default = Rule;\n Container.registerRule(Rule);\n return rule;\n}\nvar parser;\nvar hasRequiredParser;\nfunction requireParser() {\n if (hasRequiredParser) return parser;\n hasRequiredParser = 1;\n let Declaration = requireDeclaration();\n let tokenizer = requireTokenize();\n let Comment = requireComment();\n let AtRule = requireAtRule();\n let Root = requireRoot();\n let Rule = requireRule();\n const SAFE_COMMENT_NEIGHBOR = {\n empty: true,\n space: true\n };\n function findLastWithPosition(tokens) {\n for (let i = tokens.length - 1; i >= 0; i--) {\n let token = tokens[i];\n let pos = token[3] || token[2];\n if (pos) return pos;\n }\n }\n class Parser {\n constructor(input2) {\n this.input = input2;\n this.root = new Root();\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();\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 [i, 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 i;\n }\n }\n prev = token;\n }\n return false;\n }\n comment(token) {\n let node2 = new Comment();\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 = tokenizer(this.input);\n }\n decl(tokens, customProperty) {\n let node2 = new Declaration();\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 i = tokens.length - 1; i >= 0; i--) {\n token = tokens[i];\n if (token[1].toLowerCase() === \"!important\") {\n node2.important = true;\n let string = this.stringFrom(tokens, i);\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 = i; 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((i) => i[0] !== \"space\" && i[0] !== \"comment\");\n if (hasWord) {\n node2.raws.between += firstSpaces.map((i) => i[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();\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 i = 0; i < length; i += 1) {\n token = tokens[i];\n type = token[0];\n if (type === \"space\" && i === length - 1 && !customProperty) {\n clean = false;\n } else if (type === \"comment\") {\n prev = tokens[i - 1] ? tokens[i - 1][0] : \"empty\";\n next = tokens[i + 1] ? tokens[i + 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, i) => all + i[1], \"\");\n node2.raws[prop] = { raw, value };\n }\n node2[prop] = value;\n }\n rule(tokens) {\n tokens.pop();\n let node2 = new Rule();\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 i = from; i < tokens.length; i++) {\n result2 += tokens[i][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 }\n parser = Parser;\n return parser;\n}\nvar parse_1;\nvar hasRequiredParse;\nfunction requireParse() {\n if (hasRequiredParse) return parse_1;\n hasRequiredParse = 1;\n let Container = requireContainer();\n let Parser = requireParser();\n let Input = requireInput();\n function parse(css, opts) {\n let input2 = new Input(css, opts);\n let parser2 = new Parser(input2);\n try {\n parser2.parse();\n } catch (e) {\n if (process.env.NODE_ENV !== \"production\") {\n if (e.name === \"CssSyntaxError\" && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e.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 e.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 e.message += \"\\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser\";\n }\n }\n }\n throw e;\n }\n return parser2.root;\n }\n parse_1 = parse;\n parse.default = parse;\n Container.registerParse(parse);\n return parse_1;\n}\nvar lazyResult;\nvar hasRequiredLazyResult;\nfunction requireLazyResult() {\n if (hasRequiredLazyResult) return lazyResult;\n hasRequiredLazyResult = 1;\n let { isClean, my } = requireSymbols();\n let MapGenerator = requireMapGenerator();\n let stringify = requireStringify();\n let Container = requireContainer();\n let Document = requireDocument();\n let warnOnce2 = requireWarnOnce();\n let Result = requireResult();\n let parse = requireParse();\n let Root = requireRoot();\n const TYPE_TO_CLASS_NAME = {\n atrule: \"AtRule\",\n comment: \"Comment\",\n decl: \"Declaration\",\n document: \"Document\",\n root: \"Root\",\n rule: \"Rule\"\n };\n const 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 };\n const NOT_VISITORS = {\n Once: true,\n postcssPlugin: true,\n prepare: true\n };\n const CHILDREN = 0;\n function isPromise(obj) {\n return typeof obj === \"object\" && typeof obj.then === \"function\";\n }\n function 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 }\n function 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 }\n function cleanMarks(node2) {\n node2[isClean] = false;\n if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));\n return node2;\n }\n let postcss2 = {};\n 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(css);\n } else if (css instanceof LazyResult || css instanceof Result) {\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;\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.rebuild(root2);\n }\n }\n this.result = new Result(processor2, root2, opts);\n this.helpers = { ...postcss2, postcss: postcss2, result: this.result };\n this.plugins = this.processor.plugins.map((plugin) => {\n if (typeof plugin === \"object\" && plugin.prepare) {\n return { ...plugin, ...plugin.prepare(this.result) };\n } else {\n return plugin;\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 plugin = 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 = plugin.postcssPlugin;\n error.setMessage();\n } else if (plugin.postcssVersion) {\n if (process.env.NODE_ENV !== \"production\") {\n let pluginName = plugin.postcssPlugin;\n let pluginVer = plugin.postcssVersion;\n let runtimeVer = this.result.processor.version;\n let a = pluginVer.split(\".\");\n let b = runtimeVer.split(\".\");\n if (a[0] !== b[0] || parseInt(a[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 = (plugin, type, cb) => {\n if (!this.listeners[type]) this.listeners[type] = [];\n this.listeners[type].push([plugin, cb]);\n };\n for (let plugin of this.plugins) {\n if (typeof plugin === \"object\") {\n for (let event in plugin) {\n if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {\n throw new Error(\n `Unknown event ${event} in ${plugin.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`\n );\n }\n if (!NOT_VISITORS[event]) {\n if (typeof plugin[event] === \"object\") {\n for (let filter in plugin[event]) {\n if (filter === \"*\") {\n add(plugin, event, plugin[event][filter]);\n } else {\n add(\n plugin,\n event + \"-\" + filter.toLowerCase(),\n plugin[event][filter]\n );\n }\n }\n } else if (typeof plugin[event] === \"function\") {\n add(plugin, event, plugin[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 i = 0; i < this.plugins.length; i++) {\n let plugin = this.plugins[i];\n let promise = this.runOnRoot(plugin);\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 (e) {\n let node2 = stack[stack.length - 1].node;\n throw this.handleError(e, node2);\n }\n }\n }\n }\n if (this.listeners.OnceExit) {\n for (let [plugin, visitor] of this.listeners.OnceExit) {\n this.result.lastPlugin = plugin;\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 (e) {\n throw this.handleError(e);\n }\n }\n }\n }\n this.processed = true;\n return this.stringify();\n }\n runOnRoot(plugin) {\n this.result.lastPlugin = plugin;\n try {\n if (typeof plugin === \"object\" && plugin.Once) {\n if (this.result.root.type === \"document\") {\n let roots = this.result.root.nodes.map(\n (root2) => plugin.Once(root2, this.helpers)\n );\n if (isPromise(roots[0])) {\n return Promise.all(roots);\n }\n return roots;\n }\n return plugin.Once(this.result.root, this.helpers);\n } else if (typeof plugin === \"function\") {\n return plugin(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;\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(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 plugin of this.plugins) {\n let promise = this.runOnRoot(plugin);\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 (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this.opts)) {\n warnOnce2(\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 [plugin, visitor] of visitors) {\n this.result.lastPlugin = plugin;\n let promise;\n try {\n promise = visitor(node2, this.helpers);\n } catch (e) {\n throw this.handleError(e, 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 [plugin, 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 = plugin;\n try {\n return visitor(node2.toProxy(), this.helpers);\n } catch (e) {\n throw this.handleError(e, 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 }\n LazyResult.registerPostcss = (dependant) => {\n postcss2 = dependant;\n };\n lazyResult = LazyResult;\n LazyResult.default = LazyResult;\n Root.registerLazyResult(LazyResult);\n Document.registerLazyResult(LazyResult);\n return lazyResult;\n}\nvar noWorkResult;\nvar hasRequiredNoWorkResult;\nfunction requireNoWorkResult() {\n if (hasRequiredNoWorkResult) return noWorkResult;\n hasRequiredNoWorkResult = 1;\n let MapGenerator = requireMapGenerator();\n let stringify = requireStringify();\n let warnOnce2 = requireWarnOnce();\n let parse = requireParse();\n const Result = requireResult();\n 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;\n this.result = new Result(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 MapGenerator(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 (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this._opts)) {\n warnOnce2(\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;\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 }\n noWorkResult = NoWorkResult;\n NoWorkResult.default = NoWorkResult;\n return noWorkResult;\n}\nvar processor;\nvar hasRequiredProcessor;\nfunction requireProcessor() {\n if (hasRequiredProcessor) return processor;\n hasRequiredProcessor = 1;\n let NoWorkResult = requireNoWorkResult();\n let LazyResult = requireLazyResult();\n let Document = requireDocument();\n let Root = requireRoot();\n 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 i of plugins) {\n if (i.postcss === true) {\n i = i();\n } else if (i.postcss) {\n i = i.postcss;\n }\n if (typeof i === \"object\" && Array.isArray(i.plugins)) {\n normalized = normalized.concat(i.plugins);\n } else if (typeof i === \"object\" && i.postcssPlugin) {\n normalized.push(i);\n } else if (typeof i === \"function\") {\n normalized.push(i);\n } else if (typeof i === \"object\" && (i.parse || i.stringify)) {\n if (process.env.NODE_ENV !== \"production\") {\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(i + \" 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 NoWorkResult(this, css, opts);\n } else {\n return new LazyResult(this, css, opts);\n }\n }\n use(plugin) {\n this.plugins = this.plugins.concat(this.normalize([plugin]));\n return this;\n }\n }\n processor = Processor;\n Processor.default = Processor;\n Root.registerProcessor(Processor);\n Document.registerProcessor(Processor);\n return processor;\n}\nvar fromJSON_1;\nvar hasRequiredFromJSON;\nfunction requireFromJSON() {\n if (hasRequiredFromJSON) return fromJSON_1;\n hasRequiredFromJSON = 1;\n let Declaration = requireDeclaration();\n let PreviousMap = requirePreviousMap();\n let Comment = requireComment();\n let AtRule = requireAtRule();\n let Input = requireInput();\n let Root = requireRoot();\n let Rule = requireRule();\n function fromJSON(json, inputs) {\n if (Array.isArray(json)) return json.map((n) => fromJSON(n));\n let { inputs: ownInputs, ...defaults } = json;\n if (ownInputs) {\n inputs = [];\n for (let input2 of ownInputs) {\n let inputHydrated = { ...input2, __proto__: Input.prototype };\n if (inputHydrated.map) {\n inputHydrated.map = {\n ...inputHydrated.map,\n __proto__: PreviousMap.prototype\n };\n }\n inputs.push(inputHydrated);\n }\n }\n if (defaults.nodes) {\n defaults.nodes = json.nodes.map((n) => fromJSON(n, inputs));\n }\n if (defaults.source) {\n let { inputId, ...source } = defaults.source;\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(defaults);\n } else if (defaults.type === \"decl\") {\n return new Declaration(defaults);\n } else if (defaults.type === \"rule\") {\n return new Rule(defaults);\n } else if (defaults.type === \"comment\") {\n return new Comment(defaults);\n } else if (defaults.type === \"atrule\") {\n return new AtRule(defaults);\n } else {\n throw new Error(\"Unknown node type: \" + json.type);\n }\n }\n fromJSON_1 = fromJSON;\n fromJSON.default = fromJSON;\n return fromJSON_1;\n}\nvar postcss_1;\nvar hasRequiredPostcss;\nfunction requirePostcss() {\n if (hasRequiredPostcss) return postcss_1;\n hasRequiredPostcss = 1;\n let CssSyntaxError = requireCssSyntaxError();\n let Declaration = requireDeclaration();\n let LazyResult = requireLazyResult();\n let Container = requireContainer();\n let Processor = requireProcessor();\n let stringify = requireStringify();\n let fromJSON = requireFromJSON();\n let Document = requireDocument();\n let Warning = requireWarning();\n let Comment = requireComment();\n let AtRule = requireAtRule();\n let Result = requireResult();\n let Input = requireInput();\n let parse = requireParse();\n let list = requireList();\n let Rule = requireRule();\n let Root = requireRoot();\n let Node = requireNode();\n function postcss2(...plugins) {\n if (plugins.length === 1 && Array.isArray(plugins[0])) {\n plugins = plugins[0];\n }\n return new Processor(plugins);\n }\n postcss2.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 + \": 里面 postcss.plugin 被弃用. 迁移指南:\\nhttps://www.w3ctech.com/topic/2226\"\n );\n }\n }\n let transformer = initializer(...args);\n transformer.postcssPlugin = name;\n transformer.postcssVersion = new Processor().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 postcss2([creator(pluginOpts)]).process(css, processOpts);\n };\n return creator;\n };\n postcss2.stringify = stringify;\n postcss2.parse = parse;\n postcss2.fromJSON = fromJSON;\n postcss2.list = list;\n postcss2.comment = (defaults) => new Comment(defaults);\n postcss2.atRule = (defaults) => new AtRule(defaults);\n postcss2.decl = (defaults) => new Declaration(defaults);\n postcss2.rule = (defaults) => new Rule(defaults);\n postcss2.root = (defaults) => new Root(defaults);\n postcss2.document = (defaults) => new Document(defaults);\n postcss2.CssSyntaxError = CssSyntaxError;\n postcss2.Declaration = Declaration;\n postcss2.Container = Container;\n postcss2.Processor = Processor;\n postcss2.Document = Document;\n postcss2.Comment = Comment;\n postcss2.Warning = Warning;\n postcss2.AtRule = AtRule;\n postcss2.Result = Result;\n postcss2.Input = Input;\n postcss2.Rule = Rule;\n postcss2.Root = Root;\n postcss2.Node = Node;\n LazyResult.registerPostcss(postcss2);\n postcss_1 = postcss2;\n postcss2.default = postcss2;\n return postcss_1;\n}\nvar postcssExports = requirePostcss();\nconst postcss = /* @__PURE__ */ getDefaultExportFromCjs(postcssExports);\npostcss.stringify;\npostcss.fromJSON;\npostcss.plugin;\npostcss.parse;\npostcss.list;\npostcss.document;\npostcss.comment;\npostcss.atRule;\npostcss.rule;\npostcss.decl;\npostcss.root;\npostcss.CssSyntaxError;\npostcss.Declaration;\npostcss.Container;\npostcss.Processor;\npostcss.Document;\npostcss.Comment;\npostcss.Warning;\npostcss.AtRule;\npostcss.Result;\npostcss.Input;\npostcss.Rule;\npostcss.Root;\npostcss.Node;\nconst tagMap = {\n script: \"noscript\",\n // camel case svg element tag names\n altglyph: \"altGlyph\",\n altglyphdef: \"altGlyphDef\",\n altglyphitem: \"altGlyphItem\",\n animatecolor: \"animateColor\",\n animatemotion: \"animateMotion\",\n animatetransform: \"animateTransform\",\n clippath: \"clipPath\",\n feblend: \"feBlend\",\n fecolormatrix: \"feColorMatrix\",\n fecomponenttransfer: \"feComponentTransfer\",\n fecomposite: \"feComposite\",\n feconvolvematrix: \"feConvolveMatrix\",\n fediffuselighting: \"feDiffuseLighting\",\n fedisplacementmap: \"feDisplacementMap\",\n fedistantlight: \"feDistantLight\",\n fedropshadow: \"feDropShadow\",\n feflood: \"feFlood\",\n fefunca: \"feFuncA\",\n fefuncb: \"feFuncB\",\n fefuncg: \"feFuncG\",\n fefuncr: \"feFuncR\",\n fegaussianblur: \"feGaussianBlur\",\n feimage: \"feImage\",\n femerge: \"feMerge\",\n femergenode: \"feMergeNode\",\n femorphology: \"feMorphology\",\n feoffset: \"feOffset\",\n fepointlight: \"fePointLight\",\n fespecularlighting: \"feSpecularLighting\",\n fespotlight: \"feSpotLight\",\n fetile: \"feTile\",\n feturbulence: \"feTurbulence\",\n foreignobject: \"foreignObject\",\n glyphref: \"glyphRef\",\n lineargradient: \"linearGradient\",\n radialgradient: \"radialGradient\"\n};\nfunction getTagName(n) {\n let tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName;\n if (tagName === \"link\" && n.attributes._cssText) {\n tagName = \"style\";\n }\n return tagName;\n}\nfunction adaptCssForReplay(cssText, cache) {\n const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);\n if (cachedStyle) return cachedStyle;\n let result2 = cssText;\n try {\n const ast = postcss([\n mediaSelectorPlugin,\n pseudoClassPlugin\n ]).process(cssText);\n result2 = ast.css;\n } catch (error) {\n console.warn(\"Failed to adapt css for replay\", error);\n }\n cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);\n return result2;\n}\nfunction createCache() {\n const stylesWithHoverClass = /* @__PURE__ */ new Map();\n return {\n stylesWithHoverClass\n };\n}\nconst REBUILD_TARGET_ERROR = \"rrweb-snapshot.rebuild() cannot rebuild into an unprotected browser document. Use rebuildIntoSandboxedIframe() or set UNSAFE_allowUnprotectedRebuild: true only when you accept the script-execution risk.\";\nconst SANDBOXED_IFRAME_ROOT_ERROR = \"rrweb-snapshot.createSandboxedIframe() requires root to be connected to a document before creating a sandboxed iframe.\";\nconst sandboxedRebuildDocuments = /* @__PURE__ */ new WeakSet();\nfunction isSupportedSandboxedIframe(frameElement) {\n if (!frameElement || frameElement.tagName !== \"IFRAME\") {\n return false;\n }\n if (!(\"sandbox\" in frameElement)) {\n return false;\n }\n const sandboxTokens = Array.from(frameElement.sandbox);\n return sandboxTokens.length === 1 && sandboxTokens[0] === \"allow-same-origin\";\n}\nfunction assertRebuildTargetAllowed(options) {\n if (options.UNSAFE_allowUnprotectedRebuild) {\n return;\n }\n const win = options.doc.defaultView;\n if (!win) {\n return;\n }\n if (sandboxedRebuildDocuments.has(options.doc) && isSupportedSandboxedIframe(win.frameElement)) {\n return;\n }\n throw new Error(REBUILD_TARGET_ERROR);\n}\nfunction applyCssSplits(n, cssText, hackCss, cache) {\n const childTextNodes = [];\n for (const scn of n.childNodes) {\n if (scn.type === NodeType.Text) {\n childTextNodes.push(scn);\n }\n }\n const cssTextSplits = cssText.split(\"/* rr_split */\");\n while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {\n cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(\"\"));\n }\n let adaptedCss = \"\";\n if (hackCss) {\n adaptedCss = adaptCssForReplay(cssTextSplits.join(\"\"), cache);\n }\n let startIndex = 0;\n for (let i = 0; i < childTextNodes.length; i++) {\n if (i === cssTextSplits.length) {\n break;\n }\n const childTextNode = childTextNodes[i];\n if (!hackCss) {\n childTextNode.textContent = cssTextSplits[i];\n } else if (i < cssTextSplits.length - 1) {\n let endIndex = startIndex;\n let endSearch = cssTextSplits[i + 1].length;\n endSearch = Math.min(endSearch, 30);\n let found = false;\n for (; endSearch > 2; endSearch--) {\n const searchBit = cssTextSplits[i + 1].substring(0, endSearch);\n const searchIndex = adaptedCss.substring(startIndex).indexOf(searchBit);\n found = searchIndex !== -1;\n if (found) {\n endIndex += searchIndex;\n break;\n }\n }\n if (!found) {\n endIndex += cssTextSplits[i].length;\n }\n childTextNode.textContent = adaptedCss.substring(startIndex, endIndex);\n startIndex = endIndex;\n } else {\n childTextNode.textContent = adaptedCss.substring(startIndex);\n }\n }\n}\nfunction buildStyleNode(n, styleEl, cssText, options) {\n const { doc, hackCss, cache } = options;\n if (n.childNodes.length) {\n applyCssSplits(n, cssText, hackCss, cache);\n } else {\n if (hackCss) {\n cssText = adaptCssForReplay(cssText, cache);\n }\n styleEl.appendChild(doc.createTextNode(cssText));\n }\n}\nfunction buildNode(n, options) {\n var _a;\n const { doc, hackCss, cache } = options;\n switch (n.type) {\n case NodeType.Document:\n return doc.implementation.createDocument(null, \"\", null);\n case NodeType.DocumentType:\n return doc.implementation.createDocumentType(\n n.name || \"html\",\n n.publicId,\n n.systemId\n );\n case NodeType.Element: {\n const tagName = getTagName(n);\n let node2;\n if (n.isSVG) {\n node2 = doc.createElementNS(\"http://www.w3.org/2000/svg\", tagName);\n } else {\n if (\n // If the tag name is a custom element name\n n.isCustom && // If the browser supports custom elements\n ((_a = doc.defaultView) == null ? void 0 : _a.customElements) && // If the custom element hasn't been defined yet\n !doc.defaultView.customElements.get(n.tagName)\n )\n doc.defaultView.customElements.define(\n n.tagName,\n class extends doc.defaultView.HTMLElement {\n }\n );\n node2 = doc.createElement(tagName);\n }\n const specialAttributes = {};\n for (const name in n.attributes) {\n if (!Object.prototype.hasOwnProperty.call(n.attributes, name)) {\n continue;\n }\n let value = n.attributes[name];\n if (tagName === \"option\" && name === \"selected\" && value === false) {\n continue;\n }\n if (value === null) {\n continue;\n }\n if (value === true) value = \"\";\n if (name.startsWith(\"rr_\")) {\n specialAttributes[name] = value;\n continue;\n }\n if (typeof value !== \"string\") ;\n else if (tagName === \"style\" && name === \"_cssText\") {\n buildStyleNode(n, node2, value, options);\n continue;\n } else if (tagName === \"textarea\" && name === \"value\") {\n node2.appendChild(doc.createTextNode(value));\n n.childNodes = [];\n continue;\n }\n try {\n if (n.isSVG && name === \"xlink:href\") {\n node2.setAttributeNS(\n \"http://www.w3.org/1999/xlink\",\n name,\n value.toString()\n );\n } else if (name === \"onload\" || name === \"onclick\" || name.substring(0, 7) === \"onmouse\") {\n node2.setAttribute(\"_\" + name, value.toString());\n } else if (tagName === \"meta\" && n.attributes[\"http-equiv\"] === \"Content-Security-Policy\" && name === \"content\") {\n node2.setAttribute(\"csp-content\", value.toString());\n continue;\n } else if (tagName === \"link\" && (n.attributes.rel === \"preload\" && n.attributes.as === \"script\" || n.attributes.rel === \"modulepreload\")) {\n } else if (tagName === \"link\" && n.attributes.rel === \"prefetch\" && typeof n.attributes.href === \"string\" && extractFileExtension(n.attributes.href) === \"js\") {\n } else if (tagName === \"img\" && n.attributes.srcset && n.attributes.rr_dataURL) {\n node2.setAttribute(\n \"rrweb-original-srcset\",\n n.attributes.srcset\n );\n } else {\n node2.setAttribute(name, value.toString());\n }\n } catch (error) {\n }\n }\n for (const name in specialAttributes) {\n const value = specialAttributes[name];\n if (tagName === \"canvas\" && name === \"rr_dataURL\") {\n const image = doc.createElement(\"img\");\n image.onload = () => {\n const ctx = node2.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(image, 0, 0, image.width, image.height);\n }\n };\n image.src = value.toString();\n if (node2.RRNodeType)\n node2.rr_dataURL = value.toString();\n } else if (tagName === \"img\" && name === \"rr_dataURL\") {\n const image = node2;\n if (!image.currentSrc.startsWith(\"data:\")) {\n image.setAttribute(\n \"rrweb-original-src\",\n n.attributes.src\n );\n image.src = value.toString();\n }\n }\n if (name === \"rr_width\") {\n node2.style.setProperty(\"width\", value.toString());\n } else if (name === \"rr_height\") {\n node2.style.setProperty(\"height\", value.toString());\n } else if (name === \"rr_mediaCurrentTime\" && typeof value === \"number\") {\n node2.currentTime = value;\n } else if (name === \"rr_mediaState\") {\n switch (value) {\n case \"played\":\n node2.play().catch((e) => console.warn(\"media playback error\", e));\n break;\n case \"paused\":\n node2.pause();\n break;\n }\n } else if (name === \"rr_mediaPlaybackRate\" && typeof value === \"number\") {\n node2.playbackRate = value;\n } else if (name === \"rr_mediaMuted\" && typeof value === \"boolean\") {\n node2.muted = value;\n } else if (name === \"rr_mediaLoop\" && typeof value === \"boolean\") {\n node2.loop = value;\n } else if (name === \"rr_mediaVolume\" && typeof value === \"number\") {\n node2.volume = value;\n } else if (name === \"rr_open_mode\") {\n node2.setAttribute(\n \"rr_open_mode\",\n value\n );\n }\n }\n if (n.isShadowHost) {\n if (!node2.shadowRoot) {\n node2.attachShadow({ mode: \"open\" });\n } else {\n while (node2.shadowRoot.firstChild) {\n node2.shadowRoot.removeChild(node2.shadowRoot.firstChild);\n }\n }\n }\n return node2;\n }\n case NodeType.Text:\n if (n.isStyle && hackCss) {\n return doc.createTextNode(adaptCssForReplay(n.textContent, cache));\n }\n return doc.createTextNode(n.textContent);\n case NodeType.CDATA:\n return doc.createCDATASection(n.textContent);\n case NodeType.Comment:\n return doc.createComment(n.textContent);\n default:\n return null;\n }\n}\nfunction buildNodeWithSN(n, options) {\n const {\n doc,\n mirror,\n skipChild = false,\n hackCss = true,\n afterAppend,\n cache\n } = options;\n if (mirror.has(n.id)) {\n const nodeInMirror = mirror.getNode(n.id);\n const meta = mirror.getMeta(nodeInMirror);\n if (isNodeMetaEqual(meta, n)) return mirror.getNode(n.id);\n }\n let node2 = buildNode(n, { doc, hackCss, cache });\n if (!node2) {\n return null;\n }\n if (n.rootId && mirror.getNode(n.rootId) !== doc) {\n mirror.replace(n.rootId, doc);\n }\n if (n.type === NodeType.Document) {\n doc.close();\n doc.open();\n if (n.compatMode === \"BackCompat\" && n.childNodes && n.childNodes[0].type !== NodeType.DocumentType) {\n if (n.childNodes[0].type === NodeType.Element && \"xmlns\" in n.childNodes[0].attributes && n.childNodes[0].attributes.xmlns === \"http://www.w3.org/1999/xhtml\") {\n doc.write(\n '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\">'\n );\n } else {\n doc.write(\n '<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"\">'\n );\n }\n }\n node2 = doc;\n }\n mirror.add(node2, n);\n if ((n.type === NodeType.Document || n.type === NodeType.Element) && !skipChild) {\n for (const childN of n.childNodes) {\n const childNode = buildNodeWithSN(childN, {\n doc,\n mirror,\n skipChild: false,\n hackCss,\n afterAppend,\n cache\n });\n if (!childNode) {\n console.warn(\"Failed to rebuild\", childN);\n continue;\n }\n if (childN.isShadow && isElement(node2) && node2.shadowRoot) {\n node2.shadowRoot.appendChild(childNode);\n } else if (n.type === NodeType.Document && childN.type == NodeType.Element) {\n const htmlElement = childNode;\n let body = null;\n htmlElement.childNodes.forEach((child) => {\n if (child.nodeName === \"BODY\") body = child;\n });\n if (body) {\n htmlElement.removeChild(body);\n node2.appendChild(childNode);\n htmlElement.appendChild(body);\n } else {\n node2.appendChild(childNode);\n }\n } else {\n node2.appendChild(childNode);\n }\n if (afterAppend) {\n afterAppend(childNode, childN.id);\n }\n }\n }\n return node2;\n}\nfunction visit(mirror, onVisit) {\n function walk(node2) {\n onVisit(node2);\n }\n for (const id of mirror.getIds()) {\n if (mirror.has(id)) {\n walk(mirror.getNode(id));\n }\n }\n}\nfunction handleScroll(node2, mirror) {\n const n = mirror.getMeta(node2);\n if ((n == null ? void 0 : n.type) !== NodeType.Element) {\n return;\n }\n const el = node2;\n for (const name in n.attributes) {\n if (!(Object.prototype.hasOwnProperty.call(n.attributes, name) && name.startsWith(\"rr_\"))) {\n continue;\n }\n const value = n.attributes[name];\n if (name === \"rr_scrollLeft\") {\n el.scrollLeft = value;\n }\n if (name === \"rr_scrollTop\") {\n el.scrollTop = value;\n }\n }\n}\nfunction rebuild(n, options) {\n assertRebuildTargetAllowed(options);\n const {\n doc,\n onVisit,\n hackCss = true,\n afterAppend,\n cache,\n mirror = new Mirror()\n } = options;\n const node2 = buildNodeWithSN(n, {\n doc,\n mirror,\n skipChild: false,\n hackCss,\n afterAppend,\n cache\n });\n visit(mirror, (visitedNode) => {\n if (onVisit) {\n onVisit(visitedNode);\n }\n handleScroll(visitedNode, mirror);\n });\n return node2;\n}\nfunction createSandboxedIframe(options) {\n var _a;\n if (!options.root.isConnected) {\n throw new Error(SANDBOXED_IFRAME_ROOT_ERROR);\n }\n const iframe = options.root.ownerDocument.createElement(\"iframe\");\n for (const [name, value] of Object.entries(options.iframeAttributes || {})) {\n if (name === \"sandbox\") {\n continue;\n }\n iframe.setAttribute(name, value);\n }\n iframe.setAttribute(\"sandbox\", \"allow-same-origin\");\n options.root.appendChild(iframe);\n const doc = iframe.contentDocument;\n if (!doc || !iframe.contentWindow) {\n (_a = iframe.parentNode) == null ? void 0 : _a.removeChild(iframe);\n throw new Error(SANDBOXED_IFRAME_ROOT_ERROR);\n }\n sandboxedRebuildDocuments.add(doc);\n return iframe;\n}\nfunction rebuildIntoSandboxedIframe(n, options) {\n var _a;\n const iframe = createSandboxedIframe(options);\n const doc = iframe.contentDocument;\n let node2;\n try {\n node2 = rebuild(n, {\n ...options,\n doc\n });\n } catch (error) {\n (_a = iframe.parentNode) == null ? void 0 : _a.removeChild(iframe);\n throw error;\n }\n return { iframe, node: node2 };\n}\nexport {\n IGNORED_NODE,\n Mirror,\n absolutifyURLs,\n adaptCssForReplay,\n buildNodeWithSN,\n classMatchesRegex,\n cleanupSnapshot,\n createCache,\n createMirror,\n createSandboxedIframe,\n escapeImportStatement,\n extractFileExtension,\n fixSafariColons,\n genId,\n getInputType,\n ignoreAttribute,\n is2DCanvasBlank,\n isCSSImportRule,\n isCSSStyleRule,\n isElement,\n isNativeShadowDom,\n isNodeMetaEqual,\n isShadowRoot,\n markCssSplits,\n maskInputValue,\n needMaskingText,\n normalizeCssString,\n rebuild,\n rebuildIntoSandboxedIframe,\n serializeNodeWithId,\n slimDOMDefaults,\n snapshot,\n splitCssText,\n stringifyRule,\n stringifyStylesheet,\n toLowerCase,\n transformAttribute,\n visitSnapshot\n};\n//# sourceMappingURL=rrweb-snapshot.js.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\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 __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) ;\nlet Mirror$1 = class Mirror {\n constructor() {\n __publicField2(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField2(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n) {\n var _a;\n if (!n) return -1;\n const id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;\n return 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(n) {\n return this.nodeMetaMap.get(n) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n) {\n const id = this.getId(n);\n this.idNodeMap.delete(id);\n if (n.childNodes) {\n n.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(n, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n);\n this.nodeMetaMap.set(n, meta);\n }\n replace(id, n) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n, meta);\n }\n this.idNodeMap.set(id, n);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n};\nfunction createMirror$1() {\n return new Mirror$1();\n}\nfunction getDefaultExportFromCjs(x) {\n return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, \"default\") ? x[\"default\"] : x;\n}\nfunction getAugmentedNamespace(n) {\n if (n.__esModule) return n;\n var f = n.default;\n if (typeof f == \"function\") {\n var a = function a2() {\n if (this instanceof a2) {\n return Reflect.construct(f, arguments, this.constructor);\n }\n return f.apply(this, arguments);\n };\n a.prototype = f.prototype;\n } else a = {};\n Object.defineProperty(a, \"__esModule\", { value: true });\n Object.keys(n).forEach(function(k) {\n var d = Object.getOwnPropertyDescriptor(n, k);\n Object.defineProperty(a, k, d.get ? d : {\n enumerable: true,\n get: function() {\n return n[k];\n }\n });\n });\n return a;\n}\nvar picocolors_browser = { exports: {} };\nvar hasRequiredPicocolors_browser;\nfunction requirePicocolors_browser() {\n if (hasRequiredPicocolors_browser) return picocolors_browser.exports;\n hasRequiredPicocolors_browser = 1;\n var x = String;\n var 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 };\n picocolors_browser.exports = create();\n picocolors_browser.exports.createColors = create;\n return picocolors_browser.exports;\n}\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);\nvar cssSyntaxError;\nvar hasRequiredCssSyntaxError;\nfunction requireCssSyntaxError() {\n if (hasRequiredCssSyntaxError) return cssSyntaxError;\n hasRequiredCssSyntaxError = 1;\n let pico = /* @__PURE__ */ requirePicocolors_browser();\n let terminalHighlight = require$$2;\n class CssSyntaxError extends Error {\n constructor(message, line, column, source, file, plugin) {\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 (plugin) {\n this.plugin = plugin;\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.isColorSupported;\n if (terminalHighlight) {\n if (color) css = terminalHighlight(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 }\n cssSyntaxError = CssSyntaxError;\n CssSyntaxError.default = CssSyntaxError;\n return cssSyntaxError;\n}\nvar symbols = {};\nvar hasRequiredSymbols;\nfunction requireSymbols() {\n if (hasRequiredSymbols) return symbols;\n hasRequiredSymbols = 1;\n symbols.isClean = Symbol(\"isClean\");\n symbols.my = Symbol(\"my\");\n return symbols;\n}\nvar stringifier;\nvar hasRequiredStringifier;\nfunction requireStringifier() {\n if (hasRequiredStringifier) return stringifier;\n hasRequiredStringifier = 1;\n const 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 };\n function capitalize(str) {\n return str[0].toUpperCase() + str.slice(1);\n }\n 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 i = 0; i < node2.nodes.length; i++) {\n let child = node2.nodes[i];\n let before = this.raw(child, \"before\");\n if (before) this.builder(before);\n this.stringify(child, last !== i || 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((i) => {\n value = i.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((i) => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== \"undefined\") {\n value = i.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((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.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((i) => {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.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((i) => {\n if (i.type !== \"decl\") {\n value = i.raws.between;\n if (typeof value !== \"undefined\") return false;\n }\n });\n return value;\n }\n rawBeforeRule(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && (i.parent !== root2 || root2.first !== i)) {\n if (typeof i.raws.before !== \"undefined\") {\n value = i.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((i) => {\n if (typeof i.raws.between !== \"undefined\") {\n value = i.raws.between.replace(/[^\\s:]/g, \"\");\n return false;\n }\n });\n return value;\n }\n rawEmptyBody(root2) {\n let value;\n root2.walk((i) => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.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((i) => {\n let p = i.parent;\n if (p && p !== root2 && p.parent && p.parent === root2) {\n if (typeof i.raws.before !== \"undefined\") {\n let parts = i.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((i) => {\n if (i.nodes && i.nodes.length && i.last.type === \"decl\") {\n value = i.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 }\n stringifier = Stringifier;\n Stringifier.default = Stringifier;\n return stringifier;\n}\nvar stringify_1;\nvar hasRequiredStringify;\nfunction requireStringify() {\n if (hasRequiredStringify) return stringify_1;\n hasRequiredStringify = 1;\n let Stringifier = requireStringifier();\n function stringify(node2, builder) {\n let str = new Stringifier(builder);\n str.stringify(node2);\n }\n stringify_1 = stringify;\n stringify.default = stringify;\n return stringify_1;\n}\nvar node;\nvar hasRequiredNode;\nfunction requireNode() {\n if (hasRequiredNode) return node;\n hasRequiredNode = 1;\n let { isClean, my } = requireSymbols();\n let CssSyntaxError = requireCssSyntaxError();\n let Stringifier = requireStringifier();\n let stringify = requireStringify();\n function cloneNode(obj, parent) {\n let cloned = new obj.constructor();\n for (let i in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i)) {\n continue;\n }\n if (i === \"proxyCache\") continue;\n let value = obj[i];\n let type = typeof value;\n if (i === \"parent\" && type === \"object\") {\n if (parent) cloned[i] = parent;\n } else if (i === \"source\") {\n cloned[i] = value;\n } else if (Array.isArray(value)) {\n cloned[i] = value.map((j) => cloneNode(j, cloned));\n } else {\n if (type === \"object\" && value !== null) value = cloneNode(value);\n cloned[i] = value;\n }\n }\n return cloned;\n }\n class Node {\n constructor(defaults = {}) {\n this.raws = {};\n this[isClean] = false;\n this[my] = 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 s = this.source;\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s.input.from}:${s.start.line}:${s.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(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]) {\n this[isClean] = false;\n let next = this;\n while (next = next.parent) {\n next[isClean] = 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 i = 0; i < index2; i++) {\n if (string[i] === \"\\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 Stringifier();\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((i) => {\n if (typeof i === \"object\" && i.toJSON) {\n return i.toJSON(null, inputs);\n } else {\n return i;\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) {\n if (stringifier2.stringify) stringifier2 = stringifier2.stringify;\n let result2 = \"\";\n stringifier2(this, (i) => {\n result2 += i;\n });\n return result2;\n }\n warn(result2, text, opts) {\n let data = { node: this };\n for (let i in opts) data[i] = opts[i];\n return result2.warn(text, data);\n }\n get proxyOf() {\n return this;\n }\n }\n node = Node;\n Node.default = Node;\n return node;\n}\nvar declaration;\nvar hasRequiredDeclaration;\nfunction requireDeclaration() {\n if (hasRequiredDeclaration) return declaration;\n hasRequiredDeclaration = 1;\n let Node = requireNode();\n class Declaration extends Node {\n constructor(defaults) {\n if (defaults && typeof defaults.value !== \"undefined\" && typeof defaults.value !== \"string\") {\n defaults = { ...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 }\n declaration = Declaration;\n Declaration.default = Declaration;\n return declaration;\n}\nvar nonSecure;\nvar hasRequiredNonSecure;\nfunction requireNonSecure() {\n if (hasRequiredNonSecure) return nonSecure;\n hasRequiredNonSecure = 1;\n let urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\n let customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += alphabet[Math.random() * alphabet.length | 0];\n }\n return id;\n };\n };\n let nanoid = (size = 21) => {\n let id = \"\";\n let i = size;\n while (i--) {\n id += urlAlphabet[Math.random() * 64 | 0];\n }\n return id;\n };\n nonSecure = { nanoid, customAlphabet };\n return nonSecure;\n}\nvar previousMap;\nvar hasRequiredPreviousMap;\nfunction requirePreviousMap() {\n if (hasRequiredPreviousMap) return previousMap;\n hasRequiredPreviousMap = 1;\n let { SourceMapConsumer, SourceMapGenerator } = require$$2;\n let { existsSync, readFileSync } = require$$2;\n let { dirname, join } = require$$2;\n function fromBase64(str) {\n if (Buffer) {\n return Buffer.from(str, \"base64\").toString();\n } else {\n return window.atob(str);\n }\n }\n 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(this.mapFile);\n if (text) this.text = text;\n }\n consumer() {\n if (!this.consumerCache) {\n this.consumerCache = new SourceMapConsumer(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(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) {\n return SourceMapGenerator.fromSourceMap(prev).toString();\n } else if (prev instanceof SourceMapGenerator) {\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(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 }\n previousMap = PreviousMap;\n PreviousMap.default = PreviousMap;\n return previousMap;\n}\nvar input;\nvar hasRequiredInput;\nfunction requireInput() {\n if (hasRequiredInput) return input;\n hasRequiredInput = 1;\n let { SourceMapConsumer, SourceMapGenerator } = require$$2;\n let { fileURLToPath, pathToFileURL } = require$$2;\n let { isAbsolute, resolve } = require$$2;\n let { nanoid } = /* @__PURE__ */ requireNonSecure();\n let terminalHighlight = require$$2;\n let CssSyntaxError = requireCssSyntaxError();\n let PreviousMap = requirePreviousMap();\n let fromOffsetCache = Symbol(\"fromOffsetCache\");\n let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);\n let pathAvailable = Boolean(resolve && isAbsolute);\n 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] === \"\") {\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 || /^\\w+:\\/\\//.test(opts.from) || isAbsolute(opts.from)) {\n this.file = opts.from;\n } else {\n this.file = resolve(opts.from);\n }\n }\n if (pathAvailable && sourceMapAvailable) {\n let map = new PreviousMap(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(\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(\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) {\n result2.input.url = pathToFileURL(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 i = 0, l = lines.length; i < l; i++) {\n lineToIndex[i] = prevIndex;\n prevIndex += lines[i].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(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(from.source);\n } else {\n fromUrl = new URL(\n from.source,\n this.map.consumer().sourceRoot || pathToFileURL(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 = { ...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 }\n input = Input;\n Input.default = Input;\n if (terminalHighlight && terminalHighlight.registerInput) {\n terminalHighlight.registerInput(Input);\n }\n return input;\n}\nvar mapGenerator;\nvar hasRequiredMapGenerator;\nfunction requireMapGenerator() {\n if (hasRequiredMapGenerator) return mapGenerator;\n hasRequiredMapGenerator = 1;\n let { SourceMapConsumer, SourceMapGenerator } = require$$2;\n let { dirname, relative, resolve, sep } = require$$2;\n let { pathToFileURL } = require$$2;\n let Input = requireInput();\n let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);\n let pathAvailable = Boolean(dirname && resolve && relative && sep);\n class MapGenerator {\n constructor(stringify, root2, opts, cssString) {\n this.stringify = stringify;\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 i = this.root.nodes.length - 1; i >= 0; i--) {\n node2 = this.root.nodes[i];\n if (node2.type !== \"comment\") continue;\n if (node2.text.indexOf(\"# sourceMappingURL=\") === 0) {\n this.root.removeChild(i);\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, (i) => {\n result2 += i;\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((i) => i.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((i) => i.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((i) => i.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(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 }\n mapGenerator = MapGenerator;\n return mapGenerator;\n}\nvar comment;\nvar hasRequiredComment;\nfunction requireComment() {\n if (hasRequiredComment) return comment;\n hasRequiredComment = 1;\n let Node = requireNode();\n class Comment extends Node {\n constructor(defaults) {\n super(defaults);\n this.type = \"comment\";\n }\n }\n comment = Comment;\n Comment.default = Comment;\n return comment;\n}\nvar container;\nvar hasRequiredContainer;\nfunction requireContainer() {\n if (hasRequiredContainer) return container;\n hasRequiredContainer = 1;\n let { isClean, my } = requireSymbols();\n let Declaration = requireDeclaration();\n let Comment = requireComment();\n let Node = requireNode();\n let parse, Rule, AtRule, Root;\n function cleanSource(nodes) {\n return nodes.map((i) => {\n if (i.nodes) i.nodes = cleanSource(i.nodes);\n delete i.source;\n return i;\n });\n }\n function markDirtyUp(node2) {\n node2[isClean] = false;\n if (node2.proxyOf.nodes) {\n for (let i of node2.proxyOf.nodes) {\n markDirtyUp(i);\n }\n }\n }\n class Container extends Node {\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((i) => {\n if (typeof i === \"function\") {\n return (child, index2) => i(child.toProxy(), index2);\n } else {\n return i;\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((i) => i.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(nodes).nodes);\n } else if (typeof nodes === \"undefined\") {\n nodes = [];\n } else if (Array.isArray(nodes)) {\n nodes = nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"ignore\");\n }\n } else if (nodes.type === \"root\" && this.type !== \"document\") {\n nodes = nodes.nodes.slice(0);\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, \"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(nodes)];\n } else if (nodes.selector) {\n nodes = [new Rule(nodes)];\n } else if (nodes.name) {\n nodes = [new AtRule(nodes)];\n } else if (nodes.text) {\n nodes = [new Comment(nodes)];\n } else {\n throw new Error(\"Unknown node type in node creation\");\n }\n let processed = nodes.map((i) => {\n if (!i[my]) Container.rebuild(i);\n i = i.proxyOf;\n if (i.parent) i.parent.removeChild(i);\n if (i[isClean]) markDirtyUp(i);\n if (typeof i.raws.before === \"undefined\") {\n if (sample && typeof sample.raws.before !== \"undefined\") {\n i.raws.before = sample.raws.before.replace(/\\S/g, \"\");\n }\n }\n i.parent = this.proxyOf;\n return i;\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, i) => {\n let result2;\n try {\n result2 = callback(child, i);\n } catch (e) {\n throw child.addToError(e);\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, i) => {\n if (child.type === \"atrule\") {\n return callback(child, i);\n }\n });\n }\n if (name instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && name.test(child.name)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"atrule\" && child.name === name) {\n return callback(child, i);\n }\n });\n }\n walkComments(callback) {\n return this.walk((child, i) => {\n if (child.type === \"comment\") {\n return callback(child, i);\n }\n });\n }\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop;\n return this.walk((child, i) => {\n if (child.type === \"decl\") {\n return callback(child, i);\n }\n });\n }\n if (prop instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"decl\" && prop.test(child.prop)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"decl\" && child.prop === prop) {\n return callback(child, i);\n }\n });\n }\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector;\n return this.walk((child, i) => {\n if (child.type === \"rule\") {\n return callback(child, i);\n }\n });\n }\n if (selector instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === \"rule\" && selector.test(child.selector)) {\n return callback(child, i);\n }\n });\n }\n return this.walk((child, i) => {\n if (child.type === \"rule\" && child.selector === selector) {\n return callback(child, i);\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 }\n Container.registerParse = (dependant) => {\n parse = dependant;\n };\n Container.registerRule = (dependant) => {\n Rule = dependant;\n };\n Container.registerAtRule = (dependant) => {\n AtRule = dependant;\n };\n Container.registerRoot = (dependant) => {\n Root = dependant;\n };\n container = Container;\n Container.default = Container;\n Container.rebuild = (node2) => {\n if (node2.type === \"atrule\") {\n Object.setPrototypeOf(node2, AtRule.prototype);\n } else if (node2.type === \"rule\") {\n Object.setPrototypeOf(node2, Rule.prototype);\n } else if (node2.type === \"decl\") {\n Object.setPrototypeOf(node2, Declaration.prototype);\n } else if (node2.type === \"comment\") {\n Object.setPrototypeOf(node2, Comment.prototype);\n } else if (node2.type === \"root\") {\n Object.setPrototypeOf(node2, Root.prototype);\n }\n node2[my] = true;\n if (node2.nodes) {\n node2.nodes.forEach((child) => {\n Container.rebuild(child);\n });\n }\n };\n return container;\n}\nvar document$1;\nvar hasRequiredDocument;\nfunction requireDocument() {\n if (hasRequiredDocument) return document$1;\n hasRequiredDocument = 1;\n let Container = requireContainer();\n let LazyResult, Processor;\n class Document2 extends Container {\n constructor(defaults) {\n super({ type: \"document\", ...defaults });\n if (!this.nodes) {\n this.nodes = [];\n }\n }\n toResult(opts = {}) {\n let lazy = new LazyResult(new Processor(), this, opts);\n return lazy.stringify();\n }\n }\n Document2.registerLazyResult = (dependant) => {\n LazyResult = dependant;\n };\n Document2.registerProcessor = (dependant) => {\n Processor = dependant;\n };\n document$1 = Document2;\n Document2.default = Document2;\n return document$1;\n}\nvar warnOnce;\nvar hasRequiredWarnOnce;\nfunction requireWarnOnce() {\n if (hasRequiredWarnOnce) return warnOnce;\n hasRequiredWarnOnce = 1;\n let printed = {};\n warnOnce = 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 };\n return warnOnce;\n}\nvar warning;\nvar hasRequiredWarning;\nfunction requireWarning() {\n if (hasRequiredWarning) return warning;\n hasRequiredWarning = 1;\n 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 }\n warning = Warning;\n Warning.default = Warning;\n return warning;\n}\nvar result;\nvar hasRequiredResult;\nfunction requireResult() {\n if (hasRequiredResult) return result;\n hasRequiredResult = 1;\n let Warning = requireWarning();\n 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(text, opts);\n this.messages.push(warning2);\n return warning2;\n }\n warnings() {\n return this.messages.filter((i) => i.type === \"warning\");\n }\n get content() {\n return this.css;\n }\n }\n result = Result;\n Result.default = Result;\n return result;\n}\nvar tokenize;\nvar hasRequiredTokenize;\nfunction requireTokenize() {\n if (hasRequiredTokenize) return tokenize;\n hasRequiredTokenize = 1;\n const SINGLE_QUOTE = \"'\".charCodeAt(0);\n const DOUBLE_QUOTE = '\"'.charCodeAt(0);\n const BACKSLASH = \"\\\\\".charCodeAt(0);\n const SLASH = \"/\".charCodeAt(0);\n const NEWLINE = \"\\n\".charCodeAt(0);\n const SPACE = \" \".charCodeAt(0);\n const FEED = \"\\f\".charCodeAt(0);\n const TAB = \"\t\".charCodeAt(0);\n const CR = \"\\r\".charCodeAt(0);\n const OPEN_SQUARE = \"[\".charCodeAt(0);\n const CLOSE_SQUARE = \"]\".charCodeAt(0);\n const OPEN_PARENTHESES = \"(\".charCodeAt(0);\n const CLOSE_PARENTHESES = \")\".charCodeAt(0);\n const OPEN_CURLY = \"{\".charCodeAt(0);\n const CLOSE_CURLY = \"}\".charCodeAt(0);\n const SEMICOLON = \";\".charCodeAt(0);\n const ASTERISK = \"*\".charCodeAt(0);\n const COLON = \":\".charCodeAt(0);\n const AT = \"@\".charCodeAt(0);\n const RE_AT_END = /[\\t\\n\\f\\r \"#'()/;[\\\\\\]{}]/g;\n const RE_WORD_END = /[\\t\\n\\f\\r !\"#'():;@[\\\\\\]{}]|\\/(?=\\*)/g;\n const RE_BAD_BRACKET = /.[\\r\\n\"'(/\\\\]/;\n const RE_HEX_ESCAPE = /[\\da-f]/i;\n tokenize = 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, n, 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 n = css.charCodeAt(pos + 1);\n if (prev === \"url\" && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== 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 };\n return tokenize;\n}\nvar atRule;\nvar hasRequiredAtRule;\nfunction requireAtRule() {\n if (hasRequiredAtRule) return atRule;\n hasRequiredAtRule = 1;\n let Container = requireContainer();\n class AtRule extends Container {\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 }\n atRule = AtRule;\n AtRule.default = AtRule;\n Container.registerAtRule(AtRule);\n return atRule;\n}\nvar root;\nvar hasRequiredRoot;\nfunction requireRoot() {\n if (hasRequiredRoot) return root;\n hasRequiredRoot = 1;\n let Container = requireContainer();\n let LazyResult, Processor;\n class Root extends Container {\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(new Processor(), this, opts);\n return lazy.stringify();\n }\n }\n Root.registerLazyResult = (dependant) => {\n LazyResult = dependant;\n };\n Root.registerProcessor = (dependant) => {\n Processor = dependant;\n };\n root = Root;\n Root.default = Root;\n Container.registerRoot(Root);\n return root;\n}\nvar list_1;\nvar hasRequiredList;\nfunction requireList() {\n if (hasRequiredList) return list_1;\n hasRequiredList = 1;\n let list = {\n comma(string) {\n return list.split(string, [\",\"], true);\n },\n space(string) {\n let spaces = [\" \", \"\\n\", \"\t\"];\n return list.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 };\n list_1 = list;\n list.default = list;\n return list_1;\n}\nvar rule;\nvar hasRequiredRule;\nfunction requireRule() {\n if (hasRequiredRule) return rule;\n hasRequiredRule = 1;\n let Container = requireContainer();\n let list = requireList();\n class Rule extends Container {\n constructor(defaults) {\n super(defaults);\n this.type = \"rule\";\n if (!this.nodes) this.nodes = [];\n }\n get selectors() {\n return list.comma(this.selector);\n }\n set selectors(values) {\n let match = this.selector ? this.selector.match(/,\\s*/) : null;\n let sep = match ? match[0] : \",\" + this.raw(\"between\", \"beforeOpen\");\n this.selector = values.join(sep);\n }\n }\n rule = Rule;\n Rule.default = Rule;\n Container.registerRule(Rule);\n return rule;\n}\nvar parser;\nvar hasRequiredParser;\nfunction requireParser() {\n if (hasRequiredParser) return parser;\n hasRequiredParser = 1;\n let Declaration = requireDeclaration();\n let tokenizer = requireTokenize();\n let Comment = requireComment();\n let AtRule = requireAtRule();\n let Root = requireRoot();\n let Rule = requireRule();\n const SAFE_COMMENT_NEIGHBOR = {\n empty: true,\n space: true\n };\n function findLastWithPosition(tokens) {\n for (let i = tokens.length - 1; i >= 0; i--) {\n let token = tokens[i];\n let pos = token[3] || token[2];\n if (pos) return pos;\n }\n }\n class Parser {\n constructor(input2) {\n this.input = input2;\n this.root = new Root();\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();\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 [i, 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 i;\n }\n }\n prev = token;\n }\n return false;\n }\n comment(token) {\n let node2 = new Comment();\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 = tokenizer(this.input);\n }\n decl(tokens, customProperty) {\n let node2 = new Declaration();\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 i = tokens.length - 1; i >= 0; i--) {\n token = tokens[i];\n if (token[1].toLowerCase() === \"!important\") {\n node2.important = true;\n let string = this.stringFrom(tokens, i);\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 = i; 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((i) => i[0] !== \"space\" && i[0] !== \"comment\");\n if (hasWord) {\n node2.raws.between += firstSpaces.map((i) => i[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();\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 i = 0; i < length; i += 1) {\n token = tokens[i];\n type = token[0];\n if (type === \"space\" && i === length - 1 && !customProperty) {\n clean = false;\n } else if (type === \"comment\") {\n prev = tokens[i - 1] ? tokens[i - 1][0] : \"empty\";\n next = tokens[i + 1] ? tokens[i + 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, i) => all + i[1], \"\");\n node2.raws[prop] = { raw, value };\n }\n node2[prop] = value;\n }\n rule(tokens) {\n tokens.pop();\n let node2 = new Rule();\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 i = from; i < tokens.length; i++) {\n result2 += tokens[i][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 }\n parser = Parser;\n return parser;\n}\nvar parse_1;\nvar hasRequiredParse;\nfunction requireParse() {\n if (hasRequiredParse) return parse_1;\n hasRequiredParse = 1;\n let Container = requireContainer();\n let Parser = requireParser();\n let Input = requireInput();\n function parse(css, opts) {\n let input2 = new Input(css, opts);\n let parser2 = new Parser(input2);\n try {\n parser2.parse();\n } catch (e) {\n if (process.env.NODE_ENV !== \"production\") {\n if (e.name === \"CssSyntaxError\" && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e.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 e.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 e.message += \"\\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser\";\n }\n }\n }\n throw e;\n }\n return parser2.root;\n }\n parse_1 = parse;\n parse.default = parse;\n Container.registerParse(parse);\n return parse_1;\n}\nvar lazyResult;\nvar hasRequiredLazyResult;\nfunction requireLazyResult() {\n if (hasRequiredLazyResult) return lazyResult;\n hasRequiredLazyResult = 1;\n let { isClean, my } = requireSymbols();\n let MapGenerator = requireMapGenerator();\n let stringify = requireStringify();\n let Container = requireContainer();\n let Document2 = requireDocument();\n let warnOnce2 = requireWarnOnce();\n let Result = requireResult();\n let parse = requireParse();\n let Root = requireRoot();\n const TYPE_TO_CLASS_NAME = {\n atrule: \"AtRule\",\n comment: \"Comment\",\n decl: \"Declaration\",\n document: \"Document\",\n root: \"Root\",\n rule: \"Rule\"\n };\n const 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 };\n const NOT_VISITORS = {\n Once: true,\n postcssPlugin: true,\n prepare: true\n };\n const CHILDREN = 0;\n function isPromise(obj) {\n return typeof obj === \"object\" && typeof obj.then === \"function\";\n }\n function 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 }\n function 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 }\n function cleanMarks(node2) {\n node2[isClean] = false;\n if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));\n return node2;\n }\n let postcss2 = {};\n 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(css);\n } else if (css instanceof LazyResult || css instanceof Result) {\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;\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.rebuild(root2);\n }\n }\n this.result = new Result(processor2, root2, opts);\n this.helpers = { ...postcss2, postcss: postcss2, result: this.result };\n this.plugins = this.processor.plugins.map((plugin) => {\n if (typeof plugin === \"object\" && plugin.prepare) {\n return { ...plugin, ...plugin.prepare(this.result) };\n } else {\n return plugin;\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 plugin = 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 = plugin.postcssPlugin;\n error.setMessage();\n } else if (plugin.postcssVersion) {\n if (process.env.NODE_ENV !== \"production\") {\n let pluginName = plugin.postcssPlugin;\n let pluginVer = plugin.postcssVersion;\n let runtimeVer = this.result.processor.version;\n let a = pluginVer.split(\".\");\n let b = runtimeVer.split(\".\");\n if (a[0] !== b[0] || parseInt(a[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 = (plugin, type, cb) => {\n if (!this.listeners[type]) this.listeners[type] = [];\n this.listeners[type].push([plugin, cb]);\n };\n for (let plugin of this.plugins) {\n if (typeof plugin === \"object\") {\n for (let event in plugin) {\n if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {\n throw new Error(\n `Unknown event ${event} in ${plugin.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`\n );\n }\n if (!NOT_VISITORS[event]) {\n if (typeof plugin[event] === \"object\") {\n for (let filter in plugin[event]) {\n if (filter === \"*\") {\n add(plugin, event, plugin[event][filter]);\n } else {\n add(\n plugin,\n event + \"-\" + filter.toLowerCase(),\n plugin[event][filter]\n );\n }\n }\n } else if (typeof plugin[event] === \"function\") {\n add(plugin, event, plugin[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 i = 0; i < this.plugins.length; i++) {\n let plugin = this.plugins[i];\n let promise = this.runOnRoot(plugin);\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 (e) {\n let node2 = stack[stack.length - 1].node;\n throw this.handleError(e, node2);\n }\n }\n }\n }\n if (this.listeners.OnceExit) {\n for (let [plugin, visitor] of this.listeners.OnceExit) {\n this.result.lastPlugin = plugin;\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 (e) {\n throw this.handleError(e);\n }\n }\n }\n }\n this.processed = true;\n return this.stringify();\n }\n runOnRoot(plugin) {\n this.result.lastPlugin = plugin;\n try {\n if (typeof plugin === \"object\" && plugin.Once) {\n if (this.result.root.type === \"document\") {\n let roots = this.result.root.nodes.map(\n (root2) => plugin.Once(root2, this.helpers)\n );\n if (isPromise(roots[0])) {\n return Promise.all(roots);\n }\n return roots;\n }\n return plugin.Once(this.result.root, this.helpers);\n } else if (typeof plugin === \"function\") {\n return plugin(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;\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(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 plugin of this.plugins) {\n let promise = this.runOnRoot(plugin);\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 (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this.opts)) {\n warnOnce2(\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 [plugin, visitor] of visitors) {\n this.result.lastPlugin = plugin;\n let promise;\n try {\n promise = visitor(node2, this.helpers);\n } catch (e) {\n throw this.handleError(e, 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 [plugin, 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 = plugin;\n try {\n return visitor(node2.toProxy(), this.helpers);\n } catch (e) {\n throw this.handleError(e, 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 }\n LazyResult.registerPostcss = (dependant) => {\n postcss2 = dependant;\n };\n lazyResult = LazyResult;\n LazyResult.default = LazyResult;\n Root.registerLazyResult(LazyResult);\n Document2.registerLazyResult(LazyResult);\n return lazyResult;\n}\nvar noWorkResult;\nvar hasRequiredNoWorkResult;\nfunction requireNoWorkResult() {\n if (hasRequiredNoWorkResult) return noWorkResult;\n hasRequiredNoWorkResult = 1;\n let MapGenerator = requireMapGenerator();\n let stringify = requireStringify();\n let warnOnce2 = requireWarnOnce();\n let parse = requireParse();\n const Result = requireResult();\n 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;\n this.result = new Result(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 MapGenerator(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 (process.env.NODE_ENV !== \"production\") {\n if (!(\"from\" in this._opts)) {\n warnOnce2(\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;\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 }\n noWorkResult = NoWorkResult;\n NoWorkResult.default = NoWorkResult;\n return noWorkResult;\n}\nvar processor;\nvar hasRequiredProcessor;\nfunction requireProcessor() {\n if (hasRequiredProcessor) return processor;\n hasRequiredProcessor = 1;\n let NoWorkResult = requireNoWorkResult();\n let LazyResult = requireLazyResult();\n let Document2 = requireDocument();\n let Root = requireRoot();\n 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 i of plugins) {\n if (i.postcss === true) {\n i = i();\n } else if (i.postcss) {\n i = i.postcss;\n }\n if (typeof i === \"object\" && Array.isArray(i.plugins)) {\n normalized = normalized.concat(i.plugins);\n } else if (typeof i === \"object\" && i.postcssPlugin) {\n normalized.push(i);\n } else if (typeof i === \"function\") {\n normalized.push(i);\n } else if (typeof i === \"object\" && (i.parse || i.stringify)) {\n if (process.env.NODE_ENV !== \"production\") {\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(i + \" 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 NoWorkResult(this, css, opts);\n } else {\n return new LazyResult(this, css, opts);\n }\n }\n use(plugin) {\n this.plugins = this.plugins.concat(this.normalize([plugin]));\n return this;\n }\n }\n processor = Processor;\n Processor.default = Processor;\n Root.registerProcessor(Processor);\n Document2.registerProcessor(Processor);\n return processor;\n}\nvar fromJSON_1;\nvar hasRequiredFromJSON;\nfunction requireFromJSON() {\n if (hasRequiredFromJSON) return fromJSON_1;\n hasRequiredFromJSON = 1;\n let Declaration = requireDeclaration();\n let PreviousMap = requirePreviousMap();\n let Comment = requireComment();\n let AtRule = requireAtRule();\n let Input = requireInput();\n let Root = requireRoot();\n let Rule = requireRule();\n function fromJSON(json, inputs) {\n if (Array.isArray(json)) return json.map((n) => fromJSON(n));\n let { inputs: ownInputs, ...defaults } = json;\n if (ownInputs) {\n inputs = [];\n for (let input2 of ownInputs) {\n let inputHydrated = { ...input2, __proto__: Input.prototype };\n if (inputHydrated.map) {\n inputHydrated.map = {\n ...inputHydrated.map,\n __proto__: PreviousMap.prototype\n };\n }\n inputs.push(inputHydrated);\n }\n }\n if (defaults.nodes) {\n defaults.nodes = json.nodes.map((n) => fromJSON(n, inputs));\n }\n if (defaults.source) {\n let { inputId, ...source } = defaults.source;\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(defaults);\n } else if (defaults.type === \"decl\") {\n return new Declaration(defaults);\n } else if (defaults.type === \"rule\") {\n return new Rule(defaults);\n } else if (defaults.type === \"comment\") {\n return new Comment(defaults);\n } else if (defaults.type === \"atrule\") {\n return new AtRule(defaults);\n } else {\n throw new Error(\"Unknown node type: \" + json.type);\n }\n }\n fromJSON_1 = fromJSON;\n fromJSON.default = fromJSON;\n return fromJSON_1;\n}\nvar postcss_1;\nvar hasRequiredPostcss;\nfunction requirePostcss() {\n if (hasRequiredPostcss) return postcss_1;\n hasRequiredPostcss = 1;\n let CssSyntaxError = requireCssSyntaxError();\n let Declaration = requireDeclaration();\n let LazyResult = requireLazyResult();\n let Container = requireContainer();\n let Processor = requireProcessor();\n let stringify = requireStringify();\n let fromJSON = requireFromJSON();\n let Document2 = requireDocument();\n let Warning = requireWarning();\n let Comment = requireComment();\n let AtRule = requireAtRule();\n let Result = requireResult();\n let Input = requireInput();\n let parse = requireParse();\n let list = requireList();\n let Rule = requireRule();\n let Root = requireRoot();\n let Node = requireNode();\n function postcss2(...plugins) {\n if (plugins.length === 1 && Array.isArray(plugins[0])) {\n plugins = plugins[0];\n }\n return new Processor(plugins);\n }\n postcss2.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 + \": 里面 postcss.plugin 被弃用. 迁移指南:\\nhttps://www.w3ctech.com/topic/2226\"\n );\n }\n }\n let transformer = initializer(...args);\n transformer.postcssPlugin = name;\n transformer.postcssVersion = new Processor().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 postcss2([creator(pluginOpts)]).process(css, processOpts);\n };\n return creator;\n };\n postcss2.stringify = stringify;\n postcss2.parse = parse;\n postcss2.fromJSON = fromJSON;\n postcss2.list = list;\n postcss2.comment = (defaults) => new Comment(defaults);\n postcss2.atRule = (defaults) => new AtRule(defaults);\n postcss2.decl = (defaults) => new Declaration(defaults);\n postcss2.rule = (defaults) => new Rule(defaults);\n postcss2.root = (defaults) => new Root(defaults);\n postcss2.document = (defaults) => new Document2(defaults);\n postcss2.CssSyntaxError = CssSyntaxError;\n postcss2.Declaration = Declaration;\n postcss2.Container = Container;\n postcss2.Processor = Processor;\n postcss2.Document = Document2;\n postcss2.Comment = Comment;\n postcss2.Warning = Warning;\n postcss2.AtRule = AtRule;\n postcss2.Result = Result;\n postcss2.Input = Input;\n postcss2.Rule = Rule;\n postcss2.Root = Root;\n postcss2.Node = Node;\n LazyResult.registerPostcss(postcss2);\n postcss_1 = postcss2;\n postcss2.default = postcss2;\n return postcss_1;\n}\nvar postcssExports = requirePostcss();\nconst postcss = /* @__PURE__ */ getDefaultExportFromCjs(postcssExports);\npostcss.stringify;\npostcss.fromJSON;\npostcss.plugin;\npostcss.parse;\npostcss.list;\npostcss.document;\npostcss.comment;\npostcss.atRule;\npostcss.rule;\npostcss.decl;\npostcss.root;\npostcss.CssSyntaxError;\npostcss.Declaration;\npostcss.Container;\npostcss.Processor;\npostcss.Document;\npostcss.Comment;\npostcss.Warning;\npostcss.AtRule;\npostcss.Result;\npostcss.Input;\npostcss.Rule;\npostcss.Root;\npostcss.Node;\nvar NodeType$1 = /* @__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$1 || {});\nfunction parseCSSText(cssText) {\n const res = {};\n const listDelimiter = /;(?![^(]*\\))/g;\n const propertyDelimiter = /:(.+)/;\n const comment2 = /\\/\\*.*?\\*\\//g;\n cssText.replace(comment2, \"\").split(listDelimiter).forEach(function(item) {\n if (item) {\n const tmp = item.split(propertyDelimiter);\n tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());\n }\n });\n return res;\n}\nfunction toCSSText(style) {\n const properties = [];\n for (const name in style) {\n const value = style[name];\n if (typeof value !== \"string\") continue;\n const normalizedName = hyphenate(name);\n properties.push(`${normalizedName}: ${value};`);\n }\n return properties.join(\" \");\n}\nconst camelizeRE = /-([a-z])/g;\nconst CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;\nconst camelize = (str) => {\n if (CUSTOM_PROPERTY_REGEX.test(str)) return str;\n return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : \"\");\n};\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = (str) => {\n return str.replace(hyphenateRE, \"-$1\").toLowerCase();\n};\nclass BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n constructor(..._args) {\n __publicField(this, \"parentElement\", null);\n __publicField(this, \"parentNode\", null);\n __publicField(this, \"ownerDocument\");\n __publicField(this, \"firstChild\", null);\n __publicField(this, \"lastChild\", null);\n __publicField(this, \"previousSibling\", null);\n __publicField(this, \"nextSibling\", null);\n __publicField(this, \"ELEMENT_NODE\", 1);\n __publicField(this, \"TEXT_NODE\", 3);\n // corresponding nodeType value of standard HTML Node\n __publicField(this, \"nodeType\");\n __publicField(this, \"nodeName\");\n __publicField(this, \"RRNodeType\");\n }\n get childNodes() {\n const childNodes = [];\n let childIterator = this.firstChild;\n while (childIterator) {\n childNodes.push(childIterator);\n childIterator = childIterator.nextSibling;\n }\n return childNodes;\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}\nclass BaseRRDocument extends BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(...args) {\n super(args);\n __publicField(this, \"nodeType\", 9);\n __publicField(this, \"nodeName\", \"#document\");\n __publicField(this, \"compatMode\", \"CSS1Compat\");\n __publicField(this, \"RRNodeType\", NodeType$1.Document);\n __publicField(this, \"textContent\", null);\n this.ownerDocument = this;\n }\n get documentElement() {\n return this.childNodes.find(\n (node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === \"HTML\"\n ) || null;\n }\n get body() {\n var _a;\n return ((_a = this.documentElement) == null ? void 0 : _a.childNodes.find(\n (node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === \"BODY\"\n )) || null;\n }\n get head() {\n var _a;\n return ((_a = this.documentElement) == null ? void 0 : _a.childNodes.find(\n (node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === \"HEAD\"\n )) || null;\n }\n get implementation() {\n return this;\n }\n get firstElementChild() {\n return this.documentElement;\n }\n appendChild(newChild) {\n const nodeType = newChild.RRNodeType;\n if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {\n if (this.childNodes.some((s) => s.RRNodeType === nodeType)) {\n throw new Error(\n `RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? \"RRElement\" : \"RRDoctype\"} on RRDocument allowed.`\n );\n }\n }\n const child = appendChild(this, newChild);\n child.parentElement = null;\n return child;\n }\n insertBefore(newChild, refChild) {\n const nodeType = newChild.RRNodeType;\n if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {\n if (this.childNodes.some((s) => s.RRNodeType === nodeType)) {\n throw new Error(\n `RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? \"RRElement\" : \"RRDoctype\"} on RRDocument allowed.`\n );\n }\n }\n const child = insertBefore(this, newChild, refChild);\n child.parentElement = null;\n return child;\n }\n removeChild(node2) {\n return removeChild(this, node2);\n }\n open() {\n this.firstChild = null;\n this.lastChild = null;\n }\n close() {\n }\n /**\n * Adhoc implementation for setting xhtml namespace in rebuilt.ts (rrweb-snapshot).\n * There are two lines used this function:\n * 1. doc.write('\\<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\"\\>')\n * 2. doc.write('\\<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"\"\\>')\n */\n write(content) {\n let publicId;\n if (content === '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\">')\n publicId = \"-//W3C//DTD XHTML 1.0 Transitional//EN\";\n else if (content === '<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"\">')\n publicId = \"-//W3C//DTD HTML 4.0 Transitional//EN\";\n if (publicId) {\n const doctype = this.createDocumentType(\"html\", publicId, \"\");\n this.open();\n this.appendChild(doctype);\n }\n }\n createDocument(_namespace, _qualifiedName, _doctype) {\n return new BaseRRDocument();\n }\n createDocumentType(qualifiedName, publicId, systemId) {\n const doctype = new BaseRRDocumentType(qualifiedName, publicId, systemId);\n doctype.ownerDocument = this;\n return doctype;\n }\n createElement(tagName) {\n const element = new BaseRRElement(tagName);\n element.ownerDocument = this;\n return element;\n }\n createElementNS(_namespaceURI, qualifiedName) {\n return this.createElement(qualifiedName);\n }\n createTextNode(data) {\n const text = new BaseRRText(data);\n text.ownerDocument = this;\n return text;\n }\n createComment(data) {\n const comment2 = new BaseRRComment(data);\n comment2.ownerDocument = this;\n return comment2;\n }\n createCDATASection(data) {\n const CDATASection = new BaseRRCDATASection(data);\n CDATASection.ownerDocument = this;\n return CDATASection;\n }\n toString() {\n return \"RRDocument\";\n }\n}\nclass BaseRRDocumentType extends BaseRRNode {\n constructor(qualifiedName, publicId, systemId) {\n super();\n __publicField(this, \"nodeType\", 10);\n __publicField(this, \"RRNodeType\", NodeType$1.DocumentType);\n __publicField(this, \"name\");\n __publicField(this, \"publicId\");\n __publicField(this, \"systemId\");\n __publicField(this, \"textContent\", null);\n this.name = qualifiedName;\n this.publicId = publicId;\n this.systemId = systemId;\n this.nodeName = qualifiedName;\n }\n toString() {\n return \"RRDocumentType\";\n }\n}\nclass BaseRRElement extends BaseRRNode {\n constructor(tagName) {\n super();\n __publicField(this, \"nodeType\", 1);\n __publicField(this, \"RRNodeType\", NodeType$1.Element);\n __publicField(this, \"tagName\");\n __publicField(this, \"attributes\", {});\n __publicField(this, \"shadowRoot\", null);\n __publicField(this, \"scrollLeft\");\n __publicField(this, \"scrollTop\");\n this.tagName = tagName.toUpperCase();\n this.nodeName = tagName.toUpperCase();\n }\n get textContent() {\n let result2 = \"\";\n this.childNodes.forEach((node2) => result2 += node2.textContent);\n return result2;\n }\n set textContent(textContent) {\n this.firstChild = null;\n this.lastChild = null;\n this.appendChild(this.ownerDocument.createTextNode(textContent));\n }\n get classList() {\n return new ClassList(\n this.attributes.class,\n (newClassName) => {\n this.attributes.class = newClassName;\n }\n );\n }\n get id() {\n return this.attributes.id || \"\";\n }\n get className() {\n return this.attributes.class || \"\";\n }\n get style() {\n const style = this.attributes.style ? parseCSSText(this.attributes.style) : {};\n const hyphenateRE2 = /\\B([A-Z])/g;\n style.setProperty = (name, value, priority) => {\n if (hyphenateRE2.test(name)) return;\n const normalizedName = camelize(name);\n if (!value) delete style[normalizedName];\n else style[normalizedName] = value;\n if (priority === \"important\") style[normalizedName] += \" !important\";\n this.attributes.style = toCSSText(style);\n };\n style.removeProperty = (name) => {\n if (hyphenateRE2.test(name)) return \"\";\n const normalizedName = camelize(name);\n const value = style[normalizedName] || \"\";\n delete style[normalizedName];\n this.attributes.style = toCSSText(style);\n return value;\n };\n return style;\n }\n getAttribute(name) {\n if (this.attributes[name] === void 0) return null;\n return this.attributes[name];\n }\n setAttribute(name, attribute) {\n this.attributes[name] = attribute;\n }\n setAttributeNS(_namespace, qualifiedName, value) {\n this.setAttribute(qualifiedName, value);\n }\n removeAttribute(name) {\n delete this.attributes[name];\n }\n appendChild(newChild) {\n return appendChild(this, newChild);\n }\n insertBefore(newChild, refChild) {\n return insertBefore(this, newChild, refChild);\n }\n removeChild(node2) {\n return removeChild(this, node2);\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n attachShadow(_init) {\n const shadowRoot = this.ownerDocument.createElement(\"SHADOWROOT\");\n this.shadowRoot = shadowRoot;\n return shadowRoot;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dispatchEvent(_event) {\n return true;\n }\n toString() {\n let attributeString = \"\";\n for (const attribute in this.attributes) {\n attributeString += `${attribute}=\"${this.attributes[attribute]}\" `;\n }\n return `${this.tagName} ${attributeString}`;\n }\n}\nclass BaseRRMediaElement extends BaseRRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"currentTime\");\n __publicField(this, \"volume\");\n __publicField(this, \"paused\");\n __publicField(this, \"muted\");\n __publicField(this, \"playbackRate\");\n __publicField(this, \"loop\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n attachShadow(_init) {\n throw new Error(\n `RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow`\n );\n }\n play() {\n this.paused = false;\n }\n pause() {\n this.paused = true;\n }\n}\nclass BaseRRDialogElement extends BaseRRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"tagName\", \"DIALOG\");\n __publicField(this, \"nodeName\", \"DIALOG\");\n }\n get isModal() {\n return this.getAttribute(\"rr_open_mode\") === \"modal\";\n }\n get open() {\n return this.getAttribute(\"open\") !== null;\n }\n close() {\n this.removeAttribute(\"open\");\n this.removeAttribute(\"rr_open_mode\");\n }\n show() {\n this.setAttribute(\"open\", \"\");\n this.setAttribute(\"rr_open_mode\", \"non-modal\");\n }\n showModal() {\n this.setAttribute(\"open\", \"\");\n this.setAttribute(\"rr_open_mode\", \"modal\");\n }\n}\nclass BaseRRText extends BaseRRNode {\n constructor(data) {\n super();\n __publicField(this, \"nodeType\", 3);\n __publicField(this, \"nodeName\", \"#text\");\n __publicField(this, \"RRNodeType\", NodeType$1.Text);\n __publicField(this, \"data\");\n this.data = data;\n }\n get textContent() {\n return this.data;\n }\n set textContent(textContent) {\n this.data = textContent;\n }\n toString() {\n return `RRText text=${JSON.stringify(this.data)}`;\n }\n}\nclass BaseRRComment extends BaseRRNode {\n constructor(data) {\n super();\n __publicField(this, \"nodeType\", 8);\n __publicField(this, \"nodeName\", \"#comment\");\n __publicField(this, \"RRNodeType\", NodeType$1.Comment);\n __publicField(this, \"data\");\n this.data = data;\n }\n get textContent() {\n return this.data;\n }\n set textContent(textContent) {\n this.data = textContent;\n }\n toString() {\n return `RRComment text=${JSON.stringify(this.data)}`;\n }\n}\nclass BaseRRCDATASection extends BaseRRNode {\n constructor(data) {\n super();\n __publicField(this, \"nodeName\", \"#cdata-section\");\n __publicField(this, \"nodeType\", 4);\n __publicField(this, \"RRNodeType\", NodeType$1.CDATA);\n __publicField(this, \"data\");\n this.data = data;\n }\n get textContent() {\n return this.data;\n }\n set textContent(textContent) {\n this.data = textContent;\n }\n toString() {\n return `RRCDATASection data=${JSON.stringify(this.data)}`;\n }\n}\nclass ClassList {\n constructor(classText, onChange) {\n __publicField(this, \"onChange\");\n __publicField(this, \"classes\", []);\n __publicField(this, \"add\", (...classNames) => {\n for (const item of classNames) {\n const className = String(item);\n if (this.classes.indexOf(className) >= 0) continue;\n this.classes.push(className);\n }\n this.onChange && this.onChange(this.classes.join(\" \"));\n });\n __publicField(this, \"remove\", (...classNames) => {\n this.classes = this.classes.filter(\n (item) => classNames.indexOf(item) === -1\n );\n this.onChange && this.onChange(this.classes.join(\" \"));\n });\n if (classText) {\n const classes = classText.trim().split(/\\s+/);\n this.classes.push(...classes);\n }\n this.onChange = onChange;\n }\n}\nfunction appendChild(parent, newChild) {\n if (newChild.parentNode) newChild.parentNode.removeChild(newChild);\n if (parent.lastChild) {\n parent.lastChild.nextSibling = newChild;\n newChild.previousSibling = parent.lastChild;\n } else {\n parent.firstChild = newChild;\n newChild.previousSibling = null;\n }\n parent.lastChild = newChild;\n newChild.nextSibling = null;\n newChild.parentNode = parent;\n newChild.parentElement = parent;\n newChild.ownerDocument = parent.ownerDocument;\n return newChild;\n}\nfunction insertBefore(parent, newChild, refChild) {\n if (!refChild) return appendChild(parent, newChild);\n if (refChild.parentNode !== parent)\n throw new Error(\n \"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.\"\n );\n if (newChild === refChild) return newChild;\n if (newChild.parentNode) newChild.parentNode.removeChild(newChild);\n newChild.previousSibling = refChild.previousSibling;\n refChild.previousSibling = newChild;\n newChild.nextSibling = refChild;\n if (newChild.previousSibling) newChild.previousSibling.nextSibling = newChild;\n else parent.firstChild = newChild;\n newChild.parentElement = parent;\n newChild.parentNode = parent;\n newChild.ownerDocument = parent.ownerDocument;\n return newChild;\n}\nfunction removeChild(parent, child) {\n if (child.parentNode !== parent)\n throw new Error(\n \"Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.\"\n );\n if (child.previousSibling)\n child.previousSibling.nextSibling = child.nextSibling;\n else parent.firstChild = child.nextSibling;\n if (child.nextSibling)\n child.nextSibling.previousSibling = child.previousSibling;\n else parent.lastChild = child.previousSibling;\n child.previousSibling = null;\n child.nextSibling = null;\n child.parentElement = null;\n child.parentNode = null;\n return child;\n}\nvar NodeType = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2[\"PLACEHOLDER\"] = 0] = \"PLACEHOLDER\";\n NodeType2[NodeType2[\"ELEMENT_NODE\"] = 1] = \"ELEMENT_NODE\";\n NodeType2[NodeType2[\"ATTRIBUTE_NODE\"] = 2] = \"ATTRIBUTE_NODE\";\n NodeType2[NodeType2[\"TEXT_NODE\"] = 3] = \"TEXT_NODE\";\n NodeType2[NodeType2[\"CDATA_SECTION_NODE\"] = 4] = \"CDATA_SECTION_NODE\";\n NodeType2[NodeType2[\"ENTITY_REFERENCE_NODE\"] = 5] = \"ENTITY_REFERENCE_NODE\";\n NodeType2[NodeType2[\"ENTITY_NODE\"] = 6] = \"ENTITY_NODE\";\n NodeType2[NodeType2[\"PROCESSING_INSTRUCTION_NODE\"] = 7] = \"PROCESSING_INSTRUCTION_NODE\";\n NodeType2[NodeType2[\"COMMENT_NODE\"] = 8] = \"COMMENT_NODE\";\n NodeType2[NodeType2[\"DOCUMENT_NODE\"] = 9] = \"DOCUMENT_NODE\";\n NodeType2[NodeType2[\"DOCUMENT_TYPE_NODE\"] = 10] = \"DOCUMENT_TYPE_NODE\";\n NodeType2[NodeType2[\"DOCUMENT_FRAGMENT_NODE\"] = 11] = \"DOCUMENT_FRAGMENT_NODE\";\n return NodeType2;\n})(NodeType || {});\nconst NAMESPACES = {\n svg: \"http://www.w3.org/2000/svg\",\n \"xlink:href\": \"http://www.w3.org/1999/xlink\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\nconst SVGTagMap = {\n altglyph: \"altGlyph\",\n altglyphdef: \"altGlyphDef\",\n altglyphitem: \"altGlyphItem\",\n animatecolor: \"animateColor\",\n animatemotion: \"animateMotion\",\n animatetransform: \"animateTransform\",\n clippath: \"clipPath\",\n feblend: \"feBlend\",\n fecolormatrix: \"feColorMatrix\",\n fecomponenttransfer: \"feComponentTransfer\",\n fecomposite: \"feComposite\",\n feconvolvematrix: \"feConvolveMatrix\",\n fediffuselighting: \"feDiffuseLighting\",\n fedisplacementmap: \"feDisplacementMap\",\n fedistantlight: \"feDistantLight\",\n fedropshadow: \"feDropShadow\",\n feflood: \"feFlood\",\n fefunca: \"feFuncA\",\n fefuncb: \"feFuncB\",\n fefuncg: \"feFuncG\",\n fefuncr: \"feFuncR\",\n fegaussianblur: \"feGaussianBlur\",\n feimage: \"feImage\",\n femerge: \"feMerge\",\n femergenode: \"feMergeNode\",\n femorphology: \"feMorphology\",\n feoffset: \"feOffset\",\n fepointlight: \"fePointLight\",\n fespecularlighting: \"feSpecularLighting\",\n fespotlight: \"feSpotLight\",\n fetile: \"feTile\",\n feturbulence: \"feTurbulence\",\n foreignobject: \"foreignObject\",\n glyphref: \"glyphRef\",\n lineargradient: \"linearGradient\",\n radialgradient: \"radialGradient\"\n};\nlet createdNodeSet = null;\nfunction diff(oldTree, newTree, replayer, rrnodeMirror = newTree.mirror || newTree.ownerDocument.mirror) {\n oldTree = diffBeforeUpdatingChildren(\n oldTree,\n newTree,\n replayer,\n rrnodeMirror\n );\n diffChildren(oldTree, newTree, replayer, rrnodeMirror);\n diffAfterUpdatingChildren(oldTree, newTree, replayer);\n}\nfunction diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {\n var _a;\n if (replayer.afterAppend && !createdNodeSet) {\n createdNodeSet = /* @__PURE__ */ new WeakSet();\n setTimeout(() => {\n createdNodeSet = null;\n }, 0);\n }\n if (!sameNodeType(oldTree, newTree)) {\n const calibratedOldTree = createOrGetNode(\n newTree,\n replayer.mirror,\n rrnodeMirror\n );\n (_a = oldTree.parentNode) == null ? void 0 : _a.replaceChild(calibratedOldTree, oldTree);\n oldTree = calibratedOldTree;\n }\n switch (newTree.RRNodeType) {\n case NodeType$1.Document: {\n if (!nodeMatching(oldTree, newTree, replayer.mirror, rrnodeMirror)) {\n const newMeta = rrnodeMirror.getMeta(newTree);\n if (newMeta) {\n replayer.mirror.removeNodeFromMap(oldTree);\n oldTree.close();\n oldTree.open();\n replayer.mirror.add(oldTree, newMeta);\n createdNodeSet == null ? void 0 : createdNodeSet.add(oldTree);\n }\n }\n break;\n }\n case NodeType$1.Element: {\n const oldElement = oldTree;\n const newRRElement = newTree;\n switch (newRRElement.tagName) {\n case \"IFRAME\": {\n const oldContentDocument = oldTree.contentDocument;\n if (!oldContentDocument) break;\n diff(\n oldContentDocument,\n newTree.contentDocument,\n replayer,\n rrnodeMirror\n );\n break;\n }\n }\n if (newRRElement.shadowRoot) {\n if (!oldElement.shadowRoot) oldElement.attachShadow({ mode: \"open\" });\n diffChildren(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n oldElement.shadowRoot,\n newRRElement.shadowRoot,\n replayer,\n rrnodeMirror\n );\n }\n diffProps(oldElement, newRRElement, rrnodeMirror);\n break;\n }\n }\n return oldTree;\n}\nfunction diffAfterUpdatingChildren(oldTree, newTree, replayer) {\n var _a;\n switch (newTree.RRNodeType) {\n case NodeType$1.Document: {\n const scrollData = newTree.scrollData;\n scrollData && replayer.applyScroll(scrollData, true);\n break;\n }\n case NodeType$1.Element: {\n const oldElement = oldTree;\n const newRRElement = newTree;\n newRRElement.scrollData && replayer.applyScroll(newRRElement.scrollData, true);\n newRRElement.inputData && replayer.applyInput(newRRElement.inputData);\n switch (newRRElement.tagName) {\n case \"AUDIO\":\n case \"VIDEO\": {\n const oldMediaElement = oldTree;\n const newMediaRRElement = newRRElement;\n if (newMediaRRElement.paused !== void 0)\n newMediaRRElement.paused ? void oldMediaElement.pause() : void oldMediaElement.play();\n if (newMediaRRElement.muted !== void 0)\n oldMediaElement.muted = newMediaRRElement.muted;\n if (newMediaRRElement.volume !== void 0)\n oldMediaElement.volume = newMediaRRElement.volume;\n if (newMediaRRElement.currentTime !== void 0)\n oldMediaElement.currentTime = newMediaRRElement.currentTime;\n if (newMediaRRElement.playbackRate !== void 0)\n oldMediaElement.playbackRate = newMediaRRElement.playbackRate;\n if (newMediaRRElement.loop !== void 0)\n oldMediaElement.loop = newMediaRRElement.loop;\n break;\n }\n case \"CANVAS\": {\n const rrCanvasElement = newTree;\n if (rrCanvasElement.rr_dataURL !== null) {\n const image = document.createElement(\"img\");\n image.onload = () => {\n const ctx = oldElement.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(image, 0, 0, image.width, image.height);\n }\n };\n image.src = rrCanvasElement.rr_dataURL;\n }\n rrCanvasElement.canvasMutations.forEach(\n (canvasMutation) => replayer.applyCanvas(\n canvasMutation.event,\n canvasMutation.mutation,\n oldTree\n )\n );\n break;\n }\n // Props of style elements have to be updated after all children are updated. Otherwise the props can be overwritten by textContent.\n case \"STYLE\": {\n const styleSheet = oldElement.sheet;\n styleSheet && newTree.rules.forEach(\n (data) => replayer.applyStyleSheetMutation(data, styleSheet)\n );\n break;\n }\n case \"DIALOG\": {\n const dialog = oldElement;\n const rrDialog = newRRElement;\n const wasOpen = dialog.open;\n const wasModal = dialog.matches(\"dialog:modal\");\n const shouldBeOpen = rrDialog.open;\n const shouldBeModal = rrDialog.isModal;\n const modalChanged = wasModal !== shouldBeModal;\n const openChanged = wasOpen !== shouldBeOpen;\n if (modalChanged || wasOpen && openChanged) dialog.close();\n if (shouldBeOpen && (openChanged || modalChanged)) {\n try {\n if (shouldBeModal) dialog.showModal();\n else dialog.show();\n } catch (e) {\n console.warn(e);\n }\n }\n break;\n }\n }\n break;\n }\n case NodeType$1.Text:\n case NodeType$1.Comment:\n case NodeType$1.CDATA: {\n if (oldTree.textContent !== newTree.data)\n oldTree.textContent = newTree.data;\n break;\n }\n }\n if (createdNodeSet == null ? void 0 : createdNodeSet.has(oldTree)) {\n createdNodeSet.delete(oldTree);\n (_a = replayer.afterAppend) == null ? void 0 : _a.call(replayer, oldTree, replayer.mirror.getId(oldTree));\n }\n}\nfunction diffProps(oldTree, newTree, rrnodeMirror) {\n const oldAttributes = oldTree.attributes;\n const newAttributes = newTree.attributes;\n for (const name in newAttributes) {\n const newValue = newAttributes[name];\n const sn = rrnodeMirror.getMeta(newTree);\n if ((sn == null ? void 0 : sn.isSVG) && NAMESPACES[name])\n oldTree.setAttributeNS(NAMESPACES[name], name, newValue);\n else if (newTree.tagName === \"CANVAS\" && name === \"rr_dataURL\") {\n const image = document.createElement(\"img\");\n image.src = newValue;\n image.onload = () => {\n const ctx = oldTree.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(image, 0, 0, image.width, image.height);\n }\n };\n } else if (newTree.tagName === \"IFRAME\" && name === \"srcdoc\") continue;\n else {\n try {\n oldTree.setAttribute(name, newValue);\n } catch (err) {\n console.warn(err);\n }\n }\n }\n for (const { name } of Array.from(oldAttributes))\n if (!(name in newAttributes)) oldTree.removeAttribute(name);\n newTree.scrollLeft && (oldTree.scrollLeft = newTree.scrollLeft);\n newTree.scrollTop && (oldTree.scrollTop = newTree.scrollTop);\n}\nfunction diffChildren(oldTree, newTree, replayer, rrnodeMirror) {\n const oldChildren = Array.from(oldTree.childNodes);\n const newChildren = newTree.childNodes;\n if (oldChildren.length === 0 && newChildren.length === 0) return;\n let oldStartIndex = 0, oldEndIndex = oldChildren.length - 1, newStartIndex = 0, newEndIndex = newChildren.length - 1;\n let oldStartNode = oldChildren[oldStartIndex], oldEndNode = oldChildren[oldEndIndex], newStartNode = newChildren[newStartIndex], newEndNode = newChildren[newEndIndex];\n let oldIdToIndex = void 0, indexInOld = void 0;\n while (oldStartIndex <= oldEndIndex && newStartIndex <= newEndIndex) {\n if (oldStartNode === void 0) {\n oldStartNode = oldChildren[++oldStartIndex];\n } else if (oldEndNode === void 0) {\n oldEndNode = oldChildren[--oldEndIndex];\n } else if (\n // same first node?\n nodeMatching(oldStartNode, newStartNode, replayer.mirror, rrnodeMirror)\n ) {\n oldStartNode = oldChildren[++oldStartIndex];\n newStartNode = newChildren[++newStartIndex];\n } else if (\n // same last node?\n nodeMatching(oldEndNode, newEndNode, replayer.mirror, rrnodeMirror)\n ) {\n oldEndNode = oldChildren[--oldEndIndex];\n newEndNode = newChildren[--newEndIndex];\n } else if (\n // is the first old node the same as the last new node?\n nodeMatching(oldStartNode, newEndNode, replayer.mirror, rrnodeMirror)\n ) {\n try {\n oldTree.insertBefore(oldStartNode, oldEndNode.nextSibling);\n } catch (e) {\n console.warn(e);\n }\n oldStartNode = oldChildren[++oldStartIndex];\n newEndNode = newChildren[--newEndIndex];\n } else if (\n // is the last old node the same as the first new node?\n nodeMatching(oldEndNode, newStartNode, replayer.mirror, rrnodeMirror)\n ) {\n try {\n oldTree.insertBefore(oldEndNode, oldStartNode);\n } catch (e) {\n console.warn(e);\n }\n oldEndNode = oldChildren[--oldEndIndex];\n newStartNode = newChildren[++newStartIndex];\n } else {\n if (!oldIdToIndex) {\n oldIdToIndex = {};\n for (let i = oldStartIndex; i <= oldEndIndex; i++) {\n const oldChild2 = oldChildren[i];\n if (oldChild2 && replayer.mirror.hasNode(oldChild2))\n oldIdToIndex[replayer.mirror.getId(oldChild2)] = i;\n }\n }\n indexInOld = oldIdToIndex[rrnodeMirror.getId(newStartNode)];\n const nodeToMove = oldChildren[indexInOld];\n if (indexInOld !== void 0 && nodeToMove && nodeMatching(nodeToMove, newStartNode, replayer.mirror, rrnodeMirror)) {\n try {\n oldTree.insertBefore(nodeToMove, oldStartNode);\n } catch (e) {\n console.warn(e);\n }\n oldChildren[indexInOld] = void 0;\n } else {\n const newNode = createOrGetNode(\n newStartNode,\n replayer.mirror,\n rrnodeMirror\n );\n if (oldTree.nodeName === \"#document\" && oldStartNode && /**\n * Special case 1: one document isn't allowed to have two doctype nodes at the same time, so we need to remove the old one first before inserting the new one.\n * How this case happens: A parent document in the old tree already has a doctype node with an id e.g. #1. A new full snapshot rebuilds the replayer with a new doctype node with another id #2. According to the algorithm, the new doctype node will be inserted before the old one, which is not allowed by the Document standard.\n */\n (newNode.nodeType === newNode.DOCUMENT_TYPE_NODE && oldStartNode.nodeType === oldStartNode.DOCUMENT_TYPE_NODE || /**\n * Special case 2: one document isn't allowed to have two HTMLElements at the same time, so we need to remove the old one first before inserting the new one.\n * How this case happens: A mounted iframe element has an automatically created HTML element. We should delete it before inserting a serialized one. Otherwise, an error 'Only one element on document allowed' will be thrown.\n */\n newNode.nodeType === newNode.ELEMENT_NODE && oldStartNode.nodeType === oldStartNode.ELEMENT_NODE)) {\n oldTree.removeChild(oldStartNode);\n replayer.mirror.removeNodeFromMap(oldStartNode);\n oldStartNode = oldChildren[++oldStartIndex];\n }\n try {\n oldTree.insertBefore(newNode, oldStartNode || null);\n } catch (e) {\n console.warn(e);\n }\n }\n newStartNode = newChildren[++newStartIndex];\n }\n }\n if (oldStartIndex > oldEndIndex) {\n const referenceRRNode = newChildren[newEndIndex + 1];\n let referenceNode = null;\n if (referenceRRNode)\n referenceNode = replayer.mirror.getNode(\n rrnodeMirror.getId(referenceRRNode)\n );\n for (; newStartIndex <= newEndIndex; ++newStartIndex) {\n const newNode = createOrGetNode(\n newChildren[newStartIndex],\n replayer.mirror,\n rrnodeMirror\n );\n try {\n oldTree.insertBefore(newNode, referenceNode);\n } catch (e) {\n console.warn(e);\n }\n }\n } else if (newStartIndex > newEndIndex) {\n for (; oldStartIndex <= oldEndIndex; oldStartIndex++) {\n const node2 = oldChildren[oldStartIndex];\n if (!node2 || node2.parentNode !== oldTree) continue;\n try {\n oldTree.removeChild(node2);\n replayer.mirror.removeNodeFromMap(node2);\n } catch (e) {\n console.warn(e);\n }\n }\n }\n let oldChild = oldTree.firstChild;\n let newChild = newTree.firstChild;\n while (oldChild !== null && newChild !== null) {\n diff(oldChild, newChild, replayer, rrnodeMirror);\n oldChild = oldChild.nextSibling;\n newChild = newChild.nextSibling;\n }\n}\nfunction createOrGetNode(rrNode, domMirror, rrnodeMirror) {\n const nodeId = rrnodeMirror.getId(rrNode);\n const sn = rrnodeMirror.getMeta(rrNode);\n let node2 = null;\n if (nodeId > -1) node2 = domMirror.getNode(nodeId);\n if (node2 !== null && sameNodeType(node2, rrNode)) return node2;\n switch (rrNode.RRNodeType) {\n case NodeType$1.Document:\n node2 = new Document();\n break;\n case NodeType$1.DocumentType:\n node2 = document.implementation.createDocumentType(\n rrNode.name,\n rrNode.publicId,\n rrNode.systemId\n );\n break;\n case NodeType$1.Element: {\n let tagName = rrNode.tagName.toLowerCase();\n tagName = SVGTagMap[tagName] || tagName;\n if (sn && \"isSVG\" in sn && (sn == null ? void 0 : sn.isSVG)) {\n node2 = document.createElementNS(NAMESPACES[\"svg\"], tagName);\n } else node2 = document.createElement(rrNode.tagName);\n break;\n }\n case NodeType$1.Text:\n node2 = document.createTextNode(rrNode.data);\n break;\n case NodeType$1.Comment:\n node2 = document.createComment(rrNode.data);\n break;\n case NodeType$1.CDATA:\n node2 = document.createCDATASection(rrNode.data);\n break;\n }\n if (sn) domMirror.add(node2, { ...sn });\n try {\n createdNodeSet == null ? void 0 : createdNodeSet.add(node2);\n } catch (e) {\n }\n return node2;\n}\nfunction sameNodeType(node1, node2) {\n if (node1.nodeType !== node2.nodeType) return false;\n return node1.nodeType !== node1.ELEMENT_NODE || node1.tagName.toUpperCase() === node2.tagName;\n}\nfunction nodeMatching(node1, node2, domMirror, rrdomMirror) {\n const node1Id = domMirror.getId(node1);\n const node2Id = rrdomMirror.getId(node2);\n if (node1Id === -1 || node1Id !== node2Id) return false;\n return sameNodeType(node1, node2);\n}\nclass RRDocument extends BaseRRDocument {\n constructor(mirror) {\n super();\n __publicField(this, \"UNSERIALIZED_STARTING_ID\", -2);\n // In the rrweb replayer, there are some unserialized nodes like the element that stores the injected style rules.\n // These unserialized nodes may interfere the execution of the diff algorithm.\n // The id of serialized node is larger than 0. So this value less than 0 is used as id for these unserialized nodes.\n __publicField(this, \"_unserializedId\", this.UNSERIALIZED_STARTING_ID);\n __publicField(this, \"mirror\", createMirror());\n __publicField(this, \"scrollData\", null);\n if (mirror) {\n this.mirror = mirror;\n }\n }\n /**\n * Every time the id is used, it will minus 1 automatically to avoid collisions.\n */\n get unserializedId() {\n return this._unserializedId--;\n }\n createDocument(_namespace, _qualifiedName, _doctype) {\n return new RRDocument();\n }\n createDocumentType(qualifiedName, publicId, systemId) {\n const documentTypeNode = new RRDocumentType(\n qualifiedName,\n publicId,\n systemId\n );\n documentTypeNode.ownerDocument = this;\n return documentTypeNode;\n }\n createElement(tagName) {\n const upperTagName = tagName.toUpperCase();\n let element;\n switch (upperTagName) {\n case \"AUDIO\":\n case \"VIDEO\":\n element = new RRMediaElement(upperTagName);\n break;\n case \"IFRAME\":\n element = new RRIFrameElement(upperTagName, this.mirror);\n break;\n case \"CANVAS\":\n element = new RRCanvasElement(upperTagName);\n break;\n case \"STYLE\":\n element = new RRStyleElement(upperTagName);\n break;\n case \"DIALOG\":\n element = new RRDialogElement(upperTagName);\n break;\n default:\n element = new RRElement(upperTagName);\n break;\n }\n element.ownerDocument = this;\n return element;\n }\n createComment(data) {\n const commentNode = new RRComment(data);\n commentNode.ownerDocument = this;\n return commentNode;\n }\n createCDATASection(data) {\n const sectionNode = new RRCDATASection(data);\n sectionNode.ownerDocument = this;\n return sectionNode;\n }\n createTextNode(data) {\n const textNode = new RRText(data);\n textNode.ownerDocument = this;\n return textNode;\n }\n destroyTree() {\n this.firstChild = null;\n this.lastChild = null;\n this.mirror.reset();\n }\n open() {\n super.open();\n this._unserializedId = this.UNSERIALIZED_STARTING_ID;\n }\n}\nconst RRDocumentType = BaseRRDocumentType;\nclass RRElement extends BaseRRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"inputData\", null);\n __publicField(this, \"scrollData\", null);\n }\n}\nclass RRMediaElement extends BaseRRMediaElement {\n}\nclass RRDialogElement extends BaseRRDialogElement {\n}\nclass RRCanvasElement extends RRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"rr_dataURL\", null);\n __publicField(this, \"canvasMutations\", []);\n }\n /**\n * This is a dummy implementation to distinguish RRCanvasElement from real HTMLCanvasElement.\n */\n getContext() {\n return null;\n }\n}\nclass RRStyleElement extends RRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"rules\", []);\n }\n}\nclass RRIFrameElement extends RRElement {\n constructor(upperTagName, mirror) {\n super(upperTagName);\n __publicField(this, \"contentDocument\", new RRDocument());\n this.contentDocument.mirror = mirror;\n }\n}\nconst RRText = BaseRRText;\nconst RRComment = BaseRRComment;\nconst RRCDATASection = BaseRRCDATASection;\nfunction getValidTagName(element) {\n if (element instanceof HTMLFormElement) {\n return \"FORM\";\n }\n return element.tagName.toUpperCase();\n}\nfunction buildFromNode(node2, rrdom, domMirror, parentRRNode) {\n let rrNode;\n switch (node2.nodeType) {\n case NodeType.DOCUMENT_NODE:\n if (parentRRNode && parentRRNode.nodeName === \"IFRAME\")\n rrNode = parentRRNode.contentDocument;\n else {\n rrNode = rrdom;\n rrNode.compatMode = node2.compatMode;\n }\n break;\n case NodeType.DOCUMENT_TYPE_NODE: {\n const documentType = node2;\n rrNode = rrdom.createDocumentType(\n documentType.name,\n documentType.publicId,\n documentType.systemId\n );\n break;\n }\n case NodeType.ELEMENT_NODE: {\n const elementNode = node2;\n const tagName = getValidTagName(elementNode);\n rrNode = rrdom.createElement(tagName);\n const rrElement = rrNode;\n for (const { name, value } of Array.from(elementNode.attributes)) {\n rrElement.attributes[name] = value;\n }\n elementNode.scrollLeft && (rrElement.scrollLeft = elementNode.scrollLeft);\n elementNode.scrollTop && (rrElement.scrollTop = elementNode.scrollTop);\n break;\n }\n case NodeType.TEXT_NODE:\n rrNode = rrdom.createTextNode(node2.textContent || \"\");\n break;\n case NodeType.CDATA_SECTION_NODE:\n rrNode = rrdom.createCDATASection(node2.data);\n break;\n case NodeType.COMMENT_NODE:\n rrNode = rrdom.createComment(node2.textContent || \"\");\n break;\n // if node is a shadow root\n case NodeType.DOCUMENT_FRAGMENT_NODE:\n rrNode = parentRRNode.attachShadow({ mode: \"open\" });\n break;\n default:\n return null;\n }\n let sn = domMirror.getMeta(node2);\n if (rrdom instanceof RRDocument) {\n if (!sn) {\n sn = getDefaultSN(rrNode, rrdom.unserializedId);\n domMirror.add(node2, sn);\n }\n rrdom.mirror.add(rrNode, { ...sn });\n }\n return rrNode;\n}\nfunction buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument()) {\n function walk2(node2, parentRRNode) {\n const rrNode = buildFromNode(node2, rrdom, domMirror, parentRRNode);\n if (rrNode === null) return;\n if (\n // if the parentRRNode isn't a RRIFrameElement\n (parentRRNode == null ? void 0 : parentRRNode.nodeName) !== \"IFRAME\" && // if node isn't a shadow root\n node2.nodeType !== NodeType.DOCUMENT_FRAGMENT_NODE\n ) {\n parentRRNode == null ? void 0 : parentRRNode.appendChild(rrNode);\n rrNode.parentNode = parentRRNode;\n rrNode.parentElement = parentRRNode;\n }\n if (node2.nodeName === \"IFRAME\") {\n const iframeDoc = node2.contentDocument;\n iframeDoc && walk2(iframeDoc, rrNode);\n } else if (node2.nodeType === NodeType.DOCUMENT_NODE || node2.nodeType === NodeType.ELEMENT_NODE || node2.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {\n if (node2.nodeType === NodeType.ELEMENT_NODE && node2.shadowRoot)\n walk2(node2.shadowRoot, rrNode);\n node2.childNodes.forEach((childNode) => walk2(childNode, rrNode));\n }\n }\n walk2(dom, null);\n return rrdom;\n}\nfunction createMirror() {\n return new Mirror2();\n}\nclass Mirror2 {\n constructor() {\n __publicField(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n) {\n var _a;\n if (!n) return -1;\n const id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;\n return 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(n) {\n return this.nodeMetaMap.get(n) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n) {\n const id = this.getId(n);\n this.idNodeMap.delete(id);\n if (n.childNodes) {\n n.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode));\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node2) {\n return this.nodeMetaMap.has(node2);\n }\n add(n, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n);\n this.nodeMetaMap.set(n, meta);\n }\n replace(id, n) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n, meta);\n }\n this.idNodeMap.set(id, n);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction getDefaultSN(node2, id) {\n switch (node2.RRNodeType) {\n case NodeType$1.Document:\n return {\n id,\n type: node2.RRNodeType,\n childNodes: []\n };\n case NodeType$1.DocumentType: {\n const doctype = node2;\n return {\n id,\n type: node2.RRNodeType,\n name: doctype.name,\n publicId: doctype.publicId,\n systemId: doctype.systemId\n };\n }\n case NodeType$1.Element:\n return {\n id,\n type: node2.RRNodeType,\n tagName: node2.tagName.toLowerCase(),\n // In rrweb data, all tagNames are lowercase.\n attributes: {},\n childNodes: []\n };\n case NodeType$1.Text:\n return {\n id,\n type: node2.RRNodeType,\n textContent: node2.textContent || \"\"\n };\n case NodeType$1.Comment:\n return {\n id,\n type: node2.RRNodeType,\n textContent: node2.textContent || \"\"\n };\n case NodeType$1.CDATA:\n return {\n id,\n type: node2.RRNodeType,\n textContent: \"\"\n };\n }\n}\nfunction printRRDom(rootNode, mirror) {\n return walk(rootNode, mirror, \"\");\n}\nfunction walk(node2, mirror, blankSpace) {\n let printText = `${blankSpace}${mirror.getId(node2)} ${node2.toString()}\n`;\n if (node2.RRNodeType === NodeType$1.Element) {\n const element = node2;\n if (element.shadowRoot)\n printText += walk(element.shadowRoot, mirror, blankSpace + \" \");\n }\n for (const child of node2.childNodes)\n printText += walk(child, mirror, blankSpace + \" \");\n if (node2.nodeName === \"IFRAME\")\n printText += walk(\n node2.contentDocument,\n mirror,\n blankSpace + \" \"\n );\n return printText;\n}\nexport {\n BaseRRCDATASection,\n BaseRRComment,\n BaseRRDialogElement,\n BaseRRDocument,\n BaseRRDocumentType,\n BaseRRElement,\n BaseRRMediaElement,\n BaseRRNode,\n BaseRRText,\n ClassList,\n Mirror2 as Mirror,\n NodeType,\n RRCDATASection,\n RRCanvasElement,\n RRComment,\n RRDialogElement,\n RRDocument,\n RRDocumentType,\n RRElement,\n RRIFrameElement,\n RRMediaElement,\n BaseRRNode as RRNode,\n RRStyleElement,\n RRText,\n buildFromDom,\n buildFromNode,\n createMirror,\n createOrGetNode,\n diff,\n getDefaultSN,\n printRRDom\n};\n//# sourceMappingURL=rrdom.js.map\n","const testableAccessors = {\n Node: [\n \"childNodes\",\n \"parentNode\",\n \"parentElement\",\n \"textContent\",\n \"ownerDocument\"\n ],\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 untaintedBaseIframeCleanup = {};\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 _a, _b;\n return Boolean(\n (_b = (_a = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a.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 _a;\n return typeof defaultPrototype[method] === \"function\" && ((_a = defaultPrototype[method]) == null ? void 0 : _a.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 iframeEl.style.display = \"none\";\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n if (!untaintedObject) {\n iframeEl.remove();\n return defaultPrototype;\n }\n const ua = navigator.userAgent;\n if (ua.includes(\"Safari\") && !ua.includes(\"Chrome\")) {\n iframeEl.classList.add(\"rr-block\");\n iframeEl.setAttribute(\"__rrwebUntaintedMutationObserver\", \"\");\n untaintedBaseIframeCleanup[key] = () => iframeEl.remove();\n } else {\n iframeEl.remove();\n }\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a;\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 = (_a = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a.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 ownerDocument(n) {\n return getUntaintedAccessor(\"Node\", n, \"ownerDocument\");\n}\nfunction childNodes(n) {\n return getUntaintedAccessor(\"Node\", n, \"childNodes\");\n}\nfunction parentNode(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentNode\");\n}\nfunction parentElement(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentElement\");\n}\nfunction textContent(n) {\n return getUntaintedAccessor(\"Node\", n, \"textContent\");\n}\nfunction contains(n, other) {\n return getUntaintedMethod(\"Node\", n, \"contains\")(other);\n}\nfunction getRootNode(n) {\n return getUntaintedMethod(\"Node\", n, \"getRootNode\")();\n}\nfunction host(n) {\n if (!n || !(\"host\" in n)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n, \"host\");\n}\nfunction styleSheets(n) {\n return n.styleSheets;\n}\nfunction shadowRoot(n) {\n if (!n || !(\"shadowRoot\" in n)) return null;\n return getUntaintedAccessor(\"Element\", n, \"shadowRoot\");\n}\nfunction querySelector(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return [\n getUntaintedPrototype(\"MutationObserver\").constructor,\n untaintedBaseIframeCleanup[\"MutationObserver\"] ?? (() => {\n })\n ];\n}\nlet nowTimestamp = Date.now;\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {\n nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();\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 {\n return () => {\n };\n }\n}\nconst index = {\n ownerDocument,\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n nowTimestamp,\n mutationObserverCtor,\n patch\n};\nexport {\n childNodes,\n contains,\n index as default,\n getRootNode,\n getUntaintedAccessor,\n getUntaintedMethod,\n getUntaintedPrototype,\n host,\n isAngularZonePresent,\n mutationObserverCtor,\n nowTimestamp,\n ownerDocument,\n parentElement,\n parentNode,\n patch,\n querySelector,\n querySelectorAll,\n shadowRoot,\n styleSheets,\n textContent\n};\n//# sourceMappingURL=utils.js.map\n","import type {\n throttleOptions,\n listenerHandler,\n hookResetter,\n blockClass,\n addedNodeMutation,\n DocumentDimension,\n IWindow,\n DeprecatedMirror,\n textMutation,\n IMirror,\n} from '@rrweb/types';\nimport type { Mirror, SlimDOMOptions } from 'rrweb-snapshot';\nimport { isShadowRoot, IGNORED_NODE, classMatchesRegex } from 'rrweb-snapshot';\nimport { RRNode, RRIFrameElement, BaseRRNode } from 'rrdom';\nimport dom from '@rrweb/utils';\nexport { nowTimestamp } from '@rrweb/utils';\n\nexport function on(\n type: string,\n fn: EventListenerOrEventListenerObject,\n target: Document | IWindow = document,\n): listenerHandler {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\n\n// https://github.com/rrweb-io/rrweb/pull/407\nconst DEPARTED_MIRROR_ACCESS_WARNING =\n 'Please stop import mirror directly. Instead of that,' +\n '\\r\\n' +\n 'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +\n '\\r\\n' +\n 'or you can use record.mirror to access the mirror instance during recording.';\n/** @deprecated */\nexport let _mirror: DeprecatedMirror = {\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n// copy from underscore and modified\nexport function throttle<T>(\n func: (arg: T) => void,\n wait: number,\n options: throttleOptions = {},\n) {\n let timeout: ReturnType<typeof setTimeout> | null = null;\n let previous = 0;\n return function (...args: T[]) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-this-alias\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}\n\nexport function hookSetter<T>(\n target: T,\n key: string | number | symbol,\n d: PropertyDescriptor,\n isRevoked?: boolean,\n win = window,\n): hookResetter {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked\n ? d\n : {\n set(value) {\n // put hooked setter into event loop to avoid of set latency\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}\n\nexport function getWindowScroll(win: Window) {\n const doc = win.document;\n return {\n left: doc.scrollingElement\n ? doc.scrollingElement.scrollLeft\n : win.pageXOffset !== undefined\n ? win.pageXOffset\n : doc.documentElement.scrollLeft ||\n (doc?.body && dom.parentElement(doc.body)?.scrollLeft) ||\n doc?.body?.scrollLeft ||\n 0,\n top: doc.scrollingElement\n ? doc.scrollingElement.scrollTop\n : win.pageYOffset !== undefined\n ? win.pageYOffset\n : doc?.documentElement.scrollTop ||\n (doc?.body && dom.parentElement(doc.body)?.scrollTop) ||\n doc?.body?.scrollTop ||\n 0,\n };\n}\n\nexport function getWindowHeight(): number {\n return (\n window.innerHeight ||\n (document.documentElement && document.documentElement.clientHeight) ||\n (document.body && document.body.clientHeight)\n );\n}\n\nexport function getWindowWidth(): number {\n return (\n window.innerWidth ||\n (document.documentElement && document.documentElement.clientWidth) ||\n (document.body && document.body.clientWidth)\n );\n}\n\n/**\n * Returns the given node as an HTMLElement if it is one, otherwise the parent node as an HTMLElement\n * @param node - node to check\n * @returns HTMLElement or null\n */\n\nexport function closestElementOfNode(node: Node | null): HTMLElement | null {\n if (!node) {\n return null;\n }\n const el: HTMLElement | null =\n node.nodeType === node.ELEMENT_NODE\n ? (node as HTMLElement)\n : dom.parentElement(node);\n return el;\n}\n\n/**\n * Checks if the given element set to be blocked by rrweb\n * @param node - node to check\n * @param blockClass - class name to check\n * @param blockSelector - css selectors to check\n * @param checkAncestors - whether to search through parent nodes for the block class\n * @returns true/false if the node was blocked or not\n */\nexport function isBlocked(\n node: Node | null,\n blockClass: blockClass,\n blockSelector: string | null,\n checkAncestors: boolean,\n): boolean {\n if (!node) {\n return false;\n }\n const el = closestElementOfNode(node);\n\n if (!el) {\n return false;\n }\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 (e) {\n // e\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}\n\nexport function isSerialized(n: Node, mirror: Mirror): boolean {\n return mirror.getId(n) !== -1;\n}\n\nexport function isIgnored(\n n: Node,\n mirror: Mirror,\n slimDOMOptions: SlimDOMOptions,\n): boolean {\n if ((n as Element).tagName === 'TITLE' && slimDOMOptions.headTitleMutations) {\n // we do this check here but not in rrweb-snapshot\n // to block mutations/animations on the title.\n // the headTitleMutations option isn't intended to block recording of the initial value\n return true;\n }\n // The main part of the slimDOM check happens in\n // rrweb-snapshot::serializeNodeWithId\n return mirror.getId(n) === IGNORED_NODE;\n}\n\nexport function isAncestorRemoved(target: Node, mirror: Mirror): boolean {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror.getId(target);\n if (!mirror.has(id)) {\n return true;\n }\n const parent = dom.parentNode(target);\n if (parent && parent.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n // if the root is not document, it means the node is not in the DOM tree anymore\n if (!parent) {\n return true;\n }\n return isAncestorRemoved(parent, mirror);\n}\n\nexport function legacy_isTouchEvent(\n event: MouseEvent | TouchEvent | PointerEvent,\n): event is TouchEvent {\n return Boolean((event as TouchEvent).changedTouches);\n}\n\nexport function polyfill(win = window) {\n if ('NodeList' in win && !win.NodeList.prototype.forEach) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n win.NodeList.prototype.forEach = Array.prototype\n .forEach as unknown as NodeList['forEach'];\n }\n\n if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n win.DOMTokenList.prototype.forEach = Array.prototype\n .forEach as unknown as DOMTokenList['forEach'];\n }\n}\n\ntype ResolveTree = {\n value: addedNodeMutation;\n children: ResolveTree[];\n parent: ResolveTree | null;\n};\n\nexport function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[] {\n const queueNodeMap: Record<number, ResolveTree> = {};\n const putIntoMap = (\n m: addedNodeMutation,\n parent: ResolveTree | null,\n ): ResolveTree => {\n const nodeInTree: ResolveTree = {\n value: m,\n parent,\n children: [],\n };\n queueNodeMap[m.node.id] = nodeInTree;\n return nodeInTree;\n };\n\n const queueNodeTrees: ResolveTree[] = [];\n for (const mutation of queue) {\n const { nextId, parentId } = mutation;\n if (nextId && nextId in queueNodeMap) {\n const nextInTree = queueNodeMap[nextId];\n if (nextInTree.parent) {\n const idx = nextInTree.parent.children.indexOf(nextInTree);\n nextInTree.parent.children.splice(\n idx,\n 0,\n putIntoMap(mutation, nextInTree.parent),\n );\n } else {\n const idx = queueNodeTrees.indexOf(nextInTree);\n queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));\n }\n continue;\n }\n if (parentId in queueNodeMap) {\n const parentInTree = queueNodeMap[parentId];\n parentInTree.children.push(putIntoMap(mutation, parentInTree));\n continue;\n }\n queueNodeTrees.push(putIntoMap(mutation, null));\n }\n\n return queueNodeTrees;\n}\n\nexport function iterateResolveTree(\n tree: ResolveTree,\n cb: (mutation: addedNodeMutation) => unknown,\n) {\n cb(tree.value);\n /**\n * The resolve tree was designed to reflect the DOM layout,\n * but we need append next sibling first, so we do a reverse\n * loop here.\n */\n for (let i = tree.children.length - 1; i >= 0; i--) {\n iterateResolveTree(tree.children[i], cb);\n }\n}\n\nexport type AppendedIframe = {\n mutationInQueue: addedNodeMutation;\n builtNode: HTMLIFrameElement | RRIFrameElement;\n};\n\nexport function isSerializedIframe<TNode extends Node | RRNode>(\n n: TNode,\n mirror: IMirror<TNode>,\n): boolean {\n return Boolean(n.nodeName === 'IFRAME' && mirror.getMeta(n));\n}\n\nexport function isSerializedStylesheet<TNode extends Node | RRNode>(\n n: TNode,\n mirror: IMirror<TNode>,\n): boolean {\n return Boolean(\n n.nodeName === 'LINK' &&\n n.nodeType === n.ELEMENT_NODE &&\n (n as HTMLElement).getAttribute &&\n (n as HTMLElement).getAttribute('rel') === 'stylesheet' &&\n mirror.getMeta(n),\n );\n}\n\nexport function getBaseDimension(\n node: Node,\n rootIframe: Node,\n): DocumentDimension {\n const frameElement = node.ownerDocument?.defaultView?.frameElement;\n if (!frameElement || frameElement === rootIframe) {\n return {\n x: 0,\n y: 0,\n relativeScale: 1,\n absoluteScale: 1,\n };\n }\n\n const frameDimension = frameElement.getBoundingClientRect();\n const frameBaseDimension = getBaseDimension(frameElement, rootIframe);\n // the iframe element may have a scale transform\n const relativeScale = frameDimension.height / frameElement.clientHeight;\n return {\n x:\n frameDimension.x * frameBaseDimension.relativeScale +\n frameBaseDimension.x,\n y:\n frameDimension.y * frameBaseDimension.relativeScale +\n frameBaseDimension.y,\n relativeScale,\n absoluteScale: frameBaseDimension.absoluteScale * relativeScale,\n };\n}\n\nexport function hasShadowRoot<T extends Node | RRNode>(\n n: T,\n): n is T & { shadowRoot: ShadowRoot } {\n if (!n) return false;\n if (n instanceof BaseRRNode && 'shadowRoot' in n) {\n return Boolean(n.shadowRoot);\n }\n return Boolean(dom.shadowRoot(n as unknown as Element));\n}\n\n/**\n * Traverses a CSSRuleList to find a nested rule at the given position.\n *\n * Returns null instead of throwing if the rule doesn't exist. This is important\n * because during replay:\n * - StyleDeclaration events may reference rules added dynamically that don't\n * exist yet due to timing/ordering issues\n * - StyleSheetRule events that create rules may not have been processed yet\n * - Constructed/adopted stylesheets may not be fully synchronized\n *\n * @param rules - The CSSRuleList to traverse\n * @param position - Array of indices, e.g., [0, 1, 0] for rules[0].cssRules[1].cssRules[0]\n * @returns The nested rule, or null if not found\n */\nexport function getNestedRule(\n rules: CSSRuleList,\n position: number[],\n): CSSGroupingRule | null {\n const rule = rules?.[position[0]] as CSSGroupingRule | null;\n if (!rule) {\n return null;\n }\n if (position.length === 1) {\n return rule;\n } else {\n return getNestedRule(rule.cssRules, position.slice(1));\n }\n}\n\nexport function getPositionsAndIndex(nestedIndex: number[]) {\n const positions = [...nestedIndex];\n const index = positions.pop();\n return { positions, index };\n}\n\n/**\n * Returns the latest mutation in the queue for each node.\n * @param mutations - mutations The text mutations to filter.\n * @returns The filtered text mutations.\n */\nexport function uniqueTextMutations(mutations: textMutation[]): textMutation[] {\n const idSet = new Set<number>();\n const uniqueMutations: textMutation[] = [];\n\n for (let i = mutations.length; i--; ) {\n const mutation = mutations[i];\n if (!idSet.has(mutation.id)) {\n uniqueMutations.push(mutation);\n idSet.add(mutation.id);\n }\n }\n\n return uniqueMutations;\n}\n\nexport class StyleSheetMirror {\n private id = 1;\n private styleIDMap = new WeakMap<CSSStyleSheet, number>();\n private idStyleMap = new Map<number, CSSStyleSheet>();\n\n getId(stylesheet: CSSStyleSheet): number {\n return this.styleIDMap.get(stylesheet) ?? -1;\n }\n\n has(stylesheet: CSSStyleSheet): boolean {\n return this.styleIDMap.has(stylesheet);\n }\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: CSSStyleSheet, id?: number): number {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId: number;\n if (id === undefined) {\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\n getStyle(id: number): CSSStyleSheet | null {\n return this.idStyleMap.get(id) || null;\n }\n\n reset(): void {\n this.styleIDMap = new WeakMap();\n this.idStyleMap = new Map();\n this.id = 1;\n }\n\n generateId(): number {\n return this.id++;\n }\n}\n\n/**\n * Get the direct shadow host of a node in shadow dom. Returns null if it is not in a shadow dom.\n */\nexport function getShadowHost(n: Node): Element | null {\n let shadowHost: Element | null = null;\n if (\n 'getRootNode' in n &&\n dom.getRootNode(n)?.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&\n dom.host(dom.getRootNode(n) as ShadowRoot)\n )\n shadowHost = dom.host(dom.getRootNode(n) as ShadowRoot);\n return shadowHost;\n}\n\n/**\n * Get the root shadow host of a node in nested shadow doms. Returns the node itself if it is not in a shadow dom.\n */\nexport function getRootShadowHost(n: Node): Node {\n let rootShadowHost: Node = n;\n\n let shadowHost: Element | null;\n // If n is in a nested shadow dom.\n while ((shadowHost = getShadowHost(rootShadowHost)))\n rootShadowHost = shadowHost;\n\n return rootShadowHost;\n}\n\nexport function shadowHostInDom(n: Node): boolean {\n const doc = dom.ownerDocument(n);\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n);\n return dom.contains(doc, shadowHost);\n}\n\nexport function inDom(n: Node): boolean {\n const doc = dom.ownerDocument(n);\n if (!doc) return false;\n return dom.contains(doc, n) || shadowHostInDom(n);\n}\n","var 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 EventType2[EventType2[\"Asset\"] = 7] = \"Asset\";\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 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 ReplayerEvents = /* @__PURE__ */ ((ReplayerEvents2) => {\n ReplayerEvents2[\"Start\"] = \"start\";\n ReplayerEvents2[\"Pause\"] = \"pause\";\n ReplayerEvents2[\"Resume\"] = \"resume\";\n ReplayerEvents2[\"Resize\"] = \"resize\";\n ReplayerEvents2[\"Finish\"] = \"finish\";\n ReplayerEvents2[\"FullsnapshotRebuilded\"] = \"fullsnapshot-rebuilded\";\n ReplayerEvents2[\"LoadStylesheetStart\"] = \"load-stylesheet-start\";\n ReplayerEvents2[\"LoadStylesheetEnd\"] = \"load-stylesheet-end\";\n ReplayerEvents2[\"SkipStart\"] = \"skip-start\";\n ReplayerEvents2[\"SkipEnd\"] = \"skip-end\";\n ReplayerEvents2[\"MouseInteraction\"] = \"mouse-interaction\";\n ReplayerEvents2[\"EventCast\"] = \"event-cast\";\n ReplayerEvents2[\"CustomEvent\"] = \"custom-event\";\n ReplayerEvents2[\"Flush\"] = \"flush\";\n ReplayerEvents2[\"StateChange\"] = \"state-change\";\n ReplayerEvents2[\"PlayBack\"] = \"play-back\";\n ReplayerEvents2[\"Destroy\"] = \"destroy\";\n return ReplayerEvents2;\n})(ReplayerEvents || {});\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 || {});\nexport {\n CanvasContext,\n EventType,\n IncrementalSource,\n MediaInteractions,\n MouseInteractions,\n NodeType,\n PointerTypes,\n ReplayerEvents\n};\n//# sourceMappingURL=types.js.map\n","import {\n serializeNodeWithId,\n transformAttribute,\n IGNORED_NODE,\n ignoreAttribute,\n isShadowRoot,\n needMaskingText,\n maskInputValue,\n Mirror,\n isNativeShadowDom,\n getInputType,\n toLowerCase,\n} from 'rrweb-snapshot';\nimport type { observerParam, MutationBufferParam } from '../types';\nimport type {\n mutationRecord,\n textCursor,\n attributeCursor,\n removedNodeMutation,\n addedNodeMutation,\n Optional,\n} from '@rrweb/types';\nimport {\n isBlocked,\n isAncestorRemoved,\n isIgnored,\n isSerialized,\n hasShadowRoot,\n isSerializedIframe,\n isSerializedStylesheet,\n inDom,\n getShadowHost,\n closestElementOfNode,\n} from '../utils';\nimport dom from '@rrweb/utils';\n\ntype DoubleLinkedListNode = {\n previous: DoubleLinkedListNode | null;\n next: DoubleLinkedListNode | null;\n value: NodeInLinkedList;\n};\ntype NodeInLinkedList = Node & {\n __ln: DoubleLinkedListNode;\n};\n\nfunction isNodeInLinkedList(n: Node | NodeInLinkedList): n is NodeInLinkedList {\n return '__ln' in n;\n}\n\nclass DoubleLinkedList {\n public length = 0;\n public head: DoubleLinkedListNode | null = null;\n public tail: DoubleLinkedListNode | null = null;\n\n public get(position: number) {\n if (position >= this.length) {\n throw new Error('Position outside of list range');\n }\n\n let current = this.head;\n for (let index = 0; index < position; index++) {\n current = current?.next || null;\n }\n return current;\n }\n\n public addNode(n: Node) {\n const node: DoubleLinkedListNode = {\n value: n as NodeInLinkedList,\n previous: null,\n next: null,\n };\n (n as NodeInLinkedList).__ln = node;\n if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) {\n const current = n.previousSibling.__ln.next;\n node.next = current;\n node.previous = n.previousSibling.__ln;\n n.previousSibling.__ln.next = node;\n if (current) {\n current.previous = node;\n }\n } else if (\n n.nextSibling &&\n isNodeInLinkedList(n.nextSibling) &&\n n.nextSibling.__ln.previous\n ) {\n const current = n.nextSibling.__ln.previous;\n node.previous = current;\n node.next = n.nextSibling.__ln;\n n.nextSibling.__ln.previous = node;\n if (current) {\n current.next = node;\n }\n } else {\n if (this.head) {\n this.head.previous = node;\n }\n node.next = this.head;\n this.head = node;\n }\n if (node.next === null) {\n this.tail = node;\n }\n this.length++;\n }\n\n public removeNode(n: NodeInLinkedList) {\n const current = n.__ln;\n if (!this.head) {\n return;\n }\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 (n.__ln) {\n delete (n as Optional<NodeInLinkedList, '__ln'>).__ln;\n }\n this.length--;\n }\n}\n\nconst moveKey = (id: number, parentId: number) => `${id}@${parentId}`;\n\n/**\n * controls behaviour of a MutationObserver\n */\nexport default class MutationBuffer {\n private frozen = false;\n private locked = false;\n\n private texts: textCursor[] = [];\n private attributes: attributeCursor[] = [];\n private attributeMap = new WeakMap<Node, attributeCursor>();\n private removes: removedNodeMutation[] = [];\n private mapRemoves: Node[] = [];\n\n private movedMap: Record<string, true> = {};\n\n /**\n * the browser MutationObserver emits multiple mutations after\n * a delay for performance reasons, making tracing added nodes hard\n * in our `processMutations` callback function.\n * For example, if we append an element el_1 into body, and then append\n * another element el_2 into el_1, these two mutations may be passed to the\n * callback function together when the two operations were done.\n * Generally we need to trace child nodes of newly added nodes, but in this\n * case if we count el_2 as el_1's child node in the first mutation record,\n * then we will count el_2 again in the second mutation record which was\n * duplicated.\n * To avoid of duplicate counting added nodes, we use a Set to store\n * added nodes and its child nodes during iterate mutation records. Then\n * collect added nodes from the Set which have no duplicate copy. But\n * this also causes newly added nodes will not be serialized with id ASAP,\n * which means all the id related calculation should be lazy too.\n */\n private addedSet = new Set<Node>();\n private movedSet = new Set<Node>();\n private droppedSet = new Set<Node>();\n private removesSubTreeCache = new Set<Node>();\n\n private mutationCb: observerParam['mutationCb'];\n private blockClass: observerParam['blockClass'];\n private blockSelector: observerParam['blockSelector'];\n private maskTextClass: observerParam['maskTextClass'];\n private maskTextSelector: observerParam['maskTextSelector'];\n private inlineStylesheet: observerParam['inlineStylesheet'];\n private maskInputOptions: observerParam['maskInputOptions'];\n private maskTextFn: observerParam['maskTextFn'];\n private maskInputFn: observerParam['maskInputFn'];\n private keepIframeSrcFn: observerParam['keepIframeSrcFn'];\n private recordCanvas: observerParam['recordCanvas'];\n private inlineImages: observerParam['inlineImages'];\n private slimDOMOptions: observerParam['slimDOMOptions'];\n private dataURLOptions: observerParam['dataURLOptions'];\n private doc: observerParam['doc'];\n private mirror: observerParam['mirror'];\n private iframeManager: observerParam['iframeManager'];\n private stylesheetManager: observerParam['stylesheetManager'];\n private shadowDomManager: observerParam['shadowDomManager'];\n private canvasManager: observerParam['canvasManager'];\n private processedNodeManager: observerParam['processedNodeManager'];\n private unattachedDoc: HTMLDocument;\n\n public init(options: MutationBufferParam) {\n (\n [\n 'mutationCb',\n 'blockClass',\n 'blockSelector',\n 'maskTextClass',\n 'maskTextSelector',\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 'processedNodeManager',\n ] as const\n ).forEach((key) => {\n // just a type trick, the runtime result is correct\n this[key] = options[key] as never;\n });\n }\n\n public freeze() {\n this.frozen = true;\n this.canvasManager.freeze();\n }\n\n public unfreeze() {\n this.frozen = false;\n this.canvasManager.unfreeze();\n this.emit();\n }\n\n public isFrozen() {\n return this.frozen;\n }\n\n public lock() {\n this.locked = true;\n this.canvasManager.lock();\n }\n\n public unlock() {\n this.locked = false;\n this.canvasManager.unlock();\n this.emit();\n }\n\n public reset() {\n this.shadowDomManager.reset();\n this.canvasManager.reset();\n }\n\n public processMutations = (mutations: mutationRecord[]) => {\n mutations.forEach(this.processMutation); // adds mutations to the buffer\n this.emit(); // clears buffer if not locked/frozen\n };\n\n public emit = () => {\n if (this.frozen || this.locked) {\n return;\n }\n\n // delay any modification of the mirror until this function\n // so that the mirror for takeFullSnapshot doesn't get mutated while it's event is being processed\n\n const adds: addedNodeMutation[] = [];\n const addedIds = new Set<number>();\n\n /**\n * Sometimes child node may be pushed before its newly added\n * parent, so we init a queue to store these nodes.\n */\n const addList = new DoubleLinkedList();\n const getNextId = (n: Node): number | null => {\n let ns: Node | null = n;\n let nextId: number | null = IGNORED_NODE; // slimDOM: ignored\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 = (n: Node) => {\n const parent = dom.parentNode(n);\n if (!parent || !inDom(n)) {\n return;\n }\n let cssCaptured = false;\n if (n.nodeType === Node.TEXT_NODE) {\n const parentTag = (parent as Element).tagName;\n if (parentTag === 'TEXTAREA') {\n // genTextAreaValueMutation already called via parent\n return;\n } else if (parentTag === 'STYLE' && this.addedSet.has(parent)) {\n // css content will be recorded via parent's _cssText attribute when\n // mutation adds entire <style> element\n cssCaptured = true;\n }\n }\n\n const parentId = isShadowRoot(parent)\n ? this.mirror.getId(getShadowHost(n))\n : this.mirror.getId(parent);\n\n const nextId = getNextId(n);\n if (parentId === -1 || nextId === -1) {\n return addList.addNode(n);\n }\n const sn = serializeNodeWithId(n, {\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 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 as HTMLIFrameElement);\n }\n if (isSerializedStylesheet(currentN, this.mirror)) {\n this.stylesheetManager.trackLinkElement(\n currentN as HTMLLinkElement,\n );\n }\n if (hasShadowRoot(n)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.shadowDomManager.addShadowRoot(dom.shadowRoot(n)!, 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\n while (this.mapRemoves.length) {\n this.mirror.removeNodeFromMap(this.mapRemoves.shift()!);\n }\n\n for (const n of this.movedSet) {\n if (\n isParentRemoved(this.removesSubTreeCache, n, this.mirror) &&\n !this.movedSet.has(dom.parentNode(n)!)\n ) {\n continue;\n }\n pushAdd(n);\n }\n\n for (const n of this.addedSet) {\n if (\n !isAncestorInSet(this.droppedSet, n) &&\n !isParentRemoved(this.removesSubTreeCache, n, this.mirror)\n ) {\n pushAdd(n);\n } else if (isAncestorInSet(this.movedSet, n)) {\n pushAdd(n);\n } else {\n this.droppedSet.add(n);\n }\n }\n\n let candidate: DoubleLinkedListNode | null = null;\n while (addList.length) {\n let node: DoubleLinkedListNode | null = null;\n if (candidate) {\n const parentId = this.mirror.getId(dom.parentNode(candidate.value));\n const nextId = getNextId(candidate.value);\n if (parentId !== -1 && nextId !== -1) {\n node = candidate;\n }\n }\n if (!node) {\n let tailNode = addList.tail;\n while (tailNode) {\n const _node = tailNode;\n tailNode = tailNode.previous;\n // ensure _node is defined before attempting to find value\n if (_node) {\n const parentId = this.mirror.getId(dom.parentNode(_node.value));\n const nextId = getNextId(_node.value);\n\n if (nextId === -1) continue;\n // nextId !== -1 && parentId !== -1\n else if (parentId !== -1) {\n node = _node;\n break;\n }\n // nextId !== -1 && parentId === -1 This branch can happen if the node is the child of shadow root\n else {\n const unhandledNode = _node.value;\n const parent = dom.parentNode(unhandledNode);\n // If the node is the direct child of a shadow root, we treat the shadow host as its parent node.\n if (parent && parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowHost = dom.host(parent as ShadowRoot);\n const parentId = this.mirror.getId(shadowHost);\n if (parentId !== -1) {\n node = _node;\n break;\n }\n }\n }\n }\n }\n }\n if (!node) {\n /**\n * If all nodes in queue could not find a serialized parent,\n * it may be a bug or corner case. We need to escape the\n * dead while loop at once.\n */\n while (addList.head) {\n addList.removeNode(addList.head.value);\n }\n break;\n }\n candidate = node.previous;\n addList.removeNode(node.value);\n pushAdd(node.value);\n }\n\n const payload = {\n texts: this.texts\n .map((text) => {\n const n = text.node;\n const parent = dom.parentNode(n);\n if (parent && (parent as Element).tagName === 'TEXTAREA') {\n // the node is being ignored as it isn't in the mirror, so shift mutation to attributes on parent textarea\n this.genTextAreaValueMutation(parent as HTMLTextAreaElement);\n }\n return {\n id: this.mirror.getId(n),\n value: text.value,\n };\n })\n // no need to include them on added elements, as they have just been serialized with up to date attribubtes\n .filter((text) => !addedIds.has(text.id))\n // text mutation's id was not in the mirror map means the target node has been removed\n .filter((text) => this.mirror.has(text.id)),\n attributes: this.attributes\n .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 // check if the style diff is actually shorter than the regular string based mutation\n // (which was the whole point of #464 'compact style mutation').\n if (diffAsStr.length < attributes.style.length) {\n // also: CSSOM fails badly when var() is present on shorthand properties, so only proceed with\n // the compact style mutation if these have all been accounted for\n if (\n (diffAsStr + unchangedAsStr).split('var(').length ===\n attributes.style.split('var(').length\n ) {\n attributes.style = attribute.styleDiff;\n }\n }\n }\n return {\n id: this.mirror.getId(attribute.node),\n attributes: attributes,\n };\n })\n // no need to include them on added elements, as they have just been serialized with up to date attribubtes\n .filter((attribute) => !addedIds.has(attribute.id))\n // attribute mutation's id was not in the mirror map means the target node has been removed\n .filter((attribute) => this.mirror.has(attribute.id)),\n removes: this.removes,\n adds,\n };\n // payload may be empty if the mutations happened in some blocked elements\n if (\n !payload.texts.length &&\n !payload.attributes.length &&\n !payload.removes.length &&\n !payload.adds.length\n ) {\n return;\n }\n\n // reset\n this.texts = [];\n this.attributes = [];\n this.attributeMap = new WeakMap<Node, attributeCursor>();\n this.removes = [];\n this.addedSet = new Set<Node>();\n this.movedSet = new Set<Node>();\n this.droppedSet = new Set<Node>();\n this.removesSubTreeCache = new Set<Node>();\n this.movedMap = {};\n\n this.mutationCb(payload);\n };\n\n private genTextAreaValueMutation = (textarea: HTMLTextAreaElement) => {\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 dom.childNodes(textarea),\n (cn) => dom.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\n private processMutation = (m: mutationRecord) => {\n if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {\n return;\n }\n switch (m.type) {\n case 'characterData': {\n const value = dom.textContent(m.target);\n\n if (\n !isBlocked(m.target, this.blockClass, this.blockSelector, false) &&\n value !== m.oldValue\n ) {\n this.texts.push({\n value:\n needMaskingText(\n m.target,\n this.maskTextClass,\n this.maskTextSelector,\n true, // checkAncestors\n ) && value\n ? this.maskTextFn\n ? this.maskTextFn(value, closestElementOfNode(m.target))\n : value.replace(/[\\S]/g, '*')\n : value,\n node: m.target,\n });\n }\n break;\n }\n case 'attributes': {\n const target = m.target as HTMLElement;\n let attributeName = m.attributeName as string;\n let value = (m.target as HTMLElement).getAttribute(attributeName);\n\n if (attributeName === 'value') {\n const type = getInputType(target);\n\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 (\n isBlocked(m.target, this.blockClass, this.blockSelector, false) ||\n value === m.oldValue\n ) {\n return;\n }\n\n let item = this.attributeMap.get(m.target);\n if (\n target.tagName === 'IFRAME' &&\n attributeName === 'src' &&\n !this.keepIframeSrcFn(value as string)\n ) {\n if (!(target as HTMLIFrameElement).contentDocument) {\n // we can't record it directly as we can't see into it\n // preserve the src attribute so a decision can be taken at replay time\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\n // Keep this property on inputs that used to be password inputs\n // This is used to ensure we do not unmask value when using e.g. a \"Show password\" type button\n if (\n attributeName === 'type' &&\n target.tagName === 'INPUT' &&\n (m.oldValue || '').toLowerCase() === 'password'\n ) {\n target.setAttribute('data-rr-is-password', 'true');\n }\n\n if (!ignoreAttribute(target.tagName, attributeName, value)) {\n // overwrite attribute if the mutations was triggered in same time\n item.attributes[attributeName] = transformAttribute(\n this.doc,\n toLowerCase(target.tagName),\n toLowerCase(attributeName),\n value,\n );\n if (attributeName === 'style') {\n if (!this.unattachedDoc) {\n try {\n // avoid upsetting original document from a Content Security point of view\n this.unattachedDoc =\n document.implementation.createHTMLDocument();\n } catch (e) {\n // fallback to more direct method\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 (\n newValue !== old.style.getPropertyValue(pname) ||\n newPriority !== old.style.getPropertyPriority(pname)\n ) {\n if (newPriority === '') {\n item.styleDiff[pname] = newValue;\n } else {\n item.styleDiff[pname] = [newValue, newPriority];\n }\n } else {\n // for checking\n item._unchangedStyles[pname] = [newValue, newPriority];\n }\n }\n for (const pname of Array.from(old.style)) {\n if (target.style.getPropertyValue(pname) === '') {\n // \"if not set, returns the empty string\"\n item.styleDiff[pname] = false; // delete\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 /**\n * Parent is blocked, ignore all child mutations\n */\n if (isBlocked(m.target, this.blockClass, this.blockSelector, true))\n return;\n\n if ((m.target as Element).tagName === 'TEXTAREA') {\n // children would be ignored in genAdds as they aren't in the mirror\n this.genTextAreaValueMutation(m.target as HTMLTextAreaElement);\n return; // any removedNodes won't have been in mirror either\n }\n\n m.addedNodes.forEach((n) => this.genAdds(n, m.target));\n m.removedNodes.forEach((n) => {\n const nodeId = this.mirror.getId(n);\n const parentId = isShadowRoot(m.target)\n ? this.mirror.getId(dom.host(m.target))\n : this.mirror.getId(m.target);\n if (\n isBlocked(m.target, this.blockClass, this.blockSelector, false) ||\n isIgnored(n, this.mirror, this.slimDOMOptions) ||\n !isSerialized(n, this.mirror)\n ) {\n return;\n }\n // removed node has not been serialized yet, just remove it from the Set\n if (this.addedSet.has(n)) {\n deepDelete(this.addedSet, n);\n this.droppedSet.add(n);\n } else if (this.addedSet.has(m.target) && nodeId === -1) {\n /**\n * If target was newly added and removed child node was\n * not serialized, it means the child node has been removed\n * before callback fired, so we can ignore it because\n * newly added node will be serialized without child nodes.\n * TODO: verify this\n */\n } else if (isAncestorRemoved(m.target, this.mirror)) {\n /**\n * If parent id was not in the mirror map any more, it\n * means the parent node has already been removed. So\n * the node is also removed which we do not need to track\n * and replay.\n */\n } else if (\n this.movedSet.has(n) &&\n this.movedMap[moveKey(nodeId, parentId)]\n ) {\n deepDelete(this.movedSet, n);\n } else {\n this.removes.push({\n parentId,\n id: nodeId,\n isShadow:\n isShadowRoot(m.target) && isNativeShadowDom(m.target)\n ? true\n : undefined,\n });\n processRemoves(n, this.removesSubTreeCache);\n }\n this.mapRemoves.push(n);\n });\n break;\n }\n default:\n break;\n }\n };\n\n /**\n * Make sure you check if `n`'s parent is blocked before calling this function\n * */\n private genAdds = (n: Node, target?: Node) => {\n // this node was already recorded in other buffer, ignore it\n if (this.processedNodeManager.inOtherBuffer(n, this)) return;\n\n // if n is added to set, there is no need to travel it and its' children again\n if (this.addedSet.has(n) || this.movedSet.has(n)) return;\n\n if (this.mirror.hasNode(n)) {\n if (isIgnored(n, this.mirror, this.slimDOMOptions)) {\n return;\n }\n this.movedSet.add(n);\n let targetId: number | null = 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(n), targetId)] = true;\n }\n } else {\n this.addedSet.add(n);\n this.droppedSet.delete(n);\n }\n\n // if this node is blocked `serializeNode` will turn it into a placeholder element\n // but we have to remove it's children otherwise they will be added as placeholders too\n if (!isBlocked(n, this.blockClass, this.blockSelector, false)) {\n dom.childNodes(n).forEach((childN) => this.genAdds(childN));\n if (hasShadowRoot(n)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n dom.childNodes(dom.shadowRoot(n)!).forEach((childN) => {\n this.processedNodeManager.add(childN, this);\n this.genAdds(childN, n);\n });\n }\n }\n };\n}\n\n/**\n * Some utils to handle the mutation observer DOM records.\n * It should be more clear to extend the native data structure\n * like Set and Map, but currently Typescript does not support\n * that.\n */\nfunction deepDelete(addsSet: Set<Node>, n: Node) {\n addsSet.delete(n);\n dom.childNodes(n).forEach((childN) => deepDelete(addsSet, childN));\n}\n\nfunction processRemoves(n: Node, cache: Set<Node>) {\n const queue = [n];\n\n while (queue.length) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const next = queue.pop()!;\n if (cache.has(next)) continue;\n cache.add(next);\n dom.childNodes(next).forEach((n) => queue.push(n));\n }\n\n return;\n}\n\nfunction isParentRemoved(removes: Set<Node>, n: Node, mirror: Mirror): boolean {\n if (removes.size === 0) return false;\n return _isParentRemoved(removes, n, mirror);\n}\n\nfunction _isParentRemoved(\n removes: Set<Node>,\n n: Node,\n _mirror: Mirror,\n): boolean {\n const node: ParentNode | null = dom.parentNode(n);\n if (!node) return false;\n return removes.has(node);\n}\n\nfunction isAncestorInSet(set: Set<Node>, n: Node): boolean {\n if (set.size === 0) return false;\n return _isAncestorInSet(set, n);\n}\n\nfunction _isAncestorInSet(set: Set<Node>, n: Node): boolean {\n const parent = dom.parentNode(n);\n if (!parent) {\n return false;\n }\n if (set.has(parent)) {\n return true;\n }\n return _isAncestorInSet(set, parent);\n}\n","import type { ErrorHandler } from '../types';\n\ntype Callback = (...args: unknown[]) => unknown;\n\nlet errorHandler: ErrorHandler | undefined;\n\nexport function registerErrorHandler(handler: ErrorHandler | undefined) {\n errorHandler = handler;\n}\n\nexport function unregisterErrorHandler() {\n errorHandler = undefined;\n}\n\n/**\n * Wrap callbacks in a wrapper that allows to pass errors to a configured `errorHandler` method.\n */\nexport const callbackWrapper = <T extends Callback>(cb: T): T => {\n if (!errorHandler) {\n return cb;\n }\n\n const rrwebWrapped = ((...rest: unknown[]) => {\n try {\n return cb(...rest);\n } catch (error) {\n if (errorHandler && errorHandler(error) === true) {\n return;\n }\n\n throw error;\n }\n }) as unknown as T;\n\n return rrwebWrapped;\n};\n","import {\n type MaskInputOptions,\n maskInputValue,\n Mirror,\n getInputType,\n toLowerCase,\n} from 'rrweb-snapshot';\nimport type { FontFaceSet } from 'css-font-loading-module';\nimport {\n throttle,\n on,\n hookSetter,\n getWindowScroll,\n getWindowHeight,\n getWindowWidth,\n isBlocked,\n legacy_isTouchEvent,\n StyleSheetMirror,\n nowTimestamp,\n} from '../utils';\nimport { patch } from '@rrweb/utils';\nimport type { observerParam, MutationBufferParam } from '../types';\nimport {\n IncrementalSource,\n MouseInteractions,\n PointerTypes,\n MediaInteractions,\n} from '@rrweb/types';\nimport type {\n mutationCallBack,\n mousemoveCallBack,\n mousePosition,\n mouseInteractionCallBack,\n listenerHandler,\n scrollCallback,\n styleSheetRuleCallback,\n viewportResizeCallback,\n inputValue,\n inputCallback,\n hookResetter,\n hooksParam,\n Arguments,\n mediaInteractionCallback,\n canvasMutationCallback,\n fontCallback,\n fontParam,\n styleDeclarationCallback,\n IWindow,\n SelectionRange,\n selectionCallback,\n customElementCallback,\n} from '@rrweb/types';\nimport MutationBuffer from './mutation';\nimport { callbackWrapper } from './error-handler';\nimport dom, { mutationObserverCtor } from '@rrweb/utils';\n\nexport const mutationBuffers: MutationBuffer[] = [];\n\n// Event.path is non-standard and used in some older browsers\ntype NonStandardEvent = Omit<Event, 'composedPath'> & {\n path: EventTarget[];\n};\n\nfunction getEventTarget(event: Event | NonStandardEvent): EventTarget | null {\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 {\n // fallback to `event.target` below\n }\n\n return event && event.target;\n}\n\nexport function initMutationObserver(\n options: MutationBufferParam,\n rootEl: Node,\n): [MutationObserver, () => void] {\n const mutationBuffer = new MutationBuffer();\n mutationBuffers.push(mutationBuffer);\n // see mutation.ts for details\n mutationBuffer.init(options);\n const [ObserverCtor, iframeCleanup] = mutationObserverCtor();\n const observer = new (ObserverCtor as new (\n callback: MutationCallback,\n ) => MutationObserver)(\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, iframeCleanup];\n}\n\nfunction initMoveObserver({\n mousemoveCb,\n sampling,\n doc,\n mirror,\n}: observerParam): listenerHandler {\n if (sampling.mousemove === false) {\n return () => {\n //\n };\n }\n\n const threshold =\n typeof sampling.mousemove === 'number' ? sampling.mousemove : 50;\n const callbackThreshold =\n typeof sampling.mousemoveCallback === 'number'\n ? sampling.mousemoveCallback\n : 500;\n\n let positions: mousePosition[] = [];\n let timeBaseline: number | null;\n const wrappedCb = throttle(\n callbackWrapper(\n (\n source:\n | IncrementalSource.MouseMove\n | IncrementalSource.TouchMove\n | IncrementalSource.Drag,\n ) => {\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<MouseEvent | TouchEvent | DragEvent>(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n // 'legacy' here as we could switch to https://developer.mozilla.org/en-US/docs/Web/API/Element/pointermove_event\n const { clientX, clientY } = legacy_isTouchEvent(evt)\n ? evt.changedTouches[0]\n : evt;\n if (!timeBaseline) {\n timeBaseline = nowTimestamp();\n }\n positions.push({\n x: clientX,\n y: clientY,\n id: mirror.getId(target as Node),\n timeOffset: nowTimestamp() - timeBaseline,\n });\n // it is possible DragEvent is undefined even on devices\n // that support event 'drag'\n wrappedCb(\n typeof DragEvent !== 'undefined' && evt instanceof DragEvent\n ? IncrementalSource.Drag\n : evt instanceof MouseEvent\n ? IncrementalSource.MouseMove\n : 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}\n\nfunction initMouseInteractionObserver({\n mouseInteractionCb,\n doc,\n mirror,\n blockClass,\n blockSelector,\n sampling,\n}: observerParam): listenerHandler {\n if (sampling.mouseInteraction === false) {\n return () => {\n //\n };\n }\n const disableMap: Record<string, boolean | undefined> =\n sampling.mouseInteraction === true ||\n sampling.mouseInteraction === undefined\n ? {}\n : sampling.mouseInteraction;\n\n const handlers: listenerHandler[] = [];\n let currentPointerType: PointerTypes | null = null;\n const getHandler = (eventKey: keyof typeof MouseInteractions) => {\n return (event: MouseEvent | TouchEvent | PointerEvent) => {\n const target = getEventTarget(event) as Node;\n if (isBlocked(target, blockClass, blockSelector, true)) {\n return;\n }\n let pointerType: PointerTypes | null = 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 // we are actually listening on 'pointerdown'\n thisEventKey = 'TouchStart';\n } else if (\n MouseInteractions[eventKey] === MouseInteractions.MouseUp\n ) {\n // we are actually listening on 'pointerup'\n thisEventKey = 'TouchEnd';\n }\n } else if (pointerType === PointerTypes.Pen) {\n // TODO: these will get incorrectly emitted as MouseDown/MouseUp\n }\n } else if (legacy_isTouchEvent(event)) {\n pointerType = PointerTypes.Touch;\n }\n if (pointerType !== null) {\n currentPointerType = pointerType;\n if (\n (thisEventKey.startsWith('Touch') &&\n pointerType === PointerTypes.Touch) ||\n (thisEventKey.startsWith('Mouse') &&\n pointerType === PointerTypes.Mouse)\n ) {\n // don't output redundant info\n pointerType = null;\n }\n } else if (MouseInteractions[eventKey] === MouseInteractions.Click) {\n pointerType = currentPointerType;\n currentPointerType = null; // cleanup as we've used it\n }\n const e = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;\n if (!e) {\n return;\n }\n const id = mirror.getId(target);\n const { clientX, clientY } = e;\n callbackWrapper(mouseInteractionCb)({\n type: MouseInteractions[thisEventKey],\n id,\n x: clientX,\n y: clientY,\n ...(pointerType !== null && { pointerType }),\n });\n };\n };\n Object.keys(MouseInteractions)\n .filter(\n (key) =>\n Number.isNaN(Number(key)) &&\n !key.endsWith('_Departed') &&\n disableMap[key] !== false,\n )\n .forEach((eventKey: keyof typeof MouseInteractions) => {\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 ) as unknown as typeof eventName;\n break;\n case MouseInteractions.TouchStart:\n case MouseInteractions.TouchEnd:\n // these are handled by pointerdown/pointerup\n return;\n }\n }\n handlers.push(on(eventName, handler, doc));\n });\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\n\nexport function initScrollObserver({\n scrollCb,\n doc,\n mirror,\n blockClass,\n blockSelector,\n sampling,\n}: Pick<\n observerParam,\n 'scrollCb' | 'doc' | 'mirror' | 'blockClass' | 'blockSelector' | 'sampling'\n>): listenerHandler {\n const updatePosition = callbackWrapper(\n throttle<UIEvent>(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n if (\n !target ||\n isBlocked(target as Node, blockClass, blockSelector, true)\n ) {\n return;\n }\n const id = mirror.getId(target as Node);\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 as HTMLElement).scrollLeft,\n y: (target as HTMLElement).scrollTop,\n });\n }\n }),\n sampling.scroll || 100,\n ),\n );\n return on('scroll', updatePosition, doc);\n}\n\nfunction initViewportResizeObserver(\n { viewportResizeCb }: observerParam,\n { win }: { win: IWindow },\n): listenerHandler {\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}\n\nexport const INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];\nconst lastInputValueMap: WeakMap<EventTarget, inputValue> = new WeakMap();\nfunction initInputObserver({\n inputCb,\n doc,\n mirror,\n blockClass,\n blockSelector,\n ignoreClass,\n ignoreSelector,\n maskInputOptions,\n maskInputFn,\n sampling,\n userTriggeredOnInput,\n}: observerParam): listenerHandler {\n function eventHandler(event: Event) {\n let target = getEventTarget(event) as HTMLElement | null;\n const userTriggered = event.isTrusted;\n const tagName = target && target.tagName;\n\n /**\n * If a site changes the value 'selected' of an option element, the value of its parent element, usually a select element, will be changed as well.\n * We can treat this change as a value change of the select element the current target belongs to.\n */\n if (target && tagName === 'OPTION') {\n target = dom.parentElement(target);\n }\n if (\n !target ||\n !tagName ||\n INPUT_TAGS.indexOf(tagName) < 0 ||\n isBlocked(target as Node, blockClass, blockSelector, true)\n ) {\n return;\n }\n\n if (\n target.classList.contains(ignoreClass) ||\n (ignoreSelector && target.matches(ignoreSelector))\n ) {\n return;\n }\n let text = (target as HTMLInputElement).value;\n let isChecked = false;\n const type: Lowercase<string> = getInputType(target) || '';\n\n if (type === 'radio' || type === 'checkbox') {\n isChecked = (target as HTMLInputElement).checked;\n } else if (\n maskInputOptions[tagName.toLowerCase() as keyof MaskInputOptions] ||\n maskInputOptions[type as keyof MaskInputOptions]\n ) {\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\n ? { text, isChecked, userTriggered }\n : { text, isChecked },\n );\n // if a radio was checked\n // the other radios with the same name attribute will be unchecked.\n const name: string | undefined = (target as HTMLInputElement).name;\n if (type === 'radio' && name && isChecked) {\n doc\n .querySelectorAll(`input[type=\"radio\"][name=\"${name}\"]`)\n .forEach((el) => {\n if (el !== target) {\n const text = (el as HTMLInputElement).value;\n cbWithDedup(\n el,\n userTriggeredOnInput\n ? { text, isChecked: !isChecked, userTriggered: false }\n : { text, isChecked: !isChecked },\n );\n }\n });\n }\n }\n function cbWithDedup(target: EventTarget, v: inputValue) {\n const lastInputValue = lastInputValueMap.get(target);\n if (\n !lastInputValue ||\n lastInputValue.text !== v.text ||\n lastInputValue.isChecked !== v.isChecked\n ) {\n lastInputValueMap.set(target, v);\n const id = mirror.getId(target as Node);\n callbackWrapper(inputCb)({\n ...v,\n id,\n });\n }\n }\n const events = sampling.input === 'last' ? ['change'] : ['input', 'change'];\n const handlers: Array<listenerHandler | hookResetter> = 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: Array<[HTMLElement, string]> = [\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((p) =>\n hookSetter<HTMLElement>(\n p[0],\n p[1],\n {\n set() {\n // mock to a normal event\n callbackWrapper(eventHandler)({\n target: this as EventTarget,\n isTrusted: false, // userTriggered to false as this could well be programmatic\n } as Event);\n },\n },\n false,\n currentWindow,\n ),\n ),\n );\n }\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\n\ntype GroupingCSSRule =\n | CSSGroupingRule\n | CSSMediaRule\n | CSSSupportsRule\n | CSSConditionRule;\ntype GroupingCSSRuleTypes =\n | typeof CSSGroupingRule\n | typeof CSSMediaRule\n | typeof CSSSupportsRule\n | typeof CSSConditionRule;\n\nfunction getNestedCSSRulePositions(rule: CSSRule): number[] {\n const positions: number[] = [];\n function recurse(childRule: CSSRule, pos: number[]) {\n if (\n (hasNestedCSSRule('CSSGroupingRule') &&\n childRule.parentRule instanceof CSSGroupingRule) ||\n (hasNestedCSSRule('CSSMediaRule') &&\n childRule.parentRule instanceof CSSMediaRule) ||\n (hasNestedCSSRule('CSSSupportsRule') &&\n childRule.parentRule instanceof CSSSupportsRule) ||\n (hasNestedCSSRule('CSSConditionRule') &&\n childRule.parentRule instanceof CSSConditionRule)\n ) {\n const rules = Array.from(\n (childRule.parentRule as GroupingCSSRule).cssRules,\n );\n const index = rules.indexOf(childRule);\n pos.unshift(index);\n return recurse(childRule.parentRule, pos);\n } else if (childRule.parentStyleSheet) {\n const rules = Array.from(childRule.parentStyleSheet.cssRules);\n const index = rules.indexOf(childRule);\n pos.unshift(index);\n }\n return pos;\n }\n return recurse(rule, positions);\n}\n\n/**\n * For StyleSheets in Element, this function retrieves id of its host element.\n * For adopted StyleSheets, this function retrieves its styleId from a styleMirror.\n */\nfunction getIdAndStyleId(\n sheet: CSSStyleSheet | undefined | null,\n mirror: Mirror,\n styleMirror: StyleSheetMirror,\n): {\n styleId?: number;\n id?: number;\n} {\n let id, styleId;\n if (!sheet) return {};\n if (sheet.ownerNode) id = mirror.getId(sheet.ownerNode as Node);\n else styleId = styleMirror.getId(sheet);\n return {\n styleId,\n id,\n };\n}\n\nfunction initStyleSheetObserver(\n { styleSheetRuleCb, mirror, stylesheetManager }: observerParam,\n { win }: { win: IWindow },\n): listenerHandler {\n if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {\n // If, for whatever reason, CSSStyleSheet is not available, we skip the observation of stylesheets.\n return () => {\n // Do nothing\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const insertRule = win.CSSStyleSheet.prototype.insertRule;\n win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, {\n apply: callbackWrapper(\n (\n target: typeof insertRule,\n thisArg: CSSStyleSheet,\n argumentsList: [string, number | undefined],\n ) => {\n const [rule, index] = argumentsList;\n\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror,\n stylesheetManager.styleMirror,\n );\n\n if ((id && id !== -1) || (styleId && styleId !== -1)) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [{ rule, index }],\n });\n }\n return target.apply(thisArg, argumentsList);\n },\n ),\n });\n\n // Support for deprecated addRule method\n win.CSSStyleSheet.prototype.addRule = function (\n this: CSSStyleSheet,\n selector: string,\n styleBlock: string,\n index: number = this.cssRules.length,\n ) {\n const rule = `${selector} { ${styleBlock} }`;\n return win.CSSStyleSheet.prototype.insertRule.apply(this, [rule, index]);\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const deleteRule = win.CSSStyleSheet.prototype.deleteRule;\n win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, {\n apply: callbackWrapper(\n (\n target: typeof deleteRule,\n thisArg: CSSStyleSheet,\n argumentsList: [number],\n ) => {\n const [index] = argumentsList;\n\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror,\n stylesheetManager.styleMirror,\n );\n\n if ((id && id !== -1) || (styleId && styleId !== -1)) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [{ index }],\n });\n }\n return target.apply(thisArg, argumentsList);\n },\n ),\n });\n\n // Support for deprecated removeRule method\n win.CSSStyleSheet.prototype.removeRule = function (\n this: CSSStyleSheet,\n index: number,\n ) {\n return win.CSSStyleSheet.prototype.deleteRule.apply(this, [index]);\n };\n\n let replace: (text: string) => Promise<CSSStyleSheet>;\n\n if (win.CSSStyleSheet.prototype.replace) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n replace = win.CSSStyleSheet.prototype.replace;\n win.CSSStyleSheet.prototype.replace = new Proxy(replace, {\n apply: callbackWrapper(\n (\n target: typeof replace,\n thisArg: CSSStyleSheet,\n argumentsList: [string],\n ) => {\n const [text] = argumentsList;\n\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror,\n stylesheetManager.styleMirror,\n );\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\n let replaceSync: (text: string) => void;\n if (win.CSSStyleSheet.prototype.replaceSync) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n replaceSync = win.CSSStyleSheet.prototype.replaceSync;\n win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, {\n apply: callbackWrapper(\n (\n target: typeof replaceSync,\n thisArg: CSSStyleSheet,\n argumentsList: [string],\n ) => {\n const [text] = argumentsList;\n\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror,\n stylesheetManager.styleMirror,\n );\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\n const supportedNestedCSSRuleTypes: {\n [key: string]: GroupingCSSRuleTypes;\n } = {};\n if (canMonkeyPatchNestedCSSRule('CSSGroupingRule')) {\n supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;\n } else {\n // Some browsers (Safari) don't support CSSGroupingRule\n // https://caniuse.com/?search=cssgroupingrule\n // fall back to monkey patching classes that would have inherited from CSSGroupingRule\n\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\n const unmodifiedFunctions: {\n [key: string]: {\n insertRule: (rule: string, index?: number) => number;\n deleteRule: (index: number) => void;\n };\n } = {};\n\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\n type.prototype.insertRule = new Proxy(\n unmodifiedFunctions[typeKey].insertRule,\n {\n apply: callbackWrapper(\n (\n target: typeof insertRule,\n thisArg: CSSRule,\n argumentsList: [string, number | undefined],\n ) => {\n const [rule, index] = argumentsList;\n\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror,\n stylesheetManager.styleMirror,\n );\n\n if ((id && id !== -1) || (styleId && styleId !== -1)) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [\n {\n rule,\n index: [\n ...getNestedCSSRulePositions(thisArg),\n index || 0, // defaults to 0\n ],\n },\n ],\n });\n }\n return target.apply(thisArg, argumentsList);\n },\n ),\n },\n );\n\n type.prototype.deleteRule = new Proxy(\n unmodifiedFunctions[typeKey].deleteRule,\n {\n apply: callbackWrapper(\n (\n target: typeof deleteRule,\n thisArg: CSSRule,\n argumentsList: [number],\n ) => {\n const [index] = argumentsList;\n\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror,\n stylesheetManager.styleMirror,\n );\n\n if ((id && id !== -1) || (styleId && styleId !== -1)) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [\n { index: [...getNestedCSSRulePositions(thisArg), index] },\n ],\n });\n }\n return target.apply(thisArg, argumentsList);\n },\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}\n\nexport function initAdoptedStyleSheetObserver(\n {\n mirror,\n stylesheetManager,\n }: Pick<observerParam, 'mirror' | 'stylesheetManager'>,\n host: Document | ShadowRoot,\n): listenerHandler {\n let hostId: number | null = null;\n // host of adoptedStyleSheets is outermost document or IFrame's document\n if (host.nodeName === '#document') hostId = mirror.getId(host);\n // The host is a ShadowRoot.\n else hostId = mirror.getId(dom.host(host as ShadowRoot));\n\n const patchTarget =\n host.nodeName === '#document'\n ? (host as Document).defaultView?.Document\n : host.ownerDocument?.defaultView?.ShadowRoot;\n const originalPropertyDescriptor = patchTarget?.prototype\n ? Object.getOwnPropertyDescriptor(\n patchTarget?.prototype,\n 'adoptedStyleSheets',\n )\n : undefined;\n if (\n hostId === null ||\n hostId === -1 ||\n !patchTarget ||\n !originalPropertyDescriptor\n )\n return () => {\n //\n };\n\n // Patch adoptedStyleSheets by overriding the original one.\n Object.defineProperty(host, 'adoptedStyleSheets', {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n get(): CSSStyleSheet[] {\n return originalPropertyDescriptor.get?.call(this) as CSSStyleSheet[];\n },\n set(sheets: CSSStyleSheet[]) {\n const result = originalPropertyDescriptor.set?.call(this, sheets);\n if (hostId !== null && hostId !== -1) {\n try {\n stylesheetManager.adoptStyleSheets(sheets, hostId);\n } catch (e) {\n // for safety\n }\n }\n return result;\n },\n });\n\n return callbackWrapper(() => {\n Object.defineProperty(host, '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}\n\nfunction initStyleDeclarationObserver(\n {\n styleDeclarationCb,\n mirror,\n ignoreCSSAttributes,\n stylesheetManager,\n }: observerParam,\n { win }: { win: IWindow },\n): listenerHandler {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const setProperty = win.CSSStyleDeclaration.prototype.setProperty;\n win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {\n apply: callbackWrapper(\n (\n target: typeof setProperty,\n thisArg: CSSStyleDeclaration,\n argumentsList: [string, string, string],\n ) => {\n const [property, value, priority] = argumentsList;\n\n // ignore this mutation if we do not care about this css attribute\n if (ignoreCSSAttributes.has(property)) {\n return setProperty.apply(thisArg, [property, value, priority]);\n }\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentRule?.parentStyleSheet,\n mirror,\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\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {\n apply: callbackWrapper(\n (\n target: typeof removeProperty,\n thisArg: CSSStyleDeclaration,\n argumentsList: [string],\n ) => {\n const [property] = argumentsList;\n\n // ignore this mutation if we do not care about this css attribute\n if (ignoreCSSAttributes.has(property)) {\n return removeProperty.apply(thisArg, [property]);\n }\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentRule?.parentStyleSheet,\n mirror,\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\n return callbackWrapper(() => {\n win.CSSStyleDeclaration.prototype.setProperty = setProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;\n });\n}\n\nfunction initMediaInteractionObserver({\n mediaInteractionCb,\n blockClass,\n blockSelector,\n mirror,\n sampling,\n doc,\n}: observerParam): listenerHandler {\n const handler = callbackWrapper((type: MediaInteractions) =>\n throttle(\n callbackWrapper((event: Event) => {\n const target = getEventTarget(event);\n if (\n !target ||\n isBlocked(target as Node, blockClass, blockSelector, true)\n ) {\n return;\n }\n const { currentTime, volume, muted, playbackRate, loop } =\n target as HTMLMediaElement;\n mediaInteractionCb({\n type,\n id: mirror.getId(target as Node),\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}\n\nfunction initFontObserver({ fontCb, doc }: observerParam): listenerHandler {\n const win = doc.defaultView as IWindow;\n if (!win) {\n return () => {\n //\n };\n }\n\n const handlers: listenerHandler[] = [];\n\n const fontMap = new WeakMap<FontFace, fontParam>();\n\n const originalFontFace = win.FontFace;\n win.FontFace = function FontFace(\n family: string,\n source: string | ArrayBufferLike,\n descriptors?: FontFaceDescriptors,\n ) {\n const fontFace = new originalFontFace(family, source, descriptors);\n fontMap.set(fontFace, {\n family,\n buffer: typeof source !== 'string',\n descriptors,\n fontSource:\n typeof source === 'string'\n ? source\n : JSON.stringify(Array.from(new Uint8Array(source))),\n });\n return fontFace;\n } as unknown as typeof FontFace;\n\n const restoreHandler = patch(\n doc.fonts,\n 'add',\n function (original: (font: FontFace) => void) {\n return function (this: FontFaceSet, fontFace: 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\n handlers.push(() => {\n win.FontFace = originalFontFace;\n });\n handlers.push(restoreHandler);\n\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\n\nfunction initSelectionObserver(param: observerParam): listenerHandler {\n const { doc, mirror, blockClass, blockSelector, selectionCb } = param;\n let collapsed = true;\n\n const updateSelection = callbackWrapper(() => {\n const selection = doc.getSelection();\n\n if (!selection || (collapsed && selection?.isCollapsed)) return;\n\n collapsed = selection.isCollapsed || false;\n\n const ranges: SelectionRange[] = [];\n const count = selection.rangeCount || 0;\n\n for (let i = 0; i < count; i++) {\n const range = selection.getRangeAt(i);\n\n const { startContainer, startOffset, endContainer, endOffset } = range;\n\n const blocked =\n isBlocked(startContainer, blockClass, blockSelector, true) ||\n isBlocked(endContainer, blockClass, blockSelector, true);\n\n if (blocked) continue;\n\n ranges.push({\n start: mirror.getId(startContainer),\n startOffset,\n end: mirror.getId(endContainer),\n endOffset,\n });\n }\n\n selectionCb({ ranges });\n });\n\n updateSelection();\n\n return on('selectionchange', updateSelection);\n}\n\nfunction initCustomElementObserver({\n doc,\n customElementCb,\n}: observerParam): listenerHandler {\n const win = doc.defaultView as IWindow;\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n if (!win || !win.customElements) return () => {};\n const restoreHandler = patch(\n win.customElements,\n 'define',\n function (\n original: (\n name: string,\n constructor: CustomElementConstructor,\n options?: ElementDefinitionOptions,\n ) => void,\n ) {\n return function (\n name: string,\n constructor: CustomElementConstructor,\n options?: ElementDefinitionOptions,\n ) {\n try {\n customElementCb({\n define: {\n name,\n },\n });\n } catch (e) {\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}\n\nfunction mergeHooks(o: observerParam, hooks: hooksParam) {\n const {\n mutationCb,\n mousemoveCb,\n mouseInteractionCb,\n scrollCb,\n viewportResizeCb,\n inputCb,\n mediaInteractionCb,\n styleSheetRuleCb,\n styleDeclarationCb,\n canvasMutationCb,\n fontCb,\n selectionCb,\n customElementCb,\n } = o;\n o.mutationCb = (...p: Arguments<mutationCallBack>) => {\n if (hooks.mutation) {\n hooks.mutation(...p);\n }\n mutationCb(...p);\n };\n o.mousemoveCb = (...p: Arguments<mousemoveCallBack>) => {\n if (hooks.mousemove) {\n hooks.mousemove(...p);\n }\n mousemoveCb(...p);\n };\n o.mouseInteractionCb = (...p: Arguments<mouseInteractionCallBack>) => {\n if (hooks.mouseInteraction) {\n hooks.mouseInteraction(...p);\n }\n mouseInteractionCb(...p);\n };\n o.scrollCb = (...p: Arguments<scrollCallback>) => {\n if (hooks.scroll) {\n hooks.scroll(...p);\n }\n scrollCb(...p);\n };\n o.viewportResizeCb = (...p: Arguments<viewportResizeCallback>) => {\n if (hooks.viewportResize) {\n hooks.viewportResize(...p);\n }\n viewportResizeCb(...p);\n };\n o.inputCb = (...p: Arguments<inputCallback>) => {\n if (hooks.input) {\n hooks.input(...p);\n }\n inputCb(...p);\n };\n o.mediaInteractionCb = (...p: Arguments<mediaInteractionCallback>) => {\n if (hooks.mediaInteaction) {\n hooks.mediaInteaction(...p);\n }\n mediaInteractionCb(...p);\n };\n o.styleSheetRuleCb = (...p: Arguments<styleSheetRuleCallback>) => {\n if (hooks.styleSheetRule) {\n hooks.styleSheetRule(...p);\n }\n styleSheetRuleCb(...p);\n };\n o.styleDeclarationCb = (...p: Arguments<styleDeclarationCallback>) => {\n if (hooks.styleDeclaration) {\n hooks.styleDeclaration(...p);\n }\n styleDeclarationCb(...p);\n };\n o.canvasMutationCb = (...p: Arguments<canvasMutationCallback>) => {\n if (hooks.canvasMutation) {\n hooks.canvasMutation(...p);\n }\n canvasMutationCb(...p);\n };\n o.fontCb = (...p: Arguments<fontCallback>) => {\n if (hooks.font) {\n hooks.font(...p);\n }\n fontCb(...p);\n };\n o.selectionCb = (...p: Arguments<selectionCallback>) => {\n if (hooks.selection) {\n hooks.selection(...p);\n }\n selectionCb(...p);\n };\n o.customElementCb = (...c: Arguments<customElementCallback>) => {\n if (hooks.customElement) {\n hooks.customElement(...c);\n }\n customElementCb(...c);\n };\n}\n\nexport function initObservers(\n o: observerParam,\n hooks: hooksParam = {},\n): listenerHandler {\n const currentWindow = o.doc.defaultView; // basically document.window\n if (!currentWindow) {\n return () => {\n //\n };\n }\n\n mergeHooks(o, hooks);\n let mutationObserver: MutationObserver | undefined;\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let cleanupMutationIframe: () => void = () => {};\n if (o.recordDOM) {\n [mutationObserver, cleanupMutationIframe] = initMutationObserver(o, o.doc);\n }\n const mousemoveHandler = initMoveObserver(o);\n const mouseInteractionHandler = initMouseInteractionObserver(o);\n const scrollHandler = initScrollObserver(o);\n const viewportResizeHandler = initViewportResizeObserver(o, {\n win: currentWindow,\n });\n const inputHandler = initInputObserver(o);\n const mediaInteractionHandler = initMediaInteractionObserver(o);\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let styleSheetObserver = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let adoptedStyleSheetObserver = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let styleDeclarationObserver = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let fontObserver = () => {};\n if (o.recordDOM) {\n styleSheetObserver = initStyleSheetObserver(o, { win: currentWindow });\n adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o, o.doc);\n styleDeclarationObserver = initStyleDeclarationObserver(o, {\n win: currentWindow,\n });\n if (o.collectFonts) {\n fontObserver = initFontObserver(o);\n }\n }\n const selectionObserver = initSelectionObserver(o);\n const customElementObserver = initCustomElementObserver(o);\n\n // plugins\n const pluginHandlers: listenerHandler[] = [];\n for (const plugin of o.plugins) {\n pluginHandlers.push(\n plugin.observer(plugin.callback, currentWindow, plugin.options),\n );\n }\n\n return callbackWrapper(() => {\n mutationBuffers.forEach((b) => b.reset());\n mutationObserver?.disconnect();\n cleanupMutationIframe();\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}\n\ntype CSSGroupingProp =\n | 'CSSGroupingRule'\n | 'CSSMediaRule'\n | 'CSSSupportsRule'\n | 'CSSConditionRule';\n\nfunction hasNestedCSSRule(prop: CSSGroupingProp): boolean {\n return typeof window[prop] !== 'undefined';\n}\n\nfunction canMonkeyPatchNestedCSSRule(prop: CSSGroupingProp): boolean {\n return Boolean(\n typeof window[prop] !== 'undefined' &&\n // 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 &&\n 'insertRule' in window[prop].prototype &&\n 'deleteRule' in window[prop].prototype,\n );\n}\n","import type { ICrossOriginIframeMirror } from '@rrweb/types';\nexport default class CrossOriginIframeMirror\n implements ICrossOriginIframeMirror\n{\n private iframeIdToRemoteIdMap: WeakMap<\n HTMLIFrameElement,\n Map<number, number>\n > = new WeakMap();\n private iframeRemoteIdToIdMap: WeakMap<\n HTMLIFrameElement,\n Map<number, number>\n > = new WeakMap();\n\n constructor(private generateIdFn: () => number) {}\n\n getId(\n iframe: HTMLIFrameElement,\n remoteId: number,\n idToRemoteMap?: Map<number, number>,\n remoteToIdMap?: Map<number, number>,\n ): number {\n const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);\n\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\n getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[] {\n const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return remoteId.map((id) =>\n this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap),\n );\n }\n\n getRemoteId(\n iframe: HTMLIFrameElement,\n id: number,\n map?: Map<number, number>,\n ): number {\n const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);\n\n if (typeof id !== 'number') return id;\n\n const remoteId = remoteIdToIdMap.get(id);\n if (!remoteId) return -1;\n return remoteId;\n }\n\n getRemoteIds(iframe: HTMLIFrameElement, ids: number[]): number[] {\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n\n return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));\n }\n\n reset(iframe?: HTMLIFrameElement) {\n if (!iframe) {\n this.iframeIdToRemoteIdMap = new WeakMap();\n this.iframeRemoteIdToIdMap = new WeakMap();\n return;\n }\n this.iframeIdToRemoteIdMap.delete(iframe);\n this.iframeRemoteIdToIdMap.delete(iframe);\n }\n\n private getIdToRemoteIdMap(iframe: HTMLIFrameElement) {\n let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);\n if (!idToRemoteIdMap) {\n idToRemoteIdMap = new Map();\n this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);\n }\n return idToRemoteIdMap;\n }\n\n private getRemoteIdToIdMap(iframe: HTMLIFrameElement) {\n let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);\n if (!remoteIdToIdMap) {\n remoteIdToIdMap = new Map();\n this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);\n }\n return remoteIdToIdMap;\n }\n}\n","import type { Mirror } from 'rrweb-snapshot';\nimport { genId } from 'rrweb-snapshot';\nimport type { CrossOriginIframeMessageEvent } from '../types';\nimport CrossOriginIframeMirror from './cross-origin-iframe-mirror';\nimport { EventType, NodeType, IncrementalSource } from '@rrweb/types';\nimport type {\n eventWithTime,\n eventWithoutTime,\n serializedNodeWithId,\n mutationCallBack,\n} from '@rrweb/types';\nimport type { StylesheetManager } from './stylesheet-manager';\n\nexport class IframeManager {\n private iframes: WeakMap<HTMLIFrameElement, true> = new WeakMap();\n private crossOriginIframeMap: WeakMap<MessageEventSource, HTMLIFrameElement> =\n new WeakMap();\n public crossOriginIframeMirror = new CrossOriginIframeMirror(genId);\n public crossOriginIframeStyleMirror: CrossOriginIframeMirror;\n public crossOriginIframeRootIdMap: WeakMap<HTMLIFrameElement, number> =\n new WeakMap();\n private mirror: Mirror;\n private mutationCb: mutationCallBack;\n private wrappedEmit: (e: eventWithoutTime, isCheckout?: boolean) => void;\n private loadListener?: (iframeEl: HTMLIFrameElement) => unknown;\n private stylesheetManager: StylesheetManager;\n private recordCrossOriginIframes: boolean;\n\n constructor(options: {\n mirror: Mirror;\n mutationCb: mutationCallBack;\n stylesheetManager: StylesheetManager;\n recordCrossOriginIframes: boolean;\n wrappedEmit: (e: eventWithoutTime, isCheckout?: boolean) => void;\n }) {\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\n public addIframe(iframeEl: HTMLIFrameElement) {\n this.iframes.set(iframeEl, true);\n if (iframeEl.contentWindow)\n this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);\n }\n\n public addLoadListener(cb: (iframeEl: HTMLIFrameElement) => unknown) {\n this.loadListener = cb;\n }\n\n public attachIframe(\n iframeEl: HTMLIFrameElement,\n childSn: serializedNodeWithId,\n ) {\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\n // Receive messages (events) coming from cross-origin iframes that are nested in this same-origin iframe.\n if (this.recordCrossOriginIframes)\n iframeEl.contentWindow?.addEventListener(\n 'message',\n this.handleMessage.bind(this),\n );\n\n this.loadListener?.(iframeEl);\n\n if (\n iframeEl.contentDocument &&\n iframeEl.contentDocument.adoptedStyleSheets &&\n iframeEl.contentDocument.adoptedStyleSheets.length > 0\n )\n this.stylesheetManager.adoptStyleSheets(\n iframeEl.contentDocument.adoptedStyleSheets,\n this.mirror.getId(iframeEl.contentDocument),\n );\n }\n private handleMessage(message: MessageEvent | CrossOriginIframeMessageEvent) {\n const crossOriginMessageEvent = message as CrossOriginIframeMessageEvent;\n if (\n crossOriginMessageEvent.data.type !== 'rrweb' ||\n // To filter out the rrweb messages which are forwarded by some sites.\n crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin\n )\n return;\n\n const iframeSourceWindow = message.source;\n if (!iframeSourceWindow) return;\n\n const iframeEl = this.crossOriginIframeMap.get(message.source);\n if (!iframeEl) return;\n\n const transformedEvent = this.transformCrossOriginEvent(\n iframeEl,\n crossOriginMessageEvent.data.event,\n );\n\n if (transformedEvent)\n this.wrappedEmit(\n transformedEvent,\n crossOriginMessageEvent.data.isCheckout,\n );\n }\n\n private transformCrossOriginEvent(\n iframeEl: HTMLIFrameElement,\n e: eventWithTime,\n ): eventWithTime | false {\n switch (e.type) {\n case EventType.FullSnapshot: {\n this.crossOriginIframeMirror.reset(iframeEl);\n this.crossOriginIframeStyleMirror.reset(iframeEl);\n /**\n * Replaces the original id of the iframe with a new set of unique ids\n */\n this.replaceIdOnNode(e.data.node, iframeEl);\n const rootId = e.data.node.id;\n this.crossOriginIframeRootIdMap.set(iframeEl, rootId);\n this.patchRootIdOnNode(e.data.node, rootId);\n return {\n timestamp: e.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: e.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 e;\n }\n case EventType.Custom: {\n this.replaceIds(\n e.data.payload as {\n id?: unknown;\n parentId?: unknown;\n previousId?: unknown;\n nextId?: unknown;\n },\n iframeEl,\n ['id', 'parentId', 'previousId', 'nextId'],\n );\n return e;\n }\n case EventType.IncrementalSnapshot: {\n switch (e.data.source) {\n case IncrementalSource.Mutation: {\n e.data.adds.forEach((n) => {\n this.replaceIds(n, iframeEl, [\n 'parentId',\n 'nextId',\n 'previousId',\n ]);\n this.replaceIdOnNode(n.node, iframeEl);\n const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);\n rootId && this.patchRootIdOnNode(n.node, rootId);\n });\n e.data.removes.forEach((n) => {\n this.replaceIds(n, iframeEl, ['parentId', 'id']);\n });\n e.data.attributes.forEach((n) => {\n this.replaceIds(n, iframeEl, ['id']);\n });\n e.data.texts.forEach((n) => {\n this.replaceIds(n, iframeEl, ['id']);\n });\n return e;\n }\n case IncrementalSource.Drag:\n case IncrementalSource.TouchMove:\n case IncrementalSource.MouseMove: {\n e.data.positions.forEach((p) => {\n this.replaceIds(p, iframeEl, ['id']);\n });\n return e;\n }\n case IncrementalSource.ViewportResize: {\n // can safely ignore these events\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(e.data, iframeEl, ['id']);\n return e;\n }\n case IncrementalSource.StyleSheetRule:\n case IncrementalSource.StyleDeclaration: {\n this.replaceIds(e.data, iframeEl, ['id']);\n this.replaceStyleIds(e.data, iframeEl, ['styleId']);\n return e;\n }\n case IncrementalSource.Font: {\n // fine as-is no modification needed\n return e;\n }\n case IncrementalSource.Selection: {\n e.data.ranges.forEach((range) => {\n this.replaceIds(range, iframeEl, ['start', 'end']);\n });\n return e;\n }\n case IncrementalSource.AdoptedStyleSheet: {\n this.replaceIds(e.data, iframeEl, ['id']);\n this.replaceStyleIds(e.data, iframeEl, ['styleIds']);\n e.data.styles?.forEach((style) => {\n this.replaceStyleIds(style, iframeEl, ['styleId']);\n });\n return e;\n }\n }\n }\n }\n return false;\n }\n\n private replace<T extends Record<string, unknown>>(\n iframeMirror: CrossOriginIframeMirror,\n obj: T,\n iframeEl: HTMLIFrameElement,\n keys: Array<keyof T>,\n ): T {\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] as number[],\n ) as T[keyof T];\n } else {\n (obj[key] as number) = iframeMirror.getId(iframeEl, obj[key] as number);\n }\n }\n\n return obj;\n }\n\n private replaceIds<T extends Record<string, unknown>>(\n obj: T,\n iframeEl: HTMLIFrameElement,\n keys: Array<keyof T>,\n ): T {\n return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);\n }\n\n private replaceStyleIds<T extends Record<string, unknown>>(\n obj: T,\n iframeEl: HTMLIFrameElement,\n keys: Array<keyof T>,\n ): T {\n return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);\n }\n\n private replaceIdOnNode(\n node: serializedNodeWithId,\n iframeEl: HTMLIFrameElement,\n ) {\n this.replaceIds(node, iframeEl, ['id', 'rootId']);\n if ('childNodes' in node) {\n node.childNodes.forEach((child) => {\n this.replaceIdOnNode(child, iframeEl);\n });\n }\n }\n\n private patchRootIdOnNode(node: serializedNodeWithId, rootId: number) {\n if (node.type !== NodeType.Document && !node.rootId) node.rootId = rootId;\n if ('childNodes' in node) {\n node.childNodes.forEach((child) => {\n this.patchRootIdOnNode(child, rootId);\n });\n }\n }\n}\n","import type { MutationBufferParam } from '../types';\nimport type {\n mutationCallBack,\n scrollCallback,\n SamplingStrategy,\n} from '@rrweb/types';\nimport {\n initMutationObserver,\n initScrollObserver,\n initAdoptedStyleSheetObserver,\n} from './observer';\nimport { inDom } from '../utils';\nimport type { Mirror } from 'rrweb-snapshot';\nimport { isNativeShadowDom } from 'rrweb-snapshot';\nimport dom, { patch } from '@rrweb/utils';\n\ntype BypassOptions = Omit<\n MutationBufferParam,\n 'doc' | 'mutationCb' | 'mirror' | 'shadowDomManager'\n> & {\n sampling: SamplingStrategy;\n};\n\nexport class ShadowDomManager {\n private shadowDoms = new WeakSet<ShadowRoot>();\n private mutationCb: mutationCallBack;\n private scrollCb: scrollCallback;\n private bypassOptions: BypassOptions;\n private mirror: Mirror;\n private restoreHandlers: (() => void)[] = [];\n\n constructor(options: {\n mutationCb: mutationCallBack;\n scrollCb: scrollCallback;\n bypassOptions: BypassOptions;\n mirror: Mirror;\n }) {\n this.mutationCb = options.mutationCb;\n this.scrollCb = options.scrollCb;\n this.bypassOptions = options.bypassOptions;\n this.mirror = options.mirror;\n\n this.init();\n }\n\n public init() {\n this.reset();\n // Patch 'attachShadow' to observe newly added shadow doms.\n this.patchAttachShadow(Element, document);\n }\n\n public addShadowRoot(shadowRoot: ShadowRoot, doc: Document) {\n if (!isNativeShadowDom(shadowRoot)) return;\n if (this.shadowDoms.has(shadowRoot)) return;\n this.shadowDoms.add(shadowRoot);\n const [observer] = initMutationObserver(\n {\n ...this.bypassOptions,\n doc,\n mutationCb: this.mutationCb,\n mirror: this.mirror,\n shadowDomManager: this,\n },\n shadowRoot,\n );\n this.restoreHandlers.push(() => observer.disconnect());\n this.restoreHandlers.push(\n initScrollObserver({\n ...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: shadowRoot as unknown as Document,\n mirror: this.mirror,\n }),\n );\n // Defer this to avoid adoptedStyleSheet events being created before the full snapshot is created or attachShadow action is recorded.\n setTimeout(() => {\n if (\n shadowRoot.adoptedStyleSheets &&\n shadowRoot.adoptedStyleSheets.length > 0\n )\n this.bypassOptions.stylesheetManager.adoptStyleSheets(\n shadowRoot.adoptedStyleSheets,\n this.mirror.getId(dom.host(shadowRoot)),\n );\n this.restoreHandlers.push(\n initAdoptedStyleSheetObserver(\n {\n mirror: this.mirror,\n stylesheetManager: this.bypassOptions.stylesheetManager,\n },\n shadowRoot,\n ),\n );\n }, 0);\n }\n\n /**\n * Monkey patch 'attachShadow' of an IFrameElement to observe newly added shadow doms.\n */\n public observeAttachShadow(iframeElement: HTMLIFrameElement) {\n if (!iframeElement.contentWindow || !iframeElement.contentDocument) return;\n\n this.patchAttachShadow(\n (\n iframeElement.contentWindow as Window & {\n Element: { prototype: Element };\n }\n ).Element,\n iframeElement.contentDocument,\n );\n }\n\n /**\n * Patch 'attachShadow' to observe newly added shadow doms.\n */\n private patchAttachShadow(\n element: {\n prototype: Element;\n },\n doc: Document,\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const manager = this;\n this.restoreHandlers.push(\n patch(\n element.prototype,\n 'attachShadow',\n function (original: (init: ShadowRootInit) => ShadowRoot) {\n return function (this: Element, option: ShadowRootInit) {\n const sRoot = original.call(this, option);\n // For the shadow dom elements in the document, monitor their dom mutations.\n // For shadow dom elements that aren't in the document yet,\n // we start monitoring them once their shadow dom host is appended to the document.\n const shadowRootEl = dom.shadowRoot(this);\n if (shadowRootEl && inDom(this))\n manager.addShadowRoot(shadowRootEl, doc);\n return sRoot;\n };\n },\n ),\n );\n }\n\n public reset() {\n this.restoreHandlers.forEach((handler) => {\n try {\n handler();\n } catch (e) {\n //\n }\n });\n this.restoreHandlers = [];\n this.shadowDoms = new WeakSet();\n }\n}\n","/*\n * base64-arraybuffer 1.0.2 <https://github.com/niklasvh/base64-arraybuffer>\n * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>\n * Released under MIT License\n */\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n// Use a lookup table to find the index.\nvar lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);\nfor (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\nvar encode = function (arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';\n for (i = 0; i < len; i += 3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + '=';\n }\n else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + '==';\n }\n return base64;\n};\nvar decode = function (base64) {\n var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);\n for (i = 0; i < len; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n return arraybuffer;\n};\n\nexport { decode, encode };\n//# sourceMappingURL=base64-arraybuffer.es5.js.map\n","import { encode } from 'base64-arraybuffer';\nimport type { IWindow, CanvasArg } from '@rrweb/types';\n\n// TODO: unify with `replay/webgl.ts`\ntype CanvasVarMap = Map<string, unknown[]>;\nconst canvasVarMap: Map<RenderingContext, CanvasVarMap> = new Map();\nexport function variableListFor(ctx: RenderingContext, ctor: string) {\n let contextMap = canvasVarMap.get(ctx);\n if (!contextMap) {\n contextMap = new Map();\n canvasVarMap.set(ctx, contextMap);\n }\n if (!contextMap.has(ctor)) {\n contextMap.set(ctor, []);\n }\n return contextMap.get(ctor) as unknown[];\n}\n\nexport const saveWebGLVar = (\n value: unknown,\n win: IWindow,\n ctx: RenderingContext,\n): number | void => {\n if (\n !value ||\n !(isInstanceOfWebGLObject(value, win) || typeof value === 'object')\n )\n return;\n\n const name = value.constructor.name;\n const list = variableListFor(ctx, name);\n let index = list.indexOf(value);\n\n if (index === -1) {\n index = list.length;\n list.push(value);\n }\n return index;\n};\n\n// from webgl-recorder: https://github.com/evanw/webgl-recorder/blob/bef0e65596e981ee382126587e2dcbe0fc7748e2/webgl-recorder.js#L50-L77\nexport function serializeArg(\n value: unknown,\n win: IWindow,\n ctx: RenderingContext,\n): CanvasArg {\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 (\n value instanceof Float32Array ||\n value instanceof Float64Array ||\n value instanceof Int32Array ||\n value instanceof Uint32Array ||\n value instanceof Uint8Array ||\n value instanceof Uint16Array ||\n value instanceof Int16Array ||\n value instanceof Int8Array ||\n value instanceof Uint8ClampedArray\n ) {\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 as 'ArrayBuffer';\n const base64 = encode(value);\n\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 // TODO: move `toDataURL` to web worker if possible\n const src = value.toDataURL(); // heavy on large canvas\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 (value instanceof Blob) {\n // const name = value.constructor.name;\n // return {\n // rr_type: name,\n // data: [serializeArg(await value.arrayBuffer(), win, ctx)],\n // type: value.type,\n // };\n } else if (isInstanceOfWebGLObject(value, win) || typeof value === 'object') {\n const name = value.constructor.name;\n const index = saveWebGLVar(value, win, ctx) as number;\n\n return {\n rr_type: name,\n index: index,\n };\n }\n\n return value as unknown as CanvasArg;\n}\n\nexport const serializeArgs = (\n args: Array<unknown>,\n win: IWindow,\n ctx: RenderingContext,\n) => {\n return args.map((arg) => serializeArg(arg, win, ctx));\n};\n\nexport const isInstanceOfWebGLObject = (\n value: unknown,\n win: IWindow,\n): value is\n | WebGLActiveInfo\n | WebGLBuffer\n | WebGLFramebuffer\n | WebGLProgram\n | WebGLRenderbuffer\n | WebGLShader\n | WebGLShaderPrecisionFormat\n | WebGLTexture\n | WebGLUniformLocation\n | WebGLVertexArrayObject => {\n const webGLConstructorNames: string[] = [\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: string) => typeof win[name as keyof Window] === 'function',\n );\n return Boolean(\n supportedWebGLConstructorNames.find(\n (name: string) => value instanceof win[name as keyof Window],\n ),\n );\n};\n","import type { ICanvas } from 'rrweb-snapshot';\nimport type { blockClass, IWindow, listenerHandler } from '@rrweb/types';\nimport { isBlocked } from '../../../utils';\nimport { patch } from '@rrweb/utils';\n\nfunction getNormalizedContextName(contextType: string) {\n return contextType === 'experimental-webgl' ? 'webgl' : contextType;\n}\n\nexport default function initCanvasContextObserver(\n win: IWindow,\n blockClass: blockClass,\n blockSelector: string | null,\n setPreserveDrawingBufferToTrue: boolean,\n): listenerHandler {\n const handlers: listenerHandler[] = [];\n try {\n const restoreHandler = patch(\n win.HTMLCanvasElement.prototype,\n 'getContext',\n function (\n original: (\n this: ICanvas | HTMLCanvasElement,\n contextType: string,\n ...args: Array<unknown>\n ) => void,\n ) {\n return function (\n this: ICanvas | HTMLCanvasElement,\n contextType: string,\n ...args: Array<unknown>\n ) {\n if (!isBlocked(this, blockClass, blockSelector, true)) {\n const ctxName = getNormalizedContextName(contextType);\n if (!('__context' in this)) (this as ICanvas).__context = ctxName;\n\n if (\n setPreserveDrawingBufferToTrue &&\n ['webgl', 'webgl2'].includes(ctxName)\n ) {\n if (args[0] && typeof args[0] === 'object') {\n const contextAttributes = args[0] as WebGLContextAttributes;\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 {\n console.error('failed to patch HTMLCanvasElement.prototype.getContext');\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\n","import {\n type blockClass,\n CanvasContext,\n type canvasManagerMutationCallback,\n type canvasMutationWithType,\n type IWindow,\n type listenerHandler,\n} from '@rrweb/types';\nimport { hookSetter, isBlocked } from '../../../utils';\nimport { patch } from '@rrweb/utils';\nimport { saveWebGLVar, serializeArgs } from './serialize-args';\n\nfunction patchGLPrototype(\n prototype: WebGLRenderingContext | WebGL2RenderingContext,\n type: CanvasContext,\n cb: canvasManagerMutationCallback,\n blockClass: blockClass,\n blockSelector: string | null,\n win: IWindow,\n): listenerHandler[] {\n const handlers: listenerHandler[] = [];\n\n const props = Object.getOwnPropertyNames(prototype);\n\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 // skip read only propery/functions\n continue;\n }\n try {\n if (typeof prototype[prop as keyof typeof prototype] !== 'function') {\n continue;\n }\n const restoreHandler = patch(\n prototype,\n prop,\n function (\n original: (this: typeof prototype, ...args: Array<unknown>) => void,\n ) {\n return function (this: typeof prototype, ...args: Array<unknown>) {\n const result = original.apply(this, args);\n saveWebGLVar(result, win, this);\n if (\n 'tagName' in this.canvas &&\n !isBlocked(this.canvas, blockClass, blockSelector, true)\n ) {\n const recordArgs = serializeArgs(args, win, this);\n const mutation: canvasMutationWithType = {\n type,\n property: prop,\n args: recordArgs,\n };\n // TODO: this could potentially also be an OffscreenCanvas as well as HTMLCanvasElement\n cb(this.canvas, mutation);\n }\n\n return result;\n };\n },\n );\n handlers.push(restoreHandler);\n } catch {\n const hookHandler = hookSetter<typeof prototype>(prototype, prop, {\n set(v) {\n // TODO: this could potentially also be an OffscreenCanvas as well as HTMLCanvasElement\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n cb(this.canvas as HTMLCanvasElement, {\n type,\n property: prop,\n args: [v],\n setter: true,\n });\n },\n });\n handlers.push(hookHandler);\n }\n }\n\n return handlers;\n}\n\nexport default function initCanvasWebGLMutationObserver(\n cb: canvasManagerMutationCallback,\n win: IWindow,\n blockClass: blockClass,\n blockSelector: string | null,\n): listenerHandler {\n const handlers: listenerHandler[] = [];\n\n if (typeof win.WebGLRenderingContext !== 'undefined') {\n handlers.push(\n ...patchGLPrototype(\n win.WebGLRenderingContext.prototype,\n CanvasContext.WebGL,\n cb,\n blockClass,\n blockSelector,\n win,\n ),\n );\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\n return () => {\n handlers.forEach((h) => h());\n };\n}\n","import type { ICanvas, Mirror } from 'rrweb-snapshot';\nimport type {\n blockClass,\n canvasManagerMutationCallback,\n canvasMutationCallback,\n canvasMutationCommand,\n canvasMutationWithType,\n IWindow,\n listenerHandler,\n CanvasArg,\n DataURLOptions,\n} from '@rrweb/types';\nimport { isBlocked } from '../../../utils';\nimport { CanvasContext } from '@rrweb/types';\nimport initCanvas2DMutationObserver from './2d';\nimport initCanvasContextObserver from './canvas';\nimport initCanvasWebGLMutationObserver from './webgl';\nimport ImageBitmapDataURLWorker from '../../workers/image-bitmap-data-url-worker?worker&inline';\nimport type { ImageBitmapDataURLRequestWorker } from '../../workers/image-bitmap-data-url-worker';\n\nexport type RafStamps = { latestId: number; invokeId: number | null };\n\ntype pendingCanvasMutationsMap = Map<\n HTMLCanvasElement,\n canvasMutationWithType[]\n>;\n\nexport class CanvasManager {\n private pendingCanvasMutations: pendingCanvasMutationsMap = new Map();\n private rafStamps: RafStamps = { latestId: 0, invokeId: null };\n private mirror: Mirror;\n\n private mutationCb: canvasMutationCallback;\n private resetObservers?: listenerHandler;\n private frozen = false;\n private locked = false;\n\n public reset() {\n this.pendingCanvasMutations.clear();\n this.resetObservers && this.resetObservers();\n }\n\n public freeze() {\n this.frozen = true;\n }\n\n public unfreeze() {\n this.frozen = false;\n }\n\n public lock() {\n this.locked = true;\n }\n\n public unlock() {\n this.locked = false;\n }\n\n constructor(options: {\n recordCanvas: boolean;\n mutationCb: canvasMutationCallback;\n win: IWindow;\n blockClass: blockClass;\n blockSelector: string | null;\n mirror: Mirror;\n sampling?: 'all' | number;\n dataURLOptions: DataURLOptions;\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\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\n private processMutation: canvasManagerMutationCallback = (\n target,\n mutation,\n ) => {\n const newFrame =\n this.rafStamps.invokeId &&\n this.rafStamps.latestId !== this.rafStamps.invokeId;\n if (newFrame || !this.rafStamps.invokeId)\n this.rafStamps.invokeId = this.rafStamps.latestId;\n\n if (!this.pendingCanvasMutations.has(target)) {\n this.pendingCanvasMutations.set(target, []);\n }\n\n this.pendingCanvasMutations.get(target)!.push(mutation);\n };\n\n private initCanvasFPSObserver(\n fps: number,\n win: IWindow,\n blockClass: blockClass,\n blockSelector: string | null,\n options: {\n dataURLOptions: DataURLOptions;\n },\n ) {\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n true,\n );\n const snapshotInProgressMap: Map<number, boolean> = new Map();\n const worker =\n new ImageBitmapDataURLWorker() as ImageBitmapDataURLRequestWorker;\n worker.onmessage = (e) => {\n const { id } = e.data;\n snapshotInProgressMap.set(id, false);\n\n if (!('base64' in e.data)) return;\n\n const { base64, type, width, height } = e.data;\n this.mutationCb({\n id,\n type: CanvasContext['2D'],\n commands: [\n {\n property: 'clearRect', // wipe canvas\n args: [0, 0, width, height],\n },\n {\n property: 'drawImage', // 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 } as CanvasArg,\n 0,\n 0,\n ],\n },\n ],\n });\n };\n\n const timeBetweenSnapshots = 1000 / fps;\n let lastSnapshotTime = 0;\n let rafId: number;\n\n const getCanvas = (): HTMLCanvasElement[] => {\n const matchedCanvas: HTMLCanvasElement[] = [];\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\n const takeCanvasSnapshots = (timestamp: DOMHighResTimeStamp) => {\n if (\n lastSnapshotTime &&\n timestamp - lastSnapshotTime < timeBetweenSnapshots\n ) {\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n return;\n }\n lastSnapshotTime = timestamp;\n\n getCanvas()\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n .forEach(async (canvas: HTMLCanvasElement) => {\n const id = this.mirror.getId(canvas);\n if (snapshotInProgressMap.get(id)) return;\n\n // The browser throws if the canvas is 0 in size\n // Uncaught (in promise) DOMException: Failed to execute 'createImageBitmap' on 'Window': The source image width is 0.\n // Assuming the same happens with height\n if (canvas.width === 0 || canvas.height === 0) return;\n\n snapshotInProgressMap.set(id, true);\n if (['webgl', 'webgl2'].includes((canvas as ICanvas).__context)) {\n // if the canvas hasn't been modified recently,\n // its contents won't be in memory and `createImageBitmap`\n // will return a transparent imageBitmap\n\n const context = canvas.getContext((canvas as ICanvas).__context) as\n | WebGLRenderingContext\n | WebGL2RenderingContext\n | null;\n if (\n context?.getContextAttributes()?.preserveDrawingBuffer === false\n ) {\n // Hack to load canvas back into memory so `createImageBitmap` can grab it's contents.\n // Context: https://twitter.com/Juice10/status/1499775271758704643\n // Preferably we set `preserveDrawingBuffer` to true, but that's not always possible,\n // especially when canvas is loaded before rrweb.\n // This hack can wipe the background color of the canvas in the (unlikely) event that\n // the canvas background was changed but clear was not called directly afterwards.\n // Example of this hack having negative side effect: https://visgl.github.io/react-map-gl/examples/layers\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\n rafId = requestAnimationFrame(takeCanvasSnapshots);\n\n this.resetObservers = () => {\n canvasContextReset();\n cancelAnimationFrame(rafId);\n };\n }\n\n private initCanvasMutationObserver(\n win: IWindow,\n blockClass: blockClass,\n blockSelector: string | null,\n ): void {\n this.startRAFTimestamping();\n this.startPendingCanvasMutationFlusher();\n\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\n const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector,\n );\n\n this.resetObservers = () => {\n canvasContextReset();\n canvas2DReset();\n canvasWebGL1and2Reset();\n };\n }\n\n private startPendingCanvasMutationFlusher() {\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n\n private startRAFTimestamping() {\n const setLatestRAFTimestamp = (timestamp: DOMHighResTimeStamp) => {\n this.rafStamps.latestId = timestamp;\n requestAnimationFrame(setLatestRAFTimestamp);\n };\n requestAnimationFrame(setLatestRAFTimestamp);\n }\n\n flushPendingCanvasMutations() {\n this.pendingCanvasMutations.forEach(\n (_values: canvasMutationCommand[], canvas: HTMLCanvasElement) => {\n const id = this.mirror.getId(canvas);\n this.flushPendingCanvasMutationFor(canvas, id);\n },\n );\n requestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n\n flushPendingCanvasMutationFor(canvas: HTMLCanvasElement, id: number) {\n if (this.frozen || this.locked) {\n return;\n }\n\n const valuesWithType = this.pendingCanvasMutations.get(canvas);\n if (!valuesWithType || id === -1) return;\n\n const values = valuesWithType.map((value) => {\n const { type, ...rest } = value;\n return rest;\n });\n const { type } = valuesWithType[0];\n\n this.mutationCb({ id, type, commands: values });\n\n this.pendingCanvasMutations.delete(canvas);\n }\n}\n","import {\n snapshot,\n slimDOMDefaults,\n type MaskInputOptions,\n createMirror,\n} from 'rrweb-snapshot';\nimport { initObservers, mutationBuffers } from './observer';\nimport {\n on,\n getWindowWidth,\n getWindowHeight,\n getWindowScroll,\n polyfill,\n hasShadowRoot,\n isSerializedIframe,\n isSerializedStylesheet,\n nowTimestamp,\n} from '../utils';\nimport type { recordOptions } from '../types';\nimport {\n EventType,\n type eventWithoutTime,\n type eventWithTime,\n IncrementalSource,\n type listenerHandler,\n type mutationCallbackParam,\n type scrollCallback,\n type canvasMutationParam,\n type adoptedStyleSheetParam,\n} from '@rrweb/types';\nimport type { CrossOriginIframeMessageEventContent } from '../types';\nimport { IframeManager } from './iframe-manager';\nimport { ShadowDomManager } from './shadow-dom-manager';\nimport { CanvasManager } from './observers/canvas/canvas-manager';\nimport { StylesheetManager } from './stylesheet-manager';\nimport ProcessedNodeManager from './processed-node-manager';\nimport {\n callbackWrapper,\n registerErrorHandler,\n unregisterErrorHandler,\n} from './error-handler';\nimport dom from '@rrweb/utils';\n\nlet wrappedEmit!: (e: eventWithoutTime, isCheckout?: boolean) => void;\n\nlet takeFullSnapshot!: (isCheckout?: boolean) => void;\nlet canvasManager!: CanvasManager;\nlet recording = false;\n\n// Multiple tools (i.e. MooTools, Prototype.js) override Array.from and drop support for the 2nd parameter\n// Try to pull a clean implementation from a newly created iframe\ntry {\n if (Array.from([1], (x) => x * 2)[0] !== 2) {\n const cleanFrame = document.createElement('iframe');\n document.body.appendChild(cleanFrame);\n // eslint-disable-next-line @typescript-eslint/unbound-method -- Array.from is static and doesn't rely on binding\n Array.from = cleanFrame.contentWindow?.Array.from || Array.from;\n document.body.removeChild(cleanFrame);\n }\n} catch (err) {\n console.debug('Unable to override Array.from', err);\n}\n\nconst mirror = createMirror();\nfunction record<T = eventWithTime>(\n options: recordOptions<T> = {},\n): listenerHandler | undefined {\n const {\n emit,\n checkoutEveryNms,\n checkoutEveryNth,\n blockClass = 'rr-block',\n blockSelector = null,\n ignoreClass = 'rr-ignore',\n ignoreSelector = null,\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'\n ? options.recordAfter\n : 'load',\n userTriggeredOnInput = false,\n collectFonts = false,\n inlineImages = false,\n plugins,\n keepIframeSrcFn = () => false,\n ignoreCSSAttributes = new Set([]),\n errorHandler,\n } = options;\n\n registerErrorHandler(errorHandler);\n\n const inEmittingFrame = recordCrossOriginIframes\n ? window.parent === window\n : true;\n\n let passEmitsToParent = false;\n if (!inEmittingFrame) {\n try {\n // throws if parent is cross-origin\n if (window.parent.document) {\n passEmitsToParent = false; // if parent is same origin we collect iframe events from the parent\n }\n } catch (e) {\n passEmitsToParent = true;\n }\n }\n\n // runtime checks for user options\n if (inEmittingFrame && !emit) {\n throw new Error('emit function is required');\n }\n if (!inEmittingFrame && !passEmitsToParent) {\n return () => {\n /* no-op since in this case we don't need to record anything from this frame in particular */\n };\n }\n // move departed options to new options\n if (mousemoveWait !== undefined && sampling.mousemove === undefined) {\n sampling.mousemove = mousemoveWait;\n }\n\n // reset mirror in case `record` this was called earlier\n mirror.reset();\n\n const maskInputOptions: MaskInputOptions =\n maskAllInputs === true\n ? {\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 }\n : _maskInputOptions !== undefined\n ? _maskInputOptions\n : { password: true };\n\n const slimDOMOptions = slimDOMDefaults(_slimDOMOptions);\n\n polyfill();\n\n let lastFullSnapshotEvent: eventWithTime;\n let incrementalSnapshotCount = 0;\n\n const eventProcessor = (e: eventWithTime): T => {\n for (const plugin of plugins || []) {\n if (plugin.eventProcessor) {\n e = plugin.eventProcessor(e);\n }\n }\n if (\n packFn &&\n // Disable packing events which will be emitted to parent frames.\n !passEmitsToParent\n ) {\n e = packFn(e) as unknown as eventWithTime;\n }\n return e as unknown as T;\n };\n wrappedEmit = (r: eventWithoutTime, isCheckout?: boolean) => {\n const e = r as eventWithTime;\n e.timestamp = nowTimestamp();\n if (\n mutationBuffers[0]?.isFrozen() &&\n e.type !== EventType.FullSnapshot &&\n !(\n e.type === EventType.IncrementalSnapshot &&\n e.data.source === IncrementalSource.Mutation\n )\n ) {\n // we've got a user initiated event so first we need to apply\n // all DOM changes that have been buffering during paused state\n mutationBuffers.forEach((buf) => buf.unfreeze());\n }\n\n if (inEmittingFrame) {\n emit?.(eventProcessor(e), isCheckout);\n } else if (passEmitsToParent) {\n const message: CrossOriginIframeMessageEventContent<T> = {\n type: 'rrweb',\n event: eventProcessor(e),\n origin: window.location.origin,\n isCheckout,\n };\n window.parent.postMessage(message, '*');\n }\n\n if (e.type === EventType.FullSnapshot) {\n lastFullSnapshotEvent = e;\n incrementalSnapshotCount = 0;\n } else if (e.type === EventType.IncrementalSnapshot) {\n // attach iframe should be considered as full snapshot\n if (\n e.data.source === IncrementalSource.Mutation &&\n e.data.isAttachIframe\n ) {\n return;\n }\n\n incrementalSnapshotCount++;\n const exceedCount =\n checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;\n const exceedTime =\n checkoutEveryNms &&\n e.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;\n if (exceedCount || exceedTime) {\n takeFullSnapshot(true);\n }\n }\n };\n\n const wrappedMutationEmit = (m: mutationCallbackParam) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n ...m,\n },\n });\n };\n const wrappedScrollEmit: scrollCallback = (p) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Scroll,\n ...p,\n },\n });\n const wrappedCanvasMutationEmit = (p: canvasMutationParam) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CanvasMutation,\n ...p,\n },\n });\n\n const wrappedAdoptedStyleSheetEmit = (a: adoptedStyleSheetParam) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.AdoptedStyleSheet,\n ...a,\n },\n });\n\n const stylesheetManager = new StylesheetManager({\n mutationCb: wrappedMutationEmit,\n adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit,\n });\n\n const iframeManager = new IframeManager({\n mirror,\n mutationCb: wrappedMutationEmit,\n stylesheetManager: stylesheetManager,\n recordCrossOriginIframes,\n wrappedEmit,\n });\n\n /**\n * Exposes mirror to the plugins\n */\n for (const plugin of plugins || []) {\n if (plugin.getMirror)\n plugin.getMirror({\n nodeMirror: mirror,\n crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,\n crossOriginIframeStyleMirror:\n iframeManager.crossOriginIframeStyleMirror,\n });\n }\n\n const processedNodeManager = new ProcessedNodeManager();\n\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\n const shadowDomManager = new ShadowDomManager({\n mutationCb: wrappedMutationEmit,\n scrollCb: wrappedScrollEmit,\n bypassOptions: {\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\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 keepIframeSrcFn,\n processedNodeManager,\n },\n mirror,\n });\n\n takeFullSnapshot = (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\n // When we take a full snapshot, old tracked StyleSheets need to be removed.\n stylesheetManager.reset();\n\n shadowDomManager.init();\n\n mutationBuffers.forEach((buf) => buf.lock()); // don't allow any mirror modifications during snapshotting\n const node = snapshot(document, {\n mirror,\n blockClass,\n blockSelector,\n maskTextClass,\n maskTextSelector,\n inlineStylesheet,\n maskAllInputs: maskInputOptions,\n maskTextFn,\n maskInputFn,\n slimDOM: slimDOMOptions,\n dataURLOptions,\n recordCanvas,\n inlineImages,\n onSerialize: (n) => {\n if (isSerializedIframe(n, mirror)) {\n iframeManager.addIframe(n as HTMLIFrameElement);\n }\n if (isSerializedStylesheet(n, mirror)) {\n stylesheetManager.trackLinkElement(n as HTMLLinkElement);\n }\n if (hasShadowRoot(n)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowDomManager.addShadowRoot(dom.shadowRoot(n as Node)!, 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\n if (!node) {\n return console.warn('Failed to snapshot the document');\n }\n\n wrappedEmit(\n {\n type: EventType.FullSnapshot,\n data: {\n node,\n initialOffset: getWindowScroll(window),\n },\n },\n isCheckout,\n );\n mutationBuffers.forEach((buf) => buf.unlock()); // generate & emit any mutations that happened during snapshotting, as can now apply against the newly built mirror\n\n // Some old browsers don't support adoptedStyleSheets.\n if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)\n stylesheetManager.adoptStyleSheets(\n document.adoptedStyleSheets,\n mirror.getId(document),\n );\n };\n\n try {\n const handlers: listenerHandler[] = [];\n\n const observe = (doc: Document) => {\n return callbackWrapper(initObservers)(\n {\n mutationCb: wrappedMutationEmit,\n mousemoveCb: (positions, source) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source,\n positions,\n },\n }),\n mouseInteractionCb: (d) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MouseInteraction,\n ...d,\n },\n }),\n scrollCb: wrappedScrollEmit,\n viewportResizeCb: (d) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.ViewportResize,\n ...d,\n },\n }),\n inputCb: (v) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Input,\n ...v,\n },\n }),\n mediaInteractionCb: (p) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MediaInteraction,\n ...p,\n },\n }),\n styleSheetRuleCb: (r) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleSheetRule,\n ...r,\n },\n }),\n styleDeclarationCb: (r) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleDeclaration,\n ...r,\n },\n }),\n canvasMutationCb: wrappedCanvasMutationEmit,\n fontCb: (p) =>\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Font,\n ...p,\n },\n }),\n selectionCb: (p) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Selection,\n ...p,\n },\n });\n },\n customElementCb: (c) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CustomElement,\n ...c,\n },\n });\n },\n blockClass,\n ignoreClass,\n ignoreSelector,\n maskTextClass,\n maskTextSelector,\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 ignoreCSSAttributes,\n plugins:\n plugins\n ?.filter((p) => p.observer)\n ?.map((p) => ({\n observer: p.observer!,\n options: p.options,\n callback: (payload: object) =>\n wrappedEmit({\n type: EventType.Plugin,\n data: {\n plugin: p.name,\n payload,\n },\n }),\n })) || [],\n },\n hooks,\n );\n };\n\n iframeManager.addLoadListener((iframeEl) => {\n try {\n handlers.push(observe(iframeEl.contentDocument!));\n } catch (error) {\n // TODO: handle internal error\n console.warn(error);\n }\n });\n\n const init = () => {\n takeFullSnapshot();\n handlers.push(observe(document));\n recording = true;\n };\n if (['interactive', 'complete'].includes(document.readyState)) {\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 handlers.forEach((handler) => {\n try {\n handler();\n } catch (error) {\n const msg = String(error).toLowerCase();\n /**\n * https://github.com/rrweb-io/rrweb/pull/1695\n * This error can occur in a known scenario:\n * If an iframe is initially same-origin and observed, but later its \n location is changed in an opaque way to a cross-origin URL (perhaps within the iframe via its `document.location` or a redirect) \n * attempting to execute the handler in the stop record function will \n throw a \"cannot access cross-origin frame\" error.\n * This error is expected and can be safely ignored.\n */\n if (!msg.includes('cross-origin')) {\n console.warn(error);\n }\n }\n });\n processedNodeManager.destroy();\n recording = false;\n unregisterErrorHandler();\n };\n } catch (error) {\n // TODO: handle internal error\n console.warn(error);\n }\n}\n\nrecord.addCustomEvent = <T>(tag: string, payload: T) => {\n if (!recording) {\n throw new Error('please add custom event after start recording');\n }\n wrappedEmit({\n type: EventType.Custom,\n data: {\n tag,\n payload,\n },\n });\n};\n\nrecord.freezePage = () => {\n mutationBuffers.forEach((buf) => buf.freeze());\n};\n\nrecord.takeFullSnapshot = (isCheckout?: boolean) => {\n if (!recording) {\n throw new Error('please take full snapshot after start recording');\n }\n takeFullSnapshot(isCheckout);\n};\n\nrecord.mirror = mirror;\n\nexport default record;\n","import {\n type blockClass,\n CanvasContext,\n type canvasManagerMutationCallback,\n type IWindow,\n type listenerHandler,\n} from '@rrweb/types';\nimport { hookSetter, isBlocked } from '../../../utils';\nimport { patch } from '@rrweb/utils';\nimport { serializeArgs } from './serialize-args';\n\nexport default function initCanvas2DMutationObserver(\n cb: canvasManagerMutationCallback,\n win: IWindow,\n blockClass: blockClass,\n blockSelector: string | null,\n): listenerHandler {\n const handlers: listenerHandler[] = [];\n const props2D = Object.getOwnPropertyNames(\n win.CanvasRenderingContext2D.prototype,\n );\n for (const prop of props2D) {\n try {\n if (\n typeof win.CanvasRenderingContext2D.prototype[\n prop as keyof CanvasRenderingContext2D\n ] !== 'function'\n ) {\n continue;\n }\n const restoreHandler = patch(\n win.CanvasRenderingContext2D.prototype,\n prop,\n function (\n original: (\n this: CanvasRenderingContext2D,\n ...args: unknown[]\n ) => void,\n ) {\n return function (\n this: CanvasRenderingContext2D,\n ...args: Array<unknown>\n ) {\n if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {\n // Using setTimeout as toDataURL can be heavy\n // and we'd rather not block the main thread\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 {\n const hookHandler = hookSetter<CanvasRenderingContext2D>(\n win.CanvasRenderingContext2D.prototype,\n prop,\n {\n set(v) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n cb(this.canvas, {\n type: CanvasContext['2D'],\n property: prop,\n args: [v],\n setter: true,\n });\n },\n },\n );\n handlers.push(hookHandler);\n }\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\n","import { stringifyRule } from 'rrweb-snapshot';\nimport type {\n elementNode,\n serializedNodeWithId,\n adoptedStyleSheetCallback,\n adoptedStyleSheetParam,\n attributeMutation,\n mutationCallBack,\n} from '@rrweb/types';\nimport { StyleSheetMirror } from '../utils';\n\nexport class StylesheetManager {\n private trackedLinkElements: WeakSet<HTMLLinkElement> = new WeakSet();\n private mutationCb: mutationCallBack;\n private adoptedStyleSheetCb: adoptedStyleSheetCallback;\n public styleMirror = new StyleSheetMirror();\n\n constructor(options: {\n mutationCb: mutationCallBack;\n adoptedStyleSheetCb: adoptedStyleSheetCallback;\n }) {\n this.mutationCb = options.mutationCb;\n this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;\n }\n\n public attachLinkElement(\n linkEl: HTMLLinkElement,\n childSn: serializedNodeWithId,\n ) {\n if ('_cssText' in (childSn as elementNode).attributes)\n this.mutationCb({\n adds: [],\n removes: [],\n texts: [],\n attributes: [\n {\n id: childSn.id,\n attributes: (childSn as elementNode)\n .attributes as attributeMutation['attributes'],\n },\n ],\n });\n\n this.trackLinkElement(linkEl);\n }\n\n public trackLinkElement(linkEl: HTMLLinkElement) {\n if (this.trackedLinkElements.has(linkEl)) return;\n\n this.trackedLinkElements.add(linkEl);\n this.trackStylesheetInLinkElement(linkEl);\n }\n\n public adoptStyleSheets(\n sheets: CSSStyleSheet[] | readonly CSSStyleSheet[],\n hostId: number,\n ) {\n if (sheets.length === 0) return;\n const adoptedStyleSheetData: adoptedStyleSheetParam = {\n id: hostId,\n styleIds: [] as number[],\n };\n const styles: NonNullable<adoptedStyleSheetParam['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, (r, index) => ({\n rule: stringifyRule(r, sheet.href),\n index,\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\n public reset() {\n this.styleMirror.reset();\n this.trackedLinkElements = new WeakSet();\n }\n\n // TODO: take snapshot on stylesheet reload by applying event listener\n private trackStylesheetInLinkElement(_linkEl: HTMLLinkElement) {\n // linkEl.addEventListener('load', () => {\n // // re-loaded, maybe take another snapshot?\n // });\n }\n}\n","import type MutationBuffer from './mutation';\n\n/**\n * Keeps a log of nodes that could show up in multiple mutation buffer but shouldn't be handled twice.\n */\nexport default class ProcessedNodeManager {\n private nodeMap: WeakMap<Node, Set<MutationBuffer>> = new WeakMap();\n\n private active = false;\n\n public inOtherBuffer(node: Node, thisBuffer: MutationBuffer) {\n const buffers = this.nodeMap.get(node);\n return (\n buffers && Array.from(buffers).some((buffer) => buffer !== thisBuffer)\n );\n }\n\n public add(node: Node, buffer: MutationBuffer) {\n if (!this.active) {\n this.active = true;\n requestAnimationFrame(() => {\n this.nodeMap = new WeakMap();\n this.active = false;\n });\n }\n this.nodeMap.set(node, (this.nodeMap.get(node) || new Set()).add(buffer));\n }\n\n public destroy() {\n // cleanup no longer needed\n }\n}\n","/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\nfunction t(t,n){var e=\"function\"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return a}var n;!function(t){t[t.NotStarted=0]=\"NotStarted\",t[t.Running=1]=\"Running\",t[t.Stopped=2]=\"Stopped\"}(n||(n={}));var e={type:\"xstate.init\"};function r(t){return void 0===t?[]:[].concat(t)}function o(t){return{type:\"xstate.assign\",assignment:t}}function i(t,n){return\"string\"==typeof(t=\"string\"==typeof t&&n&&n[t]?n[t]:t)?{type:t}:\"function\"==typeof t?{type:t.name,exec:t}:t}function a(t){return function(n){return t===n}}function u(t){return\"string\"==typeof t?{type:t}:t}function c(t,n){return{value:t,context:n,actions:[],changed:!1,matches:a(t)}}function f(t,n,e){var r=n,o=!1;return[t.filter((function(t){if(\"xstate.assign\"===t.type){o=!0;var n=Object.assign({},r);return\"function\"==typeof t.assignment?n=t.assignment(r,e):Object.keys(t.assignment).forEach((function(o){n[o]=\"function\"==typeof t.assignment[o]?t.assignment[o](r,e):t.assignment[o]})),r=n,!1}return!0})),r,o]}function s(n,o){void 0===o&&(o={});var s=t(f(r(n.states[n.initial].entry).map((function(t){return i(t,o.actions)})),n.context,e),2),l=s[0],v=s[1],y={config:n,_options:o,initialState:{value:n.initial,actions:l,context:v,matches:a(n.initial)},transition:function(e,o){var s,l,v=\"string\"==typeof e?{value:e,context:n.context}:e,p=v.value,g=v.context,d=u(o),x=n.states[p];if(x.on){var m=r(x.on[d.type]);try{for(var h=function(t){var n=\"function\"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&\"number\"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(m),b=h.next();!b.done;b=h.next()){var S=b.value;if(void 0===S)return c(p,g);var w=\"string\"==typeof S?{target:S}:S,j=w.target,E=w.actions,R=void 0===E?[]:E,N=w.cond,O=void 0===N?function(){return!0}:N,_=void 0===j,k=null!=j?j:p,T=n.states[k];if(O(g,d)){var q=t(f((_?r(R):[].concat(x.exit,R,T.entry).filter((function(t){return t}))).map((function(t){return i(t,y._options.actions)})),g,d),3),z=q[0],A=q[1],B=q[2],C=null!=j?j:p;return{value:C,context:A,actions:z,changed:j!==p||z.length>0||B,matches:a(C)}}}}catch(t){s={error:t}}finally{try{b&&!b.done&&(l=h.return)&&l.call(h)}finally{if(s)throw s.error}}}return c(p,g)}};return y}var l=function(t,n){return t.actions.forEach((function(e){var r=e.exec;return r&&r(t.context,n)}))};function v(t){var r=t.initialState,o=n.NotStarted,i=new Set,c={_machine:t,send:function(e){o===n.Running&&(r=t.transition(r,e),l(r,u(e)),i.forEach((function(t){return t(r)})))},subscribe:function(t){return i.add(t),t(r),{unsubscribe:function(){return i.delete(t)}}},start:function(i){if(i){var u=\"object\"==typeof i?i:{context:t.config.context,value:i};r={value:u.value,actions:[],context:u.context,matches:a(u.value)}}return o=n.Running,l(r,e),c},stop:function(){return o=n.Stopped,i.clear(),c},get state(){return r},get status(){return o}};return c}export{n as InterpreterStatus,o as assign,s as createMachine,v as interpret};\n","import {\n rebuild,\n adaptCssForReplay,\n buildNodeWithSN,\n type BuildCache,\n createCache,\n createSandboxedIframe,\n Mirror,\n createMirror,\n toLowerCase,\n} from 'rrweb-snapshot';\nimport {\n RRDocument,\n createOrGetNode,\n buildFromNode,\n buildFromDom,\n diff,\n getDefaultSN,\n} from 'rrdom';\nimport type {\n RRNode,\n RRElement,\n RRStyleElement,\n RRIFrameElement,\n RRMediaElement,\n RRCanvasElement,\n ReplayerHandler,\n Mirror as RRDOMMirror,\n} from 'rrdom';\nimport * as mittProxy from 'mitt';\nimport { polyfill as smoothscrollPolyfill } from './smoothscroll';\nimport { Timer } from './timer';\nimport {\n createPlayerService,\n createSpeedService,\n type PlayerMachineState,\n type SpeedMachineState,\n} from './machine';\nimport type { playerConfig, missingNodeMap } from '../types';\nimport {\n NodeType,\n EventType,\n IncrementalSource,\n MouseInteractions,\n ReplayerEvents,\n} from '@rrweb/types';\nimport type {\n attributes,\n fullSnapshotEvent,\n eventWithTime,\n playerMetaData,\n viewportResizeDimension,\n addedNodeMutation,\n incrementalSnapshotEvent,\n incrementalData,\n Handler,\n Emitter,\n metaEvent,\n mutationData,\n scrollData,\n inputData,\n canvasMutationData,\n styleValueWithPriority,\n mouseMovePos,\n IWindow,\n canvasMutationCommand,\n canvasMutationParam,\n canvasEventWithTime,\n selectionData,\n styleSheetRuleData,\n styleDeclarationData,\n adoptedStyleSheetData,\n serializedElementNodeWithId,\n} from '@rrweb/types';\nimport {\n polyfill,\n queueToResolveTrees,\n iterateResolveTree,\n type AppendedIframe,\n getBaseDimension,\n hasShadowRoot,\n isSerializedIframe,\n getNestedRule,\n getPositionsAndIndex,\n uniqueTextMutations,\n StyleSheetMirror,\n} from '../utils';\nimport getInjectStyleRules from './styles/inject-style';\nimport './styles/style.css';\nimport canvasMutation from './canvas';\nimport { deserializeArg } from './canvas/deserialize-args';\nimport { MediaManager } from './media';\nimport { applyDialogToTopLevel, removeDialogFromTopLevel } from './dialog';\n\nconst SKIP_TIME_INTERVAL = 5 * 1000;\n\n// https://github.com/rollup/rollup/issues/1267#issuecomment-296395734\nconst mitt = mittProxy.default || mittProxy;\n\nconst REPLAY_CONSOLE_PREFIX = '[replayer]';\n\nconst defaultMouseTailConfig = {\n duration: 500,\n lineCap: 'round',\n lineWidth: 3,\n strokeStyle: 'red',\n} as const;\n\nfunction indicatesTouchDevice(e: eventWithTime) {\n return (\n e.type == EventType.IncrementalSnapshot &&\n (e.data.source == IncrementalSource.TouchMove ||\n (e.data.source == IncrementalSource.MouseInteraction &&\n e.data.type == MouseInteractions.TouchStart))\n );\n}\n\nexport class Replayer {\n public wrapper: HTMLDivElement;\n public iframe: HTMLIFrameElement;\n private UNSAFE_replayCanvas = false;\n\n public service: ReturnType<typeof createPlayerService>;\n public speedService: ReturnType<typeof createSpeedService>;\n public get timer() {\n return this.service.state.context.timer;\n }\n\n public config: playerConfig;\n\n // In the fast-forward process, if the virtual-dom optimization is used, this flag value is true.\n public usingVirtualDom = false;\n public virtualDom: RRDocument = new RRDocument();\n\n private mouse: HTMLDivElement;\n private mouseTail: HTMLCanvasElement | null = null;\n private tailPositions: Array<{ x: number; y: number }> = [];\n\n private emitter: Emitter = mitt();\n\n private nextUserInteractionEvent: eventWithTime | null;\n\n private legacy_missingNodeRetryMap: missingNodeMap = {};\n\n // The replayer uses the cache to speed up replay and scrubbing.\n private cache: BuildCache = createCache();\n\n private imageMap: Map<eventWithTime | string, HTMLImageElement> = new Map();\n private canvasEventMap: Map<eventWithTime, canvasMutationParam> = new Map();\n\n private mirror: Mirror = createMirror();\n\n // Used to track StyleSheetObjects adopted on multiple document hosts.\n private styleMirror: StyleSheetMirror = new StyleSheetMirror();\n\n // Used to track video & audio elements, and keep them in sync with general playback.\n private mediaManager: MediaManager;\n\n private firstFullSnapshot: eventWithTime | true | null = null;\n\n private newDocumentQueue: addedNodeMutation[] = [];\n\n private mousePos: mouseMovePos | null = null;\n private touchActive: boolean | null = null;\n private lastMouseDownEvent: [Node, Event] | null = null;\n\n // Keep the rootNode of the last hovered element. So when hovering a new element, we can remove the last hovered element's :hover style.\n private lastHoveredRootNode: Document | ShadowRoot;\n\n // In the fast-forward mode, only the last selection data needs to be applied.\n private lastSelectionData: selectionData | null = null;\n\n // In the fast-forward mode using VirtualDom optimization, all stylesheetRule, and styleDeclaration events on constructed StyleSheets will be delayed to get applied until the flush stage.\n private constructedStyleMutations: (\n | styleSheetRuleData\n | styleDeclarationData\n )[] = [];\n\n // Similar to the reason for constructedStyleMutations.\n private adoptedStyleSheets: adoptedStyleSheetData[] = [];\n\n constructor(\n events: Array<eventWithTime | string>,\n config?: Partial<playerConfig>,\n ) {\n if (!config?.liveMode && events.length < 2) {\n throw new Error('Replayer need at least 2 events.');\n }\n const defaultConfig: playerConfig = {\n speed: 1,\n maxSpeed: 360,\n root: document.body,\n loadTimeout: 0,\n skipInactive: false,\n inactivePeriodThreshold: 10 * 1000,\n showWarning: true,\n showDebug: false,\n blockClass: 'rr-block',\n liveMode: false,\n insertStyleRules: [],\n triggerFocus: true,\n UNSAFE_replayCanvas: false,\n pauseAnimation: true,\n mouseTail: defaultMouseTailConfig,\n useVirtualDom: true, // Virtual-dom optimization is enabled by default.\n logger: console,\n };\n this.config = Object.assign({}, defaultConfig, config);\n\n this.handleResize = this.handleResize.bind(this);\n this.getCastFn = this.getCastFn.bind(this);\n this.applyEventsSynchronously = this.applyEventsSynchronously.bind(this);\n this.emitter.on(ReplayerEvents.Resize, this.handleResize as Handler);\n\n this.setupDom();\n\n /**\n * Exposes mirror to the plugins\n */\n for (const plugin of this.config.plugins || []) {\n if (plugin.getMirror) plugin.getMirror({ nodeMirror: this.mirror });\n }\n\n this.emitter.on(ReplayerEvents.Flush, () => {\n if (this.usingVirtualDom) {\n const replayerHandler: ReplayerHandler = {\n mirror: this.mirror,\n applyCanvas: (\n canvasEvent: canvasEventWithTime,\n canvasMutationData: canvasMutationData,\n target: HTMLCanvasElement,\n ) => {\n void canvasMutation({\n event: canvasEvent,\n mutation: canvasMutationData,\n target,\n imageMap: this.imageMap,\n canvasEventMap: this.canvasEventMap,\n errorHandler: this.warnCanvasMutationFailed.bind(this),\n });\n },\n applyInput: this.applyInput.bind(this),\n applyScroll: this.applyScroll.bind(this),\n applyStyleSheetMutation: (\n data: styleDeclarationData | styleSheetRuleData,\n styleSheet: CSSStyleSheet,\n ) => {\n if (data.source === IncrementalSource.StyleSheetRule)\n this.applyStyleSheetRule(data, styleSheet);\n else if (data.source === IncrementalSource.StyleDeclaration)\n this.applyStyleDeclaration(data, styleSheet);\n },\n afterAppend: (node: Node, id: number) => {\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild) plugin.onBuild(node, { id, replayer: this });\n }\n },\n };\n if (this.iframe.contentDocument)\n try {\n diff(\n this.iframe.contentDocument,\n this.virtualDom,\n replayerHandler,\n this.virtualDom.mirror,\n );\n } catch (e) {\n console.warn(e);\n }\n\n this.virtualDom.destroyTree();\n this.usingVirtualDom = false;\n\n // If these legacy missing nodes haven't been resolved, they should be converted to real Nodes.\n if (Object.keys(this.legacy_missingNodeRetryMap).length) {\n for (const key in this.legacy_missingNodeRetryMap) {\n try {\n const value = this.legacy_missingNodeRetryMap[key];\n const realNode = createOrGetNode(\n value.node as RRNode,\n this.mirror,\n this.virtualDom.mirror,\n );\n diff(\n realNode,\n value.node as RRNode,\n replayerHandler,\n this.virtualDom.mirror,\n );\n value.node = realNode;\n } catch (error) {\n this.warn(error);\n }\n }\n }\n\n this.constructedStyleMutations.forEach((data) => {\n this.applyStyleSheetMutation(data);\n });\n this.constructedStyleMutations = [];\n\n this.adoptedStyleSheets.forEach((data) => {\n this.applyAdoptedStyleSheet(data);\n });\n this.adoptedStyleSheets = [];\n }\n\n if (this.mousePos) {\n this.moveAndHover(\n this.mousePos.x,\n this.mousePos.y,\n this.mousePos.id,\n true,\n this.mousePos.debugData,\n );\n this.mousePos = null;\n }\n\n if (this.touchActive === true) {\n this.mouse.classList.add('touch-active');\n } else if (this.touchActive === false) {\n this.mouse.classList.remove('touch-active');\n }\n this.touchActive = null;\n\n if (this.lastMouseDownEvent) {\n const [target, event] = this.lastMouseDownEvent;\n target.dispatchEvent(event);\n }\n this.lastMouseDownEvent = null;\n\n if (this.lastSelectionData) {\n this.applySelection(this.lastSelectionData);\n this.lastSelectionData = null;\n }\n });\n this.emitter.on(ReplayerEvents.PlayBack, () => {\n this.firstFullSnapshot = null;\n this.mirror.reset();\n this.styleMirror.reset();\n this.mediaManager.reset();\n });\n\n const timer = new Timer([], {\n speed: this.config.speed,\n });\n this.service = createPlayerService(\n {\n events: events\n .map((e) => {\n if (config && config.unpackFn) {\n return config.unpackFn(e as string);\n }\n return e as eventWithTime;\n })\n .sort((a1, a2) => a1.timestamp - a2.timestamp),\n timer,\n timeOffset: 0,\n baselineTime: 0,\n lastPlayedEvent: null,\n },\n {\n getCastFn: this.getCastFn,\n applyEventsSynchronously: this.applyEventsSynchronously,\n emitter: this.emitter,\n },\n );\n this.service.start();\n this.service.subscribe((state) => {\n this.emitter.emit(ReplayerEvents.StateChange, {\n player: state,\n });\n });\n this.speedService = createSpeedService({\n normalSpeed: -1,\n timer,\n });\n this.speedService.start();\n this.speedService.subscribe((state) => {\n this.emitter.emit(ReplayerEvents.StateChange, {\n speed: state,\n });\n });\n this.mediaManager = new MediaManager({\n warn: this.warn.bind(this),\n service: this.service,\n speedService: this.speedService,\n emitter: this.emitter,\n getCurrentTime: this.getCurrentTime.bind(this),\n });\n\n // rebuild first full snapshot as the poster of the player\n // maybe we can cache it for performance optimization\n const firstMeta = this.service.state.context.events.find(\n (e) => e.type === EventType.Meta,\n );\n const firstFullsnapshot = this.service.state.context.events.find(\n (e) => e.type === EventType.FullSnapshot,\n );\n if (firstMeta) {\n const { width, height } = firstMeta.data as metaEvent['data'];\n setTimeout(() => {\n this.emitter.emit(ReplayerEvents.Resize, {\n width,\n height,\n });\n }, 0);\n }\n if (firstFullsnapshot) {\n setTimeout(() => {\n // when something has been played, there is no need to rebuild poster\n if (this.firstFullSnapshot) {\n // true if any other fullSnapshot has been executed by Timer already\n return;\n }\n this.firstFullSnapshot = firstFullsnapshot;\n this.rebuildFullSnapshot(\n firstFullsnapshot as fullSnapshotEvent & { timestamp: number },\n );\n this.iframe.contentWindow?.scrollTo(\n (firstFullsnapshot as fullSnapshotEvent).data.initialOffset,\n );\n }, 1);\n }\n if (this.service.state.context.events.find(indicatesTouchDevice)) {\n this.mouse.classList.add('touch-device');\n }\n }\n\n public on(event: string, handler: Handler) {\n this.emitter.on(event, handler);\n return this;\n }\n\n public off(event: string, handler: Handler) {\n this.emitter.off(event, handler);\n return this;\n }\n\n public setConfig(config: Partial<playerConfig>) {\n Object.keys(config).forEach((key) => {\n const newConfigValue = config[key as keyof playerConfig];\n (this.config as Record<keyof playerConfig, typeof newConfigValue>)[\n key as keyof playerConfig\n ] = config[key as keyof playerConfig];\n });\n if (!this.config.skipInactive) {\n this.backToNormal();\n }\n if (typeof config.speed !== 'undefined') {\n this.speedService.send({\n type: 'SET_SPEED',\n payload: {\n speed: config.speed,\n },\n });\n }\n if (typeof config.mouseTail !== 'undefined') {\n if (config.mouseTail === false) {\n if (this.mouseTail) {\n this.mouseTail.style.display = 'none';\n }\n } else {\n if (!this.mouseTail) {\n this.mouseTail = document.createElement('canvas');\n this.mouseTail.width = Number.parseFloat(this.iframe.width);\n this.mouseTail.height = Number.parseFloat(this.iframe.height);\n this.mouseTail.classList.add('replayer-mouse-tail');\n this.wrapper.insertBefore(this.mouseTail, this.iframe);\n }\n this.mouseTail.style.display = 'inherit';\n }\n }\n }\n\n public getMetaData(): playerMetaData {\n const firstEvent = this.service.state.context.events[0];\n const lastEvent =\n this.service.state.context.events[\n this.service.state.context.events.length - 1\n ];\n return {\n startTime: firstEvent.timestamp,\n endTime: lastEvent.timestamp,\n totalTime: lastEvent.timestamp - firstEvent.timestamp,\n };\n }\n\n /**\n * Get the actual time offset the player is at now compared to the first event.\n */\n public getCurrentTime(): number {\n if (this.config.liveMode) {\n this.timer.updateLiveTime();\n }\n return this.timer.timeOffset + this.getTimeOffset();\n }\n\n /**\n * Get the time offset the player is at now compared to the first event, but without regard for the timer.\n */\n public getTimeOffset(): number {\n const { baselineTime, events } = this.service.state.context;\n return baselineTime - events[0].timestamp;\n }\n\n public getMirror(): Mirror {\n return this.mirror;\n }\n\n /**\n * This API was designed to be used as play at any time offset.\n * Since we minimized the data collected from recorder, we do not\n * have the ability of undo an event.\n * So the implementation of play at any time offset will always iterate\n * all of the events, cast event before the offset synchronously\n * and cast event after the offset asynchronously with timer.\n * @param timeOffset - number\n */\n public play(timeOffset = 0) {\n if (this.service.state.matches('paused')) {\n this.service.send({ type: 'PLAY', payload: { timeOffset } });\n } else {\n this.service.send({ type: 'PAUSE' });\n this.service.send({ type: 'PLAY', payload: { timeOffset } });\n }\n this.iframe.contentDocument\n ?.getElementsByTagName('html')[0]\n ?.classList.remove('rrweb-paused');\n this.emitter.emit(ReplayerEvents.Start);\n }\n\n public pause(timeOffset?: number) {\n if (timeOffset === undefined && this.service.state.matches('playing')) {\n this.service.send({ type: 'PAUSE' });\n }\n if (typeof timeOffset === 'number') {\n this.play(timeOffset);\n this.service.send({ type: 'PAUSE' });\n }\n this.iframe.contentDocument\n ?.getElementsByTagName('html')[0]\n ?.classList.add('rrweb-paused');\n this.emitter.emit(ReplayerEvents.Pause);\n }\n\n public resume(timeOffset = 0) {\n this.warn(\n `The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface.`,\n );\n this.play(timeOffset);\n this.emitter.emit(ReplayerEvents.Resume);\n }\n\n /**\n * Totally destroy this replayer and please be careful that this operation is irreversible.\n * Memory occupation can be released by removing all references to this replayer.\n */\n public destroy() {\n this.pause();\n this.mirror.reset();\n this.styleMirror.reset();\n this.mediaManager.reset();\n this.config.root.removeChild(this.wrapper);\n this.emitter.emit(ReplayerEvents.Destroy);\n }\n\n public startLive(baselineTime?: number) {\n this.service.send({ type: 'TO_LIVE', payload: { baselineTime } });\n }\n\n public addEvent(rawEvent: eventWithTime | string) {\n const event = this.config.unpackFn\n ? this.config.unpackFn(rawEvent as string)\n : (rawEvent as eventWithTime);\n if (indicatesTouchDevice(event)) {\n this.mouse.classList.add('touch-device');\n }\n void Promise.resolve().then(() =>\n this.service.send({ type: 'ADD_EVENT', payload: { event } }),\n );\n }\n\n public enableInteract() {\n this.iframe.setAttribute('scrolling', 'auto');\n this.iframe.style.pointerEvents = 'auto';\n }\n\n public disableInteract() {\n this.iframe.setAttribute('scrolling', 'no');\n this.iframe.style.pointerEvents = 'none';\n }\n\n /**\n * Empties the replayer's cache and reclaims memory.\n * The replayer will use this cache to speed up the playback.\n */\n public resetCache() {\n this.cache = createCache();\n }\n\n private setupDom() {\n this.wrapper = document.createElement('div');\n this.wrapper.classList.add('replayer-wrapper');\n this.config.root.appendChild(this.wrapper);\n\n this.mouse = document.createElement('div');\n this.mouse.classList.add('replayer-mouse');\n this.wrapper.appendChild(this.mouse);\n\n if (this.config.mouseTail !== false) {\n this.mouseTail = document.createElement('canvas');\n this.mouseTail.classList.add('replayer-mouse-tail');\n this.mouseTail.style.display = 'inherit';\n this.wrapper.appendChild(this.mouseTail);\n }\n\n if (this.config.UNSAFE_replayCanvas) {\n this.iframe = document.createElement('iframe');\n this.iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts');\n this.wrapper.appendChild(this.iframe);\n this.UNSAFE_replayCanvas = true;\n } else {\n this.iframe = createSandboxedIframe({\n root: this.wrapper,\n });\n this.UNSAFE_replayCanvas = false;\n }\n // hide iframe before first meta event\n this.iframe.style.display = 'none';\n this.disableInteract();\n if (this.iframe.contentWindow && this.iframe.contentDocument) {\n smoothscrollPolyfill(\n this.iframe.contentWindow,\n this.iframe.contentDocument,\n );\n\n polyfill(this.iframe.contentWindow as IWindow);\n }\n }\n\n private handleResize = (dimension: viewportResizeDimension) => {\n this.iframe.style.display = 'inherit';\n for (const el of [this.mouseTail, this.iframe]) {\n if (!el) {\n continue;\n }\n el.setAttribute('width', String(dimension.width));\n el.setAttribute('height', String(dimension.height));\n }\n };\n\n private applyEventsSynchronously = (events: Array<eventWithTime>) => {\n for (const event of events) {\n switch (event.type) {\n case EventType.DomContentLoaded:\n case EventType.Load:\n case EventType.Custom:\n continue;\n case EventType.FullSnapshot:\n case EventType.Meta:\n case EventType.Plugin:\n case EventType.IncrementalSnapshot:\n break;\n default:\n break;\n }\n const castFn = this.getCastFn(event, true);\n castFn();\n }\n };\n\n private getCastFn = (event: eventWithTime, isSync = false) => {\n let castFn: undefined | (() => void);\n switch (event.type) {\n case EventType.DomContentLoaded:\n case EventType.Load:\n break;\n case EventType.Custom:\n castFn = () => {\n /**\n * emit custom-event and pass the event object.\n *\n * This will add more value to the custom event and allows the client to react for custom-event.\n */\n this.emitter.emit(ReplayerEvents.CustomEvent, event);\n };\n break;\n case EventType.Meta:\n castFn = () =>\n this.emitter.emit(ReplayerEvents.Resize, {\n width: event.data.width,\n height: event.data.height,\n });\n break;\n case EventType.FullSnapshot:\n castFn = () => {\n if (this.firstFullSnapshot) {\n if (this.firstFullSnapshot === event) {\n // we've already built this exact FullSnapshot when the player was mounted, and haven't built any other FullSnapshot since\n this.firstFullSnapshot = true; // forget as we might need to re-execute this FullSnapshot later e.g. to rebuild after scrubbing\n return;\n }\n } else {\n // Timer (requestAnimationFrame) can be faster than setTimeout(..., 1)\n this.firstFullSnapshot = true;\n }\n this.mediaManager.reset();\n this.styleMirror.reset();\n this.rebuildFullSnapshot(event, isSync);\n this.iframe.contentWindow?.scrollTo(event.data.initialOffset);\n };\n break;\n case EventType.IncrementalSnapshot:\n castFn = () => {\n this.applyIncremental(event, isSync);\n if (isSync) {\n // do not check skip in sync\n return;\n }\n if (event === this.nextUserInteractionEvent) {\n this.nextUserInteractionEvent = null;\n this.backToNormal();\n }\n if (this.config.skipInactive && !this.nextUserInteractionEvent) {\n for (const _event of this.service.state.context.events) {\n if (_event.timestamp <= event.timestamp) {\n continue;\n }\n if (this.isUserInteraction(_event)) {\n if (\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n _event.delay! - event.delay! >\n this.config.inactivePeriodThreshold *\n this.speedService.state.context.timer.speed\n ) {\n this.nextUserInteractionEvent = _event;\n }\n break;\n }\n }\n if (this.nextUserInteractionEvent) {\n const skipTime =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.nextUserInteractionEvent.delay! - event.delay!;\n const payload = {\n speed: Math.min(\n Math.round(skipTime / SKIP_TIME_INTERVAL),\n this.config.maxSpeed,\n ),\n };\n this.speedService.send({ type: 'FAST_FORWARD', payload });\n this.emitter.emit(ReplayerEvents.SkipStart, payload);\n }\n }\n };\n break;\n default:\n }\n const wrappedCastFn = () => {\n if (castFn) {\n castFn();\n }\n\n for (const plugin of this.config.plugins || []) {\n if (plugin.handler) plugin.handler(event, isSync, { replayer: this });\n }\n\n this.service.send({ type: 'CAST_EVENT', payload: { event } });\n\n // events are kept sorted by timestamp, check if this is the last event\n const lastIndex = this.service.state.context.events.length - 1;\n if (\n !this.config.liveMode &&\n event === this.service.state.context.events[lastIndex]\n ) {\n const finish = () => {\n if (lastIndex < this.service.state.context.events.length - 1) {\n // more events have been added since the setTimeout\n return;\n }\n this.backToNormal();\n this.service.send('END');\n this.emitter.emit(ReplayerEvents.Finish);\n };\n let finishBuffer = 50; // allow for checking whether new events aren't just about to be loaded in\n if (\n event.type === EventType.IncrementalSnapshot &&\n event.data.source === IncrementalSource.MouseMove &&\n event.data.positions.length\n ) {\n // extend finish event if the last event is a mouse move so that the timer isn't stopped by the service before checking the last event\n finishBuffer += Math.max(0, -event.data.positions[0].timeOffset);\n }\n setTimeout(finish, finishBuffer);\n }\n\n this.emitter.emit(ReplayerEvents.EventCast, event);\n };\n return wrappedCastFn;\n };\n\n private rebuildFullSnapshot(\n event: fullSnapshotEvent & { timestamp: number },\n isSync = false,\n ) {\n if (!this.iframe.contentDocument) {\n return this.warn('Looks like your replayer has been destroyed.');\n }\n if (Object.keys(this.legacy_missingNodeRetryMap).length) {\n this.warn(\n 'Found unresolved missing node map',\n this.legacy_missingNodeRetryMap,\n );\n }\n this.legacy_missingNodeRetryMap = {};\n const collectedIframes: AppendedIframe[] = [];\n const collectedDialogs = new Set<HTMLDialogElement>();\n const afterAppend = (builtNode: Node, id: number) => {\n if (builtNode.nodeName === 'DIALOG')\n collectedDialogs.add(builtNode as HTMLDialogElement);\n this.collectIframeAndAttachDocument(collectedIframes, builtNode);\n if (this.mediaManager.isSupportedMediaElement(builtNode)) {\n const { events } = this.service.state.context;\n this.mediaManager.addMediaElements(\n builtNode,\n event.timestamp - events[0].timestamp,\n this.mirror,\n );\n }\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild)\n plugin.onBuild(builtNode, {\n id,\n replayer: this,\n });\n }\n };\n\n /**\n * Normally rebuilding full snapshot should not be under virtual dom environment.\n * But if the order of data events has some issues, it might be possible.\n * Adding this check to avoid any potential issues.\n */\n if (this.usingVirtualDom) {\n this.virtualDom.destroyTree();\n this.usingVirtualDom = false;\n }\n\n this.mirror.reset();\n rebuild(event.data.node, {\n doc: this.iframe.contentDocument,\n afterAppend,\n cache: this.cache,\n mirror: this.mirror,\n UNSAFE_allowUnprotectedRebuild: this.UNSAFE_replayCanvas,\n });\n afterAppend(this.iframe.contentDocument, event.data.node.id);\n\n for (const { mutationInQueue, builtNode } of collectedIframes) {\n this.attachDocumentToIframe(mutationInQueue, builtNode);\n this.newDocumentQueue = this.newDocumentQueue.filter(\n (m) => m !== mutationInQueue,\n );\n }\n const { documentElement, head } = this.iframe.contentDocument;\n this.insertStyleRules(documentElement, head);\n collectedDialogs.forEach((d) => applyDialogToTopLevel(d));\n if (!this.service.state.matches('playing')) {\n this.iframe.contentDocument\n .getElementsByTagName('html')[0]\n .classList.add('rrweb-paused');\n }\n this.emitter.emit(ReplayerEvents.FullsnapshotRebuilded, event);\n if (!isSync) {\n this.waitForStylesheetLoad();\n }\n if (this.config.UNSAFE_replayCanvas) {\n void this.preloadAllImages();\n }\n }\n\n private insertStyleRules(\n documentElement: HTMLElement | RRElement,\n head: HTMLHeadElement | RRElement,\n ) {\n const injectStylesRules = getInjectStyleRules(\n this.config.blockClass,\n ).concat(this.config.insertStyleRules);\n if (this.config.pauseAnimation) {\n injectStylesRules.push(\n 'html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }',\n );\n }\n if (!injectStylesRules.length) {\n return;\n }\n if (this.usingVirtualDom) {\n const styleEl = this.virtualDom.createElement('style');\n this.virtualDom.mirror.add(\n styleEl,\n getDefaultSN(styleEl, this.virtualDom.unserializedId),\n );\n (documentElement as RRElement).insertBefore(styleEl, head as RRElement);\n styleEl.rules.push({\n source: IncrementalSource.StyleSheetRule,\n adds: injectStylesRules.map((cssText, index) => ({\n rule: cssText,\n index,\n })),\n });\n } else {\n const styleEl = document.createElement('style');\n (documentElement as HTMLElement).insertBefore(\n styleEl,\n head as HTMLHeadElement,\n );\n for (let idx = 0; idx < injectStylesRules.length; idx++) {\n styleEl.sheet?.insertRule(injectStylesRules[idx], idx);\n }\n }\n }\n\n private attachDocumentToIframe(\n mutation: addedNodeMutation,\n iframeEl: HTMLIFrameElement | RRIFrameElement,\n ) {\n const mirror: RRDOMMirror | Mirror = this.usingVirtualDom\n ? this.virtualDom.mirror\n : this.mirror;\n type TNode = typeof mirror extends Mirror ? Node : RRNode;\n type TMirror = typeof mirror extends Mirror ? Mirror : RRDOMMirror;\n\n const collectedIframes: AppendedIframe[] = [];\n const collectedDialogs = new Set<HTMLDialogElement>();\n const afterAppend = (builtNode: Node, id: number) => {\n if (builtNode.nodeName === 'DIALOG')\n collectedDialogs.add(builtNode as HTMLDialogElement);\n this.collectIframeAndAttachDocument(collectedIframes, builtNode);\n const sn = (mirror as TMirror).getMeta(builtNode as unknown as TNode);\n if (\n sn?.type === NodeType.Element &&\n sn?.tagName.toUpperCase() === 'HTML'\n ) {\n const { documentElement, head } = iframeEl.contentDocument!;\n this.insertStyleRules(\n documentElement as HTMLElement | RRElement,\n head as HTMLElement | RRElement,\n );\n }\n\n // Skip the plugin onBuild callback in the virtual dom mode\n if (this.usingVirtualDom) return;\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild)\n plugin.onBuild(builtNode, {\n id,\n replayer: this,\n });\n }\n };\n\n buildNodeWithSN(mutation.node, {\n doc: iframeEl.contentDocument! as Document,\n mirror: mirror as Mirror,\n hackCss: true,\n skipChild: false,\n afterAppend,\n cache: this.cache,\n });\n afterAppend(iframeEl.contentDocument! as Document, mutation.node.id);\n\n for (const { mutationInQueue, builtNode } of collectedIframes) {\n this.attachDocumentToIframe(mutationInQueue, builtNode);\n this.newDocumentQueue = this.newDocumentQueue.filter(\n (m) => m !== mutationInQueue,\n );\n }\n\n collectedDialogs.forEach((d) => applyDialogToTopLevel(d));\n }\n\n private collectIframeAndAttachDocument(\n collected: AppendedIframe[],\n builtNode: Node,\n ) {\n if (isSerializedIframe(builtNode, this.mirror)) {\n const mutationInQueue = this.newDocumentQueue.find(\n (m) => m.parentId === this.mirror.getId(builtNode),\n );\n if (mutationInQueue) {\n collected.push({\n mutationInQueue,\n builtNode: builtNode as HTMLIFrameElement,\n });\n }\n }\n }\n\n /**\n * pause when loading style sheet, resume when loaded all timeout exceed\n */\n private waitForStylesheetLoad() {\n const head = this.iframe.contentDocument?.head;\n if (head) {\n const unloadSheets: Set<HTMLLinkElement> = new Set();\n let timer: ReturnType<typeof setTimeout> | -1;\n let beforeLoadState = this.service.state;\n const stateHandler = () => {\n beforeLoadState = this.service.state;\n };\n this.emitter.on(ReplayerEvents.Start, stateHandler);\n this.emitter.on(ReplayerEvents.Pause, stateHandler);\n const unsubscribe = () => {\n this.emitter.off(ReplayerEvents.Start, stateHandler);\n this.emitter.off(ReplayerEvents.Pause, stateHandler);\n };\n head\n .querySelectorAll('link[rel=\"stylesheet\"]')\n .forEach((css: HTMLLinkElement) => {\n if (!css.sheet) {\n unloadSheets.add(css);\n css.addEventListener('load', () => {\n unloadSheets.delete(css);\n // all loaded and timer not released yet\n if (unloadSheets.size === 0 && timer !== -1) {\n if (beforeLoadState.matches('playing')) {\n this.play(this.getCurrentTime());\n }\n this.emitter.emit(ReplayerEvents.LoadStylesheetEnd);\n if (timer) {\n clearTimeout(timer);\n }\n unsubscribe();\n }\n });\n }\n });\n\n if (unloadSheets.size > 0) {\n // find some unload sheets after iterate\n this.service.send({ type: 'PAUSE' });\n this.emitter.emit(ReplayerEvents.LoadStylesheetStart);\n timer = setTimeout(() => {\n if (beforeLoadState.matches('playing')) {\n this.play(this.getCurrentTime());\n }\n // mark timer was called\n timer = -1;\n unsubscribe();\n }, this.config.loadTimeout);\n }\n }\n }\n\n /**\n * pause when there are some canvas drawImage args need to be loaded\n */\n private async preloadAllImages(): Promise<void[]> {\n const promises: Promise<void>[] = [];\n for (const event of this.service.state.context.events) {\n if (\n event.type === EventType.IncrementalSnapshot &&\n event.data.source === IncrementalSource.CanvasMutation\n ) {\n promises.push(\n this.deserializeAndPreloadCanvasEvents(event.data, event),\n );\n const commands =\n 'commands' in event.data ? event.data.commands : [event.data];\n commands.forEach((c) => {\n this.preloadImages(c, event);\n });\n }\n }\n return Promise.all(promises);\n }\n\n private preloadImages(data: canvasMutationCommand, event: eventWithTime) {\n if (\n data.property === 'drawImage' &&\n typeof data.args[0] === 'string' &&\n !this.imageMap.has(event)\n ) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n const imgd = ctx?.createImageData(canvas.width, canvas.height);\n ctx?.putImageData(imgd!, 0, 0);\n }\n }\n private async deserializeAndPreloadCanvasEvents(\n data: canvasMutationData,\n event: eventWithTime,\n ) {\n if (!this.canvasEventMap.has(event)) {\n const status = {\n isUnchanged: true,\n };\n if ('commands' in data) {\n const commands = await Promise.all(\n data.commands.map(async (c) => {\n const args = await Promise.all(\n c.args.map(deserializeArg(this.imageMap, null, status)),\n );\n return { ...c, args };\n }),\n );\n if (status.isUnchanged === false)\n this.canvasEventMap.set(event, { ...data, commands });\n } else {\n const args = await Promise.all(\n data.args.map(deserializeArg(this.imageMap, null, status)),\n );\n if (status.isUnchanged === false)\n this.canvasEventMap.set(event, { ...data, args });\n }\n }\n }\n\n private applyIncremental(\n e: incrementalSnapshotEvent & { timestamp: number; delay?: number },\n isSync: boolean,\n ) {\n const { data: d } = e;\n switch (d.source) {\n case IncrementalSource.Mutation: {\n try {\n this.applyMutation(d, isSync);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions\n this.warn(`Exception in mutation ${error.message || error}`, d);\n }\n break;\n }\n case IncrementalSource.Drag:\n case IncrementalSource.TouchMove:\n case IncrementalSource.MouseMove:\n if (isSync) {\n const lastPosition = d.positions[d.positions.length - 1];\n this.mousePos = {\n x: lastPosition.x,\n y: lastPosition.y,\n id: lastPosition.id,\n debugData: d,\n };\n } else {\n d.positions.forEach((p) => {\n const action = {\n doAction: () => {\n this.moveAndHover(p.x, p.y, p.id, isSync, d);\n },\n delay:\n p.timeOffset +\n e.timestamp -\n this.service.state.context.baselineTime,\n };\n this.timer.addAction(action);\n });\n // add a dummy action to keep timer alive\n this.timer.addAction({\n doAction() {\n //\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n delay: e.delay! - d.positions[0]?.timeOffset,\n });\n }\n break;\n case IncrementalSource.MouseInteraction: {\n /**\n * Same as the situation of missing input target.\n */\n if (d.id === -1) {\n break;\n }\n const event = new Event(toLowerCase(MouseInteractions[d.type]));\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n this.emitter.emit(ReplayerEvents.MouseInteraction, {\n type: d.type,\n target,\n });\n const { triggerFocus } = this.config;\n switch (d.type) {\n case MouseInteractions.Blur:\n if ('blur' in (target as HTMLElement)) {\n (target as HTMLElement).blur();\n }\n break;\n case MouseInteractions.Focus:\n if (triggerFocus && (target as HTMLElement).focus) {\n (target as HTMLElement).focus({\n preventScroll: true,\n });\n }\n break;\n case MouseInteractions.Click:\n case MouseInteractions.TouchStart:\n case MouseInteractions.TouchEnd:\n case MouseInteractions.MouseDown:\n case MouseInteractions.MouseUp:\n if (isSync) {\n if (d.type === MouseInteractions.TouchStart) {\n this.touchActive = true;\n } else if (d.type === MouseInteractions.TouchEnd) {\n this.touchActive = false;\n }\n if (d.type === MouseInteractions.MouseDown) {\n this.lastMouseDownEvent = [target, event];\n } else if (d.type === MouseInteractions.MouseUp) {\n this.lastMouseDownEvent = null;\n }\n this.mousePos = {\n x: d.x || 0,\n y: d.y || 0,\n id: d.id,\n debugData: d,\n };\n } else {\n if (d.type === MouseInteractions.TouchStart) {\n // don't draw a trail as user has lifted finger and is placing at a new point\n this.tailPositions.length = 0;\n }\n this.moveAndHover(d.x || 0, d.y || 0, d.id, isSync, d);\n if (d.type === MouseInteractions.Click) {\n /*\n * don't want target.click() here as could trigger an iframe navigation\n * instead any effects of the click should already be covered by mutations\n */\n /*\n * removal and addition of .active class (along with void line to trigger repaint)\n * triggers the 'click' css animation in styles/style.css\n */\n this.mouse.classList.remove('active');\n void this.mouse.offsetWidth;\n this.mouse.classList.add('active');\n } else if (d.type === MouseInteractions.TouchStart) {\n void this.mouse.offsetWidth; // needed for the position update of moveAndHover to apply without the .touch-active transition\n this.mouse.classList.add('touch-active');\n } else if (d.type === MouseInteractions.TouchEnd) {\n this.mouse.classList.remove('touch-active');\n } else {\n // for MouseDown & MouseUp also invoke default behavior\n target.dispatchEvent(event);\n }\n }\n break;\n case MouseInteractions.TouchCancel:\n if (isSync) {\n this.touchActive = false;\n } else {\n this.mouse.classList.remove('touch-active');\n }\n break;\n default:\n target.dispatchEvent(event);\n }\n break;\n }\n case IncrementalSource.Scroll: {\n /**\n * Same as the situation of missing input target.\n */\n if (d.id === -1) {\n break;\n }\n if (this.usingVirtualDom) {\n const target = this.virtualDom.mirror.getNode(d.id) as RRElement;\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n target.scrollData = d;\n break;\n }\n // Use isSync rather than this.usingVirtualDom because not every fast-forward process uses virtual dom optimization.\n this.applyScroll(d, isSync);\n break;\n }\n case IncrementalSource.ViewportResize:\n this.emitter.emit(ReplayerEvents.Resize, {\n width: d.width,\n height: d.height,\n });\n break;\n case IncrementalSource.Input: {\n /**\n * Input event on an unserialized node usually means the event\n * was synchrony triggered programmatically after the node was\n * created. This means there was not an user observable interaction\n * and we do not need to replay it.\n */\n if (d.id === -1) {\n break;\n }\n if (this.usingVirtualDom) {\n const target = this.virtualDom.mirror.getNode(d.id) as RRElement;\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n target.inputData = d;\n break;\n }\n this.applyInput(d);\n break;\n }\n case IncrementalSource.MediaInteraction: {\n const target = this.usingVirtualDom\n ? this.virtualDom.mirror.getNode(d.id)\n : this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n const mediaEl = target as HTMLMediaElement | RRMediaElement;\n const { events } = this.service.state.context;\n\n this.mediaManager.mediaMutation({\n target: mediaEl,\n timeOffset: e.timestamp - events[0].timestamp,\n mutation: d,\n });\n\n break;\n }\n case IncrementalSource.StyleSheetRule:\n case IncrementalSource.StyleDeclaration: {\n if (this.usingVirtualDom) {\n if (d.styleId) this.constructedStyleMutations.push(d);\n else if (d.id)\n (\n this.virtualDom.mirror.getNode(d.id) as RRStyleElement | null\n )?.rules.push(d);\n } else this.applyStyleSheetMutation(d);\n break;\n }\n case IncrementalSource.CanvasMutation: {\n if (!this.config.UNSAFE_replayCanvas) {\n return;\n }\n if (this.usingVirtualDom) {\n const target = this.virtualDom.mirror.getNode(\n d.id,\n ) as RRCanvasElement;\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n target.canvasMutations.push({\n event: e as canvasEventWithTime,\n mutation: d,\n });\n } else {\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n void canvasMutation({\n event: e,\n mutation: d,\n target: target as HTMLCanvasElement,\n imageMap: this.imageMap,\n canvasEventMap: this.canvasEventMap,\n errorHandler: this.warnCanvasMutationFailed.bind(this),\n });\n }\n break;\n }\n case IncrementalSource.Font: {\n try {\n const fontFace = new FontFace(\n d.family,\n d.buffer\n ? new Uint8Array(JSON.parse(d.fontSource) as Iterable<number>)\n : d.fontSource,\n d.descriptors,\n );\n this.iframe.contentDocument?.fonts.add(fontFace);\n } catch (error) {\n this.warn(error);\n }\n break;\n }\n case IncrementalSource.Selection: {\n if (isSync) {\n this.lastSelectionData = d;\n break;\n }\n this.applySelection(d);\n break;\n }\n case IncrementalSource.AdoptedStyleSheet: {\n if (this.usingVirtualDom) this.adoptedStyleSheets.push(d);\n else this.applyAdoptedStyleSheet(d);\n break;\n }\n default:\n }\n }\n\n /**\n * Apply the mutation to the virtual dom or the real dom.\n * @param d - The mutation data.\n * @param isSync - Whether the mutation should be applied synchronously (while fast-forwarding).\n */\n private applyMutation(d: mutationData, isSync: boolean) {\n // Only apply virtual dom optimization if the fast-forward process has node mutation. Because the cost of creating a virtual dom tree and executing the diff algorithm is usually higher than directly applying other kind of events.\n if (this.config.useVirtualDom && !this.usingVirtualDom && isSync) {\n this.usingVirtualDom = true;\n buildFromDom(this.iframe.contentDocument!, this.mirror, this.virtualDom);\n // If these legacy missing nodes haven't been resolved, they should be converted to virtual nodes.\n if (Object.keys(this.legacy_missingNodeRetryMap).length) {\n for (const key in this.legacy_missingNodeRetryMap) {\n try {\n const value = this.legacy_missingNodeRetryMap[key];\n const virtualNode = buildFromNode(\n value.node as Node,\n this.virtualDom,\n this.mirror,\n );\n if (virtualNode) value.node = virtualNode;\n } catch (error) {\n this.warn(error);\n }\n }\n }\n }\n const mirror = this.usingVirtualDom ? this.virtualDom.mirror : this.mirror;\n type TNode = typeof mirror extends Mirror ? Node : RRNode;\n\n d.removes = d.removes.filter((mutation) => {\n // warn of absence from mirror before we start applying each removal\n // as earlier removals could remove a tree that includes a later removal\n if (!mirror.getNode(mutation.id)) {\n this.warnNodeNotFound(d, mutation.id);\n return false;\n }\n return true;\n });\n d.removes.forEach((mutation) => {\n const target = mirror.getNode(mutation.id);\n if (!target) {\n // no need to warn here, an ancestor may have already been removed\n return;\n }\n let parent: Node | null | ShadowRoot | RRNode = mirror.getNode(\n mutation.parentId,\n );\n if (!parent) {\n return this.warnNodeNotFound(d, mutation.parentId);\n }\n if (mutation.isShadow && hasShadowRoot(parent as Node)) {\n parent = (parent as Element | RRElement).shadowRoot;\n }\n // target may be removed with its parents before\n mirror.removeNodeFromMap(target as Node & RRNode);\n if (parent)\n try {\n parent.removeChild(target as Node & RRNode);\n /**\n * https://github.com/rrweb-io/rrweb/pull/887\n * Remove any virtual style rules for stylesheets if a child text node is removed.\n */\n if (\n this.usingVirtualDom &&\n target.nodeName === '#text' &&\n parent.nodeName === 'STYLE' &&\n (parent as RRStyleElement).rules?.length > 0\n )\n (parent as RRStyleElement).rules = [];\n } catch (error) {\n if (error instanceof DOMException) {\n this.warn(\n 'parent could not remove child in mutation',\n parent,\n target,\n d,\n );\n } else {\n throw error;\n }\n }\n });\n\n const legacy_missingNodeMap: missingNodeMap = {\n ...this.legacy_missingNodeRetryMap,\n };\n const queue: addedNodeMutation[] = [];\n\n // next not present at this moment\n const nextNotInDOM = (mutation: addedNodeMutation) => {\n let next: TNode | null = null;\n if (mutation.nextId) {\n next = mirror.getNode(mutation.nextId) as TNode | null;\n }\n // next not present at this moment\n if (\n mutation.nextId !== null &&\n mutation.nextId !== undefined &&\n mutation.nextId !== -1 &&\n !next\n ) {\n return true;\n }\n return false;\n };\n\n const appendNode = (mutation: addedNodeMutation) => {\n if (!this.iframe.contentDocument) {\n return this.warn('Looks like your replayer has been destroyed.');\n }\n let parent: Node | null | ShadowRoot | RRNode = mirror.getNode(\n mutation.parentId,\n );\n if (!parent) {\n if (mutation.node.type === NodeType.Document) {\n // is newly added document, maybe the document node of an iframe\n return this.newDocumentQueue.push(mutation);\n }\n return queue.push(mutation);\n }\n\n if (mutation.node.isShadow) {\n // If the parent is attached a shadow dom after it's created, it won't have a shadow root.\n if (!hasShadowRoot(parent)) {\n (parent as Element | RRElement).attachShadow({ mode: 'open' });\n parent = (parent as Element | RRElement).shadowRoot! as Node | RRNode;\n } else parent = parent.shadowRoot as Node | RRNode;\n }\n\n let previous: Node | RRNode | null = null;\n let next: Node | RRNode | null = null;\n if (mutation.previousId) {\n previous = mirror.getNode(mutation.previousId);\n }\n if (mutation.nextId) {\n next = mirror.getNode(mutation.nextId);\n }\n if (nextNotInDOM(mutation)) {\n return queue.push(mutation);\n }\n\n if (mutation.node.rootId && !mirror.getNode(mutation.node.rootId)) {\n return;\n }\n\n const targetDoc = mutation.node.rootId\n ? mirror.getNode(mutation.node.rootId)\n : this.usingVirtualDom\n ? this.virtualDom\n : this.iframe.contentDocument;\n if (isSerializedIframe<typeof parent>(parent, mirror)) {\n this.attachDocumentToIframe(\n mutation,\n parent as HTMLIFrameElement | RRIFrameElement,\n );\n return;\n }\n const afterAppend = (node: Node | RRNode, id: number) => {\n // Skip the plugin onBuild callback for virtual dom\n if (this.usingVirtualDom) return;\n applyDialogToTopLevel(node);\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild) plugin.onBuild(node, { id, replayer: this });\n }\n };\n\n const target = buildNodeWithSN(mutation.node, {\n doc: targetDoc as Document, // can be Document or RRDocument\n mirror: mirror as Mirror, // can be this.mirror or virtualDom.mirror\n skipChild: true,\n hackCss: true,\n cache: this.cache,\n /**\n * caveat: `afterAppend` only gets called on child nodes of target\n * we have to call it again below when this target was added to the DOM\n */\n afterAppend,\n }) as Node | RRNode;\n\n // legacy data, we should not have -1 siblings any more\n if (mutation.previousId === -1 || mutation.nextId === -1) {\n legacy_missingNodeMap[mutation.node.id] = {\n node: target,\n mutation,\n };\n return;\n }\n\n // Typescripts type system is not smart enough\n // to understand what is going on with the types below\n type TNode = typeof mirror extends Mirror ? Node : RRNode;\n type TMirror = typeof mirror extends Mirror ? Mirror : RRDOMMirror;\n\n const parentSn = (mirror as TMirror).getMeta(parent as TNode);\n if (\n parentSn &&\n parentSn.type === NodeType.Element &&\n mutation.node.type === NodeType.Text\n ) {\n const prospectiveSiblings = Array.isArray(parent.childNodes)\n ? parent.childNodes\n : Array.from(parent.childNodes);\n if (parentSn.tagName === 'textarea') {\n // This should be redundant now as we are either recording the value or the childNode, and not both\n // keeping around for backwards compatibility with old bad double data, see\n\n // https://github.com/rrweb-io/rrweb/issues/745\n // parent is textarea, will only keep one child node as the value\n for (const c of prospectiveSiblings) {\n if (c.nodeType === parent.TEXT_NODE) {\n parent.removeChild(c as Node & RRNode);\n }\n }\n } else if (\n parentSn.tagName === 'style' &&\n prospectiveSiblings.length === 1\n ) {\n // https://github.com/rrweb-io/rrweb/pull/1417\n /**\n * If both _cssText and textContent are present for a style element due to some existing bugs, the element was ending up with two child text nodes\n * We need to remove the textNode created by _cssText as it doesn't have an id in the mirror, and thus cannot be further mutated.\n */\n for (const cssText of prospectiveSiblings as (Node & RRNode)[]) {\n if (\n cssText.nodeType === parent.TEXT_NODE &&\n !mirror.hasNode(cssText)\n ) {\n target.textContent = cssText.textContent;\n parent.removeChild(cssText);\n }\n }\n }\n } else if (parentSn?.type === NodeType.Document) {\n /**\n * Sometimes the document object is changed or reopened and the MutationObserver is disconnected, so the removal of child elements can't be detected and recorded.\n * After the change of document, we may get another mutation which adds a new doctype or a HTML element, while the old one still exists in the dom.\n * So, we need to remove the old one first to avoid collision.\n */\n const parentDoc = parent as Document | RRDocument;\n /**\n * To detect the exist of the old doctype before adding a new doctype.\n * We need to remove the old doctype before adding the new one. Otherwise, code will throw \"mutation Failed to execute 'insertBefore' on 'Node': Only one doctype on document allowed\".\n */\n if (\n mutation.node.type === NodeType.DocumentType &&\n parentDoc.childNodes[0]?.nodeType === Node.DOCUMENT_TYPE_NODE\n )\n parentDoc.removeChild(parentDoc.childNodes[0] as Node & RRNode);\n /**\n * To detect the exist of the old HTML element before adding a new HTML element.\n * The reason is similar to the above. One document only allows exactly one DocType and one HTML Element.\n */\n if (target.nodeName === 'HTML' && parentDoc.documentElement)\n parentDoc.removeChild(\n parentDoc.documentElement as HTMLElement & RRNode,\n );\n }\n\n if (previous && previous.nextSibling && previous.nextSibling.parentNode) {\n (parent as TNode).insertBefore(\n target as TNode,\n previous.nextSibling as TNode,\n );\n } else if (next && next.parentNode) {\n // making sure the parent contains the reference nodes\n // before we insert target before next.\n (parent as TNode).contains(next as TNode)\n ? (parent as TNode).insertBefore(target as TNode, next as TNode)\n : (parent as TNode).insertBefore(target as TNode, null);\n } else {\n (parent as TNode).appendChild(target as TNode);\n }\n /**\n * target was added, execute plugin hooks\n */\n afterAppend(target, mutation.node.id);\n\n /**\n * https://github.com/rrweb-io/rrweb/pull/887\n * Remove any virtual style rules for stylesheets if a new text node is appended.\n */\n if (\n this.usingVirtualDom &&\n target.nodeName === '#text' &&\n parent.nodeName === 'STYLE' &&\n (parent as RRStyleElement).rules?.length > 0\n )\n (parent as RRStyleElement).rules = [];\n\n if (isSerializedIframe(target, this.mirror)) {\n const targetId = this.mirror.getId(target as HTMLIFrameElement);\n const mutationInQueue = this.newDocumentQueue.find(\n (m) => m.parentId === targetId,\n );\n if (mutationInQueue) {\n this.attachDocumentToIframe(\n mutationInQueue,\n target as HTMLIFrameElement,\n );\n this.newDocumentQueue = this.newDocumentQueue.filter(\n (m) => m !== mutationInQueue,\n );\n }\n }\n\n if (mutation.previousId || mutation.nextId) {\n this.legacy_resolveMissingNode(\n legacy_missingNodeMap,\n parent,\n target,\n mutation,\n );\n }\n };\n\n d.adds.forEach((mutation) => {\n appendNode(mutation);\n });\n\n const startTime = Date.now();\n while (queue.length) {\n // transform queue to resolve tree\n const resolveTrees = queueToResolveTrees(queue);\n queue.length = 0;\n if (Date.now() - startTime > 500) {\n this.warn(\n 'Timeout in the loop, please check the resolve tree data:',\n resolveTrees,\n );\n break;\n }\n for (const tree of resolveTrees) {\n const parent = mirror.getNode(tree.value.parentId);\n if (!parent) {\n this.debug(\n 'Drop resolve tree since there is no parent for the root node.',\n tree,\n );\n } else {\n iterateResolveTree(tree, (mutation) => {\n appendNode(mutation);\n });\n }\n }\n }\n\n if (Object.keys(legacy_missingNodeMap).length) {\n Object.assign(this.legacy_missingNodeRetryMap, legacy_missingNodeMap);\n }\n\n uniqueTextMutations(d.texts).forEach((mutation) => {\n const target = mirror.getNode(mutation.id);\n if (!target) {\n if (d.removes.find((r) => r.id === mutation.id)) {\n // no need to warn, element was already removed\n return;\n }\n return this.warnNodeNotFound(d, mutation.id);\n }\n\n const parentEl = target.parentElement as Element | RRElement;\n if (mutation.value && parentEl && parentEl.tagName === 'STYLE') {\n // assumes hackCss: true (which isn't currently configurable from rrweb)\n target.textContent = adaptCssForReplay(mutation.value, this.cache);\n } else {\n target.textContent = mutation.value;\n }\n\n /**\n * https://github.com/rrweb-io/rrweb/pull/865\n * Remove any virtual style rules for stylesheets whose contents are replaced.\n */\n if (this.usingVirtualDom) {\n const parent = target.parentNode as RRStyleElement;\n if (parent?.rules?.length > 0) parent.rules = [];\n }\n });\n d.attributes.forEach((mutation) => {\n const target = mirror.getNode(mutation.id);\n if (!target) {\n if (d.removes.find((r) => r.id === mutation.id)) {\n // no need to warn, element was already removed\n return;\n }\n return this.warnNodeNotFound(d, mutation.id);\n }\n for (const attributeName in mutation.attributes) {\n if (typeof attributeName === 'string') {\n const value = mutation.attributes[attributeName];\n if (value === null) {\n (target as Element | RRElement).removeAttribute(attributeName);\n if (attributeName === 'open')\n removeDialogFromTopLevel(target, mutation);\n } else if (typeof value === 'string') {\n try {\n // When building snapshot, some link styles haven't loaded. Then they are loaded, they will be inlined as incremental mutation change of attribute. We need to replace the old elements whose styles aren't inlined.\n if (\n attributeName === '_cssText' &&\n (target.nodeName === 'LINK' || target.nodeName === 'STYLE')\n ) {\n try {\n const newSn = mirror.getMeta(\n target as Node & RRNode,\n ) as serializedElementNodeWithId;\n const newNode = buildNodeWithSN(\n {\n ...newSn,\n attributes: {\n ...newSn.attributes,\n ...(mutation.attributes as attributes),\n },\n },\n {\n doc: target.ownerDocument as Document, // can be Document or RRDocument\n mirror: mirror as Mirror,\n skipChild: true,\n hackCss: true,\n cache: this.cache,\n },\n );\n // Update mirror meta's attributes\n Object.assign(\n newSn.attributes,\n mutation.attributes as attributes,\n );\n const siblingNode = target.nextSibling;\n const parentNode = target.parentNode;\n if (newNode && parentNode) {\n parentNode.removeChild(target as Node & RRNode);\n parentNode.insertBefore(\n newNode as Node & RRNode,\n siblingNode as (Node & RRNode) | null,\n );\n mirror.replace(mutation.id, newNode as Node & RRNode);\n break;\n }\n } catch (e) {\n // for safe\n }\n }\n if (attributeName === 'value' && target.nodeName === 'TEXTAREA') {\n // this may or may not have an effect on the value property (which is what is displayed)\n // depending on whether the textarea has been modified by the user yet\n // TODO: replaceChildNodes is not available in RRDom\n const textarea = target as TNode;\n textarea.childNodes.forEach((c) =>\n textarea.removeChild(c as TNode),\n );\n const tn = target.ownerDocument?.createTextNode(value);\n if (tn) {\n textarea.appendChild(tn as TNode);\n }\n } else {\n (target as Element | RRElement).setAttribute(\n attributeName,\n value,\n );\n }\n\n if (\n attributeName === 'rr_open_mode' &&\n target.nodeName === 'DIALOG'\n ) {\n applyDialogToTopLevel(target, mutation);\n }\n } catch (error) {\n this.warn(\n 'An error occurred may due to the checkout feature.',\n error,\n );\n }\n } else if (attributeName === 'style') {\n const styleValues = value;\n const targetEl = target as HTMLElement | RRElement;\n for (const s in styleValues) {\n if (styleValues[s] === false) {\n targetEl.style.removeProperty(s);\n } else if (styleValues[s] instanceof Array) {\n const svp = styleValues[s] as styleValueWithPriority;\n targetEl.style.setProperty(s, svp[0], svp[1]);\n } else {\n const svs = styleValues[s] as string;\n targetEl.style.setProperty(s, svs);\n }\n }\n }\n }\n }\n });\n }\n\n /**\n * Apply the scroll data on real elements.\n * If the replayer is in sync mode, smooth scroll behavior should be disabled.\n * @param d - the scroll data\n * @param isSync - whether the replayer is in sync mode(fast-forward)\n */\n private applyScroll(d: scrollData, isSync: boolean) {\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n const sn = this.mirror.getMeta(target);\n if (target === this.iframe.contentDocument) {\n this.iframe.contentWindow?.scrollTo({\n top: d.y,\n left: d.x,\n behavior: isSync ? 'auto' : 'smooth',\n });\n } else if (sn?.type === NodeType.Document) {\n // nest iframe content document\n (target as Document).defaultView?.scrollTo({\n top: d.y,\n left: d.x,\n behavior: isSync ? 'auto' : 'smooth',\n });\n } else {\n try {\n (target as Element).scrollTo({\n top: d.y,\n left: d.x,\n behavior: isSync ? 'auto' : 'smooth',\n });\n } catch (error) {\n /**\n * Seldomly we may found scroll target was removed before\n * its last scroll event.\n */\n }\n }\n }\n\n private applyInput(d: inputData) {\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n try {\n (target as HTMLInputElement).checked = d.isChecked;\n (target as HTMLInputElement).value = d.text;\n } catch (error) {\n // for safe\n }\n }\n\n private applySelection(d: selectionData) {\n try {\n const selectionSet = new Set<Selection>();\n const ranges = d.ranges.map(({ start, startOffset, end, endOffset }) => {\n const startContainer = this.mirror.getNode(start);\n const endContainer = this.mirror.getNode(end);\n\n if (!startContainer || !endContainer) return;\n\n const result = new Range();\n\n result.setStart(startContainer, startOffset);\n result.setEnd(endContainer, endOffset);\n const doc = startContainer.ownerDocument;\n const selection = doc?.getSelection();\n selection && selectionSet.add(selection);\n\n return {\n range: result,\n selection,\n };\n });\n\n selectionSet.forEach((s) => s.removeAllRanges());\n\n ranges.forEach((r) => r && r.selection?.addRange(r.range));\n } catch (error) {\n // for safe\n }\n }\n\n private applyStyleSheetMutation(\n data: styleDeclarationData | styleSheetRuleData,\n ) {\n let styleSheet: CSSStyleSheet | null = null;\n if (data.styleId) styleSheet = this.styleMirror.getStyle(data.styleId);\n else if (data.id)\n styleSheet =\n (this.mirror.getNode(data.id) as HTMLStyleElement)?.sheet || null;\n if (!styleSheet) return;\n if (data.source === IncrementalSource.StyleSheetRule)\n this.applyStyleSheetRule(data, styleSheet);\n else if (data.source === IncrementalSource.StyleDeclaration)\n this.applyStyleDeclaration(data, styleSheet);\n }\n\n private applyStyleSheetRule(\n data: styleSheetRuleData,\n styleSheet: CSSStyleSheet,\n ) {\n data.adds?.forEach(({ rule, index: nestedIndex }) => {\n try {\n if (Array.isArray(nestedIndex)) {\n const { positions, index } = getPositionsAndIndex(nestedIndex);\n const nestedRule = getNestedRule(styleSheet.cssRules, positions);\n // Null check: parent rule may not exist due to timing/ordering issues\n nestedRule?.insertRule(rule, index);\n } else {\n const index =\n nestedIndex === undefined\n ? undefined\n : Math.min(nestedIndex, styleSheet.cssRules.length);\n styleSheet?.insertRule(rule, index);\n }\n } catch (e) {\n /**\n * sometimes we may capture rules with browser prefix\n * insert rule with prefixs in other browsers may cause Error\n */\n /**\n * accessing styleSheet rules may cause SecurityError\n * for specific access control settings\n */\n }\n });\n\n data.removes?.forEach(({ index: nestedIndex }) => {\n try {\n if (Array.isArray(nestedIndex)) {\n const { positions, index } = getPositionsAndIndex(nestedIndex);\n const nestedRule = getNestedRule(styleSheet.cssRules, positions);\n // Null check: parent rule may not exist due to timing/ordering issues\n nestedRule?.deleteRule(index || 0);\n } else {\n styleSheet?.deleteRule(nestedIndex);\n }\n } catch (e) {\n /**\n * same as insertRule\n */\n }\n });\n\n if (typeof data.replace === 'string')\n try {\n void styleSheet.replace?.(data.replace);\n } catch (e) {\n // for safety\n }\n\n if (typeof data.replaceSync === 'string')\n try {\n styleSheet.replaceSync?.(data.replaceSync);\n } catch (e) {\n // for safety\n }\n }\n\n /**\n * Apply a StyleDeclaration event (setProperty/removeProperty) to a stylesheet.\n *\n * Uses defensive null checks because the rule may not exist:\n * - Timing issues: The rule was added by a previous StyleSheetRule event\n * that hasn't been processed yet\n * - Dynamic stylesheets: Constructed stylesheets or adopted stylesheets\n * may not be fully synchronized\n * - Nested rules: Rules inside @media/@supports require the parent rule\n * to exist first\n */\n private applyStyleDeclaration(\n data: styleDeclarationData,\n styleSheet: CSSStyleSheet,\n ) {\n if (data.set) {\n const rule = getNestedRule(\n styleSheet.rules,\n data.index,\n ) as unknown as CSSStyleRule;\n // Null check: rule may not exist due to timing/ordering issues\n if (rule?.style) {\n rule.style.setProperty(\n data.set.property,\n data.set.value,\n data.set.priority,\n );\n }\n }\n\n if (data.remove) {\n const rule = getNestedRule(\n styleSheet.rules,\n data.index,\n ) as unknown as CSSStyleRule;\n // Null check: rule may not exist due to timing/ordering issues\n if (rule?.style) {\n rule.style.removeProperty(data.remove.property);\n }\n }\n }\n\n private applyAdoptedStyleSheet(data: adoptedStyleSheetData) {\n const targetHost = this.mirror.getNode(data.id);\n if (!targetHost) return;\n // Create StyleSheet objects which will be adopted after.\n data.styles?.forEach((style) => {\n let newStyleSheet: CSSStyleSheet | null = null;\n /**\n * Constructed StyleSheet can't share across multiple documents.\n * The replayer has to get the correct host window to recreate a StyleSheetObject.\n */\n let hostWindow: IWindow | null = null;\n if (hasShadowRoot(targetHost))\n hostWindow = targetHost.ownerDocument?.defaultView || null;\n else if (targetHost.nodeName === '#document')\n hostWindow = (targetHost as Document).defaultView;\n\n if (!hostWindow) return;\n try {\n newStyleSheet = new hostWindow.CSSStyleSheet();\n this.styleMirror.add(newStyleSheet, style.styleId);\n // To reuse the code of applying stylesheet rules\n this.applyStyleSheetRule(\n {\n source: IncrementalSource.StyleSheetRule,\n adds: style.rules,\n },\n newStyleSheet,\n );\n } catch (e) {\n // In case some browsers don't support constructing StyleSheet.\n }\n });\n\n const MAX_RETRY_TIME = 10;\n let count = 0;\n const adoptStyleSheets = (targetHost: Node, styleIds: number[]) => {\n const stylesToAdopt = styleIds\n .map((styleId) => this.styleMirror.getStyle(styleId))\n .filter((style) => style !== null) as CSSStyleSheet[];\n if (hasShadowRoot(targetHost))\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n (targetHost as HTMLElement).shadowRoot!.adoptedStyleSheets =\n stylesToAdopt;\n else if (targetHost.nodeName === '#document')\n (targetHost as Document).adoptedStyleSheets = stylesToAdopt;\n\n /**\n * In the live mode where events are transferred over network without strict order guarantee, some newer events are applied before some old events and adopted stylesheets may haven't been created.\n * This retry mechanism can help resolve this situation.\n */\n if (stylesToAdopt.length !== styleIds.length && count < MAX_RETRY_TIME) {\n setTimeout(\n () => adoptStyleSheets(targetHost, styleIds),\n 0 + 100 * count,\n );\n count++;\n }\n };\n adoptStyleSheets(targetHost, data.styleIds);\n }\n\n private legacy_resolveMissingNode(\n map: missingNodeMap,\n parent: Node | RRNode,\n target: Node | RRNode,\n targetMutation: addedNodeMutation,\n ) {\n const { previousId, nextId } = targetMutation;\n const previousInMap = previousId && map[previousId];\n const nextInMap = nextId && map[nextId];\n if (previousInMap) {\n const { node, mutation } = previousInMap;\n parent.insertBefore(node as Node & RRNode, target as Node & RRNode);\n delete map[mutation.node.id];\n delete this.legacy_missingNodeRetryMap[mutation.node.id];\n if (mutation.previousId || mutation.nextId) {\n this.legacy_resolveMissingNode(map, parent, node, mutation);\n }\n }\n if (nextInMap) {\n const { node, mutation } = nextInMap;\n parent.insertBefore(\n node as Node & RRNode,\n target.nextSibling as Node & RRNode,\n );\n delete map[mutation.node.id];\n delete this.legacy_missingNodeRetryMap[mutation.node.id];\n if (mutation.previousId || mutation.nextId) {\n this.legacy_resolveMissingNode(map, parent, node, mutation);\n }\n }\n }\n\n private moveAndHover(\n x: number,\n y: number,\n id: number,\n isSync: boolean,\n debugData: incrementalData,\n ) {\n const target = this.mirror.getNode(id);\n if (!target) {\n return this.debugNodeNotFound(debugData, id);\n }\n\n const base = getBaseDimension(target, this.iframe);\n const _x = x * base.absoluteScale + base.x;\n const _y = y * base.absoluteScale + base.y;\n\n this.mouse.style.left = `${_x}px`;\n this.mouse.style.top = `${_y}px`;\n if (!isSync) {\n this.drawMouseTail({ x: _x, y: _y });\n }\n this.hoverElements(target as Element);\n }\n\n private drawMouseTail(position: { x: number; y: number }) {\n if (!this.mouseTail) {\n return;\n }\n\n const { lineCap, lineWidth, strokeStyle, duration } =\n this.config.mouseTail === true\n ? defaultMouseTailConfig\n : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);\n\n const draw = () => {\n if (!this.mouseTail) {\n return;\n }\n const ctx = this.mouseTail.getContext('2d');\n if (!ctx || !this.tailPositions.length) {\n return;\n }\n ctx.clearRect(0, 0, this.mouseTail.width, this.mouseTail.height);\n ctx.beginPath();\n ctx.lineWidth = lineWidth;\n ctx.lineCap = lineCap;\n ctx.strokeStyle = strokeStyle;\n ctx.moveTo(this.tailPositions[0].x, this.tailPositions[0].y);\n this.tailPositions.forEach((p) => ctx.lineTo(p.x, p.y));\n ctx.stroke();\n };\n\n this.tailPositions.push(position);\n draw();\n setTimeout(() => {\n this.tailPositions = this.tailPositions.filter((p) => p !== position);\n draw();\n }, duration / this.speedService.state.context.timer.speed);\n }\n\n private hoverElements(el: Element) {\n (this.lastHoveredRootNode || this.iframe.contentDocument)\n ?.querySelectorAll('.\\\\:hover')\n .forEach((hoveredEl) => {\n hoveredEl.classList.remove(':hover');\n });\n this.lastHoveredRootNode = el.getRootNode() as Document | ShadowRoot;\n let currentEl: Element | null = el;\n while (currentEl) {\n if (currentEl.classList) {\n currentEl.classList.add(':hover');\n }\n currentEl = currentEl.parentElement;\n }\n }\n\n private isUserInteraction(event: eventWithTime): boolean {\n if (event.type !== EventType.IncrementalSnapshot) {\n return false;\n }\n return (\n event.data.source > IncrementalSource.Mutation &&\n event.data.source <= IncrementalSource.Input\n );\n }\n\n private backToNormal() {\n this.nextUserInteractionEvent = null;\n if (this.speedService.state.matches('normal')) {\n return;\n }\n this.speedService.send({ type: 'BACK_TO_NORMAL' });\n this.emitter.emit(ReplayerEvents.SkipEnd, {\n speed: this.speedService.state.context.normalSpeed,\n });\n }\n\n private warnNodeNotFound(d: incrementalData, id: number) {\n this.warn(`Node with id '${id}' not found. `, d);\n }\n\n private warnCanvasMutationFailed(\n d: canvasMutationData | canvasMutationCommand,\n error: unknown,\n ) {\n this.warn(`Has error on canvas update`, error, 'canvas mutation:', d);\n }\n\n private debugNodeNotFound(d: incrementalData, id: number) {\n /**\n * There maybe some valid scenes of node not being found.\n * Because DOM events are macrotask and MutationObserver callback\n * is microtask, so events fired on a removed DOM may emit\n * snapshots in the reverse order.\n */\n this.debug(`Node with id '${id}' not found. `, d);\n }\n\n private warn(...args: Parameters<typeof console.warn>) {\n if (!this.config.showWarning) {\n return;\n }\n this.config.logger.warn(REPLAY_CONSOLE_PREFIX, ...args);\n }\n\n private debug(...args: Parameters<typeof console.log>) {\n if (!this.config.showDebug) {\n return;\n }\n this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);\n }\n}\n\nexport { type PlayerMachineState, type SpeedMachineState, type playerConfig };\n","import record from './record';\nimport {\n Replayer,\n type playerConfig,\n type PlayerMachineState,\n type SpeedMachineState,\n} from './replay';\nimport canvasMutation from './replay/canvas';\nimport { _mirror } from './utils';\nimport * as utils from './utils';\n\nexport {\n EventType,\n IncrementalSource,\n MouseInteractions,\n ReplayerEvents,\n type eventWithTime,\n} from '@rrweb/types';\n\n// exports style.css from replay\nimport './replay/styles/style.css';\n\nexport type { recordOptions, ReplayPlugin } from './types';\n\nconst { addCustomEvent } = record;\nconst { freezePage } = record;\nconst { takeFullSnapshot } = record;\n\nexport {\n record,\n addCustomEvent,\n freezePage,\n takeFullSnapshot,\n Replayer,\n type playerConfig,\n type PlayerMachineState,\n type SpeedMachineState,\n canvasMutation,\n _mirror as mirror,\n utils,\n};\n","// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([\n c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'\n ], { type: 'text/javascript' }))));\n w.onmessage = function (e) {\n var d = e.data, ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n }\n else\n cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new i32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return { b: b, r: r };\n};\nvar _a = freb(fleb, 2), fl = _a.b, revfl = _a.r;\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r;\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) >> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 1; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n return new u8(v.subarray(s, e));\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n ,\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, st, buf, dict) {\n // source length dict length\n var sl = dat.length, dl = dict ? dict.length : 0;\n if (!sl || st.f && !st.l)\n return buf || new u8(0);\n var noBuf = !buf;\n // have to estimate size\n var resize = noBuf || st.i != 2;\n // no state\n var noSt = st.i;\n // Assumes roughly 33% compression ratio average\n if (noBuf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (resize)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17\n if (resize)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & (1 << b) - 1, pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (resize)\n cbuf(bt + 131072);\n var end = bt + add;\n if (bt < dt) {\n var shift = dl - dt, dend = Math.min(dt, end);\n if (shift + bt < 0)\n err(3);\n for (; bt < dend; ++bt)\n buf[bt] = dict[shift + bt];\n }\n for (; bt < end; ++bt)\n buf[bt] = buf[bt - dt];\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n // don't reallocate for streams or user buffers\n return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n d[o + 2] |= v >> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return { t: et, l: 0 };\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return { t: v, l: 1 };\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return { t: new u8(tr), l: mbt };\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return { c: cl.subarray(0, cli), n: s };\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l;\n var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l;\n var _c = lc(dlt), lclt = _c.c, nlc = _c.n;\n var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n ++lcfreq[lclt[i] & 31];\n for (var i = 0; i < lcdt.length; ++i)\n ++lcfreq[lcdt[i] & 31];\n var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];\n if (bs >= 0 && flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >> 5) & 127), p += clct[i] >> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n var sym = syms[i];\n if (sym > 255) {\n var len = (sym >> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (sym >> 23) & 31), p += fleb[len];\n var dst = sym & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (sym >> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[sym]), p += ll[sym];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, st) {\n var s = st.z || dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var lst = st.l;\n var pos = (st.r || 0) & 7;\n if (lvl) {\n if (pos)\n w[0] = st.r >> 3;\n var opt = deo[lvl - 1];\n var n = opt >> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new i32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx blkpos\n var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;\n for (; i + 2 < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = i - dif + j & 32767;\n var pti = prev[ti];\n var cd = ti - pti & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += imod - pimod & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one int32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n for (i = Math.max(i, wi); i < s; ++i) {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n if (!lst) {\n st.r = (pos & 7) | w[(pos / 8) | 0] << 3;\n // shft(pos) now 1 less if pos & 7 != 0\n pos -= 7;\n st.h = head, st.p = prev, st.i = i, st.w = wi;\n }\n }\n else {\n for (var i = st.w || 0; i < s + lst; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[(pos / 8) | 0] = lst;\n e = s;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n st.i = s;\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Adler32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | (b >> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n if (!st) {\n st = { l: 1 };\n if (opt.dictionary) {\n var dict = opt.dictionary.subarray(-32768);\n var newDat = new u8(dict.length + dat.length);\n newDat.set(dict);\n newDat.set(dat, dict.length);\n dat = newDat;\n st.w = dict.length;\n }\n }\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? (st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20) : (12 + opt.mem), pre, post, st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return fnStr;\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n fnStr = wcln(fns[i], fnStr, td_1);\n ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 };\n }\n var td = mrg({}, ch[id].e);\n return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; };\nvar bDflt = function () { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zls]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get opts\nvar gopt = function (o) { return o && {\n out: o.size && new u8(o.size),\n dictionary: o.dictionary\n}; };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) {\n if (ev.data.length) {\n strm.push(ev.data[0], ev.data[1]);\n postMessage([ev.data[0].length]);\n }\n else\n strm.flush();\n };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id, flush, ext) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else if (!Array.isArray(dat))\n ext(dat);\n else if (dat.length == 1) {\n strm.queuedSize -= dat[0];\n if (strm.ondrain)\n strm.ondrain(dat[0]);\n }\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.queuedSize = 0;\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n strm.queuedSize += d.length;\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n if (flush) {\n strm.flush = function () { w.postMessage([]); };\n }\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += (d[10] | d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + (o.filename ? o.filename.length + 1 : 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (o.dictionary && 32);\n c[1] |= 31 - ((c[0] << 8) | c[1]) % 31;\n if (o.dictionary) {\n var h = adler();\n h.p(o.dictionary);\n wbytes(c, 2, h.d());\n }\n};\n// zlib start\nvar zls = function (d, dict) {\n if ((d[0] & 15) != 8 || (d[0] >> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if ((d[1] >> 5 & 1) == +!dict)\n err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');\n return (d[1] >> 3 & 4) + 2;\n};\nfunction StrmOpt(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n this.s = { l: 0, i: 32768, w: 32768, z: 32768 };\n // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev\n // 98304 = 32768 (lookback) + 65536 (common chunk size)\n this.b = new u8(98304);\n if (this.o.dictionary) {\n var dict = this.o.dictionary.subarray(-32768);\n this.b.set(dict, 32768 - dict.length);\n this.s.i = 32768 - dict.length;\n }\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, this.s), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n var endLen = chunk.length + this.s.z;\n if (endLen > this.b.length) {\n if (endLen > 2 * this.b.length - 32768) {\n var newBuf = new u8(endLen & -32768);\n newBuf.set(this.b.subarray(0, this.s.z));\n this.b = newBuf;\n }\n var split = this.b.length - this.s.z;\n this.b.set(chunk.subarray(0, split), this.s.z);\n this.s.z = this.b.length;\n this.p(this.b, false);\n this.b.set(this.b.subarray(-32768));\n this.b.set(chunk.subarray(split), 32768);\n this.s.z = chunk.length - split + 32768;\n this.s.i = 32766, this.s.w = 32768;\n }\n else {\n this.b.set(chunk, this.s.z);\n this.s.z += chunk.length;\n }\n this.s.l = final & 1;\n if (this.s.z > this.s.w + 8191 || final) {\n this.p(this.b, final || false);\n this.s.w = this.s.i, this.s.i -= 2;\n }\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * deflated output for small inputs.\n */\n Deflate.prototype.flush = function () {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n this.p(this.b, false);\n this.s.w = this.s.i, this.s.i -= 2;\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6, 1);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n function Inflate(opts, cb) {\n // no StrmOpt here to avoid adding to workerizer\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);\n this.s = { i: 0, b: dict ? dict.length : 0 };\n this.o = new u8(32768);\n this.p = new u8(0);\n if (dict)\n this.o.set(dict);\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n if (!this.p.length)\n this.p = c;\n else if (c.length) {\n var n = new u8(this.p.length + c.length);\n n.set(this.p), n.set(c, this.p.length), this.p = n;\n }\n };\n Inflate.prototype.c = function (final) {\n this.s.i = +(this.d = final || false);\n var bts = this.s.b;\n var dt = inflt(this.p, this.s, this.o);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n function AsyncInflate(opts, cb) {\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Inflate(ev.data);\n onmessage = astrm(strm);\n }, 7, 0);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, opts) {\n return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n this.l += chunk.length;\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * GZIPped output for small inputs.\n */\n Gzip.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8, 1);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming single or multi-member GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n function Gunzip(opts, cb) {\n this.v = 1;\n this.r = 0;\n Inflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n this.r += chunk.length;\n if (this.v) {\n var p = this.p.subarray(this.v - 1);\n var s = p.length > 3 ? gzs(p) : 4;\n if (s > p.length) {\n if (!final)\n return;\n }\n else if (this.v > 1 && this.onmember) {\n this.onmember(this.r - p.length);\n }\n this.p = p.subarray(s), this.v = 0;\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n // process concatenated GZIP\n if (this.s.f && !this.s.l && !final) {\n this.v = shft(this.s.p) + 9;\n this.s = { i: 0 };\n this.o = new u8(0);\n this.push(new u8(0), final);\n }\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming single or multi-member GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n function AsyncGunzip(opts, cb) {\n var _this = this;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gunzip(ev.data);\n strm.onmember = function (offset) { return postMessage(offset); };\n onmessage = astrm(strm);\n }, 9, 0, function (offset) { return _this.onmember && _this.onmember(offset); });\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, opts) {\n var st = gzs(data);\n if (st + 8 > data.length)\n err(6, 'invalid gzip data');\n return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * zlibbed output for small inputs.\n */\n Zlib.prototype.flush = function () {\n Deflate.prototype.flush.call(this);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10, 1);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n function Unzlib(opts, cb) {\n Inflate.call(this, opts, cb);\n this.v = opts && opts.dictionary ? 2 : 1;\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 6 && !final)\n return;\n this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n function AsyncUnzlib(opts, cb) {\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Unzlib(ev.data);\n onmessage = astrm(strm);\n }, 11, 0);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, opts) {\n return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n function Decompress(opts, cb) {\n this.o = StrmOpt.call(this, opts, cb) || {};\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n }\n // init substream\n // overriden by AsyncDecompress\n Decompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (dat, final) {\n _this.ondata(dat, final);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(this.o)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(this.o)\n : new this.Z(this.o);\n this.i();\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n function AsyncDecompress(opts, cb) {\n Decompress.call(this, opts, cb);\n this.queuedSize = 0;\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n }\n AsyncDecompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (err, dat, final) {\n _this.ondata(err, dat, final);\n };\n this.s.ondrain = function (size) {\n _this.queuedSize -= size;\n if (_this.ondrain)\n _this.ondrain(size);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n this.queuedSize += chunk.length;\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, opts) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, opts)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, opts)\n : unzlibSync(data, opts);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8)\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return { s: r, r: slc(d, i - 1) };\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (final) {\n if (r.length)\n err(8);\n this.p = null;\n }\n else\n this.p = r;\n this.ondata(s, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td) {\n return td.decode(dat);\n }\n else {\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (r.length)\n err(8);\n return s;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >> 1)), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this.ondata(err, dat, final);\n _this.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this.d & 1))\n return;\n _this.u.splice(-1, 1);\n _this.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this = this;\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this.k[0] == chks_3 && _this.c)\n _this.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n // Synchronously decompress under 512KB, or barely-compressed data\n if (su < 524288 || sc > 0.8 * su) {\n try {\n cbl(null, inflateSync(infl, { out: new u8(su) }));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n","import type { ReplaySignals } from \"./replay\";\n\nexport const REPLAY_MAX_CLICK_SIGNALS = 100;\nexport const REPLAY_MAX_NAV_SIGNALS = 50;\nexport const REPLAY_MAX_ERROR_SIGNALS = 20;\nexport const REPLAY_MAX_FORM_SIGNALS = 20;\n\nconst MAX_SELECTOR_LENGTH = 500;\nconst MAX_URL_LENGTH = 2_000;\nconst MAX_ERROR_LENGTH = 200;\nconst MAX_MUTATION_LATENCY_MS = 3_000;\n\nfunction finiteNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value);\n}\n\nfunction normalizeClicks(value: unknown): ReplaySignals[\"clicks\"] {\n if (!Array.isArray(value)) return [];\n const normalized: ReplaySignals[\"clicks\"] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) continue;\n const candidate = item as Record<string, unknown>;\n if (!finiteNumber(candidate.ts) || !finiteNumber(candidate.x) || !finiteNumber(candidate.y)) continue;\n if (typeof candidate.selector !== \"string\") continue;\n const selector = candidate.selector.trim();\n if (!selector || selector.length > MAX_SELECTOR_LENGTH) continue;\n const mutMs = candidate.mut_ms;\n if (mutMs !== undefined && (!finiteNumber(mutMs) || mutMs < 0 || mutMs > MAX_MUTATION_LATENCY_MS)) continue;\n normalized.push({\n ts: candidate.ts,\n selector,\n x: Math.round(candidate.x),\n y: Math.round(candidate.y),\n ...(mutMs === undefined ? {} : { mut_ms: mutMs }),\n });\n if (normalized.length >= REPLAY_MAX_CLICK_SIGNALS) break;\n }\n return normalized;\n}\n\nfunction normalizeNav(value: unknown): ReplaySignals[\"nav\"] {\n if (!Array.isArray(value)) return [];\n const normalized: ReplaySignals[\"nav\"] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) continue;\n const candidate = item as Record<string, unknown>;\n if (!finiteNumber(candidate.ts) || typeof candidate.url !== \"string\") continue;\n const url = candidate.url.trim();\n if (!url || url.length > MAX_URL_LENGTH) continue;\n normalized.push({ ts: candidate.ts, url });\n if (normalized.length >= REPLAY_MAX_NAV_SIGNALS) break;\n }\n return normalized;\n}\n\nfunction normalizeErrors(value: unknown): ReplaySignals[\"errors\"] {\n if (!Array.isArray(value)) return [];\n const normalized: ReplaySignals[\"errors\"] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) continue;\n const candidate = item as Record<string, unknown>;\n if (!finiteNumber(candidate.ts) || typeof candidate.message !== \"string\") continue;\n const message = candidate.message.trim();\n if (!message) continue;\n normalized.push({ ts: candidate.ts, message: message.slice(0, MAX_ERROR_LENGTH) });\n if (normalized.length >= REPLAY_MAX_ERROR_SIGNALS) break;\n }\n return normalized;\n}\n\nfunction normalizeForms(value: unknown): ReplaySignals[\"form_focus\"] {\n if (!Array.isArray(value)) return [];\n const selectors = new Set<string>();\n const normalized: ReplaySignals[\"form_focus\"] = [];\n for (const item of value) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) continue;\n const candidate = item as Record<string, unknown>;\n if (!finiteNumber(candidate.ts) || typeof candidate.selector !== \"string\") continue;\n const selector = candidate.selector.trim();\n if (!selector || selector.length > MAX_SELECTOR_LENGTH || selectors.has(selector)) continue;\n selectors.add(selector);\n normalized.push({ ts: candidate.ts, selector });\n if (normalized.length >= REPLAY_MAX_FORM_SIGNALS) break;\n }\n return normalized;\n}\n\nexport function normalizeReplaySignalState(value: Partial<Record<keyof ReplaySignals, unknown>> | undefined): ReplaySignals {\n const scrollMaxPct = finiteNumber(value?.scroll_max_pct)\n ? Math.max(0, Math.min(100, value.scroll_max_pct))\n : 0;\n return {\n clicks: normalizeClicks(value?.clicks),\n nav: normalizeNav(value?.nav),\n errors: normalizeErrors(value?.errors),\n form_focus: normalizeForms(value?.form_focus),\n form_submit: normalizeForms(value?.form_submit),\n scroll_max_pct: scrollMaxPct,\n };\n}\n","import type { ReplaySignals } from \"./replay\";\nimport {\n normalizeReplaySignalState,\n REPLAY_MAX_CLICK_SIGNALS,\n REPLAY_MAX_ERROR_SIGNALS,\n REPLAY_MAX_FORM_SIGNALS,\n REPLAY_MAX_NAV_SIGNALS,\n} from \"./replay-signal-state\";\n\nconst EVENT_META = 4;\nconst EVENT_INCREMENTAL = 3;\nconst SOURCE_MUTATION = 0;\nconst SOURCE_MOUSE_INTERACTION = 2;\nconst SOURCE_SCROLL = 3;\nconst RRWEB_DOCUMENT_ID = 1;\nconst MOUSE_CLICK = 2;\nconst MOUSE_FOCUS = 5;\n\ntype RrwebEvent = {\n type?: number;\n timestamp?: number;\n data?: Record<string, unknown>;\n};\n\nfunction selectorFor(element: Element): string {\n const parts: string[] = [];\n let current: Element | null = element;\n while (current && current !== document.documentElement && parts.length < 4) {\n const tag = current.tagName.toLowerCase();\n const id = current.id && /^[A-Za-z][\\w-]{0,80}$/.test(current.id) ? `#${current.id}` : \"\";\n if (id) {\n parts.unshift(`${tag}${id}`);\n break;\n }\n const stableAttribute = [\"data-testid\", \"data-test\", \"data-drip-id\"]\n .map((name) => ({ name, value: current?.getAttribute(name) }))\n .find(({ value }) => value && /^[\\w-]{1,80}$/.test(value));\n if (stableAttribute?.value) {\n parts.unshift(`${tag}[${stableAttribute.name}=\"${stableAttribute.value}\"]`);\n break;\n }\n let nth = 1;\n let sibling = current.previousElementSibling;\n while (sibling) {\n if (sibling.tagName === current.tagName) nth += 1;\n sibling = sibling.previousElementSibling;\n }\n parts.unshift(`${tag}:nth-of-type(${nth})`);\n current = current.parentElement;\n }\n return parts.join(\" > \").slice(0, 500);\n}\n\nfunction formFor(target: Element | null): Element | null {\n if (!target) return null;\n return target.tagName.toLowerCase() === \"form\" ? target : target.closest(\"form\");\n}\n\nfunction submitTarget(target: Element | null): boolean {\n if (!target) return false;\n const control = target.closest(\"button,input\");\n if (!control) return false;\n const tag = control.tagName.toLowerCase();\n if (tag === \"button\") return (control.getAttribute(\"type\") || \"submit\").toLowerCase() === \"submit\";\n return tag === \"input\" && control.getAttribute(\"type\")?.toLowerCase() === \"submit\";\n}\n\nexport function createReplaySignalDeriver(signalState?: ReplaySignals, captureStartedAt?: number): {\n accept: (event: RrwebEvent, target: Element | null) => void;\n error: (message: string, ts?: number) => void;\n snapshot: (now?: number) => ReplaySignals;\n submit: (target: Element | null, ts?: number) => void;\n};\nexport function createReplaySignalDeriver(signalState?: ReplaySignals, captureStartedAt = Date.now()) {\n const signals = normalizeReplaySignalState(signalState);\n const currentUrl = typeof location !== \"undefined\" ? location.href : \"\";\n // Array.prototype.at is ES2022 — the SDK targets ES2018 browsers and\n // esbuild does not polyfill it, so index access is required here (it also\n // broke build:types declaration emit in the Commerce Lab promotion lane).\n const previousUrl = signals.nav[signals.nav.length - 1]?.url ?? \"\";\n if (currentUrl && currentUrl !== previousUrl && signals.nav.length < REPLAY_MAX_NAV_SIGNALS) {\n signals.nav.push({ ts: captureStartedAt, url: currentUrl.slice(0, 2_000) });\n }\n let lastUrl = currentUrl || previousUrl;\n const focusedForms = new Set(signals.form_focus.map((signal) => signal.selector));\n const submittedForms = new Set(signals.form_submit.map((signal) => signal.selector));\n const submit = (target: Element | null, ts = Date.now()) => {\n const form = formFor(target);\n const selector = form ? selectorFor(form) : \"\";\n if (selector && !submittedForms.has(selector) && signals.form_submit.length < REPLAY_MAX_FORM_SIGNALS) {\n submittedForms.add(selector);\n signals.form_submit.push({ ts, selector });\n }\n };\n const accept = (event: RrwebEvent, target: Element | null) => {\n const ts = typeof event.timestamp === \"number\" ? event.timestamp : Date.now();\n const currentUrl = typeof location !== \"undefined\" ? location.href : \"\";\n if (currentUrl && currentUrl !== lastUrl) {\n lastUrl = currentUrl;\n if (signals.nav.length < REPLAY_MAX_NAV_SIGNALS) signals.nav.push({ ts, url: currentUrl.slice(0, 2_000) });\n }\n if (event.type === EVENT_META && typeof event.data?.href === \"string\" && event.data.href !== lastUrl) {\n lastUrl = event.data.href;\n if (signals.nav.length < REPLAY_MAX_NAV_SIGNALS) signals.nav.push({ ts, url: event.data.href.slice(0, 2_000) });\n }\n if (event.type !== EVENT_INCREMENTAL) return;\n if (event.data?.source === SOURCE_MUTATION) {\n for (const click of signals.clicks) {\n const elapsed = ts - click.ts;\n if (elapsed >= 0 && elapsed <= 3_000 && click.mut_ms === undefined) click.mut_ms = elapsed;\n }\n return;\n }\n if (event.data?.source === SOURCE_SCROLL) {\n if (event.data.id !== RRWEB_DOCUMENT_ID) return;\n const y = typeof event.data.y === \"number\" ? event.data.y : window.scrollY;\n const height = Math.max(1, document.body?.scrollHeight ?? 0, document.documentElement?.scrollHeight ?? 0);\n signals.scroll_max_pct = Math.max(signals.scroll_max_pct, Math.max(0, Math.min(100, Math.round(((y + Math.max(1, window.innerHeight)) / height) * 100))));\n return;\n }\n if (event.data?.source !== SOURCE_MOUSE_INTERACTION || !target) return;\n if (event.data.type === MOUSE_CLICK) {\n if (signals.clicks.length >= REPLAY_MAX_CLICK_SIGNALS) return;\n const click = {\n ts,\n selector: selectorFor(target),\n x: Math.round(typeof event.data.x === \"number\" ? event.data.x : 0),\n y: Math.round(typeof event.data.y === \"number\" ? event.data.y : 0),\n };\n signals.clicks.push(click);\n if (submitTarget(target)) submit(target, ts);\n } else if (event.data.type === MOUSE_FOCUS) {\n const form = formFor(target);\n if (!form || signals.form_focus.length >= REPLAY_MAX_FORM_SIGNALS) return;\n const selector = selectorFor(form);\n if (!focusedForms.has(selector)) {\n focusedForms.add(selector);\n signals.form_focus.push({ ts, selector });\n }\n }\n };\n const snapshot = (_now = Date.now()) => normalizeReplaySignalState(signals);\n return {\n accept,\n error(message: string, ts = Date.now()) {\n if (signals.errors.length < REPLAY_MAX_ERROR_SIGNALS) signals.errors.push({ ts, message: message.slice(0, 200) });\n },\n snapshot,\n submit,\n };\n}\n","import { record } from \"rrweb\";\nimport { deflate, deflateSync } from \"fflate\";\nimport type { ReplayRecorderApi, ReplayRecorderEmission } from \"./replay\";\nimport { createReplaySignalDeriver } from \"./replay-signals\";\n\nconst RRWEB_VERSION = \"2.1.1\";\nconst BLOCK_SELECTOR = [\n \"[data-drip-replay-block]\",\n \"iframe[src*='payment' i]\",\n \"iframe[name*='payment' i]\",\n \"iframe[src*='checkout' i]\",\n \".StripeElement\",\n \"[data-stripe]\",\n].join(\",\");\nconst MASK_TEXT_SELECTOR = [\n \"[data-drip-replay-mask]\",\n \"[data-email]\",\n \"[data-phone]\",\n \"[data-address]\",\n \".customer-email\",\n \".customer-phone\",\n \".customer-address\",\n \"[class*='personal-info' i]\",\n].join(\",\");\n\nfunction targetForEvent(event: Record<string, unknown>): Element | null {\n const data = event.data;\n if (!data || typeof data !== \"object\" || Array.isArray(data)) return null;\n const id = (data as Record<string, unknown>).id;\n if (typeof id !== \"number\") return null;\n const node = record.mirror.getNode(id);\n return node instanceof Element ? node : node?.parentElement ?? null;\n}\n\nfunction errorMessage(value: unknown): string {\n if (value instanceof Error) return value.message || value.name;\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value) || \"Unhandled rejection\";\n } catch {\n return \"Unhandled rejection\";\n }\n}\n\nlet replaySignals = createReplaySignalDeriver();\n\nconst api: ReplayRecorderApi = {\n version: RRWEB_VERSION,\n takeSignals() {\n return replaySignals.snapshot();\n },\n compressSync(bytes) {\n return deflateSync(bytes);\n },\n async compress(bytes) {\n try {\n return await new Promise<Uint8Array>((resolve, reject) => {\n try {\n deflate(bytes, (error, compressed) => {\n if (error) reject(error);\n else resolve(compressed);\n });\n } catch (error) {\n reject(error);\n }\n });\n } catch {\n return deflateSync(bytes);\n }\n },\n start({ emit, signalState }) {\n replaySignals = createReplaySignalDeriver(signalState);\n const stop = record({\n emit(event) {\n const rawEvent = event as unknown as Record<string, unknown>;\n replaySignals.accept(rawEvent, targetForEvent(rawEvent));\n const emission: ReplayRecorderEmission = { event: rawEvent };\n emit(emission);\n },\n maskAllInputs: true,\n slimDOMOptions: \"all\",\n blockSelector: BLOCK_SELECTOR,\n maskTextSelector: MASK_TEXT_SELECTOR,\n sampling: {\n mousemove: 50,\n scroll: 150,\n media: 800,\n input: \"last\",\n },\n recordCanvas: false,\n collectFonts: false,\n inlineStylesheet: true,\n });\n const onError = (event: ErrorEvent) => {\n replaySignals.error(event.message || \"Window error\");\n };\n const onUnhandledRejection = (event: PromiseRejectionEvent) => {\n replaySignals.error(errorMessage(event.reason));\n };\n const onSubmit = (event: SubmitEvent) => {\n replaySignals.submit(event.target instanceof Element ? event.target : null);\n };\n window.addEventListener(\"error\", onError);\n window.addEventListener(\"unhandledrejection\", onUnhandledRejection);\n window.addEventListener(\"submit\", onSubmit, { capture: true, passive: true });\n return () => {\n window.removeEventListener(\"error\", onError);\n window.removeEventListener(\"unhandledrejection\", onUnhandledRejection);\n window.removeEventListener(\"submit\", onSubmit, { capture: true });\n stop?.();\n };\n },\n};\n\n(globalThis as typeof globalThis & { __dripReplayRecorder?: ReplayRecorderApi }).__dripReplayRecorder = api;\n"],"mappings":"uBAAAA,EAGiCC,E,sJAH7BC,EAAYC,OAAOC,eAEnBC,EAAgB,CAACC,EAAKC,EAAKC,IADT,EAACF,EAAKC,EAAKC,IAAUD,KAAOD,EAAMJ,EAAUI,EAAKC,EAAK,CAAEE,YAAY,EAAMC,cAAc,EAAMC,UAAU,EAAMH,UAAWF,EAAIC,GAAOC,EACjHI,CAAgBN,EAAoB,iBAARC,EAAmBA,EAAM,GAAKA,EAAKC,GACpGK,IAA6BZ,EAQ9BY,GAAY,IAPHZ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