{"ast":null,"code":"import Platform from \"react-native-web/dist/exports/Platform\";\nimport setColor from 'color';\nimport { grey400, grey800, grey50, grey700, white, black } from \"../../styles/themes/v2/colors\";\nconst getCheckedColor = ({\n  theme,\n  color\n}) => {\n  if (color) {\n    return color;\n  }\n  if (theme.isV3) {\n    return theme.colors.primary;\n  }\n  return theme.colors.accent;\n};\nconst getThumbTintColor = ({\n  theme,\n  disabled,\n  value,\n  checkedColor\n}) => {\n  const isIOS = Platform.OS === 'ios';\n  if (isIOS) {\n    return undefined;\n  }\n  if (disabled) {\n    if (theme.dark) {\n      return grey800;\n    }\n    return grey400;\n  }\n  if (value) {\n    return checkedColor;\n  }\n  if (theme.dark) {\n    return grey400;\n  }\n  return grey50;\n};\nconst getOnTintColor = ({\n  theme,\n  disabled,\n  value,\n  checkedColor\n}) => {\n  const isIOS = Platform.OS === 'ios';\n  if (isIOS) {\n    return checkedColor;\n  }\n  if (disabled) {\n    if (theme.dark) {\n      if (theme.isV3) {\n        return setColor(white).alpha(0.06).rgb().string();\n      }\n      return setColor(white).alpha(0.1).rgb().string();\n    }\n    return setColor(black).alpha(0.12).rgb().string();\n  }\n  if (value) {\n    return setColor(checkedColor).alpha(0.5).rgb().string();\n  }\n  if (theme.dark) {\n    return grey700;\n  }\n  return 'rgb(178, 175, 177)';\n};\nexport const getSwitchColor = ({\n  theme,\n  disabled,\n  value,\n  color\n}) => {\n  const checkedColor = getCheckedColor({\n    theme,\n    color\n  });\n  return {\n    onTintColor: getOnTintColor({\n      theme,\n      disabled,\n      value,\n      checkedColor\n    }),\n    thumbTintColor: getThumbTintColor({\n      theme,\n      disabled,\n      value,\n      checkedColor\n    }),\n    checkedColor\n  };\n};","map":{"version":3,"names":["setColor","grey400","grey800","grey50","grey700","white","black","getCheckedColor","theme","color","isV3","colors","primary","accent","getThumbTintColor","disabled","value","checkedColor","isIOS","Platform","OS","undefined","dark","getOnTintColor","alpha","rgb","string","getSwitchColor","onTintColor","thumbTintColor"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Switch/utils.ts"],"sourcesContent":["import { Platform } from 'react-native';\n\nimport setColor from 'color';\n\nimport {\n  grey400,\n  grey800,\n  grey50,\n  grey700,\n  white,\n  black,\n} from '../../styles/themes/v2/colors';\nimport type { InternalTheme } from '../../types';\n\ntype BaseProps = {\n  theme: InternalTheme;\n  disabled?: boolean;\n  value?: boolean;\n};\n\nconst getCheckedColor = ({\n  theme,\n  color,\n}: {\n  theme: InternalTheme;\n  color?: string;\n}) => {\n  if (color) {\n    return color;\n  }\n\n  if (theme.isV3) {\n    return theme.colors.primary;\n  }\n\n  return theme.colors.accent;\n};\n\nconst getThumbTintColor = ({\n  theme,\n  disabled,\n  value,\n  checkedColor,\n}: BaseProps & { checkedColor: string }) => {\n  const isIOS = Platform.OS === 'ios';\n\n  if (isIOS) {\n    return undefined;\n  }\n\n  if (disabled) {\n    if (theme.dark) {\n      return grey800;\n    }\n    return grey400;\n  }\n\n  if (value) {\n    return checkedColor;\n  }\n\n  if (theme.dark) {\n    return grey400;\n  }\n  return grey50;\n};\n\nconst getOnTintColor = ({\n  theme,\n  disabled,\n  value,\n  checkedColor,\n}: BaseProps & { checkedColor: string }) => {\n  const isIOS = Platform.OS === 'ios';\n\n  if (isIOS) {\n    return checkedColor;\n  }\n\n  if (disabled) {\n    if (theme.dark) {\n      if (theme.isV3) {\n        return setColor(white).alpha(0.06).rgb().string();\n      }\n      return setColor(white).alpha(0.1).rgb().string();\n    }\n    return setColor(black).alpha(0.12).rgb().string();\n  }\n\n  if (value) {\n    return setColor(checkedColor).alpha(0.5).rgb().string();\n  }\n\n  if (theme.dark) {\n    return grey700;\n  }\n  return 'rgb(178, 175, 177)';\n};\n\nexport const getSwitchColor = ({\n  theme,\n  disabled,\n  value,\n  color,\n}: BaseProps & { color?: string }) => {\n  const checkedColor = getCheckedColor({ theme, color });\n\n  return {\n    onTintColor: getOnTintColor({ theme, disabled, value, checkedColor }),\n    thumbTintColor: getThumbTintColor({ theme, disabled, value, checkedColor }),\n    checkedColor,\n  };\n};\n"],"mappings":";AAEA,OAAOA,QAAQ,MAAM,OAAO;AAE5B,SACEC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,OAAO,EACPC,KAAK,EACLC,KAAK;AAUP,MAAMC,eAAe,GAAGA,CAAC;EACvBC,KAAK;EACLC;AAIF,CAAC,KAAK;EACJ,IAAIA,KAAK,EAAE;IACT,OAAOA,KAAK;EACd;EAEA,IAAID,KAAK,CAACE,IAAI,EAAE;IACd,OAAOF,KAAK,CAACG,MAAM,CAACC,OAAO;EAC7B;EAEA,OAAOJ,KAAK,CAACG,MAAM,CAACE,MAAM;AAC5B,CAAC;AAED,MAAMC,iBAAiB,GAAGA,CAAC;EACzBN,KAAK;EACLO,QAAQ;EACRC,KAAK;EACLC;AACoC,CAAC,KAAK;EAC1C,MAAMC,KAAK,GAAGC,QAAQ,CAACC,EAAE,KAAK,KAAK;EAEnC,IAAIF,KAAK,EAAE;IACT,OAAOG,SAAS;EAClB;EAEA,IAAIN,QAAQ,EAAE;IACZ,IAAIP,KAAK,CAACc,IAAI,EAAE;MACd,OAAOpB,OAAO;IAChB;IACA,OAAOD,OAAO;EAChB;EAEA,IAAIe,KAAK,EAAE;IACT,OAAOC,YAAY;EACrB;EAEA,IAAIT,KAAK,CAACc,IAAI,EAAE;IACd,OAAOrB,OAAO;EAChB;EACA,OAAOE,MAAM;AACf,CAAC;AAED,MAAMoB,cAAc,GAAGA,CAAC;EACtBf,KAAK;EACLO,QAAQ;EACRC,KAAK;EACLC;AACoC,CAAC,KAAK;EAC1C,MAAMC,KAAK,GAAGC,QAAQ,CAACC,EAAE,KAAK,KAAK;EAEnC,IAAIF,KAAK,EAAE;IACT,OAAOD,YAAY;EACrB;EAEA,IAAIF,QAAQ,EAAE;IACZ,IAAIP,KAAK,CAACc,IAAI,EAAE;MACd,IAAId,KAAK,CAACE,IAAI,EAAE;QACd,OAAOV,QAAQ,CAACK,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