{"ast":null,"code":"import color from 'color';\nimport { black, white } from \"../../styles/themes/v2/colors\";\nexport const getCardCoverStyle = ({\n  theme,\n  index,\n  total,\n  borderRadiusStyles\n}) => {\n  const {\n    isV3,\n    roundness\n  } = theme;\n  if (Object.keys(borderRadiusStyles).length > 0) {\n    return Object.assign({\n      borderRadius: 3 * roundness\n    }, borderRadiusStyles);\n  }\n  if (isV3) {\n    return {\n      borderRadius: 3 * roundness\n    };\n  }\n  if (index === 0) {\n    if (total === 1) {\n      return {\n        borderRadius: roundness\n      };\n    }\n    return {\n      borderTopLeftRadius: roundness,\n      borderTopRightRadius: roundness\n    };\n  }\n  if (typeof total === 'number' && index === total - 1) {\n    return {\n      borderBottomLeftRadius: roundness\n    };\n  }\n  return undefined;\n};\nconst getBorderColor = ({\n  theme\n}) => {\n  if (theme.isV3) {\n    return theme.colors.outline;\n  }\n  if (theme.dark) {\n    return color(white).alpha(0.12).rgb().string();\n  }\n  return color(black).alpha(0.12).rgb().string();\n};\nconst getBackgroundColor = ({\n  theme,\n  isMode\n}) => {\n  if (theme.isV3) {\n    if (isMode('contained')) {\n      return theme.colors.surfaceVariant;\n    }\n    if (isMode('outlined')) {\n      return theme.colors.surface;\n    }\n  }\n  return undefined;\n};\nexport const getCardColors = ({\n  theme,\n  mode\n}) => {\n  const isMode = modeToCompare => {\n    return mode === modeToCompare;\n  };\n  return {\n    backgroundColor: getBackgroundColor({\n      theme,\n      isMode\n    }),\n    borderColor: getBorderColor({\n      theme\n    })\n  };\n};","map":{"version":3,"names":["color","black","white","getCardCoverStyle","theme","index","total","borderRadiusStyles","isV3","roundness","Object","keys","length","assign","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","undefined","getBorderColor","colors","outline","dark","alpha","rgb","string","getBackgroundColor","isMode","surfaceVariant","surface","getCardColors","mode","modeToCompare","backgroundColor","borderColor"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Card/utils.tsx"],"sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nimport color from 'color';\n\nimport { black, white } from '../../styles/themes/v2/colors';\nimport type { InternalTheme } from '../../types';\n\ntype CardMode = 'elevated' | 'outlined' | 'contained';\n\ntype BorderRadiusStyles = Pick<\n  ViewStyle,\n  Extract<keyof ViewStyle, `border${string}Radius`>\n>;\n\nexport type CardActionChildProps = {\n  compact?: boolean;\n  mode?: string;\n  style?: StyleProp<ViewStyle>;\n};\n\nexport const getCardCoverStyle = ({\n  theme,\n  index,\n  total,\n  borderRadiusStyles,\n}: {\n  theme: InternalTheme;\n  borderRadiusStyles: BorderRadiusStyles;\n  index?: number;\n  total?: number;\n}) => {\n  const { isV3, roundness } = theme;\n\n  if (Object.keys(borderRadiusStyles).length > 0) {\n    return {\n      borderRadius: 3 * roundness,\n      ...borderRadiusStyles,\n    };\n  }\n\n  if (isV3) {\n    return {\n      borderRadius: 3 * roundness,\n    };\n  }\n\n  if (index === 0) {\n    if (total === 1) {\n      return {\n        borderRadius: roundness,\n      };\n    }\n\n    return {\n      borderTopLeftRadius: roundness,\n      borderTopRightRadius: roundness,\n    };\n  }\n\n  if (typeof total === 'number' && index === total - 1) {\n    return {\n      borderBottomLeftRadius: roundness,\n    };\n  }\n\n  return undefined;\n};\n\nconst getBorderColor = ({ theme }: { theme: InternalTheme }) => {\n  if (theme.isV3) {\n    return theme.colors.outline;\n  }\n\n  if (theme.dark) {\n    return color(white).alpha(0.12).rgb().string();\n  }\n  return color(black).alpha(0.12).rgb().string();\n};\n\nconst getBackgroundColor = ({\n  theme,\n  isMode,\n}: {\n  theme: InternalTheme;\n  isMode: (mode: CardMode) => boolean;\n}) => {\n  if (theme.isV3) {\n    if (isMode('contained')) {\n      return theme.colors.surfaceVariant;\n    }\n    if (isMode('outlined')) {\n      return theme.colors.surface;\n    }\n  }\n  return undefined;\n};\n\nexport const getCardColors = ({\n  theme,\n  mode,\n}: {\n  theme: InternalTheme;\n  mode: CardMode;\n}) => {\n  const isMode = (modeToCompare: CardMode) => {\n    return mode === modeToCompare;\n  };\n\n  return {\n    backgroundColor: getBackgroundColor({\n      theme,\n      isMode,\n    }),\n    borderColor: getBorderColor({ theme }),\n  };\n};\n"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,EAAEC,KAAK;AAgBrB,OAAO,MAAMC,iBAAiB,GAAGA,CAAC;EAChCC,KAAK;EACLC,KAAK;EACLC,KAAK;EACLC;AAMF,CAAC,KAAK;EACJ,MAAM;IAAEC,IAAI;IAAEC;EAAU,CAAC,GAAGL,KAAK;EAEjC,IAAIM,MAAM,CAACC,IAAI,CAACJ,kBAAkB,CAAC,CAACK,MAAM,GAAG,CAAC,EAAE;IAC9C,OAAAF,MAAA,CAAAG,MAAA;MACEC,YAAY,EAAE,CAAC,GAAGL;IAAS,GACxBF,kBAAA;EAEP;EAEA,IAAIC,IAAI,EAAE;IACR,OAAO;MACLM,YAAY,EAAE,CAAC,GAAGL;IACpB,CAAC;EACH;EAEA,IAAIJ,KAAK,KAAK,CAAC,EAAE;IACf,IAAIC,KAAK,KAAK,CAAC,EAAE;MACf,OAAO;QACLQ,YAAY,EAAEL;MAChB,CAAC;IACH;IAEA,OAAO;MACLM,mBAAmB,EAAEN,SAAS;MAC9BO,oBAAoB,EAAEP;IACxB,CAAC;EACH;EAEA,IAAI,OAAOH,KAAK,KAAK,QAAQ,IAAID,KAAK,KAAKC,KAAK,GAAG,CAAC,EAAE;IACpD,OAAO;MACLW,sBAAsB,EAAER;IAC1B,CAAC;EACH;EAEA,OAAOS,SAAS;AAClB,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAC;EAAEf;AAAgC,CAAC,KAAK;EAC9D,IAAIA,KAAK,CAACI,IAAI,EAAE;IACd,OAAOJ,KAAK,CAACgB,MAAM,CAACC,OAAO;EAC7B;EAEA,IAAIjB,KAAK,CAACkB,IAAI,EAAE;IACd,OAAOtB,KAAK,CAACE,KAAK,CAAC,CAACqB,KAA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