console.log('react-scanner-client');
import * as rrweb from 'rrweb';
// @ts-ignore
window.getReactDomComponent = function (dom: any) {
  console.log('getReactDomComponent', dom);
  
  // @ts-ignore
  const internalInstance =
    // @ts-ignore
    dom[Object.keys(dom ?? {}).find((key) => key.startsWith('__react'))];
  if (!internalInstance) return null;
  return {
    internalInstance,
    props: internalInstance.memoizedProps,
    state: internalInstance.memoizedState,
  };
};

let events: any = [];
  
  const stop = rrweb.record({
    emit(event: any) {
      // push event into the events array
        events.push(event);
    },
  });
  
  setInterval(() => {
    console.log({events});
  }, 1000)

async function init() {
  
  console.log('rrweb', rrweb)
  
  let events: any = [];
  
  const stop = rrweb.record({
    emit(event: any) {
      // push event into the events array
        events.push(event);
    },
  });
  
  setInterval(() => {
    console.log({events});
  }, 1000)
}

export default init;

export const add = (a: number, b: number) => {
  return a + b
}