{"ast":null,"code":"import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"children\", \"size\", \"style\", \"theme\", \"visible\"],\n  _excluded2 = [\"backgroundColor\"];\nfunction _extends() {\n  return _extends = Object.assign ? Object.assign.bind() : function (n) {\n    for (var e = 1; e < arguments.length; e++) {\n      var t = arguments[e];\n      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n    }\n    return n;\n  }, _extends.apply(null, arguments);\n}\nimport * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport useWindowDimensions from \"react-native-web/dist/exports/useWindowDimensions\";\nimport { useInternalTheme } from \"../core/theming\";\nimport { black, white } from \"../styles/themes/v2/colors\";\nimport getContrastingColor from \"../utils/getContrastingColor\";\nconst defaultSize = 20;\nconst Badge = _ref => {\n  let {\n      children,\n      size = defaultSize,\n      style,\n      theme: themeOverrides,\n      visible = true\n    } = _ref,\n    rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n  var _theme$colors;\n  const theme = useInternalTheme(themeOverrides);\n  const {\n    current: opacity\n  } = React.useRef(new Animated.Value(visible ? 1 : 0));\n  const {\n    fontScale\n  } = useWindowDimensions();\n  const isFirstRendering = React.useRef(true);\n  const {\n    animation: {\n      scale\n    }\n  } = theme;\n  React.useEffect(() => {\n    if (isFirstRendering.current) {\n      isFirstRendering.current = false;\n      return;\n    }\n    Animated.timing(opacity, {\n      toValue: visible ? 1 : 0,\n      duration: 150 * scale,\n      useNativeDriver: true\n    }).start();\n  }, [visible, opacity, scale]);\n  const _ref2 = StyleSheet.flatten(style) || {},\n    {\n      backgroundColor = theme.isV3 ? theme.colors.error : (_theme$colors = theme.colors) === null || _theme$colors === void 0 ? void 0 : _theme$colors.notification\n    } = _ref2,\n    restStyle = _objectWithoutPropertiesLoose(_ref2, _excluded2);\n  const textColor = theme.isV3 ? theme.colors.onError : getContrastingColor(backgroundColor, white, black);\n  const borderRadius = size / 2;\n  const paddingHorizontal = theme.isV3 ? 3 : 4;\n  return React.createElement(Animated.Text, _extends({\n    numberOfLines: 1,\n    style: [Object.assign({\n      opacity,\n      backgroundColor,\n      color: textColor,\n      fontSize: size * 0.5\n    }, !theme.isV3 && theme.fonts.regular, {\n      lineHeight: size / fontScale,\n      height: size,\n      minWidth: size,\n      borderRadius,\n      paddingHorizontal\n    }), styles.container, restStyle]\n  }, rest), children);\n};\nexport default Badge;\nconst styles = StyleSheet.create({\n  container: {\n    alignSelf: 'flex-end',\n    textAlign: 'center',\n    textAlignVertical: 'center',\n    overflow: 'hidden'\n  }\n});","map":{"version":3,"names":["React","Animated","StyleSheet","useWindowDimensions","useInternalTheme","black","white","getContrastingColor","defaultSize","Badge","_ref","children","size","style","theme","themeOverrides","visible","rest","_objectWithoutPropertiesLoose","_excluded","_theme$colors","current","opacity","useRef","Value","fontScale","isFirstRendering","animation","scale","useEffect","timing","toValue","duration","useNativeDriver","start","_ref2","flatten","backgroundColor","isV3","colors","error","notification","restStyle","_excluded2","textColor","onError","borderRadius","paddingHorizontal","createElement","Text","_extends","numberOfLines","Object","assign","color","fontSize","fonts","regular","lineHeight","height","minWidth","styles","container","create","alignSelf","textAlign","textAlignVertical","overflow"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Badge.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n  Animated,\n  StyleProp,\n  StyleSheet,\n  TextStyle,\n  useWindowDimensions,\n} from 'react-native';\n\nimport { useInternalTheme } from '../core/theming';\nimport { black, white } from '../styles/themes/v2/colors';\nimport type { ThemeProp } from '../types';\nimport getContrastingColor from '../utils/getContrastingColor';\n\nconst defaultSize = 20;\n\nexport type Props = React.ComponentProps<typeof Animated.Text> & {\n  /**\n   * Whether the badge is visible\n   */\n  visible?: boolean;\n  /**\n   * Content of the `Badge`.\n   */\n  children?: string | number;\n  /**\n   * Size of the `Badge`.\n   */\n  size?: number;\n  style?: StyleProp<TextStyle>;\n  ref?: React.RefObject<typeof Animated.Text>;\n  /**\n   * @optional\n   */\n  theme?: ThemeProp;\n};\n\n/**\n * Badges are small status descriptors for UI elements.\n * A badge consists of a small circle, typically containing a number or other short set of characters, that appears in proximity to another object.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { Badge } from 'react-native-paper';\n *\n * const MyComponent = () => (\n *   <Badge>3</Badge>\n * );\n *\n * export default MyComponent;\n * ```\n */\nconst Badge = ({\n  children,\n  size = defaultSize,\n  style,\n  theme: themeOverrides,\n  visible = true,\n  ...rest\n}: Props) => {\n  const theme = useInternalTheme(themeOverrides);\n  const { current: opacity } = React.useRef<Animated.Value>(\n    new Animated.Value(visible ? 1 : 0)\n  );\n  const { fontScale } = useWindowDimensions();\n\n  const isFirstRendering = React.useRef<boolean>(true);\n\n  const {\n    animation: { scale },\n  } = theme;\n\n  React.useEffect(() => {\n    // Do not run animation on very first rendering\n    if (isFirstRendering.current) {\n      isFirstRendering.current = false;\n      return;\n    }\n\n    Animated.timing(opacity, {\n      toValue: visible ? 1 : 0,\n      duration: 150 * scale,\n      useNativeDriver: true,\n    }).start();\n  }, [visible, opacity, scale]);\n\n  const {\n    backgroundColor = theme.isV3\n      ? theme.colors.error\n      : theme.colors?.notification,\n    ...restStyle\n  } = (StyleSheet.flatten(style) || {}) as TextStyle;\n\n  const textColor = theme.isV3\n    ? theme.colors.onError\n    : getContrastingColor(backgroundColor, white, black);\n\n  const borderRadius = size / 2;\n\n  const paddingHorizontal = theme.isV3 ? 3 : 4;\n\n  return (\n    <Animated.Text\n      numberOfLines={1}\n      style={[\n        {\n          opacity,\n          backgroundColor,\n          color: textColor,\n          fontSize: size * 0.5,\n          ...(!theme.isV3 && theme.fonts.regular),\n          lineHeight: size / fontScale,\n          height: size,\n          minWidth: size,\n          borderRadius,\n          paddingHorizontal,\n        },\n        styles.container,\n        restStyle,\n      ]}\n      {...rest}\n    >\n      {children}\n    </Animated.Text>\n  );\n};\n\nexport default Badge;\n\nconst styles = StyleSheet.create({\n  container: {\n    alignSelf: 'flex-end',\n    textAlign: 'center',\n    textAlignVertical: 'center',\n    overflow: 'hidden',\n  },\n});\n"],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,QAAA;AAAA,OAAAC,UAAA;AAAA,OAAAC,mBAAA;AAS9B,SAASC,gBAAgB;AACzB,SAASC,KAAK,EAAEC,KAAK;AAErB,OAAOC,mBAAmB;AAE1B,MAAMC,WAAW,GAAG,EAAE;AAuCtB,MAAMC,KAAK,GAAGC,IAAA,IAOD;EAAA,IAPE;MACbC,QAAQ;MACRC,IAAI,GAAGJ,WAAW;MAClBK,KAAK;MACLC,KAAK,EAAEC,cAAc;MACrBC,OAAO,GAAG;IAEL,CAAC,GAAAN,IAAA;IADHO,IAAA,GAAAC,6BAAA,CAAAR,IAAA,EAAAS,SAAA;EACQ,IAAAC,aAAA;EACX,MAAMN,KAAK,GAAGV,gBAAgB,CAACW,cAAc,CAAC;EAC9C,MAAM;IAAEM,OAAO,EAAEC;EAAQ,CAAC,GAAGtB,KAAK,CAACuB,MAAM,CACvC,IAAItB,QAAQ,CAACuB,KAAK,CAACR,OAAO,GAAG,CAAC,GAAG,CAAC,CACpC,CAAC;EACD,MAAM;IAAES;EAAU,CAAC,GAAGtB,mBAAmB,CAAC,CAAC;EAE3C,MAAMuB,gBAAgB,GAAG1B,KAAK,CAACuB,MAAM,CAAU,IAAI,CAAC;EAEpD,MAAM;IACJI,SAAS,EAAE;MAAEC;IAAM;EACrB,CAAC,GAAGd,KAAK;EAETd,KAAK,CAAC6B,SAAS,CAAC,MAAM;IAEpB,IAAIH,gBAAgB,CAACL,OAAO,EAAE;MAC5BK,gBAAgB,CAACL,OAAO,GAAG,KAAK;MAChC;IACF;IAEApB,QAAQ,CAAC6B,MAAM,CAACR,OAAO,EAAE;MACvBS,OAAO,EAAEf,OAAO,GAAG,C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