{"version":3,"file":"_httpParameterReadBigint.mjs","names":[],"sources":["../../src/internal/_httpParameterReadBigint.ts"],"sourcesContent":["/**\n * Read one path parameter as a bigint.\n *\n * `null` is null, blank text is kept as text so the assertion rejects it, and\n * other text is converted when it parses.\n *\n * @evidence contracts/common.md#principled-implementation The text `null` is null, blank text stays text so the assertion rejects it and does not read as zero, and other text is converted with BigInt where it parses.\n * @evidence contracts/common.md#clear-and-simple-design One conditional and one private converter.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts The blank rule follows the cited issue.\n * @evidence contracts/common.md#meaningful-documentation A comment states the cases.\n */\nexport const _httpParameterReadBigint = (value: string) =>\n  value !== \"null\" ? toBigint(value) : null;\n\nconst toBigint = (str: string): bigint | string => {\n  // Blank text stays text, so the assertion rejects it: `BigInt(\" \")` is 0n,\n  // which read a blank path segment as a real zero (#2448).\n  if (str.trim().length === 0) return str;\n  try {\n    return BigInt(str);\n  } catch {\n    return str;\n  }\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,4BAA4B,UACvC,UAAU,SAAS,SAAS,KAAK,IAAI;AAEvC,MAAM,YAAY,QAAiC;CAGjD,IAAI,IAAI,KAAK,CAAC,CAAC,WAAW,GAAG,OAAO;CACpC,IAAI;EACF,OAAO,OAAO,GAAG;CACnB,QAAQ;EACN,OAAO;CACT;AACF"}