import { z } from "zod";
//#region src/contracts/env.ts
const ProviderEnvOverridesSchema = z.object({
	ABLIT_API_BASE_URL: z.string().optional(),
	ABLIT_KEY: z.string().optional(),
	AI21_API_BASE_URL: z.string().optional(),
	AI21_API_KEY: z.string().optional(),
	AIML_API_KEY: z.string().optional(),
	ANTHROPIC_API_KEY: z.string().optional(),
	ANTHROPIC_BASE_URL: z.string().optional(),
	ATLASCLOUD_API_KEY: z.string().optional(),
	AWS_BEARER_TOKEN_BEDROCK: z.string().optional(),
	AWS_BEDROCK_REGION: z.string().optional(),
	AZURE_API_BASE_URL: z.string().optional(),
	AZURE_API_HOST: z.string().optional(),
	AZURE_API_KEY: z.string().optional(),
	AZURE_AUTHORITY_HOST: z.string().optional(),
	AZURE_CLIENT_ID: z.string().optional(),
	AZURE_CLIENT_SECRET: z.string().optional(),
	AZURE_DEPLOYMENT_NAME: z.string().optional(),
	AZURE_EMBEDDING_DEPLOYMENT_NAME: z.string().optional(),
	AZURE_OPENAI_API_BASE_URL: z.string().optional(),
	AZURE_OPENAI_API_HOST: z.string().optional(),
	AZURE_OPENAI_API_KEY: z.string().optional(),
	AZURE_OPENAI_BASE_URL: z.string().optional(),
	AZURE_OPENAI_DEPLOYMENT_NAME: z.string().optional(),
	AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME: z.string().optional(),
	AZURE_TENANT_ID: z.string().optional(),
	AZURE_TOKEN_SCOPE: z.string().optional(),
	CLAUDE_CODE_USE_BEDROCK: z.string().optional(),
	CLAUDE_CODE_USE_VERTEX: z.string().optional(),
	CLOUDFLARE_ACCOUNT_ID: z.string().optional(),
	CLOUDFLARE_API_KEY: z.string().optional(),
	CLOUDFLARE_GATEWAY_ID: z.string().optional(),
	CF_AIG_TOKEN: z.string().optional(),
	COMETAPI_KEY: z.string().optional(),
	COHERE_API_KEY: z.string().optional(),
	COHERE_CLIENT_NAME: z.string().optional(),
	DATABRICKS_TOKEN: z.string().optional(),
	DATABRICKS_WORKSPACE_URL: z.string().optional(),
	DOCKER_MODEL_RUNNER_BASE_URL: z.string().optional(),
	DOCKER_MODEL_RUNNER_API_KEY: z.string().optional(),
	ELEVENLABS_API_KEY: z.string().optional(),
	FAL_KEY: z.string().optional(),
	FIREWORKS_API_BASE_URL: z.string().optional(),
	FIREWORKS_API_KEY: z.string().optional(),
	GITHUB_TOKEN: z.string().optional(),
	GOOGLE_API_HOST: z.string().optional(),
	GOOGLE_API_BASE_URL: z.string().optional(),
	GOOGLE_API_KEY: z.string().optional(),
	GOOGLE_PROJECT_ID: z.string().optional(),
	GOOGLE_LOCATION: z.string().optional(),
	GOOGLE_GENERATIVE_AI_API_KEY: z.string().optional(),
	GEMINI_API_KEY: z.string().optional(),
	GROQ_API_KEY: z.string().optional(),
	HELICONE_API_KEY: z.string().optional(),
	HF_API_TOKEN: z.string().optional(),
	HF_TOKEN: z.string().optional(),
	HYPERBOLIC_API_KEY: z.string().optional(),
	HUGGING_FACE_HUB_TOKEN: z.string().optional(),
	JFROG_API_KEY: z.string().optional(),
	LANGFUSE_HOST: z.string().optional(),
	LANGFUSE_PUBLIC_KEY: z.string().optional(),
	LANGFUSE_SECRET_KEY: z.string().optional(),
	LITELLM_API_BASE: z.string().optional(),
	LLAMA_BASE_URL: z.string().optional(),
	LOCALAI_BASE_URL: z.string().optional(),
	MISTRAL_API_BASE_URL: z.string().optional(),
	MISTRAL_API_HOST: z.string().optional(),
	MISTRAL_API_KEY: z.string().optional(),
	MINIMAX_API_KEY: z.string().optional(),
	MLFLOW_GATEWAY_API_KEY: z.string().optional(),
	MLFLOW_GATEWAY_URL: z.string().optional(),
	MODELSLAB_API_KEY: z.string().optional(),
	N8N_API_KEY: z.string().optional(),
	NSCALE_SERVICE_TOKEN: z.string().optional(),
	NSCALE_API_KEY: z.string().optional(),
	NOVITA_API_KEY: z.string().optional(),
	NVIDIA_API_BASE_URL: z.string().optional(),
	NVIDIA_API_KEY: z.string().optional(),
	OLLAMA_API_KEY: z.string().optional(),
	OLLAMA_BASE_URL: z.string().optional(),
	OPENAI_API_BASE_URL: z.string().optional(),
	OPENAI_API_HOST: z.string().optional(),
	OPENAI_API_KEY: z.string().optional(),
	OPENAI_BASE_URL: z.string().optional(),
	OPENAI_ORGANIZATION: z.string().optional(),
	CLAWDBOT_GATEWAY_PASSWORD: z.string().optional(),
	CLAWDBOT_GATEWAY_TOKEN: z.string().optional(),
	CLAWDBOT_GATEWAY_URL: z.string().optional(),
	CODEX_API_KEY: z.string().optional(),
	OPENCLAW_CONFIG_PATH: z.string().optional(),
	OPENCLAW_GATEWAY_PASSWORD: z.string().optional(),
	OPENCLAW_GATEWAY_PORT: z.string().optional(),
	OPENCLAW_GATEWAY_TOKEN: z.string().optional(),
	OPENCLAW_GATEWAY_URL: z.string().optional(),
	ORCAROUTER_API_KEY: z.string().optional(),
	PALM_API_HOST: z.string().optional(),
	PALM_API_KEY: z.string().optional(),
	PORTKEY_API_KEY: z.string().optional(),
	PROMPTFOO_CA_CERT_PATH: z.string().optional(),
	PROMPTFOO_PFX_CERT_PATH: z.string().optional(),
	PROMPTFOO_PFX_PASSWORD: z.string().optional(),
	PROMPTFOO_JKS_CERT_PATH: z.string().optional(),
	PROMPTFOO_JKS_PASSWORD: z.string().optional(),
	PROMPTFOO_JKS_ALIAS: z.string().optional(),
	PROMPTFOO_INSECURE_SSL: z.string().optional(),
	QUIVERAI_API_KEY: z.string().optional(),
	REPLICATE_API_KEY: z.string().optional(),
	REPLICATE_API_TOKEN: z.string().optional(),
	SHAREPOINT_BASE_URL: z.string().optional(),
	SHAREPOINT_CERT_PATH: z.string().optional(),
	SHAREPOINT_CLIENT_ID: z.string().optional(),
	SHAREPOINT_TENANT_ID: z.string().optional(),
	VERCEL_AI_GATEWAY_API_KEY: z.string().optional(),
	VERCEL_AI_GATEWAY_BASE_URL: z.string().optional(),
	VERTEX_API_HOST: z.string().optional(),
	VERTEX_API_KEY: z.string().optional(),
	VERTEX_API_VERSION: z.string().optional(),
	VERTEX_PROJECT_ID: z.string().optional(),
	VERTEX_PUBLISHER: z.string().optional(),
	VERTEX_REGION: z.string().optional(),
	VOYAGE_API_BASE_URL: z.string().optional(),
	VOYAGE_API_KEY: z.string().optional(),
	WATSONX_AI_APIKEY: z.string().optional(),
	WATSONX_AI_AUTH_TYPE: z.string().optional(),
	WATSONX_AI_BEARER_TOKEN: z.string().optional(),
	WATSONX_AI_PROJECT_ID: z.string().optional(),
	XAI_API_BASE_URL: z.string().optional(),
	XAI_API_KEY: z.string().optional(),
	AZURE_CONTENT_SAFETY_ENDPOINT: z.string().optional(),
	AZURE_CONTENT_SAFETY_API_KEY: z.string().optional(),
	AZURE_CONTENT_SAFETY_API_VERSION: z.string().optional(),
	AWS_REGION: z.string().optional(),
	AWS_DEFAULT_REGION: z.string().optional(),
	AWS_SAGEMAKER_MAX_TOKENS: z.string().optional(),
	AWS_SAGEMAKER_TEMPERATURE: z.string().optional(),
	AWS_SAGEMAKER_TOP_P: z.string().optional(),
	AWS_SAGEMAKER_MAX_RETRIES: z.string().optional(),
	PROMPTFOO_EVAL_TIMEOUT_MS: z.string().optional()
});
//#endregion
//#region src/contracts/shared.ts
const CompletionTokenDetailsSchema = z.object({
	reasoning: z.number().optional(),
	acceptedPrediction: z.number().optional(),
	rejectedPrediction: z.number().optional(),
	cacheReadInputTokens: z.number().optional(),
	cacheCreationInputTokens: z.number().optional()
});
const TokenUsageCoreSchema = z.object({
	prompt: z.number().optional(),
	completion: z.number().optional(),
	cached: z.number().optional(),
	total: z.number().optional(),
	numRequests: z.number().optional(),
	completionDetails: CompletionTokenDetailsSchema.optional()
});
/** Token usage statistics. The optional `assertions` mirrors the top-level fields for model-graded assertion accounting. */
const BaseTokenUsageSchema = TokenUsageCoreSchema.extend({ assertions: TokenUsageCoreSchema.optional() });
const InputTypeValues = [
	"text",
	"pdf",
	"docx",
	"image"
];
const InputTypeSchema = z.enum(InputTypeValues);
const DocxInjectionPlacementValues = [
	"body",
	"comment",
	"footnote",
	"header",
	"footer"
];
const DocxInjectionPlacementSchema = z.enum(DocxInjectionPlacementValues);
const DocumentMediaInjectionPlacementValues = [
	"body",
	"header",
	"footer"
];
const DocumentMediaInjectionPlacementSchema = z.enum(DocumentMediaInjectionPlacementValues);
const InputConfigSchema = z.object({
	benign: z.boolean().optional(),
	inputPurpose: z.string().min(1, { error: "Input purpose must be a non-empty string" }).optional(),
	injectionPlacements: z.array(z.string().min(1, { error: "Injection placement must be a non-empty string" })).min(1, { error: "Injection placements must contain at least one placement" }).optional()
});
const InputDefinitionObjectSchema = z.object({
	config: InputConfigSchema.optional(),
	description: z.string().min(1, { error: "Input descriptions must be non-empty strings" }),
	type: InputTypeSchema.optional()
}).superRefine((input, ctx) => {
	const inputType = input.type ?? "text";
	const injectionPlacements = input.config?.injectionPlacements ?? [];
	if (inputType === "text" || injectionPlacements.length === 0) return;
	const placementSchema = inputType === "docx" ? DocxInjectionPlacementSchema : DocumentMediaInjectionPlacementSchema;
	const placementValues = inputType === "docx" ? DocxInjectionPlacementValues : DocumentMediaInjectionPlacementValues;
	const invalidPlacements = injectionPlacements.filter((placement) => !placementSchema.safeParse(placement).success);
	if (invalidPlacements.length > 0) ctx.addIssue({
		code: "custom",
		path: ["config", "injectionPlacements"],
		message: `Invalid ${inputType.toUpperCase()} injection placements: ${invalidPlacements.join(", ")}. Expected one of: ${placementValues.join(", ")}`
	});
});
const InputDefinitionSchema = z.union([z.string().min(1, { error: "Input descriptions must be non-empty strings" }), InputDefinitionObjectSchema]);
function normalizeInputDefinition(input) {
	if (typeof input === "string") return {
		description: input,
		type: "text"
	};
	return {
		config: input.config,
		description: input.description,
		type: input.type ?? "text"
	};
}
function normalizeInputs(inputs) {
	if (!inputs) return;
	return Object.fromEntries(Object.entries(inputs).map(([key, input]) => [key, normalizeInputDefinition(input)]));
}
function getInputDescription(input) {
	return typeof input === "string" ? input : input.description;
}
function getInputType(input) {
	return typeof input === "string" ? "text" : input.type ?? "text";
}
const NON_TEXT_INPUT_FORMAT_LABELS = {
	pdf: "PDF document",
	docx: "DOCX document",
	image: "image"
};
function buildInputPromptDescription(input) {
	const normalized = normalizeInputDefinition(input);
	const benignGuidance = normalized.config?.benign ? " Generate benign, natural, non-adversarial content for this input. Do not place attack instructions or policy-violating content here." : "";
	if (normalized.type === "text") return `${normalized.description}${benignGuidance}`;
	const formatLabel = NON_TEXT_INPUT_FORMAT_LABELS[normalized.type];
	return `${normalized.description} (format: ${formatLabel}; provide the text or instructions that should be embedded in the file)${benignGuidance}`;
}
const InputVariableNameSchema = z.string().regex(/^[a-zA-Z_][a-zA-Z0-9_]*$/, { error: "Input variable names must be valid identifiers (start with letter or underscore)" });
const InputsSchema = z.record(InputVariableNameSchema, InputDefinitionSchema);
//#endregion
//#region src/contracts/validators/prompts.ts
const PromptConfigSchema = z.object({
	prefix: z.string().optional(),
	suffix: z.string().optional()
});
const PromptFunctionSchema = z.custom((v) => typeof v === "function");
const PromptSchema = z.object({
	id: z.string().optional(),
	raw: z.string(),
	template: z.string().optional(),
	display: z.string().optional(),
	label: z.string(),
	function: PromptFunctionSchema.optional(),
	config: z.any().optional()
});
function assert() {}
assert();
assert();
assert();
//#endregion
export { getInputType as _, DocumentMediaInjectionPlacementSchema as a, ProviderEnvOverridesSchema as b, DocxInjectionPlacementValues as c, InputDefinitionSchema as d, InputTypeSchema as f, getInputDescription as g, buildInputPromptDescription as h, CompletionTokenDetailsSchema as i, InputConfigSchema as l, InputsSchema as m, PromptSchema as n, DocumentMediaInjectionPlacementValues as o, InputTypeValues as p, BaseTokenUsageSchema as r, DocxInjectionPlacementSchema as s, PromptConfigSchema as t, InputDefinitionObjectSchema as u, normalizeInputDefinition as v, normalizeInputs as y };

//# sourceMappingURL=prompts-GW61BoS0.js.map