@codemation/core-nodes-ocr 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{analyzeInvoiceNode-BqZsN8iL.js → analyzeInvoiceNode-BQzww-XC.js} +1 -9
  3. package/dist/analyzeInvoiceNode-BQzww-XC.js.map +1 -0
  4. package/dist/{analyzeInvoiceNode-CmMsifbw.cjs → analyzeInvoiceNode-CW_SXNQf.cjs} +1 -9
  5. package/dist/analyzeInvoiceNode-CW_SXNQf.cjs.map +1 -0
  6. package/dist/codemation.plugin.cjs +1204 -14695
  7. package/dist/codemation.plugin.cjs.map +1 -1
  8. package/dist/codemation.plugin.d.cts +1 -73
  9. package/dist/codemation.plugin.d.ts +1 -58
  10. package/dist/codemation.plugin.js +1248 -14738
  11. package/dist/codemation.plugin.js.map +1 -1
  12. package/dist/dist-BDgdLisG.js +5378 -0
  13. package/dist/dist-BDgdLisG.js.map +1 -0
  14. package/dist/dist-BYInIjS8.js +2246 -0
  15. package/dist/dist-BYInIjS8.js.map +1 -0
  16. package/dist/dist-BlD4pqf2.cjs +4358 -0
  17. package/dist/dist-BlD4pqf2.cjs.map +1 -0
  18. package/dist/dist-CUcwHflE.cjs +14870 -0
  19. package/dist/dist-CUcwHflE.cjs.map +1 -0
  20. package/dist/dist-DB2xMXXm.cjs +5380 -0
  21. package/dist/dist-DB2xMXXm.cjs.map +1 -0
  22. package/dist/dist-DBYFkhSG.js +14739 -0
  23. package/dist/dist-DBYFkhSG.js.map +1 -0
  24. package/dist/dist-DZfaPW8T.js +4356 -0
  25. package/dist/dist-DZfaPW8T.js.map +1 -0
  26. package/dist/dist-Zdvm5pqX.cjs +2464 -0
  27. package/dist/dist-Zdvm5pqX.cjs.map +1 -0
  28. package/dist/{index-DF2ht42F.d.ts → index-DdjAAXvy.d.ts} +18 -274
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.cts +15 -35
  31. package/dist/index.d.ts +7 -29
  32. package/dist/index.js +1 -1
  33. package/dist/metadata.json +1 -1
  34. package/dist/{runtimeTypes-WCvsnJMY.d.cts → runtimeTypes-D_9j5Pat.d.cts} +10 -253
  35. package/dist/{token-CgF09kyP.cjs → token-Cbd8b88n.cjs} +2 -2
  36. package/dist/{token-CgF09kyP.cjs.map → token-Cbd8b88n.cjs.map} +1 -1
  37. package/dist/{token-CIu4PqRI.js → token-P-r3QR1d.js} +2 -2
  38. package/dist/{token-CIu4PqRI.js.map → token-P-r3QR1d.js.map} +1 -1
  39. package/dist/{token-util-B2kSJtEV.cjs → token-util-B2Ofk2zk.cjs} +77 -77
  40. package/dist/token-util-B2Ofk2zk.cjs.map +1 -0
  41. package/dist/{token-util-Lr5foG4r.cjs → token-util-CT85hbGe.cjs} +1 -1
  42. package/dist/{token-util-EUxa8JtH.js → token-util-CfNdwRXi.js} +77 -77
  43. package/dist/token-util-CfNdwRXi.js.map +1 -0
  44. package/dist/token-util-rTxWuZPt.js +5 -0
  45. package/package.json +2 -2
  46. package/src/lib/analyzeWithAzure.ts +0 -9
  47. package/src/nodes/analyzeDocumentNode.ts +0 -9
  48. package/src/nodes/analyzeImageNode.ts +0 -9
  49. package/src/nodes/analyzeInvoiceNode.ts +0 -4
  50. package/dist/analyzeInvoiceNode-BqZsN8iL.js.map +0 -1
  51. package/dist/analyzeInvoiceNode-CmMsifbw.cjs.map +0 -1
  52. package/dist/token-util-B2kSJtEV.cjs.map +0 -1
  53. package/dist/token-util-BsR6OYHz.js +0 -5
  54. package/dist/token-util-EUxa8JtH.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-util-CfNdwRXi.js","names":["__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","import_os","import_token_error","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","fs","path","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS"],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-error.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-config.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/oauth.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-errors.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n return null;\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_config_exports = {};\n__export(auth_config_exports, {\n isValidAccessToken: () => isValidAccessToken,\n readAuthConfig: () => readAuthConfig,\n writeAuthConfig: () => writeAuthConfig\n});\nmodule.exports = __toCommonJS(auth_config_exports);\nvar fs = __toESM(require(\"fs\"));\nvar path = __toESM(require(\"path\"));\nvar import_token_util = require(\"./token-util\");\nfunction getAuthConfigPath() {\n const dataDir = (0, import_token_util.getVercelDataDir)();\n if (!dataDir) {\n throw new Error(\n `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`\n );\n }\n return path.join(dataDir, \"auth.json\");\n}\nfunction readAuthConfig() {\n try {\n const authPath = getAuthConfigPath();\n if (!fs.existsSync(authPath)) {\n return null;\n }\n const content = fs.readFileSync(authPath, \"utf8\");\n if (!content) {\n return null;\n }\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n}\nfunction writeAuthConfig(config) {\n const authPath = getAuthConfigPath();\n const authDir = path.dirname(authPath);\n if (!fs.existsSync(authDir)) {\n fs.mkdirSync(authDir, { mode: 504, recursive: true });\n }\n fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });\n}\nfunction isValidAccessToken(authConfig, expirationBufferMs = 0) {\n if (!authConfig.token)\n return false;\n if (typeof authConfig.expiresAt !== \"number\")\n return true;\n const nowInSeconds = Math.floor(Date.now() / 1e3);\n const bufferInSeconds = expirationBufferMs / 1e3;\n return authConfig.expiresAt >= nowInSeconds + bufferInSeconds;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n isValidAccessToken,\n readAuthConfig,\n writeAuthConfig\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar oauth_exports = {};\n__export(oauth_exports, {\n processTokenResponse: () => processTokenResponse,\n refreshTokenRequest: () => refreshTokenRequest\n});\nmodule.exports = __toCommonJS(oauth_exports);\nvar import_os = require(\"os\");\nconst VERCEL_ISSUER = \"https://vercel.com\";\nconst VERCEL_CLI_CLIENT_ID = \"cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp\";\nconst userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;\nlet _tokenEndpoint = null;\nasync function getTokenEndpoint() {\n if (_tokenEndpoint) {\n return _tokenEndpoint;\n }\n const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;\n const response = await fetch(discoveryUrl, {\n headers: { \"user-agent\": userAgent }\n });\n if (!response.ok) {\n throw new Error(\"Failed to discover OAuth endpoints\");\n }\n const metadata = await response.json();\n if (!metadata || typeof metadata.token_endpoint !== \"string\") {\n throw new Error(\"Invalid OAuth discovery response\");\n }\n const endpoint = metadata.token_endpoint;\n _tokenEndpoint = endpoint;\n return endpoint;\n}\nasync function refreshTokenRequest(options) {\n const tokenEndpoint = await getTokenEndpoint();\n return await fetch(tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"user-agent\": userAgent\n },\n body: new URLSearchParams({\n client_id: VERCEL_CLI_CLIENT_ID,\n grant_type: \"refresh_token\",\n ...options\n })\n });\n}\nasync function processTokenResponse(response) {\n const json = await response.json();\n if (!response.ok) {\n const errorMsg = typeof json === \"object\" && json && \"error\" in json ? String(json.error) : \"Token refresh failed\";\n return [new Error(errorMsg)];\n }\n if (typeof json !== \"object\" || json === null) {\n return [new Error(\"Invalid token response\")];\n }\n if (typeof json.access_token !== \"string\") {\n return [new Error(\"Missing access_token in response\")];\n }\n if (json.token_type !== \"Bearer\") {\n return [new Error(\"Invalid token_type in response\")];\n }\n if (typeof json.expires_in !== \"number\") {\n return [new Error(\"Missing expires_in in response\")];\n }\n return [null, json];\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n processTokenResponse,\n refreshTokenRequest\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_errors_exports = {};\n__export(auth_errors_exports, {\n AccessTokenMissingError: () => AccessTokenMissingError,\n RefreshAccessTokenFailedError: () => RefreshAccessTokenFailedError\n});\nmodule.exports = __toCommonJS(auth_errors_exports);\nclass AccessTokenMissingError extends Error {\n constructor() {\n super(\n \"No authentication found. Please log in with the Vercel CLI (vercel login).\"\n );\n this.name = \"AccessTokenMissingError\";\n }\n}\nclass RefreshAccessTokenFailedError extends Error {\n constructor(cause) {\n super(\"Failed to refresh authentication token.\", { cause });\n this.name = \"RefreshAccessTokenFailedError\";\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AccessTokenMissingError,\n RefreshAccessTokenFailedError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n getVercelToken: () => getVercelToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nvar import_auth_config = require(\"./auth-config\");\nvar import_oauth = require(\"./oauth\");\nvar import_auth_errors = require(\"./auth-errors\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nasync function getVercelToken(options) {\n const authConfig = (0, import_auth_config.readAuthConfig)();\n if (!authConfig?.token) {\n throw new import_auth_errors.AccessTokenMissingError();\n }\n if ((0, import_auth_config.isValidAccessToken)(authConfig, options?.expirationBufferMs)) {\n return authConfig.token;\n }\n if (!authConfig.refreshToken) {\n (0, import_auth_config.writeAuthConfig)({});\n throw new import_auth_errors.RefreshAccessTokenFailedError(\"No refresh token available\");\n }\n try {\n const tokenResponse = await (0, import_oauth.refreshTokenRequest)({\n refresh_token: authConfig.refreshToken\n });\n const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);\n if (tokensError || !tokens) {\n (0, import_auth_config.writeAuthConfig)({});\n throw new import_auth_errors.RefreshAccessTokenFailedError(tokensError);\n }\n const updatedConfig = {\n token: tokens.access_token,\n expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in\n };\n if (tokens.refresh_token) {\n updatedConfig.refreshToken = tokens.refresh_token;\n }\n (0, import_auth_config.writeAuthConfig)(updatedConfig);\n return updatedConfig.token;\n } catch (error) {\n (0, import_auth_config.writeAuthConfig)({});\n if (error instanceof import_auth_errors.AccessTokenMissingError || error instanceof import_auth_errors.RefreshAccessTokenFailedError) {\n throw error;\n }\n throw new import_auth_errors.RefreshAccessTokenFailedError(error);\n }\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again\"\n );\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again\"\n );\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find project root directory. Have you linked your project with `vc link?`\"\n );\n }\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\n \"project.json not found, have you linked your project with `vc link?`\"\n );\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\n \"Expected a string-valued projectId property. Try running `vc link` to re-link your project.\"\n );\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n}\nfunction saveToken(token, projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n}\nfunction loadToken(projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\n \"Invalid token. Please run `vc env pull` and try again\"\n );\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token, bufferMs = 0) {\n return token.exp * 1e3 < Date.now() + bufferMs;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelDataDir,\n getVercelOidcToken,\n getVercelToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACA,IAAIA,cAAY,OAAO;CACvB,IAAIC,qBAAmB,OAAO;CAC9B,IAAIC,sBAAoB,OAAO;CAC/B,IAAIC,iBAAe,OAAO,UAAU;CACpC,IAAIC,cAAY,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,aAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;GAAM,CAAC;;CAEjE,IAAIC,iBAAe,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YACtD;QAAK,IAAI,OAAOH,oBAAkB,KAAK,CACrC,KAAI,CAACC,eAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,aAAU,IAAI,KAAK;IAAE,WAAW,KAAK;IAAM,YAAY,EAAE,OAAOF,mBAAiB,MAAM,IAAI,KAAK,KAAK;IAAY,CAAC;;AAExH,SAAO;;CAET,IAAIK,kBAAgB,QAAQD,cAAYL,YAAU,EAAE,EAAE,cAAc,EAAE,OAAO,MAAM,CAAC,EAAE,IAAI;CAC1F,IAAI,sBAAsB,EAAE;AAC5B,YAAS,qB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G,cAAc,WAAW,UAAU;AACtC,KAAG,UAAU,WAAW,IAAI;;CAG9B,SAAS,UAAU,WAAW;EAC5B,MAAM,OAAO,GAAG,gBAAgB,iBAAiB;AACjD,MAAI,CAAC,IACH,OAAM,IAAI,mBAAmB,qBAC3B,0EACD;EAEH,MAAM,YAAY,KAAK,KAAK,KAAK,oBAAoB,GAAG,UAAU,OAAO;AACzE,MAAI,CAAC,GAAG,WAAW,UAAU,CAC3B,QAAO;EAET,MAAM,QAAQ,KAAK,MAAM,GAAG,aAAa,WAAW,OAAO,CAAC;AAC5D,gCAA8B,MAAM;AACpC,SAAO;;CAET,SAAS,gBAAgB,OAAO;EAC9B,MAAM,aAAa,MAAM,MAAM,IAAI;AACnC,MAAI,WAAW,WAAW,EACxB,OAAM,IAAI,mBAAmB,qBAC3B,wDACD;EAEH,MAAM,SAAS,WAAW,GAAG,QAAQ,MAAM,IAAI,CAAC,QAAQ,MAAM,IAAI;EAClE,MAAM,SAAS,OAAO,OACpB,OAAO,UAAU,IAAI,OAAO,SAAS,KAAK,GAC1C,IACD;AACD,SAAO,KAAK,MAAM,OAAO,KAAK,QAAQ,SAAS,CAAC,SAAS,OAAO,CAAC;;CAEnE,SAAS,UAAU,OAAO,WAAW,GAAG;AACtC,SAAO,MAAM,MAAM,MAAM,KAAK,KAAK,GAAG"}
