import { LovelaceConfig } from 'custom-card-helpers/dist/types' ; export const replaceView = ( config , viewIndex , viewConfig ) : LovelaceConfig => ( { ... config , views : config . views . map ( ( origView , index ) => ( index === viewIndex ? viewConfig : origView ) ) , } ) ; export const afterNextRender = ( cb ) : void => { requestAnimationFrame ( ( ) => setTimeout ( cb , 0 ) ) ; } ; export const nextRender = ( ) => { return new Promise ( resolve => { afterNextRender ( resolve ) ; } ) ; } ;