{"version":3,"file":"client.cjs","names":["createEnvInternal","arkenv"],"sources":["../src/client.ts"],"sourcesContent":["import 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 (Client entry point).\n */\nexport function createEnv<\n\tconst TSchema extends SchemaShape = {},\n\tconst TExtends extends readonly unknown[] = [],\n>(\n\tschema: EnvSchema<TSchema> & {\n\t\t[K in keyof TSchema]: K extends `NEXT_PUBLIC_${string}` ? unknown : never;\n\t},\n\toptions?: {\n\t\textends?: [...TExtends];\n\t\truntimeEnv: Record<keyof TSchema, string | undefined> & 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 TClient extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n\tconst TExtends extends readonly unknown[] = [],\n>(options: {\n\tclient?: EnvSchema<TClient> & {\n\t\t[K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? unknown : never;\n\t};\n\tshared?: EnvSchema<TShared>;\n\textends?: [...TExtends];\n\truntimeEnv: Record<keyof TClient | keyof TShared, unknown> &\n\t\tRecord<string, unknown>;\n}): Readonly<\n\tdistill.Out<at.infer<TClient & 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\"client\" in schemaOrOptions ||\n\t\t\t\"shared\" in schemaOrOptions);\n\n\tif (isLegacy) {\n\t\tif (\"server\" in schemaOrOptions) {\n\t\t\tthrow new Error(\n\t\t\t\t\"client entry point only accepts 'client' and 'shared' schemas.\",\n\t\t\t);\n\t\t}\n\t\treturn createEnvInternal(schemaOrOptions, false);\n\t}\n\n\treturn createEnvInternal(schemaOrOptions, optionsOrIsServer, {\n\t\tisServer: false,\n\t\tstrictLayout: \"client\",\n\t});\n}\n\nexport { type } from \"arkenv\";\n\nconst arkenv = createEnv;\nexport default arkenv;\n"],"mappings":"4LA0CA,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,GAAM,CAGjD,OAAOA,EAAAA,EAAkB,EAAiB,EAAmB,CAC5D,SAAU,GACV,aAAc,SACd,CAAC,CAKH,MAAMC,EAAS"}