@@ -0,0 +1,5 @@
1
+ import { t as require_token_util } from "./token-util-CfNdwRXi.js";
2
+
3
+ export default require_token_util();
4
+
5
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/core-nodes-ocr",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Azure AI Content Understanding (OCR) plugin for Codemation — prebuilt document, invoice, and image analyzers.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,7 +44,7 @@
44
44
  "@azure/ai-content-understanding": "^1.0.0",
45
45
  "@azure/core-auth": "^1.10.1",
46
46
  "zod": "^4.3.6",
47
- "@codemation/core": "0.13.2"
47
+ "@codemation/core": "0.15.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^25.3.5",
@@ -16,21 +16,13 @@ import { ContentUnderstandingClient } from "@azure/ai-content-understanding";
16
16
  import { AzureKeyCredential } from "@azure/core-auth";
17
17
  import type { AzureContentUnderstandingSession } from "../credentials/azureContentUnderstandingCredential";
18
18
 
19
- /** Structured analyzer fields: scalars at leaves; nested objects and arrays preserved. */
20
19
  export type OcrStructuredFields = Readonly<Record<string, unknown>>;
21
20
 
22
- /** The output shape returned by all OCR analyzer nodes. */
23
21
  export type OcrAnalysisOutput = Readonly<{
24
- /** Markdown representation of the document content. */
25
22
  content: string;
26
- /** Structured fields extracted by the prebuilt analyzer. */
27
23
  fields: OcrStructuredFields;
28
24
  }>;
29
25
 
