(value, name, options)
| 69429 | } |
| 69430 | }; |
| 69431 | } |
| 69432 | |
| 69433 | // node_modules/@anthropic-ai/sdk/uploads.mjs |
| 69434 | var isResponseLike = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function"; |
| 69435 | var isFileLike2 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value); |
| 69436 | var isBlobLike = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function"; |
| 69437 | async function toFile(value, name, options) { |
| 69438 | value = await value; |
| 69439 | options ?? (options = isFileLike2(value) ? { lastModified: value.lastModified, type: value.type } : {}); |
| 69440 | if (isResponseLike(value)) { |
| 69441 | const blob = await value.blob(); |
| 69442 | name || (name = new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file"); |
| 69443 | return new File2([blob], name, options); |
| 69444 | } |
| 69445 | const bits = await getBytes(value); |
| 69446 | name || (name = getName(value) ?? "unknown_file"); |
| 69447 | if (!options.type) { |
| 69448 | const type2 = bits[0]?.type; |
| 69449 | if (typeof type2 === "string") { |
| 69450 | options = { ...options, type: type2 }; |
| 69451 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…