{"version":3,"file":"server.cjs","names":["createEnvInternal","arkenv"],"sources":["../src/server.ts"],"sourcesContent":["import \"server-only\";\nimport type { $ } from \"@repo/scope\";\nimport type { Dict, SchemaShape } from \"@repo/types\";\nimport type { EnvSchema } from \"arkenv\";\nimport type { type as at, distill } from \"arktype\";\nimport { createEnvInternal } from \"./create-env\";\nimport type { MergeExtends } from \"./types\";\n\n/**\n * Create a validated, type-safe environment configuration for Next.js applications (Server entry point).\n */\nexport function createEnv<\n\tconst TSchema extends SchemaShape = {},\n\tconst TExtends extends readonly unknown[] = [],\n>(\n\tschema: EnvSchema<TSchema>,\n\toptions?: {\n\t\textends?: [...TExtends];\n\t\truntimeEnv?: Dict<string>;\n\t},\n): Readonly<distill.Out<at.infer<TSchema, $>> & MergeExtends<TExtends>>;\n\n/**\n * @deprecated Use the unified flat layout signature instead: `createEnv(schema, options)`\n */\nexport function createEnv<\n\tconst TServer extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n\tconst TExtends extends readonly unknown[] = [],\n>(options: {\n\tserver?: EnvSchema<TServer>;\n\tshared?: EnvSchema<TShared>;\n\textends?: [...TExtends];\n\truntimeEnv?: Record<keyof TShared, string | undefined> & Dict<string>;\n}): Readonly<\n\tdistill.Out<at.infer<TServer & TShared, $>> & MergeExtends<TExtends>\n>;\n\nexport function createEnv(schemaOrOptions: any, optionsOrIsServer?: any): any {\n\tconst isLegacy =\n\t\tschemaOrOptions &&\n\t\ttypeof schemaOrOptions === \"object\" &&\n\t\t(\"runtimeEnv\" in schemaOrOptions ||\n\t\t\t\"server\" in schemaOrOptions ||\n\t\t\t\"shared\" in schemaOrOptions);\n\n\tif (isLegacy) {\n\t\tif (\"client\" in schemaOrOptions) {\n\t\t\tthrow new Error(\n\t\t\t\t\"server entry point only accepts 'server' and 'shared' schemas.\",\n\t\t\t);\n\t\t}\n\t\treturn createEnvInternal(schemaOrOptions, true);\n\t}\n\n\treturn createEnvInternal(schemaOrOptions, optionsOrIsServer, {\n\t\tisServer: true,\n\t\tstrictLayout: \"server\",\n\t});\n}\n\nexport { type } from \"arkenv\";\n\nconst arkenv = createEnv;\nexport default arkenv;\n"],"mappings":"mNAsCA,SAAgB,EAAU,EAAsB,EAA8B,CAQ7E,GANC,GACA,OAAO,GAAoB,WAC1B,eAAgB,GAChB,WAAY,GACZ,WAAY,GAEA,CACb,GAAI,WAAY,EACf,MAAU,MACT,iEACA,CAEF,OAAOA,EAAAA,EAAkB,EAAiB,GAAK,CAGhD,OAAOA,EAAAA,EAAkB,EAAiB,EAAmB,CAC5D,SAAU,GACV,aAAc,SACd,CAAC,CAKH,MAAMC,EAAS"}