const defaultStubGlobal = (name, value) => {
  Object.defineProperty(globalThis, name, {
    value,
    writable: true,
    enumerable: true,
    configurable: true
  });
};
function mockMatchMedia({
  fn,
  stubGlobal = defaultStubGlobal
}) {
  stubGlobal('matchMedia', fn(query => {
    const matches = /^\(min-width: (\d+)px\)$/u.exec(query);
    const minWidth = matches != null ? Number(matches[1]) : undefined;
    return {
      matches: minWidth != null ? window.innerWidth >= minWidth : false,
      media: query,
      onchange: null,
      addListener: fn(),
      removeListener: fn(),
      addEventListener: fn(),
      removeEventListener: fn(),
      dispatchEvent: fn()
    };
  }));
}
function mockResizeObserver({
  fn,
  stubGlobal = defaultStubGlobal
}) {
  stubGlobal('ResizeObserver', fn(() => ({
    observe: fn(),
    unobserve: fn(),
    disconnect: fn()
  })));
}

export { mockMatchMedia, mockResizeObserver };
//# sourceMappingURL=mocks.mjs.map
