import { mutationCallBack , blockClass , maskTextClass , Mirror , scrollCallback , SamplingStrategy , } from '../types' ; import { MaskInputOptions , SlimDOMOptions , MaskTextFn , MaskInputFn , } from 'rrweb-snapshot' ; import { IframeManager } from './iframe-manager' ; import { initMutationObserver , initScrollObserver } from './observer' ; type BypassOptions = { blockClass : blockClass ; blockSelector : string | null ; maskTextClass : maskTextClass ; maskTextSelector : string | null ; inlineStylesheet : boolean ; maskInputOptions : MaskInputOptions ; maskTextFn : MaskTextFn | undefined ; maskInputFn : MaskInputFn | undefined ; recordCanvas : boolean ; sampling : SamplingStrategy ; slimDOMOptions : SlimDOMOptions ; iframeManager : IframeManager ; } ; export class ShadowDomManager { private mutationCb : mutationCallBack ; private scrollCb : scrollCallback ; private bypassOptions : BypassOptions ; private mirror : Mirror ; constructor ( options ) { this . mutationCb = options . mutationCb ; this . scrollCb = options . scrollCb ; this . bypassOptions = options . bypassOptions ; this . mirror = options . mirror ; } public addShadowRoot ( shadowRoot , doc ) { initMutationObserver ( this . mutationCb , doc , this . bypassOptions . blockClass , this . bypassOptions . blockSelector , this . bypassOptions . maskTextClass , this . bypassOptions . maskTextSelector , this . bypassOptions . inlineStylesheet , this . bypassOptions . maskInputOptions , this . bypassOptions . maskTextFn , this . bypassOptions . maskInputFn , this . bypassOptions . recordCanvas , this . bypassOptions . slimDOMOptions , this . mirror , this . bypassOptions . iframeManager , this , shadowRoot ) ; initScrollObserver ( this . scrollCb , ( shadowRoot as unknown ) as Document , this . mirror , this . bypassOptions . blockClass , this . bypassOptions . sampling ) ; } }