{"version":3,"file":"get-box-style.mjs","names":[],"sources":["../../../../src/core/Box/get-box-style/get-box-style.ts"],"sourcesContent":["import type { MantineTheme } from '../../MantineProvider';\nimport type { CssVarsProp, MantineStyleProp } from '../Box.types';\n\ninterface GetBoxStyleOptions {\n  theme: MantineTheme;\n  styleProps: React.CSSProperties;\n  style?: MantineStyleProp;\n  vars?: CssVarsProp;\n}\n\nfunction mergeStyles(\n  styles: MantineStyleProp | CssVarsProp | undefined,\n  theme: MantineTheme\n): React.CSSProperties {\n  if (Array.isArray(styles)) {\n    return [...styles].reduce<Record<string, any>>(\n      (acc, item) => ({ ...acc, ...mergeStyles(item, theme) }),\n      {}\n    );\n  }\n\n  if (typeof styles === 'function') {\n    return styles(theme);\n  }\n\n  if (styles == null) {\n    return {};\n  }\n\n  return styles;\n}\n\nexport function getBoxStyle({\n  theme,\n  style,\n  vars,\n  styleProps,\n}: GetBoxStyleOptions): React.CSSProperties {\n  const _style = mergeStyles(style, theme);\n  const _vars = mergeStyles(vars, theme);\n  return { ..._style, ..._vars, ...styleProps };\n}\n"],"mappings":";;AAUA,SAAS,YACP,QACA,OACqB;AACrB,KAAI,MAAM,QAAQ,OAAO,CACvB,QAAO,CAAC,GAAG,OAAO,CAAC,QAChB,KAAK,UAAU;EAAE,GAAG;EAAK,GAAG,YAAY,MAAM,MAAM;EAAE,GACvD,EAAE,CACH;AAGH,KAAI,OAAO,WAAW,WACpB,QAAO,OAAO,MAAM;AAGtB,KAAI,UAAU,KACZ,QAAO,EAAE;AAGX,QAAO;;AAGT,SAAgB,YAAY,EAC1B,OACA,OACA,MACA,cAC0C;CAC1C,MAAM,SAAS,YAAY,OAAO,MAAM;CACxC,MAAM,QAAQ,YAAY,MAAM,MAAM;AACtC,QAAO;EAAE,GAAG;EAAQ,GAAG;EAAO,GAAG;EAAY"}