// @bun
var U=Object.defineProperty;var V=(D)=>D;function W(D,B){this[D]=V.bind(null,B)}var J=(D,B)=>{for(var G in B)U(D,G,{get:B[G],enumerable:!0,configurable:!0,set:W.bind(B,G)})};var X=(D,B)=>()=>(D&&(B=D(D=0)),B);var P=import.meta.require;import{z as E}from"zod";function I(D){let B=D,G=(F)=>{return B.nullable?E.union([F,E.null()]):F};if(B.const!==void 0)return E.literal(B.const);if(B.enum){let F=B.enum;return G(E.enum(F.map(String)))}if(B.anyOf&&B.anyOf.length>0){let F=B.anyOf.map((H)=>I(H));if(F.length===1)return F[0]??E.unknown();return E.union([F[0]??E.unknown(),F[1]??E.unknown(),...F.slice(2)])}if(B.oneOf&&B.oneOf.length>0){let F=B.oneOf.map((H)=>I(H));if(F.length===1)return F[0]??E.unknown();return E.union([F[0]??E.unknown(),F[1]??E.unknown(),...F.slice(2)])}if(B.allOf&&B.allOf.length>0)return B.allOf.map((H)=>I(H)).reduce((H,L)=>E.intersection(H,L));switch(B.type){case"string":return G(Y(B));case"number":case"integer":return G(_(B));case"boolean":return G(E.boolean());case"null":return E.null();case"array":return G($(B));case"object":return G(g(B));default:return E.unknown()}}function Y(D){let B=E.string();if(D.description)B=B.describe(D.description);switch(D.format){case"email":B=B.email();break;case"uri":case"url":B=B.url();break;case"uuid":B=B.uuid();break;case"date-time":B=B.datetime();break;case"date":B=B.date();break}if(D.minLength!==void 0)B=B.min(D.minLength);if(D.maxLength!==void 0)B=B.max(D.maxLength);if(D.pattern)B=B.regex(new RegExp(D.pattern));return B}function _(D){let B=D.type==="integer"?E.number().int():E.number();if(D.description)B=B.describe(D.description);if(D.minimum!==void 0)B=B.min(D.minimum);if(D.maximum!==void 0)B=B.max(D.maximum);return B}function $(D){let B=D.items?I(D.items):E.unknown(),G=E.array(B);if(D.description)G=G.describe(D.description);return G}function g(D){let B=D.properties??{},G=new Set(D.required??[]),F={};for(let[L,R]of Object.entries(B)){let M=I(R);F[L]=G.has(L)?M:M.optional()}let H=E.object(F);if(D.description)H=H.describe(D.description);return H}function y(D){if(!D||Object.keys(D).length===0)return E.object({});return I(D)}var Q=()=>{};Q();import{Output as K}from"ai";function q(D){let B=I(D);return K.object({schema:B})}function w(D){let B=I(D);return K.array({element:B})}function v(D){return K.choice({options:D})}function x(D){return K.object({schema:D})}function A(){return K.text()}var T={fromJsonSchema:q,arrayFromJsonSchema:w,fromEnum:v,fromZod:x,text:A};export{x as zodToOutput,A as textOutput,q as jsonSchemaToOutput,w as jsonSchemaToArrayOutput,v as enumToChoiceOutput,T as SchemaOutput};
