{"version":3,"file":"breakpoints.mjs","sources":["../../../../../../../../../node_modules/@mui/system/esm/breakpoints/breakpoints.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport deepmerge from '@mui/utils/deepmerge';\nimport merge from \"../merge/index.js\";\nimport { isCqShorthand, getContainerQuery } from \"../cssContainerQueries/index.js\";\n\n// The breakpoint **start** at this value.\n// For instance with the first breakpoint xs: [xs, sm[.\nexport const values = {\n  xs: 0,\n  // phone\n  sm: 600,\n  // tablet\n  md: 900,\n  // small laptop\n  lg: 1200,\n  // desktop\n  xl: 1536 // large screen\n};\nconst defaultBreakpoints = {\n  // Sorted ASC by size. That's important.\n  // It can't be configured as it's used statically for propTypes.\n  keys: ['xs', 'sm', 'md', 'lg', 'xl'],\n  up: key => `@media (min-width:${values[key]}px)`\n};\nconst defaultContainerQueries = {\n  containerQueries: containerName => ({\n    up: key => {\n      let result = typeof key === 'number' ? key : values[key] || key;\n      if (typeof result === 'number') {\n        result = `${result}px`;\n      }\n      return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;\n    }\n  })\n};\nexport function handleBreakpoints(props, propValue, styleFromPropValue) {\n  const theme = props.theme || {};\n  if (Array.isArray(propValue)) {\n    const themeBreakpoints = theme.breakpoints || defaultBreakpoints;\n    return propValue.reduce((acc, item, index) => {\n      acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);\n      return acc;\n    }, {});\n  }\n  if (typeof propValue === 'object') {\n    const themeBreakpoints = theme.breakpoints || defaultBreakpoints;\n    return Object.keys(propValue).reduce((acc, breakpoint) => {\n      if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {\n        const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);\n        if (containerKey) {\n          acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);\n        }\n      }\n      // key is breakpoint\n      else if (Object.keys(themeBreakpoints.values || values).includes(breakpoint)) {\n        const mediaKey = themeBreakpoints.up(breakpoint);\n        acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);\n      } else {\n        const cssKey = breakpoint;\n        acc[cssKey] = propValue[cssKey];\n      }\n      return acc;\n    }, {});\n  }\n  const output = styleFromPropValue(propValue);\n  return output;\n}\nfunction breakpoints(styleFunction) {\n  // false positive\n  // eslint-disable-next-line react/function-component-definition\n  const newStyleFunction = props => {\n    const theme = props.theme || {};\n    const base = styleFunction(props);\n    const themeBreakpoints = theme.breakpoints || defaultBreakpoints;\n    const extended = themeBreakpoints.keys.reduce((acc, key) => {\n      if (props[key]) {\n        acc = acc || {};\n        acc[themeBreakpoints.up(key)] = styleFunction({\n          theme,\n          ...props[key]\n        });\n      }\n      return acc;\n    }, null);\n    return merge(base, extended);\n  };\n  newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? {\n    ...styleFunction.propTypes,\n    xs: PropTypes.object,\n    sm: PropTypes.object,\n    md: PropTypes.object,\n    lg: PropTypes.object,\n    xl: PropTypes.object\n  } : {};\n  newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];\n  return newStyleFunction;\n}\nexport function createEmptyBreakpointObject(breakpointsInput = {}) {\n  const breakpointsInOrder = breakpointsInput.keys?.reduce((acc, key) => {\n    const breakpointStyleKey = breakpointsInput.up(key);\n    acc[breakpointStyleKey] = {};\n    return acc;\n  }, {});\n  return breakpointsInOrder || {};\n}\nexport function removeUnusedBreakpoints(breakpointKeys, style) {\n  return breakpointKeys.reduce((acc, key) => {\n    const breakpointOutput = acc[key];\n    const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;\n    if (isBreakpointUnused) {\n      delete acc[key];\n    }\n    return acc;\n  }, style);\n}\nexport function mergeBreakpointsInOrder(breakpointsInput, ...styles) {\n  const emptyBreakpoints = createEmptyBreakpointObject(breakpointsInput);\n  const mergedOutput = [emptyBreakpoints, ...styles].reduce((prev, next) => deepmerge(prev, next), {});\n  return removeUnusedBreakpoints(Object.keys(emptyBreakpoints), mergedOutput);\n}\n\n// compute base for responsive values; e.g.,\n// [1,2,3] => {xs: true, sm: true, md: true}\n// {xs: 1, sm: 2, md: 3} => {xs: true, sm: true, md: true}\nexport function computeBreakpointsBase(breakpointValues, themeBreakpoints) {\n  // fixed value\n  if (typeof breakpointValues !== 'object') {\n    return {};\n  }\n  const base = {};\n  const breakpointsKeys = Object.keys(themeBreakpoints);\n  if (Array.isArray(breakpointValues)) {\n    breakpointsKeys.forEach((breakpoint, i) => {\n      if (i < breakpointValues.length) {\n        base[breakpoint] = true;\n      }\n    });\n  } else {\n    breakpointsKeys.forEach(breakpoint => {\n      if (breakpointValues[breakpoint] != null) {\n        base[breakpoint] = true;\n      }\n    });\n  }\n  return base;\n}\nexport function resolveBreakpointValues({\n  values: breakpointValues,\n  breakpoints: themeBreakpoints,\n  base: customBase\n}) {\n  const base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints);\n  const keys = Object.keys(base);\n  if (keys.length === 0) {\n    return breakpointValues;\n  }\n  let previous;\n  return keys.reduce((acc, breakpoint, i) => {\n    if (Array.isArray(breakpointValues)) {\n      acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];\n      previous = i;\n    } else if (typeof breakpointValues === 'object') {\n      acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];\n      previous = breakpoint;\n    } else {\n      acc[breakpoint] = breakpointValues;\n    }\n    return acc;\n  }, {});\n}\nexport default breakpoints;"],"names":["values"],"mappings":";;AAKA;AACA;AACY,MAACA,QAAM,GAAG;AACtB,EAAE,EAAE,EAAE,CAAC;AACP;AACA,EAAE,EAAE,EAAE,GAAG;AACT;AACA,EAAE,EAAE,EAAE,GAAG;AACT;AACA,EAAE,EAAE,EAAE,IAAI;AACV;AACA,EAAE,EAAE,EAAE,IAAI;AACV;AACA,MAAM,kBAAkB,GAAG;AAC3B;AACA;AACA,EAAE,IAAI,EAAE,CAAC,IAAI,EAA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