Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("./rolldown-runtime-D_mwlA32.cjs");
const require_prompts = require("./prompts-BpCc1Nyq.cjs");
const require_transform = require("./transform-d2ww5aGU.cjs");
const require_shared = require("./shared-CT0cbsKY.cjs");
let zod = require("zod");
//#region src/contracts/api/common.ts
/** Standard email validation schema. */
const EmailSchema = zod.z.string().email();
/**
* Response containing only a `message` field. Closed shape - extra properties are stripped.
* For responses that may carry endpoint-specific metadata, use `SuccessResponseSchema` (passthrough).
*/
const MessageResponseSchema = zod.z.object({ message: zod.z.string() });
/** Response containing a success flag and optional message. */
const SuccessResponseSchema = zod.z.object({
	success: zod.z.boolean(),
	message: zod.z.string().optional()
}).passthrough();
/** Shared API error shape. Routes may add endpoint-specific fields. */
const ErrorResponseSchema = zod.z.object({
	error: zod.z.string(),
	details: zod.z.unknown().optional(),
	suggestion: zod.z.string().optional(),
	success: zod.z.literal(false).optional()
}).passthrough();
/**
* Express query strings arrive as `string | undefined`. This schema treats only the literal
* string `'true'` (or boolean `true`) as truthy; every other value - including `'1'`, `'yes'`,
* and `undefined` - resolves to `false`. Tests that depend on tri-state semantics should use
* a different schema.
*/
const BooleanQueryParamSchema = zod.z.union([zod.z.boolean(), zod.z.string()]).optional().transform((value) => value === true || value === "true");
/** Generic object payload for endpoints with intentionally open data. */
const JsonObjectSchema = zod.z.record(zod.z.string(), zod.z.unknown());
/** Timestamp that can be either an ISO string or Unix epoch number. */
const TimestampSchema = zod.z.union([zod.z.string(), zod.z.number()]);
//#endregion
//#region src/contracts/api/user.ts
/** Email status values returned by the server. */
const EmailStatusEnum = zod.z.enum([
	"ok",
	"exceeded_limit",
	"show_usage_warning",
	"email_verification_required",
	"no_email",
	"risky_email",
	"disposable_email"
]);
const GetUserResponseSchema = zod.z.object({ email: EmailSchema.nullable() });
const GetUserIdResponseSchema = zod.z.object({ id: zod.z.string() });
const UpdateUserRequestSchema = zod.z.object({ email: EmailSchema });
const UpdateUserResponseSchema = zod.z.object({
	success: zod.z.boolean(),
	message: zod.z.string()
});
const ClearUserEmailResponseSchema = UpdateUserResponseSchema;
const EmailStatusValidateQueryParamSchema = zod.z.unknown().optional().transform((value) => value === true || value === "true");
const GetEmailStatusQuerySchema = zod.z.object({ validate: EmailStatusValidateQueryParamSchema });
const GetEmailStatusResponseSchema = zod.z.object({
	hasEmail: zod.z.boolean(),
	email: EmailSchema.optional(),
	status: EmailStatusEnum,
	message: zod.z.string().optional()
});
/** Request body for API key authentication. */
const LoginRequestSchema = zod.z.object({
	apiKey: zod.z.string().min(1, "API key is required").max(512, "API key too long"),
	apiHost: zod.z.url().optional()
});
/** Response from successful login. */
const LoginResponseSchema = zod.z.object({
	success: zod.z.literal(true),
	user: zod.z.object({
		id: zod.z.string(),
		name: zod.z.string(),
		email: EmailSchema
	}),
	organization: zod.z.object({
		id: zod.z.string(),
		name: zod.z.string()
	}),
	app: zod.z.object({ url: zod.z.string() })
});
/** Response from logout endpoint. */
const LogoutResponseSchema = zod.z.object({
	success: zod.z.literal(true),
	message: zod.z.string()
});
/** Response from cloud config endpoint. */
const CloudConfigResponseSchema = zod.z.object({
	appUrl: zod.z.string(),
	isEnabled: zod.z.boolean()
});
/** Grouped schemas for server-side validation. */
const UserSchemas = {
	Get: { Response: GetUserResponseSchema },
	GetId: { Response: GetUserIdResponseSchema },
	Update: {
		Request: UpdateUserRequestSchema,
		Response: UpdateUserResponseSchema
	},
	ClearEmail: { Response: ClearUserEmailResponseSchema },
	EmailStatus: {
		Query: GetEmailStatusQuerySchema,
		Response: GetEmailStatusResponseSchema
	},
	Login: {
		Request: LoginRequestSchema,
		Response: LoginResponseSchema
	},
	Logout: { Response: LogoutResponseSchema },
	CloudConfig: { Response: CloudConfigResponseSchema }
};
//#endregion
exports.BaseTokenUsageSchema = require_prompts.BaseTokenUsageSchema;
exports.BooleanQueryParamSchema = BooleanQueryParamSchema;
exports.ClearUserEmailResponseSchema = ClearUserEmailResponseSchema;
exports.CloudConfigResponseSchema = CloudConfigResponseSchema;
exports.CompletionTokenDetailsSchema = require_prompts.CompletionTokenDetailsSchema;
exports.DocumentMediaInjectionPlacementSchema = require_prompts.DocumentMediaInjectionPlacementSchema;
exports.DocumentMediaInjectionPlacementValues = require_prompts.DocumentMediaInjectionPlacementValues;
exports.DocxInjectionPlacementSchema = require_prompts.DocxInjectionPlacementSchema;
exports.DocxInjectionPlacementValues = require_prompts.DocxInjectionPlacementValues;
exports.EmailSchema = EmailSchema;
exports.EmailStatusEnum = EmailStatusEnum;
exports.ErrorResponseSchema = ErrorResponseSchema;
exports.GetEmailStatusQuerySchema = GetEmailStatusQuerySchema;
exports.GetEmailStatusResponseSchema = GetEmailStatusResponseSchema;
exports.GetUserIdResponseSchema = GetUserIdResponseSchema;
exports.GetUserResponseSchema = GetUserResponseSchema;
exports.InputConfigSchema = require_prompts.InputConfigSchema;
exports.InputDefinitionObjectSchema = require_prompts.InputDefinitionObjectSchema;
exports.InputDefinitionSchema = require_prompts.InputDefinitionSchema;
exports.InputTypeSchema = require_prompts.InputTypeSchema;
exports.InputTypeValues = require_prompts.InputTypeValues;
exports.InputsSchema = require_prompts.InputsSchema;
exports.JsonObjectSchema = JsonObjectSchema;
exports.LoginRequestSchema = LoginRequestSchema;
exports.LoginResponseSchema = LoginResponseSchema;
exports.LogoutResponseSchema = LogoutResponseSchema;
exports.MessageResponseSchema = MessageResponseSchema;
exports.NunjucksFilterMapSchema = require_shared.NunjucksFilterMapSchema;
exports.PromptConfigSchema = require_prompts.PromptConfigSchema;
exports.PromptSchema = require_prompts.PromptSchema;
exports.ProviderEnvOverridesSchema = require_prompts.ProviderEnvOverridesSchema;
exports.StringOrFunctionSchema = require_shared.StringOrFunctionSchema;
exports.SuccessResponseSchema = SuccessResponseSchema;
exports.TimestampSchema = TimestampSchema;
exports.UpdateUserRequestSchema = UpdateUserRequestSchema;
exports.UpdateUserResponseSchema = UpdateUserResponseSchema;
exports.UserSchemas = UserSchemas;
exports.buildInputPromptDescription = require_prompts.buildInputPromptDescription;
exports.getInputDescription = require_prompts.getInputDescription;
exports.getInputType = require_prompts.getInputType;
exports.hasFunctionToolCallValidator = require_transform.hasFunctionToolCallValidator;
exports.isTransformFunction = require_transform.isTransformFunction;
exports.normalizeInputDefinition = require_prompts.normalizeInputDefinition;
exports.normalizeInputs = require_prompts.normalizeInputs;

//# sourceMappingURL=contracts.cjs.map