import React, { useMemo } from 'react';
import { ThemeProvider } from '@emotion/react';
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
import { fontSize } from '@atlaskit/theme/constants';
import { WidthConsumer } from '../WidthProvider';
export function mapBreakpointToLayoutMaxWidth(breakpoint) {
  switch (breakpoint) {
    case 'M':
    case 'L':
      return 760;
    default:
      return 680;
  }
}
export function BaseThemeWrapper({
  baseFontSize,
  children
}) {
  const memoizedTheme = useMemo(() => ({
    baseFontSize: baseFontSize || fontSize(),
    layoutMaxWidth: akEditorDefaultLayoutWidth
  }), [baseFontSize]);
  return /*#__PURE__*/React.createElement(ThemeProvider, {
    theme: memoizedTheme
  }, children);
}
export function BaseTheme({
  children,
  baseFontSize
}) {
  return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
    breakpoint
  }) => /*#__PURE__*/React.createElement(BaseThemeWrapper, {
    breakpoint: breakpoint,
    baseFontSize: baseFontSize
  }, /*#__PURE__*/React.createElement(React.Fragment, null, children)));
}