{"version":3,"file":"stringifyTruncated.js","names":["stringifyTruncated","value","maxLength","stringifiedJSON","JSON","stringify","totalChars","length","substring"],"sources":["../../src/utilities/stringifyTruncated.ts"],"sourcesContent":["/**\n * Safely stringify a value and truncate it to a maximum length.\n *\n * Converts any value to a JSON string representation and truncates the resulting\n * string if it exceeds the maximum length. If truncation occurs, an ellipsis (…)\n * is appended to indicate incomplete output.\n *\n * @param value - The value to stringify (can be any type including objects, arrays, primitives)\n * @param maxLength - The maximum character length of the output string\n * @returns A JSON string representation, truncated with \"…\" if it exceeds maxLength\n */\nexport function stringifyTruncated(value: unknown, maxLength: number): string {\n const stringifiedJSON = JSON.stringify(value)\n const totalChars = stringifiedJSON.length\n\n // Only truncate if the string is significantly longer (>1.5x the max length)\n if (totalChars / maxLength > 1.5) {\n return `${stringifiedJSON.substring(0, maxLength)}\\u2026`\n }\n\n return stringifiedJSON\n}\n"],"mappings":"AAAA;;;;;;;;;;GAWA,OAAO,SAASA,mBAAmBC,KAAc,EAAEC,SAAiB;EAClE,MAAMC,eAAA,GAAkBC,IAAA,CAAKC,SAAS,CAACJ,KAAA;EACvC,MAAMK,UAAA,GAAaH,eAAA,CAAgBI,MAAM;EAEzC;EACA,IAAID,UAAA,GAAaJ,SAAA,GAAY,KAAK;IAChC,OAAO,GAAGC,eAAA,CAAgBK,SAAS,CAAC,GAAGN,SAAA,SAAkB;EAC3D;EAEA,OAAOC,eAAA;AACT","ignoreList":[]}