{"version":3,"file":"cssContainerQueries.mjs","sources":["../../../../../../../../../node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js"],"sourcesContent":["import _formatMuiErrorMessage from \"@mui/utils/formatMuiErrorMessage\";\n/**\n * For using in `sx` prop to sort the breakpoint from low to high.\n * Note: this function does not work and will not support multiple units.\n *       e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }\n *            output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px\n */\nexport function sortContainerQueries(theme, css) {\n  if (!theme.containerQueries) {\n    return css;\n  }\n  const sorted = Object.keys(css).filter(key => key.startsWith('@container')).sort((a, b) => {\n    const regex = /min-width:\\s*([0-9.]+)/;\n    return +(a.match(regex)?.[1] || 0) - +(b.match(regex)?.[1] || 0);\n  });\n  if (!sorted.length) {\n    return css;\n  }\n  return sorted.reduce((acc, key) => {\n    const value = css[key];\n    delete acc[key];\n    acc[key] = value;\n    return acc;\n  }, {\n    ...css\n  });\n}\nexport function isCqShorthand(breakpointKeys, value) {\n  return value === '@' || value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\\d/));\n}\nexport function getContainerQuery(theme, shorthand) {\n  const matches = shorthand.match(/^@([^/]+)?\\/?(.+)?$/);\n  if (!matches) {\n    if (process.env.NODE_ENV !== 'production') {\n      throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \\`@<breakpoint | number>\\` or \\`@<breakpoint | number>/<container>\\`.\\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : _formatMuiErrorMessage(18, `(${shorthand})`));\n    }\n    return null;\n  }\n  const [, containerQuery, containerName] = matches;\n  const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;\n  return theme.containerQueries(containerName).up(value);\n}\nexport default function cssContainerQueries(themeInput) {\n  const toContainerQuery = (mediaQuery, name) => mediaQuery.replace('@media', name ? `@container ${name}` : '@container');\n  function attachCq(node, name) {\n    node.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);\n    node.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);\n    node.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);\n    node.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);\n    node.not = (...args) => {\n      const result = toContainerQuery(themeInput.breakpoints.not(...args), name);\n      if (result.includes('not all and')) {\n        // `@container` does not work with `not all and`, so need to invert the logic\n        return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>').replace('and', 'or');\n      }\n      return result;\n    };\n  }\n  const node = {};\n  const containerQueries = name => {\n    attachCq(node, name);\n    return node;\n  };\n  attachCq(containerQueries);\n  return {\n    ...themeInput,\n    containerQueries\n  };\n}"],"names":[],"mappings":"AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE;AACjD,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;AAC/B,IAAI,OAAO,GAAG;AACd,EAAE;AACF,EAAE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;AAC7F,IAAI,MAAM,KAAK,GAAG,wBAAwB;AAC1C,IAAI,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AACpE,EAAE,CAAC,CAAC;AACJ,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;AACtB,IAAI,OAAO,GAAG;AACd,EAAE;AACF,EAAE,OAAO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