30
- /**
31
- * Analyzes a binary document using an Azure Content Understanding prebuilt analyzer.
32
- * Retries on transient failures are handled by the engine via the node's `retryPolicy`.
33
- */
34
26
  export async function analyzeWithAzure(
35
27
  args: Readonly<{
36
28
  session: AzureContentUnderstandingSession;
@@ -45,7 +37,6 @@ export async function analyzeWithAzure(
45
37
  return mapAnalysisResult(result);
46
38
  }
47
39
 
48
- /** @internal Exported for testing — maps a raw AnalysisResult to the node output shape. */
49
40
  export function mapAnalysisResult(result: AnalysisResult): OcrAnalysisOutput {
50
41
  const contents = result.contents ?? [];
51
42
  const markdownParts: string[] = [];
@@ -3,21 +3,12 @@ import type { AzureContentUnderstandingSession } from "../credentials/azureConte
3
3
  import { azureContentUnderstandingCredentialType } from "../credentials/azureContentUnderstandingCredential";
4
4
  import { analyzeWithAzure } from "../lib/analyzeWithAzure";
5
5
 
6
- /** Default Azure Content Understanding prebuilt general document analyzer ID. */
7
6
  const DEFAULT_DOCUMENT_ANALYZER_ID = "prebuilt-document";
8
7
 
9
8
  export type AnalyzeDocumentConfig = Readonly<{
10
- /** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
11
9
  binaryField?: string;
12
- /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
13
10
  contentType?: string;
14
- /**
15
- * Azure Content Understanding analyzer ID to use.
16
- * Defaults to `"prebuilt-document"`. Set this to a custom analyzer ID when you have
17
- * a trained model or need a different prebuilt variant.
18
- */
19
11
  analyzerId?: string;
20
- /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
21
12
  maxBytes?: number;
22
13
  }>;
23
14
 
@@ -3,21 +3,12 @@ import type { AzureContentUnderstandingSession } from "../credentials/azureConte
3
3
  import { azureContentUnderstandingCredentialType } from "../credentials/azureContentUnderstandingCredential";
4
4
  import { analyzeWithAzure } from "../lib/analyzeWithAzure";
5
5
 
6
- /** Default Azure Content Understanding prebuilt image analyzer ID. */
7
6
  const DEFAULT_IMAGE_ANALYZER_ID = "prebuilt-imageAnalyzer";
8
7
 
9
8
  export type AnalyzeImageConfig = Readonly<{
10
- /** Key on `item.binary` that holds the image bytes. Default: `"data"`. */
11
9
  binaryField?: string;
12
- /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
13
10
  contentType?: string;
14
- /**
15
- * Azure Content Understanding analyzer ID to use.
16
- * Defaults to `"prebuilt-imageAnalyzer"`. Set this to a custom analyzer ID when you have
17
- * a trained model or need a different prebuilt variant.
18
- */
19
11
  analyzerId?: string;
20
- /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
21
12
  maxBytes?: number;
22
13
  }>;
23
14
 
@@ -3,15 +3,11 @@ import type { AzureContentUnderstandingSession } from "../credentials/azureConte
3
3
  import { azureContentUnderstandingCredentialType } from "../credentials/azureContentUnderstandingCredential";
4
4
  import { analyzeWithAzure } from "../lib/analyzeWithAzure";
5
5
 
6
- /** Azure Content Understanding prebuilt invoice analyzer ID. */
7
6
  const PREBUILT_INVOICE_ANALYZER_ID = "prebuilt-invoice";
8
7
 
9
8
  export type AnalyzeInvoiceConfig = Readonly<{
10
- /** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
11
9
  binaryField?: string;
12
- /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
13
10
  contentType?: string;
14
- /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
15
11
  maxBytes?: number;
16
12
  }>;
17
13
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeInvoiceNode-BqZsN8iL.js","names":["markdownParts: string[]","out: Record<string, unknown>"],"sources":["../src/credentials/azureContentUnderstandingCredential.ts","../src/lib/analyzeWithAzure.ts","../src/nodes/analyzeDocumentNode.ts","../src/nodes/analyzeImageNode.ts","../src/nodes/analyzeInvoiceNode.ts"],"sourcesContent":["import { ContentUnderstandingClient } from \"@azure/ai-content-understanding\";\nimport { AzureKeyCredential } from \"@azure/core-auth\";\nimport { defineCredential } from \"@codemation/core\";\n\nexport type AzureContentUnderstandingSession = Readonly<{\n endpoint: string;\n apiKey: string;\n}>;\n\nfunction normalizeEndpoint(raw: string): string {\n return raw.trim().replace(/\\/+$/, \"\");\n}\n\nfunction buildSession(args: {\n readonly publicConfig: Readonly<Record<string, unknown>>;\n readonly material: Readonly<Record<string, unknown>>;\n}): AzureContentUnderstandingSession {\n const endpoint = normalizeEndpoint(String(args.publicConfig[\"endpoint\"] ?? \"\"));\n const apiKey = String(args.material[\"apiKey\"] ?? \"\").trim();\n if (!endpoint) {\n throw new Error(\"Azure Content Understanding credential is incomplete: endpoint is required.\");\n }\n if (!apiKey) {\n throw new Error(\"Azure Content Understanding credential is incomplete: API key is required.\");\n }\n return { endpoint, apiKey };\n}\n\nexport const azureContentUnderstandingCredentialType = defineCredential({\n key: \"azure.contentUnderstanding\",\n label: \"Azure Content Understanding\",\n description: \"Azure AI Content Understanding (endpoint + key) for prebuilt document, invoice, and image analyzers.\",\n public: {\n endpoint: {\n key: \"endpoint\",\n label: \"Endpoint\",\n type: \"string\" as const,\n required: true,\n placeholder: \"https://your-resource.cognitiveservices.azure.com/\",\n helpText: \"Content Understanding resource endpoint URL (no trailing slash).\",\n order: 0,\n },\n },\n secret: {\n apiKey: {\n key: \"apiKey\",\n label: \"API key\",\n type: \"password\" as const,\n required: true,\n order: 1,\n },\n },\n async createSession(args) {\n return buildSession(args);\n },\n async test(args) {\n try {\n const session = buildSession(args);\n const client = new ContentUnderstandingClient(session.endpoint, new AzureKeyCredential(session.apiKey));\n const iter = client.listAnalyzers();\n await iter.next();\n return {\n status: \"healthy\",\n message: \"Listed analyzers successfully.\",\n testedAt: new Date().toISOString(),\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n status: \"failing\",\n message: message || \"Azure Content Understanding connection failed.\",\n testedAt: new Date().toISOString(),\n };\n }\n },\n});\n","import type {\n AnalysisResult,\n ArrayField,\n BooleanField,\n ContentField,\n ContentFieldUnion,\n DateField,\n IntegerField,\n JsonField,\n NumberField,\n ObjectField,\n StringField,\n TimeField,\n} from \"@azure/ai-content-understanding\";\nimport { ContentUnderstandingClient } from \"@azure/ai-content-understanding\";\nimport { AzureKeyCredential } from \"@azure/core-auth\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\n\n/** Structured analyzer fields: scalars at leaves; nested objects and arrays preserved. */\nexport type OcrStructuredFields = Readonly<Record<string, unknown>>;\n\n/** The output shape returned by all OCR analyzer nodes. */\nexport type OcrAnalysisOutput = Readonly<{\n /** Markdown representation of the document content. */\n content: string;\n /** Structured fields extracted by the prebuilt analyzer. */\n fields: OcrStructuredFields;\n}>;\n\n/**\n * Analyzes a binary document using an Azure Content Understanding prebuilt analyzer.\n * Retries on transient failures are handled by the engine via the node's `retryPolicy`.\n */\nexport async function analyzeWithAzure(\n args: Readonly<{\n session: AzureContentUnderstandingSession;\n analyzerId: string;\n body: Uint8Array;\n contentType: string;\n }>,\n): Promise<OcrAnalysisOutput> {\n const client = new ContentUnderstandingClient(args.session.endpoint, new AzureKeyCredential(args.session.apiKey));\n const poller = client.analyzeBinary(args.analyzerId, args.body, args.contentType);\n const result = await poller.pollUntilDone();\n return mapAnalysisResult(result);\n}\n\n/** @internal Exported for testing — maps a raw AnalysisResult to the node output shape. */\nexport function mapAnalysisResult(result: AnalysisResult): OcrAnalysisOutput {\n const contents = result.contents ?? [];\n const markdownParts: string[] = [];\n for (const c of contents) {\n if (typeof c.markdown === \"string\" && c.markdown.length > 0) {\n markdownParts.push(c.markdown);\n }\n }\n const content = markdownParts.join(\"\\n\\n\");\n if (contents.length === 0) {\n return { content: \"\", fields: {} };\n }\n if (contents.length === 1) {\n const c = contents[0]!;\n return {\n content,\n fields: c.fields ? fieldsToStructuredMap(c.fields) : {},\n };\n }\n return {\n content,\n fields: {\n segments: contents.map((c, index) => ({\n index,\n markdown: typeof c.markdown === \"string\" && c.markdown.trim().length > 0 ? c.markdown : undefined,\n fields: c.fields ? fieldsToStructuredMap(c.fields) : {},\n })),\n },\n };\n}\n\nfunction fieldsToStructuredMap(fields: Readonly<Record<string, ContentFieldUnion>>): OcrStructuredFields {\n const out: Record<string, unknown> = {};\n for (const [name, field] of Object.entries(fields)) {\n out[name] = fieldToStructuredValue(field);\n }\n return out;\n}\n\nfunction fieldToStructuredValue(field: ContentFieldUnion): unknown {\n const kind = resolveFieldKind(field);\n switch (kind) {\n case \"string\":\n return (field as StringField).value ?? null;\n case \"date\": {\n const d = (field as DateField).value;\n return d ? d.toISOString() : null;\n }\n case \"time\":\n return (field as TimeField).value ?? null;\n case \"number\":\n return (field as NumberField).value ?? null;\n case \"integer\":\n return (field as IntegerField).value ?? null;\n case \"boolean\":\n return (field as BooleanField).value ?? null;\n case \"array\": {\n const values = (field as ArrayField).value ?? [];\n return values.map((element) => fieldToStructuredValue(element));\n }\n case \"object\": {\n const properties = (field as ObjectField).value ?? {};\n return fieldsToStructuredMap(properties);\n }\n case \"json\":\n return (field as JsonField).value ?? null;\n default: {\n const base = field as ContentField;\n if (base.value === undefined || base.value === null) {\n return null;\n }\n return typeof base.value === \"object\" ? base.value : String(base.value);\n }\n }\n}\n\nfunction resolveFieldKind(field: ContentFieldUnion): string {\n if (\"fieldType\" in field && typeof field.fieldType === \"string\") {\n return field.fieldType;\n }\n return (field as ContentField).type;\n}\n","import { defineNode } from \"@codemation/core\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\nimport { azureContentUnderstandingCredentialType } from \"../credentials/azureContentUnderstandingCredential\";\nimport { analyzeWithAzure } from \"../lib/analyzeWithAzure\";\n\n/** Default Azure Content Understanding prebuilt general document analyzer ID. */\nconst DEFAULT_DOCUMENT_ANALYZER_ID = \"prebuilt-document\";\n\nexport type AnalyzeDocumentConfig = Readonly<{\n /** Key on `item.binary` that holds the document bytes. Default: `\"data\"`. */\n binaryField?: string;\n /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */\n contentType?: string;\n /**\n * Azure Content Understanding analyzer ID to use.\n * Defaults to `\"prebuilt-document\"`. Set this to a custom analyzer ID when you have\n * a trained model or need a different prebuilt variant.\n */\n analyzerId?: string;\n /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */\n maxBytes?: number;\n}>;\n\nexport const analyzeDocumentNode = defineNode({\n key: \"azure-ocr.analyze-document\",\n title: \"Analyze Document\",\n description:\n \"Runs an Azure Content Understanding document analyzer on a binary attachment and returns markdown text plus structured fields. Defaults to the prebuilt general document analyzer.\",\n icon: \"lucide:scan-text\",\n input: {\n binaryField: \"data\",\n contentType: undefined as string | undefined,\n analyzerId: undefined as string | undefined,\n maxBytes: undefined as number | undefined,\n },\n credentials: {\n contentUnderstanding: {\n type: azureContentUnderstandingCredentialType as import(\"@codemation/core\").AnyCredentialType,\n label: \"Azure Content Understanding\",\n helpText: \"Bind an Azure Content Understanding credential (endpoint + key).\",\n },\n },\n inspectorSummary({ config }) {\n const cfg = config as unknown as AnalyzeDocumentConfig;\n const analyzerId = cfg.analyzerId ?? DEFAULT_DOCUMENT_ANALYZER_ID;\n const rows = [{ label: \"Analyzer\", value: analyzerId }];\n const binaryField = cfg.binaryField ?? \"data\";\n if (binaryField !== \"data\") {\n rows.push({ label: \"Binary field\", value: binaryField });\n }\n if (cfg.contentType) {\n rows.push({ label: \"Content type\", value: cfg.contentType });\n }\n return rows;\n },\n async execute({ item, ctx }, { config: rawConfig, credentials }) {\n const config = rawConfig as unknown as AnalyzeDocumentConfig;\n const session = (await credentials.contentUnderstanding()) as AzureContentUnderstandingSession;\n const binaryField = config.binaryField ?? \"data\";\n const attachment = item.binary?.[binaryField];\n if (!attachment) {\n throw new Error(`Analyze Document: no binary attachment at key \"${binaryField}\".`);\n }\n const analyzerId = config.analyzerId ?? DEFAULT_DOCUMENT_ANALYZER_ID;\n const contentType = config.contentType ?? attachment.mimeType ?? \"application/octet-stream\";\n const body = await ctx.binary.getBytes(attachment, config.maxBytes);\n return analyzeWithAzure({ session, analyzerId, body, contentType });\n },\n});\n","import { defineNode } from \"@codemation/core\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\nimport { azureContentUnderstandingCredentialType } from \"../credentials/azureContentUnderstandingCredential\";\nimport { analyzeWithAzure } from \"../lib/analyzeWithAzure\";\n\n/** Default Azure Content Understanding prebuilt image analyzer ID. */\nconst DEFAULT_IMAGE_ANALYZER_ID = \"prebuilt-imageAnalyzer\";\n\nexport type AnalyzeImageConfig = Readonly<{\n /** Key on `item.binary` that holds the image bytes. Default: `\"data\"`. */\n binaryField?: string;\n /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */\n contentType?: string;\n /**\n * Azure Content Understanding analyzer ID to use.\n * Defaults to `\"prebuilt-imageAnalyzer\"`. Set this to a custom analyzer ID when you have\n * a trained model or need a different prebuilt variant.\n */\n analyzerId?: string;\n /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */\n maxBytes?: number;\n}>;\n\nexport const analyzeImageNode = defineNode({\n key: \"azure-ocr.analyze-image\",\n title: \"Analyze Image\",\n description:\n \"Runs an Azure Content Understanding image analyzer on a binary attachment and returns markdown text plus structured fields. Defaults to the prebuilt image analyzer.\",\n icon: \"lucide:image-search\",\n input: {\n binaryField: \"data\",\n contentType: undefined as string | undefined,\n analyzerId: undefined as string | undefined,\n maxBytes: undefined as number | undefined,\n },\n credentials: {\n contentUnderstanding: {\n type: azureContentUnderstandingCredentialType as import(\"@codemation/core\").AnyCredentialType,\n label: \"Azure Content Understanding\",\n helpText: \"Bind an Azure Content Understanding credential (endpoint + key).\",\n },\n },\n inspectorSummary({ config }) {\n const cfg = config as unknown as AnalyzeImageConfig;\n const analyzerId = cfg.analyzerId ?? DEFAULT_IMAGE_ANALYZER_ID;\n const rows = [{ label: \"Analyzer\", value: analyzerId }];\n const binaryField = cfg.binaryField ?? \"data\";\n if (binaryField !== \"data\") {\n rows.push({ label: \"Binary field\", value: binaryField });\n }\n if (cfg.contentType) {\n rows.push({ label: \"Content type\", value: cfg.contentType });\n }\n return rows;\n },\n async execute({ item, ctx }, { config: rawConfig, credentials }) {\n const config = rawConfig as unknown as AnalyzeImageConfig;\n const session = (await credentials.contentUnderstanding()) as AzureContentUnderstandingSession;\n const binaryField = config.binaryField ?? \"data\";\n const attachment = item.binary?.[binaryField];\n if (!attachment) {\n throw new Error(`Analyze Image: no binary attachment at key \"${binaryField}\".`);\n }\n const analyzerId = config.analyzerId ?? DEFAULT_IMAGE_ANALYZER_ID;\n const contentType = config.contentType ?? attachment.mimeType ?? \"application/octet-stream\";\n const body = await ctx.binary.getBytes(attachment, config.maxBytes);\n return analyzeWithAzure({ session, analyzerId, body, contentType });\n },\n});\n","import { defineNode } from \"@codemation/core\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\nimport { azureContentUnderstandingCredentialType } from \"../credentials/azureContentUnderstandingCredential\";\nimport { analyzeWithAzure } from \"../lib/analyzeWithAzure\";\n\n/** Azure Content Understanding prebuilt invoice analyzer ID. */\nconst PREBUILT_INVOICE_ANALYZER_ID = \"prebuilt-invoice\";\n\nexport type AnalyzeInvoiceConfig = Readonly<{\n /** Key on `item.binary` that holds the document bytes. Default: `\"data\"`. */\n binaryField?: string;\n /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */\n contentType?: string;\n /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */\n maxBytes?: number;\n}>;\n\nexport const analyzeInvoiceNode = defineNode({\n key: \"azure-ocr.analyze-invoice\",\n title: \"Analyze Invoice\",\n description:\n \"Runs the Azure Content Understanding prebuilt invoice analyzer on a binary attachment and returns markdown text plus structured fields.\",\n icon: \"lucide:receipt\",\n input: {\n binaryField: \"data\",\n contentType: undefined as string | undefined,\n maxBytes: undefined as number | undefined,\n },\n credentials: {\n contentUnderstanding: {\n type: azureContentUnderstandingCredentialType as import(\"@codemation/core\").AnyCredentialType,\n label: \"Azure Content Understanding\",\n helpText: \"Bind an Azure Content Understanding credential (endpoint + key).\",\n },\n },\n inspectorSummary({ config }) {\n const cfg = config as unknown as AnalyzeInvoiceConfig;\n const rows = [{ label: \"Analyzer\", value: \"Invoice (prebuilt)\" }];\n const binaryField = cfg.binaryField ?? \"data\";\n if (binaryField !== \"data\") {\n rows.push({ label: \"Binary field\", value: binaryField });\n }\n if (cfg.contentType) {\n rows.push({ label: \"Content type\", value: cfg.contentType });\n }\n return rows;\n },\n async execute({ item, ctx }, { config: rawConfig, credentials }) {\n const config = rawConfig as unknown as AnalyzeInvoiceConfig;\n const session = (await credentials.contentUnderstanding()) as AzureContentUnderstandingSession;\n const binaryField = config.binaryField ?? \"data\";\n const attachment = item.binary?.[binaryField];\n if (!attachment) {\n throw new Error(`Analyze Invoice: no binary attachment at key \"${binaryField}\".`);\n }\n const contentType = config.contentType ?? attachment.mimeType ?? \"application/octet-stream\";\n const body = await ctx.binary.getBytes(attachment, config.maxBytes);\n return analyzeWithAzure({ session, analyzerId: PREBUILT_INVOICE_ANALYZER_ID, body, contentType });\n },\n});\n"],"mappings":";;;;;AASA,SAAS,kBAAkB,KAAqB;AAC9C,QAAO,IAAI,MAAM,CAAC,QAAQ,QAAQ,GAAG;;AAGvC,SAAS,aAAa,MAGe;CACnC,MAAM,WAAW,kBAAkB,OAAO,KAA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AE,UAAU;EAC3B,MAAM,MAAM;EACZ,MAAM,OAAO,CAAC;GAAE,OAAO;GAAY,OAAO;GAAsB,CAAC;EACjE,MAAM,cAAc,IAAI,eAAe;AACvC,MAAI,gBAAgB,OAClB,MAAK,KAAK;GAAE,OAAO;GAAgB,OAAO;GAAa,CAAC;AAE1D,MAAI,IAAI,YACN,MAAK,KAAK;GAAE,OAAO;GAAgB,OAAO,IAAI;GAAa,CAAC;AAE9D,SAAO;;CAET,MAAM,QAAQ,EAAE,MAAM,OAAO,EAAE,QAAQ,WAAW,eAAe;EAC/D,MAAM,SAAS;EACf,MAAM,UAAW,MAAM,YAAY,sBAAsB;EACzD,MAAM,cAAc,OAAO,eAAe;EAC1C,MAAM,aAAa,KAAK,SAAS;AACjC,MAAI,CAAC,WACH,OAAM,IAAI,MAAM,iDAAiD,YAAY,IAAI;EAEnF,MAAM,cAAc,OAAO,eAAe,WAAW,YAAY;AAEjE,SAAO,iBAAiB;GAAE;GAAS,YAAY;GAA8B,MADhE,MAAM,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS;GACgB;GAAa,CAAC;;CAEpG,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeInvoiceNode-CmMsifbw.cjs","names":["ContentUnderstandingClient","AzureKeyCredential","ContentUnderstandingClient","AzureKeyCredential","markdownParts: string[]","out: Record<string, unknown>"],"sources":["../src/credentials/azureContentUnderstandingCredential.ts","../src/lib/analyzeWithAzure.ts","../src/nodes/analyzeDocumentNode.ts","../src/nodes/analyzeImageNode.ts","../src/nodes/analyzeInvoiceNode.ts"],"sourcesContent":["import { ContentUnderstandingClient } from \"@azure/ai-content-understanding\";\nimport { AzureKeyCredential } from \"@azure/core-auth\";\nimport { defineCredential } from \"@codemation/core\";\n\nexport type AzureContentUnderstandingSession = Readonly<{\n endpoint: string;\n apiKey: string;\n}>;\n\nfunction normalizeEndpoint(raw: string): string {\n return raw.trim().replace(/\\/+$/, \"\");\n}\n\nfunction buildSession(args: {\n readonly publicConfig: Readonly<Record<string, unknown>>;\n readonly material: Readonly<Record<string, unknown>>;\n}): AzureContentUnderstandingSession {\n const endpoint = normalizeEndpoint(String(args.publicConfig[\"endpoint\"] ?? \"\"));\n const apiKey = String(args.material[\"apiKey\"] ?? \"\").trim();\n if (!endpoint) {\n throw new Error(\"Azure Content Understanding credential is incomplete: endpoint is required.\");\n }\n if (!apiKey) {\n throw new Error(\"Azure Content Understanding credential is incomplete: API key is required.\");\n }\n return { endpoint, apiKey };\n}\n\nexport const azureContentUnderstandingCredentialType = defineCredential({\n key: \"azure.contentUnderstanding\",\n label: \"Azure Content Understanding\",\n description: \"Azure AI Content Understanding (endpoint + key) for prebuilt document, invoice, and image analyzers.\",\n public: {\n endpoint: {\n key: \"endpoint\",\n label: \"Endpoint\",\n type: \"string\" as const,\n required: true,\n placeholder: \"https://your-resource.cognitiveservices.azure.com/\",\n helpText: \"Content Understanding resource endpoint URL (no trailing slash).\",\n order: 0,\n },\n },\n secret: {\n apiKey: {\n key: \"apiKey\",\n label: \"API key\",\n type: \"password\" as const,\n required: true,\n order: 1,\n },\n },\n async createSession(args) {\n return buildSession(args);\n },\n async test(args) {\n try {\n const session = buildSession(args);\n const client = new ContentUnderstandingClient(session.endpoint, new AzureKeyCredential(session.apiKey));\n const iter = client.listAnalyzers();\n await iter.next();\n return {\n status: \"healthy\",\n message: \"Listed analyzers successfully.\",\n testedAt: new Date().toISOString(),\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n status: \"failing\",\n message: message || \"Azure Content Understanding connection failed.\",\n testedAt: new Date().toISOString(),\n };\n }\n },\n});\n","import type {\n AnalysisResult,\n ArrayField,\n BooleanField,\n ContentField,\n ContentFieldUnion,\n DateField,\n IntegerField,\n JsonField,\n NumberField,\n ObjectField,\n StringField,\n TimeField,\n} from \"@azure/ai-content-understanding\";\nimport { ContentUnderstandingClient } from \"@azure/ai-content-understanding\";\nimport { AzureKeyCredential } from \"@azure/core-auth\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\n\n/** Structured analyzer fields: scalars at leaves; nested objects and arrays preserved. */\nexport type OcrStructuredFields = Readonly<Record<string, unknown>>;\n\n/** The output shape returned by all OCR analyzer nodes. */\nexport type OcrAnalysisOutput = Readonly<{\n /** Markdown representation of the document content. */\n content: string;\n /** Structured fields extracted by the prebuilt analyzer. */\n fields: OcrStructuredFields;\n}>;\n\n/**\n * Analyzes a binary document using an Azure Content Understanding prebuilt analyzer.\n * Retries on transient failures are handled by the engine via the node's `retryPolicy`.\n */\nexport async function analyzeWithAzure(\n args: Readonly<{\n session: AzureContentUnderstandingSession;\n analyzerId: string;\n body: Uint8Array;\n contentType: string;\n }>,\n): Promise<OcrAnalysisOutput> {\n const client = new ContentUnderstandingClient(args.session.endpoint, new AzureKeyCredential(args.session.apiKey));\n const poller = client.analyzeBinary(args.analyzerId, args.body, args.contentType);\n const result = await poller.pollUntilDone();\n return mapAnalysisResult(result);\n}\n\n/** @internal Exported for testing — maps a raw AnalysisResult to the node output shape. */\nexport function mapAnalysisResult(result: AnalysisResult): OcrAnalysisOutput {\n const contents = result.contents ?? [];\n const markdownParts: string[] = [];\n for (const c of contents) {\n if (typeof c.markdown === \"string\" && c.markdown.length > 0) {\n markdownParts.push(c.markdown);\n }\n }\n const content = markdownParts.join(\"\\n\\n\");\n if (contents.length === 0) {\n return { content: \"\", fields: {} };\n }\n if (contents.length === 1) {\n const c = contents[0]!;\n return {\n content,\n fields: c.fields ? fieldsToStructuredMap(c.fields) : {},\n };\n }\n return {\n content,\n fields: {\n segments: contents.map((c, index) => ({\n index,\n markdown: typeof c.markdown === \"string\" && c.markdown.trim().length > 0 ? c.markdown : undefined,\n fields: c.fields ? fieldsToStructuredMap(c.fields) : {},\n })),\n },\n };\n}\n\nfunction fieldsToStructuredMap(fields: Readonly<Record<string, ContentFieldUnion>>): OcrStructuredFields {\n const out: Record<string, unknown> = {};\n for (const [name, field] of Object.entries(fields)) {\n out[name] = fieldToStructuredValue(field);\n }\n return out;\n}\n\nfunction fieldToStructuredValue(field: ContentFieldUnion): unknown {\n const kind = resolveFieldKind(field);\n switch (kind) {\n case \"string\":\n return (field as StringField).value ?? null;\n case \"date\": {\n const d = (field as DateField).value;\n return d ? d.toISOString() : null;\n }\n case \"time\":\n return (field as TimeField).value ?? null;\n case \"number\":\n return (field as NumberField).value ?? null;\n case \"integer\":\n return (field as IntegerField).value ?? null;\n case \"boolean\":\n return (field as BooleanField).value ?? null;\n case \"array\": {\n const values = (field as ArrayField).value ?? [];\n return values.map((element) => fieldToStructuredValue(element));\n }\n case \"object\": {\n const properties = (field as ObjectField).value ?? {};\n return fieldsToStructuredMap(properties);\n }\n case \"json\":\n return (field as JsonField).value ?? null;\n default: {\n const base = field as ContentField;\n if (base.value === undefined || base.value === null) {\n return null;\n }\n return typeof base.value === \"object\" ? base.value : String(base.value);\n }\n }\n}\n\nfunction resolveFieldKind(field: ContentFieldUnion): string {\n if (\"fieldType\" in field && typeof field.fieldType === \"string\") {\n return field.fieldType;\n }\n return (field as ContentField).type;\n}\n","import { defineNode } from \"@codemation/core\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\nimport { azureContentUnderstandingCredentialType } from \"../credentials/azureContentUnderstandingCredential\";\nimport { analyzeWithAzure } from \"../lib/analyzeWithAzure\";\n\n/** Default Azure Content Understanding prebuilt general document analyzer ID. */\nconst DEFAULT_DOCUMENT_ANALYZER_ID = \"prebuilt-document\";\n\nexport type AnalyzeDocumentConfig = Readonly<{\n /** Key on `item.binary` that holds the document bytes. Default: `\"data\"`. */\n binaryField?: string;\n /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */\n contentType?: string;\n /**\n * Azure Content Understanding analyzer ID to use.\n * Defaults to `\"prebuilt-document\"`. Set this to a custom analyzer ID when you have\n * a trained model or need a different prebuilt variant.\n */\n analyzerId?: string;\n /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */\n maxBytes?: number;\n}>;\n\nexport const analyzeDocumentNode = defineNode({\n key: \"azure-ocr.analyze-document\",\n title: \"Analyze Document\",\n description:\n \"Runs an Azure Content Understanding document analyzer on a binary attachment and returns markdown text plus structured fields. Defaults to the prebuilt general document analyzer.\",\n icon: \"lucide:scan-text\",\n input: {\n binaryField: \"data\",\n contentType: undefined as string | undefined,\n analyzerId: undefined as string | undefined,\n maxBytes: undefined as number | undefined,\n },\n credentials: {\n contentUnderstanding: {\n type: azureContentUnderstandingCredentialType as import(\"@codemation/core\").AnyCredentialType,\n label: \"Azure Content Understanding\",\n helpText: \"Bind an Azure Content Understanding credential (endpoint + key).\",\n },\n },\n inspectorSummary({ config }) {\n const cfg = config as unknown as AnalyzeDocumentConfig;\n const analyzerId = cfg.analyzerId ?? DEFAULT_DOCUMENT_ANALYZER_ID;\n const rows = [{ label: \"Analyzer\", value: analyzerId }];\n const binaryField = cfg.binaryField ?? \"data\";\n if (binaryField !== \"data\") {\n rows.push({ label: \"Binary field\", value: binaryField });\n }\n if (cfg.contentType) {\n rows.push({ label: \"Content type\", value: cfg.contentType });\n }\n return rows;\n },\n async execute({ item, ctx }, { config: rawConfig, credentials }) {\n const config = rawConfig as unknown as AnalyzeDocumentConfig;\n const session = (await credentials.contentUnderstanding()) as AzureContentUnderstandingSession;\n const binaryField = config.binaryField ?? \"data\";\n const attachment = item.binary?.[binaryField];\n if (!attachment) {\n throw new Error(`Analyze Document: no binary attachment at key \"${binaryField}\".`);\n }\n const analyzerId = config.analyzerId ?? DEFAULT_DOCUMENT_ANALYZER_ID;\n const contentType = config.contentType ?? attachment.mimeType ?? \"application/octet-stream\";\n const body = await ctx.binary.getBytes(attachment, config.maxBytes);\n return analyzeWithAzure({ session, analyzerId, body, contentType });\n },\n});\n","import { defineNode } from \"@codemation/core\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\nimport { azureContentUnderstandingCredentialType } from \"../credentials/azureContentUnderstandingCredential\";\nimport { analyzeWithAzure } from \"../lib/analyzeWithAzure\";\n\n/** Default Azure Content Understanding prebuilt image analyzer ID. */\nconst DEFAULT_IMAGE_ANALYZER_ID = \"prebuilt-imageAnalyzer\";\n\nexport type AnalyzeImageConfig = Readonly<{\n /** Key on `item.binary` that holds the image bytes. Default: `\"data\"`. */\n binaryField?: string;\n /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */\n contentType?: string;\n /**\n * Azure Content Understanding analyzer ID to use.\n * Defaults to `\"prebuilt-imageAnalyzer\"`. Set this to a custom analyzer ID when you have\n * a trained model or need a different prebuilt variant.\n */\n analyzerId?: string;\n /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */\n maxBytes?: number;\n}>;\n\nexport const analyzeImageNode = defineNode({\n key: \"azure-ocr.analyze-image\",\n title: \"Analyze Image\",\n description:\n \"Runs an Azure Content Understanding image analyzer on a binary attachment and returns markdown text plus structured fields. Defaults to the prebuilt image analyzer.\",\n icon: \"lucide:image-search\",\n input: {\n binaryField: \"data\",\n contentType: undefined as string | undefined,\n analyzerId: undefined as string | undefined,\n maxBytes: undefined as number | undefined,\n },\n credentials: {\n contentUnderstanding: {\n type: azureContentUnderstandingCredentialType as import(\"@codemation/core\").AnyCredentialType,\n label: \"Azure Content Understanding\",\n helpText: \"Bind an Azure Content Understanding credential (endpoint + key).\",\n },\n },\n inspectorSummary({ config }) {\n const cfg = config as unknown as AnalyzeImageConfig;\n const analyzerId = cfg.analyzerId ?? DEFAULT_IMAGE_ANALYZER_ID;\n const rows = [{ label: \"Analyzer\", value: analyzerId }];\n const binaryField = cfg.binaryField ?? \"data\";\n if (binaryField !== \"data\") {\n rows.push({ label: \"Binary field\", value: binaryField });\n }\n if (cfg.contentType) {\n rows.push({ label: \"Content type\", value: cfg.contentType });\n }\n return rows;\n },\n async execute({ item, ctx }, { config: rawConfig, credentials }) {\n const config = rawConfig as unknown as AnalyzeImageConfig;\n const session = (await credentials.contentUnderstanding()) as AzureContentUnderstandingSession;\n const binaryField = config.binaryField ?? \"data\";\n const attachment = item.binary?.[binaryField];\n if (!attachment) {\n throw new Error(`Analyze Image: no binary attachment at key \"${binaryField}\".`);\n }\n const analyzerId = config.analyzerId ?? DEFAULT_IMAGE_ANALYZER_ID;\n const contentType = config.contentType ?? attachment.mimeType ?? \"application/octet-stream\";\n const body = await ctx.binary.getBytes(attachment, config.maxBytes);\n return analyzeWithAzure({ session, analyzerId, body, contentType });\n },\n});\n","import { defineNode } from \"@codemation/core\";\nimport type { AzureContentUnderstandingSession } from \"../credentials/azureContentUnderstandingCredential\";\nimport { azureContentUnderstandingCredentialType } from \"../credentials/azureContentUnderstandingCredential\";\nimport { analyzeWithAzure } from \"../lib/analyzeWithAzure\";\n\n/** Azure Content Understanding prebuilt invoice analyzer ID. */\nconst PREBUILT_INVOICE_ANALYZER_ID = \"prebuilt-invoice\";\n\nexport type AnalyzeInvoiceConfig = Readonly<{\n /** Key on `item.binary` that holds the document bytes. Default: `\"data\"`. */\n binaryField?: string;\n /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */\n contentType?: string;\n /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */\n maxBytes?: number;\n}>;\n\nexport const analyzeInvoiceNode = defineNode({\n key: \"azure-ocr.analyze-invoice\",\n title: \"Analyze Invoice\",\n description:\n \"Runs the Azure Content Understanding prebuilt invoice analyzer on a binary attachment and returns markdown text plus structured fields.\",\n icon: \"lucide:receipt\",\n input: {\n binaryField: \"data\",\n contentType: undefined as string | undefined,\n maxBytes: undefined as number | undefined,\n },\n credentials: {\n contentUnderstanding: {\n type: azureContentUnderstandingCredentialType as import(\"@codemation/core\").AnyCredentialType,\n label: \"Azure Content Understanding\",\n helpText: \"Bind an Azure Content Understanding credential (endpoint + key).\",\n },\n },\n inspectorSummary({ config }) {\n const cfg = config as unknown as AnalyzeInvoiceConfig;\n const rows = [{ label: \"Analyzer\", value: \"Invoice (prebuilt)\" }];\n const binaryField = cfg.binaryField ?? \"data\";\n if (binaryField !== \"data\") {\n rows.push({ label: \"Binary field\", value: binaryField });\n }\n if (cfg.contentType) {\n rows.push({ label: \"Content type\", value: cfg.contentType });\n }\n return rows;\n },\n async execute({ item, ctx }, { config: rawConfig, credentials }) {\n const config = rawConfig as unknown as AnalyzeInvoiceConfig;\n const session = (await credentials.contentUnderstanding()) as AzureContentUnderstandingSession;\n const binaryField = config.binaryField ?? \"data\";\n const attachment = item.binary?.[binaryField];\n if (!attachment) {\n throw new Error(`Analyze Invoice: no binary attachment at key \"${binaryField}\".`);\n }\n const contentType = config.contentType ?? attachment.mimeType ?? \"application/octet-stream\";\n const body = await ctx.binary.getBytes(attachment, config.maxBytes);\n return analyzeWithAzure({ session, analyzerId: PREBUILT_INVOICE_ANALYZER_ID, body, contentType });\n },\n});\n"],"mappings":";;;;;;;;;AASA,SAAS,kBAAkB,KAAqB;AAC9C,QAAO,IAAI,MAAM,CAAC,QAAQ,QAAQ,GAAG;;AAGvC,SAAS,aAAa,MAGe;CACnC,MAAM,WAAW,kBAAkB,OAAO,KAAK,aAAa,eAAe,GAAG,CAAC;CAC/E,MAAM,SAAS,OAAO,KAAK,SAAS,aAAa,GAAG,CAAC,MAAM;AAC3D,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,8EAA8E;AAEhG,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,6EAA6E;AAE/F,QAAO;EAAE;EAAU;EAAQ;;AAG7B,MAAa,kFAA2D;CACtE,KAAK;CACL,OAAO;CACP,aAAa;CACb,QAAQ,EACN,UAAU;EACR,KAAK;EACL,OAAO;EACP,MAAM;EACN,UAAU;EACV,aAAa;EACb,UAAU;EACV,OAAO;EACR,EACF;CACD,QAAQ,EACN,QAAQ;EACN,KAAK;EACL,OAAO;EACP,MAAM;EACN,UAAU;EACV,OAAO;EACR,EACF;CACD,MAAM,cAAc,MAAM;AACxB,SAAO,aAAa,KAAK;;CAE3B,MAAM,KAAK,MAAM;AACf,MAAI;GACF,MAAM,UAAU,aAAa,KAAK;AAGlC,SAF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,MADhE,MAAM,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS;GACgB;GAAa,CAAC;;CAEpG,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-util-B2kSJtEV.cjs","names":["__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","import_os","import_token_error","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","fs","path","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS"],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-error.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-errors.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-config.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/oauth.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_errors_exports = {};\n__export(auth_errors_exports, {\n AccessTokenMissingError: () => AccessTokenMissingError,\n RefreshAccessTokenFailedError: () => RefreshAccessTokenFailedError\n});\nmodule.exports = __toCommonJS(auth_errors_exports);\nclass AccessTokenMissingError extends Error {\n constructor() {\n super(\n \"No authentication found. Please log in with the Vercel CLI (vercel login).\"\n );\n this.name = \"AccessTokenMissingError\";\n }\n}\nclass RefreshAccessTokenFailedError extends Error {\n constructor(cause) {\n super(\"Failed to refresh authentication token.\", { cause });\n this.name = \"RefreshAccessTokenFailedError\";\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AccessTokenMissingError,\n RefreshAccessTokenFailedError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n return null;\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_config_exports = {};\n__export(auth_config_exports, {\n isValidAccessToken: () => isValidAccessToken,\n readAuthConfig: () => readAuthConfig,\n writeAuthConfig: () => writeAuthConfig\n});\nmodule.exports = __toCommonJS(auth_config_exports);\nvar fs = __toESM(require(\"fs\"));\nvar path = __toESM(require(\"path\"));\nvar import_token_util = require(\"./token-util\");\nfunction getAuthConfigPath() {\n const dataDir = (0, import_token_util.getVercelDataDir)();\n if (!dataDir) {\n throw new Error(\n `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`\n );\n }\n return path.join(dataDir, \"auth.json\");\n}\nfunction readAuthConfig() {\n try {\n const authPath = getAuthConfigPath();\n if (!fs.existsSync(authPath)) {\n return null;\n }\n const content = fs.readFileSync(authPath, \"utf8\");\n if (!content) {\n return null;\n }\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n}\nfunction writeAuthConfig(config) {\n const authPath = getAuthConfigPath();\n const authDir = path.dirname(authPath);\n if (!fs.existsSync(authDir)) {\n fs.mkdirSync(authDir, { mode: 504, recursive: true });\n }\n fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });\n}\nfunction isValidAccessToken(authConfig, expirationBufferMs = 0) {\n if (!authConfig.token)\n return false;\n if (typeof authConfig.expiresAt !== \"number\")\n return true;\n const nowInSeconds = Math.floor(Date.now() / 1e3);\n const bufferInSeconds = expirationBufferMs / 1e3;\n return authConfig.expiresAt >= nowInSeconds + bufferInSeconds;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n isValidAccessToken,\n readAuthConfig,\n writeAuthConfig\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar oauth_exports = {};\n__export(oauth_exports, {\n processTokenResponse: () => processTokenResponse,\n refreshTokenRequest: () => refreshTokenRequest\n});\nmodule.exports = __toCommonJS(oauth_exports);\nvar import_os = require(\"os\");\nconst VERCEL_ISSUER = \"https://vercel.com\";\nconst VERCEL_CLI_CLIENT_ID = \"cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp\";\nconst userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;\nlet _tokenEndpoint = null;\nasync function getTokenEndpoint() {\n if (_tokenEndpoint) {\n return _tokenEndpoint;\n }\n const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;\n const response = await fetch(discoveryUrl, {\n headers: { \"user-agent\": userAgent }\n });\n if (!response.ok) {\n throw new Error(\"Failed to discover OAuth endpoints\");\n }\n const metadata = await response.json();\n if (!metadata || typeof metadata.token_endpoint !== \"string\") {\n throw new Error(\"Invalid OAuth discovery response\");\n }\n const endpoint = metadata.token_endpoint;\n _tokenEndpoint = endpoint;\n return endpoint;\n}\nasync function refreshTokenRequest(options) {\n const tokenEndpoint = await getTokenEndpoint();\n return await fetch(tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"user-agent\": userAgent\n },\n body: new URLSearchParams({\n client_id: VERCEL_CLI_CLIENT_ID,\n grant_type: \"refresh_token\",\n ...options\n })\n });\n}\nasync function processTokenResponse(response) {\n const json = await response.json();\n if (!response.ok) {\n const errorMsg = typeof json === \"object\" && json && \"error\" in json ? String(json.error) : \"Token refresh failed\";\n return [new Error(errorMsg)];\n }\n if (typeof json !== \"object\" || json === null) {\n return [new Error(\"Invalid token response\")];\n }\n if (typeof json.access_token !== \"string\") {\n return [new Error(\"Missing access_token in response\")];\n }\n if (json.token_type !== \"Bearer\") {\n return [new Error(\"Invalid token_type in response\")];\n }\n if (typeof json.expires_in !== \"number\") {\n return [new Error(\"Missing expires_in in response\")];\n }\n return [null, json];\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n processTokenResponse,\n refreshTokenRequest\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n getVercelToken: () => getVercelToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nvar import_auth_config = require(\"./auth-config\");\nvar import_oauth = require(\"./oauth\");\nvar import_auth_errors = require(\"./auth-errors\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nasync function getVercelToken(options) {\n const authConfig = (0, import_auth_config.readAuthConfig)();\n if (!authConfig?.token) {\n throw new import_auth_errors.AccessTokenMissingError();\n }\n if ((0, import_auth_config.isValidAccessToken)(authConfig, options?.expirationBufferMs)) {\n return authConfig.token;\n }\n if (!authConfig.refreshToken) {\n (0, import_auth_config.writeAuthConfig)({});\n throw new import_auth_errors.RefreshAccessTokenFailedError(\"No refresh token available\");\n }\n try {\n const tokenResponse = await (0, import_oauth.refreshTokenRequest)({\n refresh_token: authConfig.refreshToken\n });\n const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);\n if (tokensError || !tokens) {\n (0, import_auth_config.writeAuthConfig)({});\n throw new import_auth_errors.RefreshAccessTokenFailedError(tokensError);\n }\n const updatedConfig = {\n token: tokens.access_token,\n expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in\n };\n if (tokens.refresh_token) {\n updatedConfig.refreshToken = tokens.refresh_token;\n }\n (0, import_auth_config.writeAuthConfig)(updatedConfig);\n return updatedConfig.token;\n } catch (error) {\n (0, import_auth_config.writeAuthConfig)({});\n if (error instanceof import_auth_errors.AccessTokenMissingError || error instanceof import_auth_errors.RefreshAccessTokenFailedError) {\n throw error;\n }\n throw new import_auth_errors.RefreshAccessTokenFailedError(error);\n }\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again\"\n );\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again\"\n );\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find project root directory. Have you linked your project with `vc link?`\"\n );\n }\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\n \"project.json not found, have you linked your project with `vc link?`\"\n );\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\n \"Expected a string-valued projectId property. Try running `vc link` to re-link your project.\"\n );\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n}\nfunction saveToken(token, projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n}\nfunction loadToken(projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\n \"Invalid token. Please run `vc env pull` and try again\"\n );\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token, bufferMs = 0) {\n return token.exp * 1e3 < Date.now() + bufferMs;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelDataDir,\n getVercelOidcToken,\n getVercelToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":";;;;CACA,IAAIA,cAAY,OAAO;CACvB,IAAIC,qBAAmB,OAAO;CAC9B,IAAIC,sBAAoB,OAAO;CAC/B,IAAIC,iBAAe,OAAO,UAAU;CACpC,IAAIC,cAAY,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,aAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;GAAM,CAAC;;CAEjE,IAAIC,iBAAe,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YACtD;QAAK,IAAI,OAAOH,oBAAkB,KAAK,CACrC,KAAI,CAACC,eAAa,KAAK,IAAI,IAAI,IAAI,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};
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-util-EUxa8JtH.js","names":["__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","import_os","import_token_error","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","__copyProps","__toESM","__toCommonJS","fs","path","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__copyProps","__toCommonJS"],"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-error.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-errors.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-config.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/oauth.js","../../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-util.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_errors_exports = {};\n__export(auth_errors_exports, {\n AccessTokenMissingError: () => AccessTokenMissingError,\n RefreshAccessTokenFailedError: () => RefreshAccessTokenFailedError\n});\nmodule.exports = __toCommonJS(auth_errors_exports);\nclass AccessTokenMissingError extends Error {\n constructor() {\n super(\n \"No authentication found. Please log in with the Vercel CLI (vercel login).\"\n );\n this.name = \"AccessTokenMissingError\";\n }\n}\nclass RefreshAccessTokenFailedError extends Error {\n constructor(cause) {\n super(\"Failed to refresh authentication token.\", { cause });\n this.name = \"RefreshAccessTokenFailedError\";\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AccessTokenMissingError,\n RefreshAccessTokenFailedError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n return null;\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar auth_config_exports = {};\n__export(auth_config_exports, {\n isValidAccessToken: () => isValidAccessToken,\n readAuthConfig: () => readAuthConfig,\n writeAuthConfig: () => writeAuthConfig\n});\nmodule.exports = __toCommonJS(auth_config_exports);\nvar fs = __toESM(require(\"fs\"));\nvar path = __toESM(require(\"path\"));\nvar import_token_util = require(\"./token-util\");\nfunction getAuthConfigPath() {\n const dataDir = (0, import_token_util.getVercelDataDir)();\n if (!dataDir) {\n throw new Error(\n `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`\n );\n }\n return path.join(dataDir, \"auth.json\");\n}\nfunction readAuthConfig() {\n try {\n const authPath = getAuthConfigPath();\n if (!fs.existsSync(authPath)) {\n return null;\n }\n const content = fs.readFileSync(authPath, \"utf8\");\n if (!content) {\n return null;\n }\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n}\nfunction writeAuthConfig(config) {\n const authPath = getAuthConfigPath();\n const authDir = path.dirname(authPath);\n if (!fs.existsSync(authDir)) {\n fs.mkdirSync(authDir, { mode: 504, recursive: true });\n }\n fs.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });\n}\nfunction isValidAccessToken(authConfig, expirationBufferMs = 0) {\n if (!authConfig.token)\n return false;\n if (typeof authConfig.expiresAt !== \"number\")\n return true;\n const nowInSeconds = Math.floor(Date.now() / 1e3);\n const bufferInSeconds = expirationBufferMs / 1e3;\n return authConfig.expiresAt >= nowInSeconds + bufferInSeconds;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n isValidAccessToken,\n readAuthConfig,\n writeAuthConfig\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar oauth_exports = {};\n__export(oauth_exports, {\n processTokenResponse: () => processTokenResponse,\n refreshTokenRequest: () => refreshTokenRequest\n});\nmodule.exports = __toCommonJS(oauth_exports);\nvar import_os = require(\"os\");\nconst VERCEL_ISSUER = \"https://vercel.com\";\nconst VERCEL_CLI_CLIENT_ID = \"cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp\";\nconst userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;\nlet _tokenEndpoint = null;\nasync function getTokenEndpoint() {\n if (_tokenEndpoint) {\n return _tokenEndpoint;\n }\n const discoveryUrl = `${VERCEL_ISSUER}/.well-known/openid-configuration`;\n const response = await fetch(discoveryUrl, {\n headers: { \"user-agent\": userAgent }\n });\n if (!response.ok) {\n throw new Error(\"Failed to discover OAuth endpoints\");\n }\n const metadata = await response.json();\n if (!metadata || typeof metadata.token_endpoint !== \"string\") {\n throw new Error(\"Invalid OAuth discovery response\");\n }\n const endpoint = metadata.token_endpoint;\n _tokenEndpoint = endpoint;\n return endpoint;\n}\nasync function refreshTokenRequest(options) {\n const tokenEndpoint = await getTokenEndpoint();\n return await fetch(tokenEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n \"user-agent\": userAgent\n },\n body: new URLSearchParams({\n client_id: VERCEL_CLI_CLIENT_ID,\n grant_type: \"refresh_token\",\n ...options\n })\n });\n}\nasync function processTokenResponse(response) {\n const json = await response.json();\n if (!response.ok) {\n const errorMsg = typeof json === \"object\" && json && \"error\" in json ? String(json.error) : \"Token refresh failed\";\n return [new Error(errorMsg)];\n }\n if (typeof json !== \"object\" || json === null) {\n return [new Error(\"Invalid token response\")];\n }\n if (typeof json.access_token !== \"string\") {\n return [new Error(\"Missing access_token in response\")];\n }\n if (json.token_type !== \"Bearer\") {\n return [new Error(\"Invalid token_type in response\")];\n }\n if (typeof json.expires_in !== \"number\") {\n return [new Error(\"Missing expires_in in response\")];\n }\n return [null, json];\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n processTokenResponse,\n refreshTokenRequest\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n getVercelToken: () => getVercelToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nvar import_auth_config = require(\"./auth-config\");\nvar import_oauth = require(\"./oauth\");\nvar import_auth_errors = require(\"./auth-errors\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nasync function getVercelToken(options) {\n const authConfig = (0, import_auth_config.readAuthConfig)();\n if (!authConfig?.token) {\n throw new import_auth_errors.AccessTokenMissingError();\n }\n if ((0, import_auth_config.isValidAccessToken)(authConfig, options?.expirationBufferMs)) {\n return authConfig.token;\n }\n if (!authConfig.refreshToken) {\n (0, import_auth_config.writeAuthConfig)({});\n throw new import_auth_errors.RefreshAccessTokenFailedError(\"No refresh token available\");\n }\n try {\n const tokenResponse = await (0, import_oauth.refreshTokenRequest)({\n refresh_token: authConfig.refreshToken\n });\n const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);\n if (tokensError || !tokens) {\n (0, import_auth_config.writeAuthConfig)({});\n throw new import_auth_errors.RefreshAccessTokenFailedError(tokensError);\n }\n const updatedConfig = {\n token: tokens.access_token,\n expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in\n };\n if (tokens.refresh_token) {\n updatedConfig.refreshToken = tokens.refresh_token;\n }\n (0, import_auth_config.writeAuthConfig)(updatedConfig);\n return updatedConfig.token;\n } catch (error) {\n (0, import_auth_config.writeAuthConfig)({});\n if (error instanceof import_auth_errors.AccessTokenMissingError || error instanceof import_auth_errors.RefreshAccessTokenFailedError) {\n throw error;\n }\n throw new import_auth_errors.RefreshAccessTokenFailedError(error);\n }\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again\"\n );\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\n \"Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again\"\n );\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find project root directory. Have you linked your project with `vc link?`\"\n );\n }\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\n \"project.json not found, have you linked your project with `vc link?`\"\n );\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\n \"Expected a string-valued projectId property. Try running `vc link` to re-link your project.\"\n );\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n}\nfunction saveToken(token, projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n}\nfunction loadToken(projectId) {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\n \"Unable to find user data directory. Please reach out to Vercel support.\"\n );\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\n \"Invalid token. Please run `vc env pull` and try again\"\n );\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nfunction isExpired(token, bufferMs = 0) {\n return token.exp * 1e3 < Date.now() + bufferMs;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelDataDir,\n getVercelOidcToken,\n getVercelToken,\n isExpired,\n loadToken,\n saveToken\n});\n"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACA,IAAIA,cAAY,OAAO;CACvB,IAAIC,qBAAmB,OAAO;CAC9B,IAAIC,sBAAoB,OAAO;CAC/B,IAAIC,iBAAe,OAAO,UAAU;CACpC,IAAIC,cAAY,QAAQ,QAAQ;AAC9B,OAAK,IAAI,QAAQ,IACf,aAAU,QAAQ,MAAM;GAAE,KAAK,IAAI;GAAO,YAAY;GAAM,CAAC;;CAEjE,IAAIC,iBAAe,IAAI,MAAM,QAAQ,SAAS;AAC5C,MAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YACtD;QAAK,IAAI,OAAOH,oBAAkB,KAAK,CACrC,KAAI,CAACC,eAAa,KAAK,IAAI,IAAI,IAAI,QAAQ,OACzC,aAAU,IAAI,KAAK;IAAE,WAAW,KAAK;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