{
  "version": 3,
  "sources": ["../../src/utils/transactions/getDecodedDataField/helpers/getDisplayValueAndValidationWarnings.ts"],
  "sourcesContent": ["import {\n  DecodeMethodEnum,\n  DecodedDisplayType\n} from 'types/serverTransactions.types';\nimport { decodeByMethod } from './decodeByMethod';\nimport { getHexValidationWarnings } from './getHexValidationWarnings';\nimport { getSmartDecodedParts } from './getSmartDecodedParts';\n\ninterface IGetDisplayValueAndValidationWarnings {\n  parts: string[];\n  decodeMethod: DecodeMethodEnum;\n  decodedData: DecodedDisplayType;\n  identifier?: string;\n}\n\nexport const getDisplayValueAndValidationWarnings = ({\n  parts,\n  decodeMethod,\n  decodedData,\n  identifier\n}: IGetDisplayValueAndValidationWarnings) => {\n  const initialDecodedParts = parts.map((part, index) => {\n    if (\n      parts.length >= 2 &&\n      ((index === 0 && part.length < 64) || (index === 1 && !parts[0]))\n    ) {\n      const encodedDisplayValue = /[^a-z0-9]/gi.test(part);\n\n      if (encodedDisplayValue) {\n        return decodeByMethod({ data: part, decodeMethod });\n      }\n\n      return part;\n    }\n\n    const hexValidationWarnings = getHexValidationWarnings(part);\n\n    if (hexValidationWarnings?.length) {\n      decodedData.validationWarnings = Array.from(\n        new Set([...decodedData.validationWarnings, ...hexValidationWarnings])\n      );\n    }\n\n    return decodeByMethod({ data: part, decodeMethod });\n  });\n\n  const decodedParts =\n    decodeMethod === DecodeMethodEnum.smart\n      ? getSmartDecodedParts({\n          parts,\n          decodedParts: initialDecodedParts,\n          identifier\n        })\n      : initialDecodedParts;\n\n  return decodedParts;\n};\n"],
  "mappings": "sHAeO,IAAMA,EAAuC,CAAC,CACnD,MAAAC,EACA,aAAAC,EACA,YAAAC,EACA,WAAAC,CACF,IAA6C,CAC3C,IAAMC,EAAsBJ,EAAM,IAAI,CAACK,EAAMC,IAAU,CACrD,GACEN,EAAM,QAAU,IACdM,IAAU,GAAKD,EAAK,OAAS,IAAQC,IAAU,GAAK,CAACN,EAAM,CAAC,GAI9D,MAF4B,cAAc,KAAKK,CAAI,EAG1CE,EAAe,CAAE,KAAMF,EAAM,aAAAJ,CAAa,CAAC,EAG7CI,EAGT,IAAMG,EAAwBC,EAAyBJ,CAAI,EAE3D,OAAIG,GAAuB,SACzBN,EAAY,mBAAqB,MAAM,KACrC,IAAI,IAAI,CAAC,GAAGA,EAAY,mBAAoB,GAAGM,CAAqB,CAAC,CACvE,GAGKD,EAAe,CAAE,KAAMF,EAAM,aAAAJ,CAAa,CAAC,CACpD,CAAC,EAWD,OAREA,YACIS,EAAqB,CACnB,MAAAV,EACA,aAAcI,EACd,WAAAD,CACF,CAAC,EACDC,CAGR",
  "names": ["getDisplayValueAndValidationWarnings", "parts", "decodeMethod", "decodedData", "identifier", "initialDecodedParts", "part", "index", "decodeByMethod", "hexValidationWarnings", "getHexValidationWarnings", "getSmartDecodedParts"]
}
