{
  "version": 3,
  "sources": ["../../../src/controllers/FormatAmountController/FormatAmountController.ts"],
  "sourcesContent": ["import { stringIsInteger, stringIsFloat, formatAmount } from 'lib/sdkDappUtils';\nimport { FormatAmountControllerPropsType, FormatedAmountType } from './types';\n\nexport class FormatAmountController {\n  public static getData(\n    props: FormatAmountControllerPropsType\n  ): FormatedAmountType {\n    const { input } = props;\n\n    if (!input || !stringIsInteger(input)) {\n      return {\n        isValid: false,\n        label: this.getLabel(props),\n        valueInteger: '0',\n        valueDecimal: this.formatDecimalPart('0', props.digits)\n      };\n    }\n\n    const formattedAmount = formatAmount(props);\n    const isValid = stringIsFloat(formattedAmount.replaceAll(',', ''));\n    const [valueInteger, valueDecimal] = formattedAmount.split('.');\n\n    return {\n      isValid,\n      label: this.getLabel(props),\n      valueInteger: valueInteger || '0',\n      valueDecimal: this.formatDecimalPart(valueDecimal, props.digits)\n    };\n  }\n\n  private static getLabel(props: FormatAmountControllerPropsType): string {\n    return ` ${props.token ?? props.egldLabel ?? ''}`.trimEnd();\n  }\n\n  private static formatDecimalPart(decimalPart = '', digits = 2): string {\n    const padded = decimalPart.padEnd(digits, '0').slice(0, digits);\n    return `.${padded || '0'.repeat(digits)}`;\n  }\n}\n"],
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA6D,4BAGtD,MAAMF,CAAuB,CAClC,OAAc,QACZG,EACoB,CACpB,KAAM,CAAE,MAAAC,CAAM,EAAID,EAElB,GAAI,CAACC,GAAS,IAAC,mBAAgBA,CAAK,EAClC,MAAO,CACL,QAAS,GACT,MAAO,KAAK,SAASD,CAAK,EAC1B,aAAc,IACd,aAAc,KAAK,kBAAkB,IAAKA,EAAM,MAAM,CACxD,EAGF,MAAME,KAAkB,gBAAaF,CAAK,EACpCG,KAAU,iBAAcD,EAAgB,WAAW,IAAK,EAAE,CAAC,EAC3D,CAACE,EAAcC,CAAY,EAAIH,EAAgB,MAAM,GAAG,EAE9D,MAAO,CACL,QAAAC,EACA,MAAO,KAAK,SAASH,CAAK,EAC1B,aAAcI,GAAgB,IAC9B,aAAc,KAAK,kBAAkBC,EAAcL,EAAM,MAAM,CACjE,CACF,CAEA,OAAe,SAASA,EAAgD,CACtE,MAAO,IAAIA,EAAM,OAASA,EAAM,WAAa,EAAE,GAAG,QAAQ,CAC5D,CAEA,OAAe,kBAAkBM,EAAc,GAAIC,EAAS,EAAW,CAErE,MAAO,IADQD,EAAY,OAAOC,EAAQ,GAAG,EAAE,MAAM,EAAGA,CAAM,GACzC,IAAI,OAAOA,CAAM,CAAC,EACzC,CACF",
  "names": ["FormatAmountController_exports", "__export", "FormatAmountController", "__toCommonJS", "import_sdkDappUtils", "props", "input", "formattedAmount", "isValid", "valueInteger", "valueDecimal", "decimalPart", "digits"]
}
