{"version":3,"file":"toolArguments.mjs","names":[],"sources":["../../../../../src/plugins/AIComponents/MessageParts/toolArguments.ts"],"sourcesContent":["// How a tool call's arguments read for people. Not exported from the package: `AIToolArguments`\n// and `AIToolApprover.argumentsPreview` are how an app shows or formats them.\n\n/** A call's arguments as people read them: JSON, indented, or `undefined` when there are none. */\nexport const formatToolArguments = (args: unknown): string | undefined => {\n  if (args === undefined || args === null || args === '') return undefined;\n  if (typeof args === 'object' && Object.keys(args).length === 0) return undefined;\n  if (typeof args === 'string') {\n    try {\n      return formatToolArguments(JSON.parse(args) as unknown);\n    } catch {\n      return args;\n    }\n  }\n  try {\n    return JSON.stringify(args, null, 2);\n  } catch {\n    return String(args);\n  }\n};\n"],"mappings":";;AAIA,IAAa,uBAAuB,SAAsC;CACxE,IAAI,SAAS,KAAA,KAAa,SAAS,QAAQ,SAAS,IAAI,OAAO,KAAA;CAC/D,IAAI,OAAO,SAAS,YAAY,OAAO,KAAK,IAAI,CAAC,CAAC,WAAW,GAAG,OAAO,KAAA;CACvE,IAAI,OAAO,SAAS,UAClB,IAAI;EACF,OAAO,oBAAoB,KAAK,MAAM,IAAI,CAAY;CACxD,QAAQ;EACN,OAAO;CACT;CAEF,IAAI;EACF,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC;CACrC,QAAQ;EACN,OAAO,OAAO,IAAI;CACpB;AACF"}