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AAc,KAAK,MAAiB,EAAc,KAAK,MAC5F,EAAc,KAAK,SAAW,wBAC7C,MAAM,YAAE,GAAgB,EAAc,KAChC,EAAS,WAAY,GAAW,EAAQ,OAAS,EAAQ,OAAS,WAClE,IAAmB,cAAe,KAAiC,IAAtB,EAAQ,UAC3D,MAAO,CACN,SAAU,qBAAqB,CAC9B,QAAS,EAAc,KAAK,iBAAmB,uBAC/C,OAAQ,GAAU,GAClB,cACA,SACA,qBAED,QAAS,oBAAoB,CAC5B,UACA,OAAQ,GAAU,GAClB,gBAED,MAAO,kBAAkB,CACxB,UACA,OAAQ,GAAU,GAClB,gBAED,OAAQ,mBAAmB,CAC1B,UACA,OAAQ,GAAU,GAClB,gBAED,SAIO,YAAa,oBAAqB,mBAAoB,aAAc,gBAAiB,aAAc,OAAQ","file":"/npm/@decartai/sdk@0.0.63/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@decartai/sdk@0.0.63/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { ERROR_CODES, createInvalidApiKeyError, createInvalidBaseUrlError } from \"./utils/errors.js\";\nimport { createProcessClient } from \"./process/client.js\";\nimport { createQueueClient } from \"./queue/client.js\";\nimport { isImageModel, isRealtimeModel, isVideoModel, models } from \"./shared/model.js\";\nimport { createRealTimeClient } from \"./realtime/client.js\";\nimport { createTokensClient } from \"./tokens/client.js\";\nimport { readEnv } from \"./utils/env.js\";\nimport { createConsoleLogger, noopLogger } from \"./utils/logger.js\";\nimport { z } from \"zod\";\n\n//#region src/index.ts\nconst proxySchema = z.union([z.string().url(), z.string().startsWith(\"/\")]);\nconst decartClientOptionsSchema = z.object({\n\tapiKey: z.string().min(1).optional(),\n\tbaseUrl: z.url().optional(),\n\tproxy: proxySchema.optional(),\n\tintegration: z.string().optional(),\n\trealtimeBaseUrl: z.url().optional()\n}).refine((data) => {\n\tconst hasProxy = !!data.proxy;\n\tconst hasApiKey = !!data.apiKey;\n\treturn !(hasProxy && hasApiKey);\n}, { message: \"Cannot provide both 'proxy' and 'apiKey'. Use 'proxy' for proxy mode or 'apiKey' for direct API access.\" });\n/**\n* Create a Decart API client.\n*\n* @param options - Configuration options\n* @param options.proxy - URL of the proxy server. When set, the client will use the proxy instead of direct API access and apiKey is not required.\n* @param options.apiKey - API key for authentication.\n* @param options.baseUrl - Override the default API base URL.\n* @param options.realtimeBaseUrl - Override the default WebSocket base URL for realtime connections.\n* @param options.integration - Optional integration identifier.\n*\n* @example\n* ```ts\n* //  (direct API access)Option 1: Explicit API key\n* const client = createDecartClient({ apiKey: \"your-api-key\" });\n*\n* // Option 2: Using DECART_API_KEY environment variable\n* const client = createDecartClient();\n*\n* // Option 3: Using proxy (client-side, no API key needed)\n* const client = createDecartClient({ proxy: \"https://your-server.com/api/decart\" });\n* ```\n*/\nconst createDecartClient = (options = {}) => {\n\tconst parsedOptions = decartClientOptionsSchema.safeParse(options);\n\tif (!parsedOptions.success) {\n\t\tconst issue = parsedOptions.error.issues[0];\n\t\tif (issue.path.includes(\"apiKey\")) throw createInvalidApiKeyError();\n\t\tif (issue.path.includes(\"baseUrl\") || issue.path.includes(\"realtimeBaseUrl\")) throw createInvalidBaseUrlError(options[issue.path.includes(\"realtimeBaseUrl\") ? \"realtimeBaseUrl\" : \"baseUrl\"]);\n\t\tif (issue.path.includes(\"proxy\")) throw createInvalidBaseUrlError(issue.path.includes(\"proxy\") ? options.proxy : void 0);\n\t\tthrow parsedOptions.error;\n\t}\n\tconst isProxyMode = \"proxy\" in parsedOptions.data && !!parsedOptions.data.proxy;\n\tconst apiKey = isProxyMode ? void 0 : (\"apiKey\" in parsedOptions.data ? parsedOptions.data.apiKey : void 0) ?? readEnv(\"DECART_API_KEY\");\n\tif (!isProxyMode && !apiKey) throw createInvalidApiKeyError();\n\tlet baseUrl;\n\tif (isProxyMode && \"proxy\" in parsedOptions.data && parsedOptions.data.proxy) baseUrl = parsedOptions.data.proxy;\n\telse baseUrl = parsedOptions.data.baseUrl || \"https://api.decart.ai\";\n\tconst { integration } = parsedOptions.data;\n\tconst logger = \"logger\" in options && options.logger ? options.logger : noopLogger;\n\tconst telemetryEnabled = \"telemetry\" in options && options.telemetry === false ? false : true;\n\treturn {\n\t\trealtime: createRealTimeClient({\n\t\t\tbaseUrl: parsedOptions.data.realtimeBaseUrl || \"wss://api3.decart.ai\",\n\t\t\tapiKey: apiKey || \"\",\n\t\t\tintegration,\n\t\t\tlogger,\n\t\t\ttelemetryEnabled\n\t\t}),\n\t\tprocess: createProcessClient({\n\t\t\tbaseUrl,\n\t\t\tapiKey: apiKey || \"\",\n\t\t\tintegration\n\t\t}),\n\t\tqueue: createQueueClient({\n\t\t\tbaseUrl,\n\t\t\tapiKey: apiKey || \"\",\n\t\t\tintegration\n\t\t}),\n\t\ttokens: createTokensClient({\n\t\t\tbaseUrl,\n\t\t\tapiKey: apiKey || \"\",\n\t\t\tintegration\n\t\t})\n\t};\n};\n\n//#endregion\nexport { ERROR_CODES, createConsoleLogger, createDecartClient, isImageModel, isRealtimeModel, isVideoModel, models, noopLogger };"]}