export const sleep = async ( time ) : Promise < void > => new Promise ( ( resolve ) : void => { setTimeout ( resolve , time ) ; } ) ; export const slotSelector = ( element , slot , selector ) : Element | null | undefined => { if ( element === null ) { return ; } const { shadowRoot } = element ; const slotEl = ( ( ) => { if ( shadowRoot !== undefined && shadowRoot !== null ) { return shadowRoot ; } return element ; } ) ( ) . querySelector ( slot ) ; if ( slotEl === null ) { return ; } const [ assigned ] = ( slotEl as HTMLSlotElement ) . assignedNodes ( ) ; const { parentElement } = assigned ; if ( parentElement === null ) { return ; } return parentElement . querySelector ( selector ) ; } ; export const removeExtraString = ( c ) : string => c . replace ( /<!--((?!-->)[\w\W])*-->/g , '' ) . trim ( ) ;