{"version":3,"sources":["../src/utils/runtime-env.ts"],"sourcesContent":["/**\n * Environment access that works across the runtimes Farm targets.\n *\n * Serverless and edge runtimes (Cloudflare Workers in particular) expose\n * bindings on `globalThis.__env__` rather than `process.env`, so security\n * checks that read `process.env` directly see an empty value there and can\n * silently take an \"unconfigured\" code path in a deployed environment.\n */\nexport function getFarmRuntimeBindings(): Record<string, unknown> | undefined {\n  const runtimeBindings = (\n    globalThis as typeof globalThis & {\n      __env__?: Record<string, unknown>;\n    }\n  ).__env__;\n  return runtimeBindings && typeof runtimeBindings === \"object\" ? runtimeBindings : undefined;\n}\n\nexport function readFarmEnvironmentValue(name: string): string | undefined {\n  const runtimeValue = getFarmRuntimeBindings()?.[name];\n  if (typeof runtimeValue === \"string\") return runtimeValue;\n  return typeof process !== \"undefined\" ? process.env?.[name] : undefined;\n}\n\n/**\n * True when the process looks like a deployed runtime rather than local\n * development: either NODE_ENV is production, or runtime bindings are present\n * (a deployed worker where NODE_ENV is frequently unset).\n */\nexport function isFarmDeployedRuntime(): boolean {\n  if (getFarmRuntimeBindings()) return true;\n  return readFarmEnvironmentValue(\"NODE_ENV\") === \"production\";\n}\n"],"mappings":";;;;;AAQO,SAAS,yBAA8D;AAC5E,QAAM,kBACJ,WAGA;AACF,SAAO,mBAAmB,OAAO,oBAAoB,WAAW,kBAAkB;AACpF;AAPgB;AAST,SAAS,yBAAyB,MAAkC;AACzE,QAAM,eAAe,uBAAuB,IAAI,IAAI;AACpD,MAAI,OAAO,iBAAiB,SAAU,QAAO;AAC7C,SAAO,OAAO,YAAY,cAAc,QAAQ,MAAM,IAAI,IAAI;AAChE;AAJgB;AAWT,SAAS,wBAAiC;AAC/C,MAAI,uBAAuB,EAAG,QAAO;AACrC,SAAO,yBAAyB,UAAU,MAAM;AAClD;AAHgB;","names":[]}