nao-core 0.0.11__py3-none-any.whl → 0.0.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. nao_core/__init__.py +1 -1
  2. nao_core/bin/migrations-postgres/0000_supreme_cable.sql +85 -0
  3. nao_core/bin/migrations-postgres/meta/0000_snapshot.json +610 -0
  4. nao_core/bin/migrations-postgres/meta/_journal.json +13 -0
  5. nao_core/bin/migrations-sqlite/0000_cloudy_squirrel_girl.sql +85 -0
  6. nao_core/bin/migrations-sqlite/meta/0000_snapshot.json +590 -0
  7. nao_core/bin/migrations-sqlite/meta/_journal.json +13 -0
  8. nao_core/bin/nao-chat-server +0 -0
  9. nao_core/bin/public/assets/index-BUcR0FCx.css +1 -0
  10. nao_core/bin/public/assets/index-DDQ8i103.js +14 -0
  11. nao_core/bin/public/assets/index-nOBqrovO.js +36 -0
  12. nao_core/bin/public/assets/login-CGCfd7iQ.js +1 -0
  13. nao_core/bin/public/assets/signinForm-BGrBZeLW.js +1 -0
  14. nao_core/bin/public/assets/signup-BGjbIX9B.js +1 -0
  15. nao_core/bin/public/github-icon.svg +19 -0
  16. nao_core/bin/public/google-icon.svg +2 -0
  17. nao_core/bin/public/index.html +2 -2
  18. nao_core/commands/debug.py +4 -0
  19. nao_core/commands/sync.py +2 -1
  20. {nao_core-0.0.11.dist-info → nao_core-0.0.12.dist-info}/METADATA +1 -1
  21. nao_core-0.0.12.dist-info/RECORD +31 -0
  22. nao_core/bin/public/assets/index-BSxC58nD.js +0 -36
  23. nao_core/bin/public/assets/index-Dh3br3Ia.js +0 -13
  24. nao_core/bin/public/assets/index-heKLHGGE.css +0 -1
  25. nao_core-0.0.11.dist-info/RECORD +0 -20
  26. {nao_core-0.0.11.dist-info → nao_core-0.0.12.dist-info}/WHEEL +0 -0
  27. {nao_core-0.0.11.dist-info → nao_core-0.0.12.dist-info}/entry_points.txt +0 -0
  28. {nao_core-0.0.11.dist-info → nao_core-0.0.12.dist-info}/licenses/LICENSE +0 -0
@@ -1,36 +0,0 @@
1
- import{g as ps,r as N,j as $,R as fs}from"./index-Dh3br3Ia.js";var wn="vercel.ai.error",ms=Symbol.for(wn),yr,_r,ve=class kn extends(_r=Error,yr=ms,_r){constructor({name:t,message:r,cause:n}){super(r),this[yr]=!0,this.name=t,this.cause=n}static isInstance(t){return kn.hasMarker(t,wn)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}};function xn(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var Sn="AI_InvalidArgumentError",En=`vercel.ai.error.${Sn}`,hs=Symbol.for(En),wr,kr,gs=class extends(kr=ve,wr=hs,kr){constructor({message:e,cause:t,argument:r}){super({name:Sn,message:e,cause:t}),this[wr]=!0,this.argument=r}static isInstance(e){return ve.hasMarker(e,En)}},zn="AI_JSONParseError",In=`vercel.ai.error.${zn}`,vs=Symbol.for(In),xr,Sr,Er=class extends(Sr=ve,xr=vs,Sr){constructor({text:e,cause:t}){super({name:zn,message:`JSON parsing failed: Text: ${e}.
2
- Error message: ${xn(t)}`,cause:t}),this[xr]=!0,this.text=e}static isInstance(e){return ve.hasMarker(e,In)}},Tn="AI_TypeValidationError",Nn=`vercel.ai.error.${Tn}`,bs=Symbol.for(Nn),zr,Ir,je=class Gt extends(Ir=ve,zr=bs,Ir){constructor({value:t,cause:r}){super({name:Tn,message:`Type validation failed: Value: ${JSON.stringify(t)}.
3
- Error message: ${xn(r)}`,cause:r}),this[zr]=!0,this.value=t}static isInstance(t){return ve.hasMarker(t,Nn)}static wrap({value:t,cause:r}){return Gt.isInstance(r)&&r.value===t?r:new Gt({value:t,cause:r})}};function f(e,t,r){function n(i,l){if(i._zod||Object.defineProperty(i,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,l);const c=a.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){const h=u[d];h in i||(i[h]=c[h].bind(i))}}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(i){var l;const c=r?.Parent?new s:this;n(c,i),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class Re extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class An extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const On={};function be(e){return On}function $n(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function qt(e,t){return typeof t=="bigint"?t.toString():t}function Tt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function nr(e){return e==null}function or(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ys(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const l=n.match(/\d?e-(\d?)/);l?.[1]&&(o=Number.parseInt(l[1]))}const s=r>o?r:o,a=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return a%i/10**s}const Tr=Symbol("evaluating");function j(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Tr)return n===void 0&&(n=Tr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ze(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ie(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Nr(e){return JSON.stringify(e)}function _s(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ws=Tt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Me(e){if(Ye(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ye(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Cn(e){return Me(e)?{...e}:Array.isArray(e)?[...e]:e}const ks=new Set(["string","number","symbol"]);function De(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _e(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function S(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function xs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ss={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Es(e,t){const r=e._zod.def,n=Ie(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return ze(this,"shape",o),o},checks:[]});return _e(e,n)}function zs(e,t){const r=e._zod.def,n=Ie(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return ze(this,"shape",o),o},checks:[]});return _e(e,n)}function Is(e,t){if(!Me(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=Ie(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return ze(this,"shape",s),s},checks:[]});return _e(e,o)}function Ts(e,t){if(!Me(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return ze(this,"shape",n),n},checks:e._zod.def.checks};return _e(e,r)}function Ns(e,t){const r=Ie(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ze(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return _e(e,r)}function As(e,t,r){const n=Ie(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=e?new e({type:"optional",innerType:o[a]}):o[a])}else for(const a in o)s[a]=e?new e({type:"optional",innerType:o[a]}):o[a];return ze(this,"shape",s),s},checks:[]});return _e(t,n)}function Os(e,t,r){const n=Ie(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return ze(this,"shape",s),s},checks:[]});return _e(t,n)}function Ce(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Pe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ct(e){return typeof e=="string"?e:e?.message}function ye(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=ct(e.inst?._zod.def?.error?.(e))??ct(t?.error?.(e))??ct(r.customError?.(e))??ct(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function sr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function He(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Pn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,qt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Rn=f("$ZodError",Pn),jn=f("$ZodError",Pn,{Parent:Error});function $s(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Zs(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let a=r,i=0;for(;i<s.path.length;){const l=s.path[i];i===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(s))):a[l]=a[l]||{_errors:[]},a=a[l],i++}}};return n(e),r}const ar=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new Re;if(a.issues.length){const i=new(o?.Err??e)(a.issues.map(l=>ye(l,s,be())));throw Zn(i,o?.callee),i}return a.value},ir=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const i=new(o?.Err??e)(a.issues.map(l=>ye(l,s,be())));throw Zn(i,o?.callee),i}return a.value},Nt=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Re;return s.issues.length?{success:!1,error:new(e??Rn)(s.issues.map(a=>ye(a,o,be())))}:{success:!0,data:s.value}},Cs=Nt(jn),At=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>ye(a,o,be())))}:{success:!0,data:s.value}},Ps=At(jn),Rs=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ar(e)(t,r,o)},js=e=>(t,r,n)=>ar(e)(t,r,n),Ms=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ir(e)(t,r,o)},Ds=e=>async(t,r,n)=>ir(e)(t,r,n),Ls=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Nt(e)(t,r,o)},Fs=e=>(t,r,n)=>Nt(e)(t,r,n),Us=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return At(e)(t,r,o)},Vs=e=>async(t,r,n)=>At(e)(t,r,n),Bs=/^[cC][^\s-]{8,}$/,Js=/^[0-9a-z]+$/,Ws=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gs=/^[0-9a-vA-V]{20}$/,qs=/^[A-Za-z0-9]{27}$/,Ys=/^[a-zA-Z0-9_-]{21}$/,Hs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ar=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ks=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ea(){return new RegExp(Qs,"u")}const ta=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ra=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,na=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,oa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Mn=/^[A-Za-z0-9_-]*$/,aa=/^\+(?:[0-9]){6,14}[0-9]$/,Dn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ia=new RegExp(`^${Dn}$`);function Ln(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ca(e){return new RegExp(`^${Ln(e)}$`)}function la(e){const t=Ln({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Dn}T(?:${n})$`)}const ua=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},da=/^-?\d+$/,pa=/^-?\d+(?:\.\d+)?/,fa=/^(?:true|false)$/i,ma=/^null$/i,ha=/^[^A-Z]*$/,ga=/^[^a-z]*$/,te=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Fn={number:"number",bigint:"bigint",object:"date"},Un=f("$ZodCheckLessThan",(e,t)=>{te.init(e,t);const r=Fn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vn=f("$ZodCheckGreaterThan",(e,t)=>{te.init(e,t);const r=Fn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),va=f("$ZodCheckMultipleOf",(e,t)=>{te.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):ys(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ba=f("$ZodCheckNumberFormat",(e,t)=>{te.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Ss[t.format];e._zod.onattach.push(a=>{const i=a._zod.bag;i.format=t.format,i.minimum=o,i.maximum=s,r&&(i.pattern=da)}),e._zod.check=a=>{const i=a.value;if(r){if(!Number.isInteger(i)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:i,inst:e});return}if(!Number.isSafeInteger(i)){i>0?a.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):a.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}i<o&&a.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),i>s&&a.issues.push({origin:"number",input:i,code:"too_big",maximum:s,inst:e})}}),ya=f("$ZodCheckMaxLength",(e,t)=>{var r;te.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!nr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=sr(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_a=f("$ZodCheckMinLength",(e,t)=>{var r;te.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!nr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=sr(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),wa=f("$ZodCheckLengthEquals",(e,t)=>{var r;te.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!nr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const a=sr(o),i=s>t.length;n.issues.push({origin:a,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ot=f("$ZodCheckStringFormat",(e,t)=>{var r,n;te.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ka=f("$ZodCheckRegex",(e,t)=>{Ot.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xa=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ha),Ot.init(e,t)}),Sa=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ga),Ot.init(e,t)}),Ea=f("$ZodCheckIncludes",(e,t)=>{te.init(e,t);const r=De(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),za=f("$ZodCheckStartsWith",(e,t)=>{te.init(e,t);const r=new RegExp(`^${De(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ia=f("$ZodCheckEndsWith",(e,t)=>{te.init(e,t);const r=new RegExp(`.*${De(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ta=f("$ZodCheckOverwrite",(e,t)=>{te.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Na{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
4
- `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),s=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
5
- `))}}const Aa={major:4,minor:2,patch:1},V=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Aa;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,i,l)=>{let c=Ce(a),u;for(const d of i){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(c)continue;const h=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new Re;if(u||g instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await g,a.issues.length!==h&&(c||(c=Ce(a,h)))});else{if(a.issues.length===h)continue;c||(c=Ce(a,h))}}return u?u.then(()=>a):a},s=(a,i,l)=>{if(Ce(a))return a.aborted=!0,a;const c=o(i,n,l);if(c instanceof Promise){if(l.async===!1)throw new Re;return c.then(u=>e._zod.parse(u,l))}return e._zod.parse(c,l)};e._zod.run=(a,i)=>{if(i.skipChecks)return e._zod.parse(a,i);if(i.direction==="backward"){const c=e._zod.parse({value:a.value,issues:[]},{...i,skipChecks:!0});return c instanceof Promise?c.then(u=>s(u,a,i)):s(c,a,i)}const l=e._zod.parse(a,i);if(l instanceof Promise){if(i.async===!1)throw new Re;return l.then(c=>o(c,n,i))}return o(l,n,i)}}e["~standard"]={validate:o=>{try{const s=Cs(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Ps(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),cr=f("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ua(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),B=f("$ZodStringFormat",(e,t)=>{Ot.init(e,t),cr.init(e,t)}),Oa=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Xs),B.init(e,t)}),$a=f("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ar(n))}else t.pattern??(t.pattern=Ar());B.init(e,t)}),Za=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ks),B.init(e,t)}),Ca=f("$ZodURL",(e,t)=>{B.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Pa=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ea()),B.init(e,t)}),Ra=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ys),B.init(e,t)}),ja=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Bs),B.init(e,t)}),Ma=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Js),B.init(e,t)}),Da=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ws),B.init(e,t)}),La=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Gs),B.init(e,t)}),Fa=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=qs),B.init(e,t)}),Ua=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=la(t)),B.init(e,t)}),Va=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ia),B.init(e,t)}),Ba=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ca(t)),B.init(e,t)}),Ja=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Hs),B.init(e,t)}),Wa=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ta),B.init(e,t),e._zod.bag.format="ipv4"}),Ga=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ra),B.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),qa=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=na),B.init(e,t)}),Ya=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=oa),B.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,s]=n;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Bn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ha=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=sa),B.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Bn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Xa(e){if(!Mn.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Bn(r)}const Ka=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Mn),B.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Xa(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Qa=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=aa),B.init(e,t)});function ei(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const ti=f("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=r=>{ei(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Jn=f("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??pa,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),ri=f("$ZodNumberFormat",(e,t)=>{ba.init(e,t),Jn.init(e,t)}),ni=f("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=fa,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),oi=f("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=ma,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),si=f("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),ai=f("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Or(e,t,r){e.issues.length&&t.issues.push(...Pe(r,e.issues)),t.value[r]=e.value}const ii=f("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let a=0;a<o.length;a++){const i=o[a],l=t.element._zod.run({value:i,issues:[]},n);l instanceof Promise?s.push(l.then(c=>Or(c,r,a))):Or(l,r,a)}return s.length?Promise.all(s).then(()=>r):r}});function gt(e,t,r,n){e.issues.length&&t.issues.push(...Pe(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Wn(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=xs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Gn(e,t,r,n,o,s){const a=[],i=o.keySet,l=o.catchall._zod,c=l.def.type;for(const u in t){if(i.has(u))continue;if(c==="never"){a.push(u);continue}const d=l.run({value:t[u],issues:[]},n);d instanceof Promise?e.push(d.then(h=>gt(h,r,u,t))):gt(d,r,u,t)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const ci=f("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const i=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...i};return Object.defineProperty(t,"shape",{value:l}),l}})}const n=Tt(()=>Wn(t));j(e._zod,"propValues",()=>{const i=t.shape,l={};for(const c in i){const u=i[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const d of u.values)l[c].add(d)}}return l});const o=Ye,s=t.catchall;let a;e._zod.parse=(i,l)=>{a??(a=n.value);const c=i.value;if(!o(c))return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;i.value={};const u=[],d=a.shape;for(const h of a.keys){const z=d[h]._zod.run({value:c[h],issues:[]},l);z instanceof Promise?u.push(z.then(b=>gt(b,i,h,c))):gt(z,i,h,c)}return s?Gn(u,c,i,l,n.value,e):u.length?Promise.all(u).then(()=>i):i}}),li=f("$ZodObjectJIT",(e,t)=>{ci.init(e,t);const r=e._zod.parse,n=Tt(()=>Wn(t)),o=h=>{const g=new Na(["shape","payload","ctx"]),z=n.value,b=p=>{const _=Nr(p);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};g.write("const input = payload.value;");const m=Object.create(null);let E=0;for(const p of z.keys)m[p]=`key_${E++}`;g.write("const newResult = {};");for(const p of z.keys){const _=m[p],T=Nr(p);g.write(`const ${_} = ${b(p)};`),g.write(`
6
- if (${_}.issues.length) {
7
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
8
- ...iss,
9
- path: iss.path ? [${T}, ...iss.path] : [${T}]
10
- })));
11
- }
12
-
13
-
14
- if (${_}.value === undefined) {
15
- if (${T} in input) {
16
- newResult[${T}] = undefined;
17
- }
18
- } else {
19
- newResult[${T}] = ${_}.value;
20
- }
21
-
22
- `)}g.write("payload.value = newResult;"),g.write("return payload;");const y=g.compile();return(p,_)=>y(h,p,_)};let s;const a=Ye,i=!On.jitless,c=i&&ws.value,u=t.catchall;let d;e._zod.parse=(h,g)=>{d??(d=n.value);const z=h.value;return a(z)?i&&c&&g?.async===!1&&g.jitless!==!0?(s||(s=o(t.shape)),h=s(h,g),u?Gn([],z,h,g,d,e):h):r(h,g):(h.issues.push({expected:"object",code:"invalid_type",input:z,inst:e}),h)}});function $r(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Ce(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(a=>ye(a,n,be())))}),t)}const qn=f("$ZodUnion",(e,t)=>{V.init(e,t),j(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),j(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),j(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),j(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>or(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let a=!1;const i=[];for(const l of t.options){const c=l._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)i.push(c),a=!0;else{if(c.issues.length===0)return c;i.push(c)}}return a?Promise.all(i).then(l=>$r(l,o,e,s)):$r(i,o,e,s)}}),ui=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,qn.init(e,t);const r=e._zod.parse;j(e._zod,"propValues",()=>{const o={};for(const s of t.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[i,l]of Object.entries(a)){o[i]||(o[i]=new Set);for(const c of l)o[i].add(c)}}return o});const n=Tt(()=>{const o=t.options,s=new Map;for(const a of o){const i=a._zod.propValues?.[t.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const l of i){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,a)}}return s});e._zod.parse=(o,s)=>{const a=o.value;if(!Ye(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const i=n.value.get(a?.[t.discriminator]);return i?i._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),di=f("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([l,c])=>Zr(r,l,c)):Zr(r,s,a)}});function Yt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Me(e)&&Me(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const a=Yt(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],a=Yt(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Zr(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Ce(e))return e;const n=Yt(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const pi=f("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Me(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[],a=t.keyType._zod.values;if(a){r.value={};const i=new Set;for(const c of a)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){i.add(typeof c=="number"?c.toString():c);const u=t.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&r.issues.push(...Pe(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...Pe(c,u.issues)),r.value[c]=u.value)}let l;for(const c in o)i.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{r.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const l=t.keyType._zod.run({value:i,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){t.mode==="loose"?r.value[i]=o[i]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>ye(u,n,be())),input:i,path:[i],inst:e});continue}const c=t.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...Pe(i,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...Pe(i,c.issues)),r.value[l.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}}),fi=f("$ZodEnum",(e,t)=>{V.init(e,t);const r=$n(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>ks.has(typeof o)).map(o=>typeof o=="string"?De(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),mi=f("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?De(n):n?De(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{const s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}}),hi=f("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new An(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Re;return r.value=o,r}});function Cr(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const gi=f("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",j(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${or(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Cr(s,r.value)):Cr(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),vi=f("$ZodNullable",(e,t)=>{V.init(e,t),j(e._zod,"optin",()=>t.innerType._zod.optin),j(e._zod,"optout",()=>t.innerType._zod.optout),j(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${or(r.source)}|null)$`):void 0}),j(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),bi=f("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",j(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Pr(s,t)):Pr(o,t)}});function Pr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yi=f("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",j(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),_i=f("$ZodNonOptional",(e,t)=>{V.init(e,t),j(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Rr(s,e)):Rr(o,e)}});function Rr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const wi=f("$ZodCatch",(e,t)=>{V.init(e,t),j(e._zod,"optin",()=>t.innerType._zod.optin),j(e._zod,"optout",()=>t.innerType._zod.optout),j(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(a=>ye(a,n,be()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>ye(s,n,be()))},input:r.value}),r.issues=[]),r)}}),ki=f("$ZodPipe",(e,t)=>{V.init(e,t),j(e._zod,"values",()=>t.in._zod.values),j(e._zod,"optin",()=>t.in._zod.optin),j(e._zod,"optout",()=>t.out._zod.optout),j(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(a=>lt(a,t.in,n)):lt(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>lt(s,t.out,n)):lt(o,t.out,n)}});function lt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const xi=f("$ZodReadonly",(e,t)=>{V.init(e,t),j(e._zod,"propValues",()=>t.innerType._zod.propValues),j(e._zod,"values",()=>t.innerType._zod.values),j(e._zod,"optin",()=>t.innerType?._zod?.optin),j(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(jr):jr(o)}});function jr(e){return e.value=Object.freeze(e.value),e}const Si=f("$ZodLazy",(e,t)=>{V.init(e,t),j(e._zod,"innerType",()=>t.getter()),j(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),j(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),j(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),j(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ei=f("$ZodCustom",(e,t)=>{te.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Mr(s,r,n,e));Mr(o,r,n,e)}});function Mr(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(He(o))}}var Dr;class zi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ii(){return new zi}(Dr=globalThis).__zod_globalRegistry??(Dr.__zod_globalRegistry=Ii());const Je=globalThis.__zod_globalRegistry;function Ti(e,t){return new e({type:"string",...S(t)})}function Ni(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function Lr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function Ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function $i(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function Ci(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function Pi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function Ri(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function ji(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function Mi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function Di(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function Li(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function Fi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Ui(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Vi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}function Bi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function Ji(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Wi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function Gi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function qi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function Yi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}function Hi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}function Xi(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}function Ki(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}function Qi(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}function ec(e,t){return new e({type:"number",checks:[],...S(t)})}function tc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}function rc(e,t){return new e({type:"boolean",...S(t)})}function nc(e,t){return new e({type:"null",...S(t)})}function oc(e){return new e({type:"unknown"})}function sc(e,t){return new e({type:"never",...S(t)})}function Fr(e,t){return new Un({check:"less_than",...S(t),value:e,inclusive:!1})}function jt(e,t){return new Un({check:"less_than",...S(t),value:e,inclusive:!0})}function Ur(e,t){return new Vn({check:"greater_than",...S(t),value:e,inclusive:!1})}function Mt(e,t){return new Vn({check:"greater_than",...S(t),value:e,inclusive:!0})}function Vr(e,t){return new va({check:"multiple_of",...S(t),value:e})}function Yn(e,t){return new ya({check:"max_length",...S(t),maximum:e})}function vt(e,t){return new _a({check:"min_length",...S(t),minimum:e})}function Hn(e,t){return new wa({check:"length_equals",...S(t),length:e})}function ac(e,t){return new ka({check:"string_format",format:"regex",...S(t),pattern:e})}function ic(e){return new xa({check:"string_format",format:"lowercase",...S(e)})}function cc(e){return new Sa({check:"string_format",format:"uppercase",...S(e)})}function lc(e,t){return new Ea({check:"string_format",format:"includes",...S(t),includes:e})}function uc(e,t){return new za({check:"string_format",format:"starts_with",...S(t),prefix:e})}function dc(e,t){return new Ia({check:"string_format",format:"ends_with",...S(t),suffix:e})}function Le(e){return new Ta({check:"overwrite",tx:e})}function pc(e){return Le(t=>t.normalize(e))}function fc(){return Le(e=>e.trim())}function mc(){return Le(e=>e.toLowerCase())}function hc(){return Le(e=>e.toUpperCase())}function gc(){return Le(e=>_s(e))}function vc(e,t,r){return new e({type:"array",element:t,...S(r)})}function bc(e,t,r){const n=S(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function yc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...S(r)})}function _c(e){const t=wc(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(He(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(He(o))}},e(r.value,r)));return t}function wc(e,t){const r=new te({check:"custom",...S(t)});return r._zod.check=e,r}function bt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Je,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function U(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);const i=e._zod.toJSONSchema?.();if(i)a.schema=i;else{const u={...r,schemaPath:[...r.schemaPath,e],path:r.path},d=e._zod.parent;if(d)a.ref=d,U(d,t,u),t.seen.get(d).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,u);else{const h=a.schema,g=t.processors[o.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,h,u)}}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&K(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function yt(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const u=e.external.registry.get(s[0])?.id,d=e.external.uri??(g=>g);if(u)return{ref:d(u)};const h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${d("__shared")}#/${a}/${h}`}}if(s[1]===r)return{ref:"#"};const l=`#/${a}/`,c=s[1].schema.id??`__schema${e.counter++}`;return{defId:c,ref:l+c}},o=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:i,defId:l}=n(s);a.def={...a.schema},l&&(a.defId=l);const c=a.schema;for(const u in c)delete c[u];c.$ref=i};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
23
-
24
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){o(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function _t(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=a=>{const i=e.seen.get(a),l=i.def??i.schema,c={...l};if(i.ref===null)return;const u=i.ref;if(i.ref=null,u){n(u);const d=e.seen.get(u).schema;d.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(d)):(Object.assign(l,d),Object.assign(l,c))}i.isParent||e.override({zodSchema:a,jsonSchema:l,path:i.path??[]})};for(const a of[...e.seen.entries()].reverse())n(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);const s=e.external?.defs??{};for(const a of e.seen.entries()){const i=a[1];i.def&&i.defId&&(s[i.defId]=i.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:wt(t,"input"),output:wt(t,"output")}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function K(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return K(n.element,r);if(n.type==="set")return K(n.valueType,r);if(n.type==="lazy")return K(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return K(n.innerType,r);if(n.type==="intersection")return K(n.left,r)||K(n.right,r);if(n.type==="record"||n.type==="map")return K(n.keyType,r)||K(n.valueType,r);if(n.type==="pipe")return K(n.in,r)||K(n.out,r);if(n.type==="object"){for(const o in n.shape)if(K(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(K(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(K(o,r))return!0;return!!(n.rest&&K(n.rest,r))}return!1}const kc=(e,t={})=>r=>{const n=bt({...r,processors:t});return U(e,n),yt(n,e),_t(n,e)},wt=(e,t)=>r=>{const{libraryOptions:n,target:o}=r??{},s=bt({...n??{},target:o,io:t,processors:{}});return U(e,s),yt(s,e),_t(s,e)},xc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Xn=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:s,maximum:a,format:i,patterns:l,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),i&&(o.format=xc[i]??i,o.format===""&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Kn=(e,t,r,n)=>{const o=r,{minimum:s,maximum:a,format:i,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=e._zod.bag;typeof i=="string"&&i.includes("int")?o.type="integer":o.type="number",typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u),typeof s=="number"&&(o.minimum=s,typeof u=="number"&&t.target!=="draft-04"&&(u>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof c=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),typeof a=="number"&&(o.maximum=a,typeof c=="number"&&t.target!=="draft-04"&&(c<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof l=="number"&&(o.multipleOf=l)},Qn=(e,t,r,n)=>{r.type="boolean"},Sc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Ec=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},eo=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},zc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Ic=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},to=(e,t,r,n)=>{r.not={}},Tc=(e,t,r,n)=>{},ro=(e,t,r,n)=>{},Nc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},no=(e,t,r,n)=>{const o=e._zod.def,s=$n(o.entries);s.every(a=>typeof a=="number")&&(r.type="number"),s.every(a=>typeof a=="string")&&(r.type="string"),r.enum=s},oo=(e,t,r,n)=>{const o=e._zod.def,s=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else s.every(a=>typeof a=="number")&&(r.type="number"),s.every(a=>typeof a=="string")&&(r.type="string"),s.every(a=>typeof a=="boolean")&&(r.type="boolean"),s.every(a=>a===null)&&(r.type="null"),r.enum=s},Ac=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Oc=(e,t,r,n)=>{const o=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},$c=(e,t,r,n)=>{const o=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:i,mime:l}=e._zod.bag;a!==void 0&&(s.minLength=a),i!==void 0&&(s.maxLength=i),l?l.length===1?(s.contentMediaType=l[0],Object.assign(o,s)):o.anyOf=l.map(c=>({...s,contentMediaType:c})):Object.assign(o,s)},Zc=(e,t,r,n)=>{r.type="boolean"},so=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Cc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},ao=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Pc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Rc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},io=(e,t,r,n)=>{const o=r,s=e._zod.def,{minimum:a,maximum:i}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof i=="number"&&(o.maxItems=i),o.type="array",o.items=U(s.element,t,{...n,path:[...n.path,"items"]})},co=(e,t,r,n)=>{const o=r,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const c in a)o.properties[c]=U(a[c],t,{...n,path:[...n.path,"properties",c]});const i=new Set(Object.keys(a)),l=new Set([...i].filter(c=>{const u=s.shape[c]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));l.size>0&&(o.required=Array.from(l)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=U(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},lo=(e,t,r,n)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((i,l)=>U(i,t,{...n,path:[...n.path,s?"oneOf":"anyOf",l]}));s?r.oneOf=a:r.anyOf=a},uo=(e,t,r,n)=>{const o=e._zod.def,s=U(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=U(o.right,t,{...n,path:[...n.path,"allOf",1]}),i=c=>"allOf"in c&&Object.keys(c).length===1,l=[...i(s)?s.allOf:[s],...i(a)?a.allOf:[a]];r.allOf=l},jc=(e,t,r,n)=>{const o=r,s=e._zod.def;o.type="array";const a=t.target==="draft-2020-12"?"prefixItems":"items",i=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((h,g)=>U(h,t,{...n,path:[...n.path,a,g]})),c=s.rest?U(s.rest,t,{...n,path:[...n.path,i,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=l,c&&(o.items=c)):t.target==="openapi-3.0"?(o.items={anyOf:l},c&&o.items.anyOf.push(c),o.minItems=l.length,c||(o.maxItems=l.length)):(o.items=l,c&&(o.additionalItems=c));const{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof d=="number"&&(o.maxItems=d)},po=(e,t,r,n)=>{const o=r,s=e._zod.def;o.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=U(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=U(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})},fo=(e,t,r,n)=>{const o=e._zod.def,s=U(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},mo=(e,t,r,n)=>{const o=e._zod.def;U(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},ho=(e,t,r,n)=>{const o=e._zod.def;U(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},go=(e,t,r,n)=>{const o=e._zod.def;U(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},vo=(e,t,r,n)=>{const o=e._zod.def;U(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},bo=(e,t,r,n)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;U(s,t,n);const a=t.seen.get(e);a.ref=s},yo=(e,t,r,n)=>{const o=e._zod.def;U(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},Mc=(e,t,r,n)=>{const o=e._zod.def;U(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},_o=(e,t,r,n)=>{const o=e._zod.def;U(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},wo=(e,t,r,n)=>{const o=e._zod.innerType;U(o,t,n);const s=t.seen.get(e);s.ref=o},Br={string:Xn,number:Kn,boolean:Qn,bigint:Sc,symbol:Ec,null:eo,undefined:zc,void:Ic,never:to,any:Tc,unknown:ro,date:Nc,enum:no,literal:oo,nan:Ac,template_literal:Oc,file:$c,success:Zc,custom:so,function:Cc,transform:ao,map:Pc,set:Rc,array:io,object:co,union:lo,intersection:uo,tuple:jc,record:po,nullable:fo,nonoptional:mo,default:ho,prefault:go,catch:vo,pipe:bo,readonly:yo,promise:Mc,optional:_o,lazy:wo};function Dc(e,t){if("_idmap"in e){const n=e,o=bt({...t,processors:Br}),s={};for(const l of n._idmap.entries()){const[c,u]=l;U(u,o)}const a={},i={registry:n,uri:t?.uri,defs:s};o.external=i;for(const l of n._idmap.entries()){const[c,u]=l;yt(o,u),a[c]=_t(o,u)}if(Object.keys(s).length>0){const l=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:s}}return{schemas:a}}const r=bt({...t,processors:Br});return U(e,r),yt(r,e),_t(r,e)}const Lc=f("ZodISODateTime",(e,t)=>{Ua.init(e,t),W.init(e,t)});function Fc(e){return Hi(Lc,e)}const Uc=f("ZodISODate",(e,t)=>{Va.init(e,t),W.init(e,t)});function Vc(e){return Xi(Uc,e)}const Bc=f("ZodISOTime",(e,t)=>{Ba.init(e,t),W.init(e,t)});function Jc(e){return Ki(Bc,e)}const Wc=f("ZodISODuration",(e,t)=>{Ja.init(e,t),W.init(e,t)});function Gc(e){return Qi(Wc,e)}const qc=(e,t)=>{Rn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Zs(e,r)},flatten:{value:r=>$s(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,qt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,qt,2)}},isEmpty:{get(){return e.issues.length===0}}})},se=f("ZodError",qc,{Parent:Error}),Yc=ar(se),Hc=ir(se),Xc=Nt(se),ko=At(se),Kc=Rs(se),Qc=js(se),el=Ms(se),tl=Ds(se),rl=Ls(se),nl=Fs(se),ol=Us(se),sl=Vs(se),J=f("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wt(e,"input"),output:wt(e,"output")}}),e.toJSONSchema=kc(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Ie(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>_e(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Yc(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Xc(e,r,n),e.parseAsync=async(r,n)=>Hc(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ko(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Kc(e,r,n),e.decode=(r,n)=>Qc(e,r,n),e.encodeAsync=async(r,n)=>el(e,r,n),e.decodeAsync=async(r,n)=>tl(e,r,n),e.safeEncode=(r,n)=>rl(e,r,n),e.safeDecode=(r,n)=>nl(e,r,n),e.safeEncodeAsync=async(r,n)=>ol(e,r,n),e.safeDecodeAsync=async(r,n)=>sl(e,r,n),e.refine=(r,n)=>e.check(Ql(r,n)),e.superRefine=r=>e.check(eu(r)),e.overwrite=r=>e.check(Le(r)),e.optional=()=>Gr(e),e.nullable=()=>qr(e),e.nullish=()=>Gr(qr(e)),e.nonoptional=r=>Jl(e,r),e.array=()=>Fe(e),e.or=r=>ee([e,r]),e.and=r=>Pl(e,r),e.transform=r=>Yr(e,Dl(r)),e.default=r=>Ul(e,r),e.prefault=r=>Bl(e,r),e.catch=r=>Gl(e,r),e.pipe=r=>Yr(e,r),e.readonly=()=>Hl(e),e.describe=r=>{const n=e.clone();return Je.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Je.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Je.get(e);const n=e.clone();return Je.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),xo=f("_ZodString",(e,t)=>{cr.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Xn(e,n,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(ac(...n)),e.includes=(...n)=>e.check(lc(...n)),e.startsWith=(...n)=>e.check(uc(...n)),e.endsWith=(...n)=>e.check(dc(...n)),e.min=(...n)=>e.check(vt(...n)),e.max=(...n)=>e.check(Yn(...n)),e.length=(...n)=>e.check(Hn(...n)),e.nonempty=(...n)=>e.check(vt(1,...n)),e.lowercase=n=>e.check(ic(n)),e.uppercase=n=>e.check(cc(n)),e.trim=()=>e.check(fc()),e.normalize=(...n)=>e.check(pc(...n)),e.toLowerCase=()=>e.check(mc()),e.toUpperCase=()=>e.check(hc()),e.slugify=()=>e.check(gc())}),al=f("ZodString",(e,t)=>{cr.init(e,t),xo.init(e,t),e.email=r=>e.check(Ni(il,r)),e.url=r=>e.check(Ci(cl,r)),e.jwt=r=>e.check(Yi(xl,r)),e.emoji=r=>e.check(Pi(ll,r)),e.guid=r=>e.check(Lr(Jr,r)),e.uuid=r=>e.check(Ai(ut,r)),e.uuidv4=r=>e.check(Oi(ut,r)),e.uuidv6=r=>e.check($i(ut,r)),e.uuidv7=r=>e.check(Zi(ut,r)),e.nanoid=r=>e.check(Ri(ul,r)),e.guid=r=>e.check(Lr(Jr,r)),e.cuid=r=>e.check(ji(dl,r)),e.cuid2=r=>e.check(Mi(pl,r)),e.ulid=r=>e.check(Di(fl,r)),e.base64=r=>e.check(Wi(_l,r)),e.base64url=r=>e.check(Gi(wl,r)),e.xid=r=>e.check(Li(ml,r)),e.ksuid=r=>e.check(Fi(hl,r)),e.ipv4=r=>e.check(Ui(gl,r)),e.ipv6=r=>e.check(Vi(vl,r)),e.cidrv4=r=>e.check(Bi(bl,r)),e.cidrv6=r=>e.check(Ji(yl,r)),e.e164=r=>e.check(qi(kl,r)),e.datetime=r=>e.check(Fc(r)),e.date=r=>e.check(Vc(r)),e.time=r=>e.check(Jc(r)),e.duration=r=>e.check(Gc(r))});function v(e){return Ti(al,e)}const W=f("ZodStringFormat",(e,t)=>{B.init(e,t),xo.init(e,t)}),il=f("ZodEmail",(e,t)=>{Za.init(e,t),W.init(e,t)}),Jr=f("ZodGUID",(e,t)=>{Oa.init(e,t),W.init(e,t)}),ut=f("ZodUUID",(e,t)=>{$a.init(e,t),W.init(e,t)}),cl=f("ZodURL",(e,t)=>{Ca.init(e,t),W.init(e,t)}),ll=f("ZodEmoji",(e,t)=>{Pa.init(e,t),W.init(e,t)}),ul=f("ZodNanoID",(e,t)=>{Ra.init(e,t),W.init(e,t)}),dl=f("ZodCUID",(e,t)=>{ja.init(e,t),W.init(e,t)}),pl=f("ZodCUID2",(e,t)=>{Ma.init(e,t),W.init(e,t)}),fl=f("ZodULID",(e,t)=>{Da.init(e,t),W.init(e,t)}),ml=f("ZodXID",(e,t)=>{La.init(e,t),W.init(e,t)}),hl=f("ZodKSUID",(e,t)=>{Fa.init(e,t),W.init(e,t)}),gl=f("ZodIPv4",(e,t)=>{Wa.init(e,t),W.init(e,t)}),vl=f("ZodIPv6",(e,t)=>{Ga.init(e,t),W.init(e,t)}),bl=f("ZodCIDRv4",(e,t)=>{qa.init(e,t),W.init(e,t)}),yl=f("ZodCIDRv6",(e,t)=>{Ya.init(e,t),W.init(e,t)}),_l=f("ZodBase64",(e,t)=>{Ha.init(e,t),W.init(e,t)}),wl=f("ZodBase64URL",(e,t)=>{Ka.init(e,t),W.init(e,t)}),kl=f("ZodE164",(e,t)=>{Qa.init(e,t),W.init(e,t)}),xl=f("ZodJWT",(e,t)=>{ti.init(e,t),W.init(e,t)}),So=f("ZodNumber",(e,t)=>{Jn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Kn(e,n,o),e.gt=(n,o)=>e.check(Ur(n,o)),e.gte=(n,o)=>e.check(Mt(n,o)),e.min=(n,o)=>e.check(Mt(n,o)),e.lt=(n,o)=>e.check(Fr(n,o)),e.lte=(n,o)=>e.check(jt(n,o)),e.max=(n,o)=>e.check(jt(n,o)),e.int=n=>e.check(Wr(n)),e.safe=n=>e.check(Wr(n)),e.positive=n=>e.check(Ur(0,n)),e.nonnegative=n=>e.check(Mt(0,n)),e.negative=n=>e.check(Fr(0,n)),e.nonpositive=n=>e.check(jt(0,n)),e.multipleOf=(n,o)=>e.check(Vr(n,o)),e.step=(n,o)=>e.check(Vr(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Sl(e){return ec(So,e)}const El=f("ZodNumberFormat",(e,t)=>{ri.init(e,t),So.init(e,t)});function Wr(e){return tc(El,e)}const zl=f("ZodBoolean",(e,t)=>{ni.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qn(e,r,n)});function Q(e){return rc(zl,e)}const Il=f("ZodNull",(e,t)=>{oi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eo(e,r,n)});function Tl(e){return nc(Il,e)}const Nl=f("ZodUnknown",(e,t)=>{si.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro()});function le(){return oc(Nl)}const Al=f("ZodNever",(e,t)=>{ai.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n)});function Eo(e){return sc(Al,e)}const Ol=f("ZodArray",(e,t)=>{ii.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(vt(r,n)),e.nonempty=r=>e.check(vt(1,r)),e.max=(r,n)=>e.check(Yn(r,n)),e.length=(r,n)=>e.check(Hn(r,n)),e.unwrap=()=>e.element});function Fe(e,t){return vc(Ol,e,t)}const zo=f("ZodObject",(e,t)=>{li.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>co(e,r,n,o),j(e,"shape",()=>t.shape),e.keyof=()=>To(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:le()}),e.loose=()=>e.clone({...e._zod.def,catchall:le()}),e.strict=()=>e.clone({...e._zod.def,catchall:Eo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Is(e,r),e.safeExtend=r=>Ts(e,r),e.merge=r=>Ns(e,r),e.pick=r=>Es(e,r),e.omit=r=>zs(e,r),e.partial=(...r)=>As(No,e,r[0]),e.required=(...r)=>Os(Ao,e,r[0])});function D(e,t){const r={type:"object",shape:e??{},...S(t)};return new zo(r)}function L(e,t){return new zo({type:"object",shape:e,catchall:Eo(),...S(t)})}const Io=f("ZodUnion",(e,t)=>{qn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o),e.options=t.options});function ee(e,t){return new Io({type:"union",options:e,...S(t)})}const $l=f("ZodDiscriminatedUnion",(e,t)=>{Io.init(e,t),ui.init(e,t)});function Zl(e,t,r){return new $l({type:"union",options:t,discriminator:e,...S(r)})}const Cl=f("ZodIntersection",(e,t)=>{di.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o)});function Pl(e,t){return new Cl({type:"intersection",left:e,right:t})}const Rl=f("ZodRecord",(e,t)=>{pi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Xe(e,t,r){return new Rl({type:"record",keyType:e,valueType:t,...S(r)})}const Ht=f("ZodEnum",(e,t)=>{fi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,s)=>no(e,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const a of n)if(r.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Ht({...t,checks:[],...S(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const a of n)if(r.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Ht({...t,checks:[],...S(o),entries:s})}});function To(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ht({type:"enum",entries:r,...S(t)})}const jl=f("ZodLiteral",(e,t)=>{mi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function I(e,t){return new jl({type:"literal",values:Array.isArray(e)?e:[e],...S(t)})}const Ml=f("ZodTransform",(e,t)=>{hi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ao(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new An(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(He(s,r.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(He(a))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Dl(e){return new Ml({type:"transform",transform:e})}const No=f("ZodOptional",(e,t)=>{gi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_o(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gr(e){return new No({type:"optional",innerType:e})}const Ll=f("ZodNullable",(e,t)=>{vi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function qr(e){return new Ll({type:"nullable",innerType:e})}const Fl=f("ZodDefault",(e,t)=>{bi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ul(e,t){return new Fl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Cn(t)}})}const Vl=f("ZodPrefault",(e,t)=>{yi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>go(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Bl(e,t){return new Vl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Cn(t)}})}const Ao=f("ZodNonOptional",(e,t)=>{_i.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Jl(e,t){return new Ao({type:"nonoptional",innerType:e,...S(t)})}const Wl=f("ZodCatch",(e,t)=>{wi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Gl(e,t){return new Wl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ql=f("ZodPipe",(e,t)=>{ki.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bo(e,r,n,o),e.in=t.in,e.out=t.out});function Yr(e,t){return new ql({type:"pipe",in:e,out:t})}const Yl=f("ZodReadonly",(e,t)=>{xi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hl(e){return new Yl({type:"readonly",innerType:e})}const Xl=f("ZodLazy",(e,t)=>{Si.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wo(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Kl(e){return new Xl({type:"lazy",getter:e})}const lr=f("ZodCustom",(e,t)=>{Ei.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r)});function Oo(e,t){return bc(lr,e??(()=>!0),t)}function Ql(e,t={}){return yc(lr,e,t)}function eu(e){return _c(e)}function kt(e,t={error:`Input not instance of ${e.name}`}){const r=new lr({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...S(t)});return r._zod.bag.Class=e,r}var Ke;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{const s={};for(const a of o)s[a]=a;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(i=>typeof o[o[i]]!="number"),a={};for(const i of s)a[i]=o[i];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},e.find=(o,s)=>{for(const a of o)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Ke||(Ke={}));var Hr;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Hr||(Hr={}));Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class xt extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(s){return s.message},n={_errors:[]},o=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let i=n,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(r(a))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return o(this),n}static assert(t){if(!(t instanceof xt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r=Object.create(null),n=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];r[s]=r[s]||[],r[s].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}xt.create=e=>new xt(e);var Xr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Xr||(Xr={}));var Z;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Z||(Z={}));class Kr extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Dt(e){}function tu(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=Dt,onError:r=Dt,onRetry:n=Dt,onComment:o}=e;let s="",a=!0,i,l="",c="";function u(b){const m=a?b.replace(/^\xEF\xBB\xBF/,""):b,[E,y]=ru(`${s}${m}`);for(const p of E)d(p);s=y,a=!1}function d(b){if(b===""){g();return}if(b.startsWith(":")){o&&o(b.slice(b.startsWith(": ")?2:1));return}const m=b.indexOf(":");if(m!==-1){const E=b.slice(0,m),y=b[m+1]===" "?2:1,p=b.slice(m+y);h(E,p,b);return}h(b,"",b)}function h(b,m,E){switch(b){case"event":c=m;break;case"data":l=`${l}${m}
25
- `;break;case"id":i=m.includes("\0")?void 0:m;break;case"retry":/^\d+$/.test(m)?n(parseInt(m,10)):r(new Kr(`Invalid \`retry\` value: "${m}"`,{type:"invalid-retry",value:m,line:E}));break;default:r(new Kr(`Unknown field "${b.length>20?`${b.slice(0,20)}…`:b}"`,{type:"unknown-field",field:b,value:m,line:E}));break}}function g(){l.length>0&&t({id:i,event:c||void 0,data:l.endsWith(`
26
- `)?l.slice(0,-1):l}),i=void 0,l="",c=""}function z(b={}){s&&b.consume&&d(s),a=!0,i=void 0,l="",c="",s=""}return{feed:u,reset:z}}function ru(e){const t=[];let r="",n=0;for(;n<e.length;){const o=e.indexOf("\r",n),s=e.indexOf(`
27
- `,n);let a=-1;if(o!==-1&&s!==-1?a=Math.min(o,s):o!==-1?o===e.length-1?a=-1:a=o:s!==-1&&(a=s),a===-1){r=e.slice(n);break}else{const i=e.slice(n,a);t.push(i),n=a+1,e[n-1]==="\r"&&e[n]===`
28
- `&&n++}}return[t,r]}class nu extends TransformStream{constructor({onError:t,onRetry:r,onComment:n}={}){let o;super({start(s){o=tu({onEvent:a=>{s.enqueue(a)},onError(a){t==="terminate"?s.error(a):typeof t=="function"&&t(a)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}var tt=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const o=()=>{const s=r.length,a=new Array(t);for(let i=0;i<t;i++)a[i]=r[Math.random()*s|0];return a.join("")};if(e==null)return o;if(r.includes(n))throw new gs({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${o()}`},ou=tt();function Qr(e=globalThis){var t,r,n;return e.window?"runtime/browser":(t=e.navigator)!=null&&t.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(n=(r=e.process)==null?void 0:r.versions)!=null&&n.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Se(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((r,n)=>{t[n.toLowerCase()]=r});else{Array.isArray(e)||(e=Object.entries(e));for(const[r,n]of e)n!=null&&(t[r.toLowerCase()]=n)}return t}function en(e,...t){const r=new Headers(Se(e)),n=r.get("user-agent")||"";return r.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var su=/"__proto__"\s*:/,au=/"constructor"\s*:/;function tn(e){const t=JSON.parse(e);return t===null||typeof t!="object"||su.test(e)===!1&&au.test(e)===!1?t:iu(t)}function iu(e){let t=[e];for(;t.length;){const r=t;t=[];for(const n of r){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const o in n){const s=n[o];s&&typeof s=="object"&&t.push(s)}}}return e}function cu(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return tn(e)}try{return tn(e)}finally{Error.stackTraceLimit=t}}function ft(e){if(e.type==="object"){e.additionalProperties=!1;const t=e.properties;if(t!=null)for(const r in t)t[r]=ft(t[r])}return e.type==="array"&&e.items!=null&&(Array.isArray(e.items)?e.items=e.items.map(t=>ft(t)):e.items=ft(e.items)),e}var lu=Symbol("Let zodToJsonSchema decide on which parser to use"),rn={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},uu=e=>typeof e=="string"?{...rn,name:e}:{...rn,...e};function ne(){return{}}function du(e,t){var r,n,o;const s={type:"array"};return(r=e.type)!=null&&r._def&&((o=(n=e.type)==null?void 0:n._def)==null?void 0:o.typeName)!==Z.ZodAny&&(s.items=M(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(s.minItems=e.minLength.value),e.maxLength&&(s.maxItems=e.maxLength.value),e.exactLength&&(s.minItems=e.exactLength.value,s.maxItems=e.exactLength.value),s}function pu(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function fu(){return{type:"boolean"}}function $o(e,t){return M(e.type._def,t)}var mu=(e,t)=>M(e.innerType._def,t);function Zo(e,t,r){const n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Zo(e,t,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return hu(e)}}var hu=e=>{const t={type:"integer",format:"unix-time"};for(const r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value;break}return t};function gu(e,t){return{...M(e.innerType._def,t),default:e.defaultValue()}}function vu(e,t){return t.effectStrategy==="input"?M(e.schema._def,t):ne()}function bu(e){return{type:"string",enum:Array.from(e.values)}}var yu=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function _u(e,t){const r=[M(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),M(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),n=[];return r.forEach(o=>{if(yu(o))n.push(...o.allOf);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:a,...i}=o;s=i}n.push(s)}}),n.length?{allOf:n}:void 0}function wu(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var Lt=void 0,ae={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Lt===void 0&&(Lt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Lt),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Co(e,t){const r={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":ie(r,"email",n.message,t);break;case"format:idn-email":ie(r,"idn-email",n.message,t);break;case"pattern:zod":X(r,ae.email,n.message,t);break}break;case"url":ie(r,"uri",n.message,t);break;case"uuid":ie(r,"uuid",n.message,t);break;case"regex":X(r,n.regex,n.message,t);break;case"cuid":X(r,ae.cuid,n.message,t);break;case"cuid2":X(r,ae.cuid2,n.message,t);break;case"startsWith":X(r,RegExp(`^${Ft(n.value,t)}`),n.message,t);break;case"endsWith":X(r,RegExp(`${Ft(n.value,t)}$`),n.message,t);break;case"datetime":ie(r,"date-time",n.message,t);break;case"date":ie(r,"date",n.message,t);break;case"time":ie(r,"time",n.message,t);break;case"duration":ie(r,"duration",n.message,t);break;case"length":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value;break;case"includes":{X(r,RegExp(Ft(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&ie(r,"ipv4",n.message,t),n.version!=="v4"&&ie(r,"ipv6",n.message,t);break}case"base64url":X(r,ae.base64url,n.message,t);break;case"jwt":X(r,ae.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&X(r,ae.ipv4Cidr,n.message,t),n.version!=="v4"&&X(r,ae.ipv6Cidr,n.message,t);break}case"emoji":X(r,ae.emoji(),n.message,t);break;case"ulid":{X(r,ae.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{ie(r,"binary",n.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{X(r,ae.base64,n.message,t);break}}break}case"nanoid":X(r,ae.nanoid,n.message,t)}return r}function Ft(e,t){return t.patternStrategy==="escape"?xu(e):e}var ku=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function xu(e){let t="";for(let r=0;r<e.length;r++)ku.has(e[r])||(t+="\\"),t+=e[r];return t}function ie(e,t,r,n){var o;e.format||(o=e.anyOf)!=null&&o.some(s=>s.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function X(e,t,r,n){var o;e.pattern||(o=e.allOf)!=null&&o.some(s=>s.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:nn(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=nn(t,n)}function nn(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=n.i?e.source.toLowerCase():e.source;let s="",a=!1,i=!1,l=!1;for(let c=0;c<o.length;c++){if(a){s+=o[c],a=!1;continue}if(n.i){if(i){if(o[c].match(/[a-z]/)){l?(s+=o[c],s+=`${o[c-2]}-${o[c]}`.toUpperCase(),l=!1):o[c+1]==="-"&&((r=o[c+2])!=null&&r.match(/[a-z]/))?(s+=o[c],l=!0):s+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){s+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(n.m){if(o[c]==="^"){s+=`(^|(?<=[\r
29
- ]))`;continue}else if(o[c]==="$"){s+=`($|(?=[\r
30
- ]))`;continue}}if(n.s&&o[c]==="."){s+=i?`${o[c]}\r
31
- `:`[${o[c]}\r
32
- ]`;continue}s+=o[c],o[c]==="\\"?a=!0:i&&o[c]==="]"?i=!1:!i&&o[c]==="["&&(i=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}function Po(e,t){var r,n,o,s,a,i;const l={type:"object",additionalProperties:(r=M(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Z.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:c,...u}=Co(e.keyType._def,t);return{...l,propertyNames:u}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===Z.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((a=e.keyType)==null?void 0:a._def.typeName)===Z.ZodBranded&&e.keyType._def.type._def.typeName===Z.ZodString&&((i=e.keyType._def.type._def.checks)!=null&&i.length)){const{type:c,...u}=$o(e.keyType._def,t);return{...l,propertyNames:u}}}return l}function Su(e,t){if(t.mapStrategy==="record")return Po(e,t);const r=M(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||ne(),n=M(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||ne();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Eu(e){const t=e.values,n=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function zu(){return{not:ne()}}function Iu(){return{type:"null"}}var Xt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Tu(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in Xt&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((o,s)=>{const a=Xt[s._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((o,s)=>{const a=typeof s._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){const o=n.filter((s,a,i)=>i.indexOf(s)===a);return{type:o.length>1?o:o[0],enum:r.reduce((s,a)=>s.includes(a._def.value)?s:[...s,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return Nu(e,t)}var Nu=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>M(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Au(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Xt[e.innerType._def.typeName],"null"]};const r=M(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Ou(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function $u(e,t){const r={type:"object",properties:{}},n=[],o=e.shape();for(const a in o){let i=o[a];if(i===void 0||i._def===void 0)continue;const l=Cu(i),c=M(i._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});c!==void 0&&(r.properties[a]=c,l||n.push(a))}n.length&&(r.required=n);const s=Zu(e,t);return s!==void 0&&(r.additionalProperties=s),r}function Zu(e,t){if(e.catchall._def.typeName!=="ZodNever")return M(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Cu(e){try{return e.isOptional()}catch{return!0}}var Pu=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return M(e.innerType._def,t);const n=M(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:ne()},n]}:ne()},Ru=(e,t)=>{if(t.pipeStrategy==="input")return M(e.in._def,t);if(t.pipeStrategy==="output")return M(e.out._def,t);const r=M(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=M(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function ju(e,t){return M(e.type._def,t)}function Mu(e,t){const n={type:"array",uniqueItems:!0,items:M(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Du(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>M(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:M(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>M(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Lu(){return{not:ne()}}function Fu(){return ne()}var Uu=(e,t)=>M(e.innerType._def,t),Vu=(e,t,r)=>{switch(t){case Z.ZodString:return Co(e,r);case Z.ZodNumber:return Ou(e);case Z.ZodObject:return $u(e,r);case Z.ZodBigInt:return pu(e);case Z.ZodBoolean:return fu();case Z.ZodDate:return Zo(e,r);case Z.ZodUndefined:return Lu();case Z.ZodNull:return Iu();case Z.ZodArray:return du(e,r);case Z.ZodUnion:case Z.ZodDiscriminatedUnion:return Tu(e,r);case Z.ZodIntersection:return _u(e,r);case Z.ZodTuple:return Du(e,r);case Z.ZodRecord:return Po(e,r);case Z.ZodLiteral:return wu(e);case Z.ZodEnum:return bu(e);case Z.ZodNativeEnum:return Eu(e);case Z.ZodNullable:return Au(e,r);case Z.ZodOptional:return Pu(e,r);case Z.ZodMap:return Su(e,r);case Z.ZodSet:return Mu(e,r);case Z.ZodLazy:return()=>e.getter()._def;case Z.ZodPromise:return ju(e,r);case Z.ZodNaN:case Z.ZodNever:return zu();case Z.ZodEffects:return vu(e,r);case Z.ZodAny:return ne();case Z.ZodUnknown:return Fu();case Z.ZodDefault:return gu(e,r);case Z.ZodBranded:return $o(e,r);case Z.ZodReadonly:return Uu(e,r);case Z.ZodCatch:return mu(e,r);case Z.ZodPipeline:return Ru(e,r);case Z.ZodFunction:case Z.ZodVoid:case Z.ZodSymbol:return;default:return(n=>{})()}},Bu=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function M(e,t,r=!1){var n;const o=t.seen.get(e);if(t.override){const l=(n=t.override)==null?void 0:n.call(t,e,t,o,r);if(l!==lu)return l}if(o&&!r){const l=Ju(o,t);if(l!==void 0)return l}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const a=Vu(e,e.typeName,t),i=typeof a=="function"?M(a(),t):a;if(i&&Wu(e,t,i),t.postProcess){const l=t.postProcess(i,e,t);return s.jsonSchema=i,l}return s.jsonSchema=i,i}var Ju=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Bu(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),ne()):t.$refStrategy==="seen"?ne():void 0}},Wu=(e,t,r)=>(e.description&&(r.description=e.description),r),Gu=e=>{const t=uu(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},qu=(e,t)=>{var r;const n=Gu(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,d])=>{var h;return{...c,[u]:(h=M(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,u]},!0))!=null?h:ne()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,a=(r=M(e._def,s===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1))!=null?r:ne(),i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(a.title=i);const l=s===void 0?o?{...a,[n.definitionPath]:o}:a:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...o,[s]:a}};return l.$schema="http://json-schema.org/draft-07/schema#",l},Kt=Symbol.for("vercel.ai.schema");function Yu(e){let t;return()=>(t==null&&(t=e()),t)}function $t(e,{validate:t}={}){return{[Kt]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function Hu(e){return typeof e=="object"&&e!==null&&Kt in e&&e[Kt]===!0&&"jsonSchema"in e&&"validate"in e}function ur(e){return e==null?$t({properties:{},additionalProperties:!1}):Hu(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Ro(e):Xu(e):e()}function Xu(e){return $t(()=>e["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async t=>{const r=await e["~standard"].validate(t);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new je({value:t,cause:r.issues})}}})}function Ku(e,t){var r;const n=(r=void 0)!=null?r:!1;return $t(()=>qu(e,{$refStrategy:n?"root":"none"}),{validate:async o=>{const s=await e.safeParseAsync(o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function Qu(e,t){var r;const n=(r=void 0)!=null?r:!1;return $t(()=>ft(Dc(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async o=>{const s=await ko(e,o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function ed(e){return"_zod"in e}function Ro(e,t){return ed(e)?Qu(e):Ku(e)}async function on({value:e,schema:t}){const r=await Qe({value:e,schema:t});if(!r.success)throw je.wrap({value:e,cause:r.error});return r.value}async function Qe({value:e,schema:t}){const r=ur(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const n=await r.validate(e);return n.success?{success:!0,value:n.value,rawValue:e}:{success:!1,error:je.wrap({value:e,cause:n.error}),rawValue:e}}catch(n){return{success:!1,error:je.wrap({value:e,cause:n}),rawValue:e}}}async function Ee({text:e,schema:t}){try{const r=cu(e);return t==null?{success:!0,value:r,rawValue:r}:await Qe({value:r,schema:t})}catch(r){return{success:!1,error:Er.isInstance(r)?r:new Er({text:e,cause:r}),rawValue:void 0}}}function td({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new nu).pipeThrough(new TransformStream({async transform({data:r},n){r!=="[DONE]"&&n.enqueue(await Ee({text:r,schema:t}))}}))}async function he(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var rd=Object.defineProperty,nd=(e,t)=>{for(var r in t)rd(e,r,{get:t[r],enumerable:!0})},jo="AI_NoObjectGeneratedError",Mo=`vercel.ai.error.${jo}`,od=Symbol.for(Mo),Do,ge=class extends ve{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:o,finishReason:s}){super({name:jo,message:e,cause:t}),this[Do]=!0,this.text=r,this.response=n,this.usage=o,this.finishReason=s}static isInstance(e){return ve.hasMarker(e,Mo)}};Do=od;var sn="6.0.3",Lo=ee([v(),kt(Uint8Array),kt(ArrayBuffer),Oo(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]),et=Kl(()=>ee([Tl(),v(),Sl(),Q(),Xe(v(),et.optional()),Fe(et)])),R=Xe(v(),Xe(v(),et.optional())),Fo=D({type:I("text"),text:v(),providerOptions:R.optional()}),sd=D({type:I("image"),image:ee([Lo,kt(URL)]),mediaType:v().optional(),providerOptions:R.optional()}),Uo=D({type:I("file"),data:ee([Lo,kt(URL)]),filename:v().optional(),mediaType:v(),providerOptions:R.optional()}),ad=D({type:I("reasoning"),text:v(),providerOptions:R.optional()}),id=D({type:I("tool-call"),toolCallId:v(),toolName:v(),input:le(),providerOptions:R.optional(),providerExecuted:Q().optional()}),cd=Zl("type",[D({type:I("text"),value:v(),providerOptions:R.optional()}),D({type:I("json"),value:et,providerOptions:R.optional()}),D({type:I("execution-denied"),reason:v().optional(),providerOptions:R.optional()}),D({type:I("error-text"),value:v(),providerOptions:R.optional()}),D({type:I("error-json"),value:et,providerOptions:R.optional()}),D({type:I("content"),value:Fe(ee([D({type:I("text"),text:v(),providerOptions:R.optional()}),D({type:I("media"),data:v(),mediaType:v()}),D({type:I("file-data"),data:v(),mediaType:v(),filename:v().optional(),providerOptions:R.optional()}),D({type:I("file-url"),url:v(),providerOptions:R.optional()}),D({type:I("file-id"),fileId:ee([v(),Xe(v(),v())]),providerOptions:R.optional()}),D({type:I("image-data"),data:v(),mediaType:v(),providerOptions:R.optional()}),D({type:I("image-url"),url:v(),providerOptions:R.optional()}),D({type:I("image-file-id"),fileId:ee([v(),Xe(v(),v())]),providerOptions:R.optional()}),D({type:I("custom"),providerOptions:R.optional()})]))})]),Vo=D({type:I("tool-result"),toolCallId:v(),toolName:v(),output:cd,providerOptions:R.optional()}),ld=D({type:I("tool-approval-request"),approvalId:v(),toolCallId:v()}),ud=D({type:I("tool-approval-response"),approvalId:v(),approved:Q(),reason:v().optional()}),dd=D({role:I("system"),content:v(),providerOptions:R.optional()}),pd=D({role:I("user"),content:ee([v(),Fe(ee([Fo,sd,Uo]))]),providerOptions:R.optional()}),fd=D({role:I("assistant"),content:ee([v(),Fe(ee([Fo,Uo,ad,id,Vo,ld]))]),providerOptions:R.optional()}),md=D({role:I("tool"),content:Fe(ee([Vo,ud])),providerOptions:R.optional()});ee([dd,pd,fd,md]);function Bo(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const r={...e};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const o=t[n];if(o===void 0)continue;const s=n in e?e[n]:void 0,a=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),i=s!=null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);a&&i?r[n]=Bo(s,o):r[n]=o}return r}var hd={};nd(hd,{array:()=>yd,choice:()=>_d,json:()=>wd,object:()=>bd,text:()=>vd});function gd(e){const t=["ROOT"];let r=-1,n=null;function o(l,c,u){switch(l){case'"':{r=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=c,n=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{r=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{r=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function s(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=c,t.pop();break}}}function a(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":o(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{c===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{s(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),r=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=l}break}case"INSIDE_ARRAY_START":{c==="]"?(r=l,t.pop()):(r=l,o(c,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=l,t.pop();break}default:{r=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),r=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&a(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&a(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(n,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?s(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&a(c,l)):r=l;break}}}let i=e.slice(0,r+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{i+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{i+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{i+="]";break}case"INSIDE_LITERAL":{const u=e.substring(n,e.length);"true".startsWith(u)?i+="true".slice(u.length):"false".startsWith(u)?i+="false".slice(u.length):"null".startsWith(u)&&(i+="null".slice(u.length))}}return i}async function rt(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Ee({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Ee({text:gd(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var vd=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}}}),bd=({schema:e,name:t,description:r})=>{const n=ur(e);return{responseFormat:he(n.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...r!=null&&{description:r}})),async parseCompleteOutput({text:o},s){const a=await Ee({text:o});if(!a.success)throw new ge({message:"No object generated: could not parse the response.",cause:a.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const i=await Qe({value:a.value,schema:n});if(!i.success)throw new ge({message:"No object generated: response did not match schema.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});return i.value},async parsePartialOutput({text:o}){const s=await rt(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:s.value}}}}},yd=({element:e,name:t,description:r})=>{const n=ur(e);return{responseFormat:he(n.jsonSchema).then(o=>{const{$schema:s,...a}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:a}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}}),async parseCompleteOutput({text:o},s){const a=await Ee({text:o});if(!a.success)throw new ge({message:"No object generated: could not parse the response.",cause:a.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const i=a.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))throw new ge({message:"No object generated: response did not match schema.",cause:new je({value:i,cause:"response must be an object with an elements array"}),text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});for(const l of i.elements){const c=await Qe({value:l,schema:n});if(!c.success)throw new ge({message:"No object generated: response did not match schema.",cause:c.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason})}return i.elements},async parsePartialOutput({text:o}){const s=await rt(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=s.value;if(a==null||typeof a!="object"||!("elements"in a)||!Array.isArray(a.elements))return;const i=s.state==="repaired-parse"&&a.elements.length>0?a.elements.slice(0,-1):a.elements,l=[];for(const c of i){const u=await Qe({value:c,schema:n});u.success&&l.push(u.value)}return{partial:l}}}}}},_d=({options:e,name:t,description:r})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}),async parseCompleteOutput({text:n},o){const s=await Ee({text:n});if(!s.success)throw new ge({message:"No object generated: could not parse the response.",cause:s.error,text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});const a=s.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string"||!e.includes(a.result))throw new ge({message:"No object generated: response did not match schema.",cause:new je({value:a,cause:"response must be an object that contains a choice value."}),text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});return a.result},async parsePartialOutput({text:n}){const o=await rt(n);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=o.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string")return;const a=e.filter(i=>i.startsWith(s.result));return o.state==="successful-parse"?a.includes(s.result)?{partial:s.result}:void 0:a.length===1?{partial:a[0]}:void 0}}}}),wd=({name:e,description:t}={})=>({responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:r},n){const o=await Ee({text:r});if(!o.success)throw new ge({message:"No object generated: could not parse the response.",cause:o.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:r}){const n=await rt(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return n.value===void 0?void 0:{partial:n.value}}}});tt({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
33
-
34
- `)},flush(e){e.enqueue(`data: [DONE]
35
-
36
- `)}})}});var kd=Yu(()=>Ro(ee([L({type:I("text-start"),id:v(),providerMetadata:R.optional()}),L({type:I("text-delta"),id:v(),delta:v(),providerMetadata:R.optional()}),L({type:I("text-end"),id:v(),providerMetadata:R.optional()}),L({type:I("error"),errorText:v()}),L({type:I("tool-input-start"),toolCallId:v(),toolName:v(),providerExecuted:Q().optional(),dynamic:Q().optional(),title:v().optional()}),L({type:I("tool-input-delta"),toolCallId:v(),inputTextDelta:v()}),L({type:I("tool-input-available"),toolCallId:v(),toolName:v(),input:le(),providerExecuted:Q().optional(),providerMetadata:R.optional(),dynamic:Q().optional(),title:v().optional()}),L({type:I("tool-input-error"),toolCallId:v(),toolName:v(),input:le(),providerExecuted:Q().optional(),providerMetadata:R.optional(),dynamic:Q().optional(),errorText:v(),title:v().optional()}),L({type:I("tool-approval-request"),approvalId:v(),toolCallId:v()}),L({type:I("tool-output-available"),toolCallId:v(),output:le(),providerExecuted:Q().optional(),dynamic:Q().optional(),preliminary:Q().optional()}),L({type:I("tool-output-error"),toolCallId:v(),errorText:v(),providerExecuted:Q().optional(),dynamic:Q().optional()}),L({type:I("tool-output-denied"),toolCallId:v()}),L({type:I("reasoning-start"),id:v(),providerMetadata:R.optional()}),L({type:I("reasoning-delta"),id:v(),delta:v(),providerMetadata:R.optional()}),L({type:I("reasoning-end"),id:v(),providerMetadata:R.optional()}),L({type:I("source-url"),sourceId:v(),url:v(),title:v().optional(),providerMetadata:R.optional()}),L({type:I("source-document"),sourceId:v(),mediaType:v(),title:v(),filename:v().optional(),providerMetadata:R.optional()}),L({type:I("file"),url:v(),mediaType:v(),providerMetadata:R.optional()}),L({type:Oo(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:v().optional(),data:le(),transient:Q().optional()}),L({type:I("start-step")}),L({type:I("finish-step")}),L({type:I("start"),messageId:v().optional(),messageMetadata:le().optional()}),L({type:I("finish"),finishReason:To(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:le().optional()}),L({type:I("abort")}),L({type:I("message-metadata"),messageMetadata:le()})])));function xd(e){return e.type.startsWith("data-")}function Qt(e){return e.type.startsWith("tool-")}function Sd(e){return e.type==="dynamic-tool"}function St(e){return Qt(e)||Sd(e)}function an(e){return e.type.split("-").slice(1).join("-")}function Ed({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function zd({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:o,onToolCall:s,onData:a}){return e.pipeThrough(new TransformStream({async transform(i,l){await n(async({state:c,write:u})=>{var d,h,g,z;function b(p){const T=c.message.parts.filter(St).find(O=>O.toolCallId===p);if(T==null)throw new Error(`no tool invocation found for tool call ${p}`);return T}function m(p){var _;const T=c.message.parts.find(x=>Qt(x)&&x.toolCallId===p.toolCallId),O=p,P=T;T!=null?(T.state=p.state,P.input=O.input,P.output=O.output,P.errorText=O.errorText,P.rawInput=O.rawInput,P.preliminary=O.preliminary,p.title!==void 0&&(P.title=p.title),P.providerExecuted=(_=O.providerExecuted)!=null?_:T.providerExecuted,O.providerMetadata!=null&&T.state==="input-available"&&(T.callProviderMetadata=O.providerMetadata)):c.message.parts.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,state:p.state,title:p.title,input:O.input,output:O.output,rawInput:O.rawInput,errorText:O.errorText,providerExecuted:O.providerExecuted,preliminary:O.preliminary,...O.providerMetadata!=null?{callProviderMetadata:O.providerMetadata}:{}})}function E(p){var _,T;const O=c.message.parts.find(Y=>Y.type==="dynamic-tool"&&Y.toolCallId===p.toolCallId),P=p,x=O;O!=null?(O.state=p.state,x.toolName=p.toolName,x.input=P.input,x.output=P.output,x.errorText=P.errorText,x.rawInput=(_=P.rawInput)!=null?_:x.rawInput,x.preliminary=P.preliminary,p.title!==void 0&&(x.title=p.title),x.providerExecuted=(T=P.providerExecuted)!=null?T:O.providerExecuted,P.providerMetadata!=null&&O.state==="input-available"&&(O.callProviderMetadata=P.providerMetadata)):c.message.parts.push({type:"dynamic-tool",toolName:p.toolName,toolCallId:p.toolCallId,state:p.state,input:P.input,output:P.output,errorText:P.errorText,preliminary:P.preliminary,providerExecuted:P.providerExecuted,title:p.title,...P.providerMetadata!=null?{callProviderMetadata:P.providerMetadata}:{}})}async function y(p){if(p!=null){const _=c.message.metadata!=null?Bo(c.message.metadata,p):p;t!=null&&await on({value:_,schema:t}),c.message.metadata=_}}switch(i.type){case"text-start":{const p={type:"text",text:"",providerMetadata:i.providerMetadata,state:"streaming"};c.activeTextParts[i.id]=p,c.message.parts.push(p),u();break}case"text-delta":{const p=c.activeTextParts[i.id];p.text+=i.delta,p.providerMetadata=(d=i.providerMetadata)!=null?d:p.providerMetadata,u();break}case"text-end":{const p=c.activeTextParts[i.id];p.state="done",p.providerMetadata=(h=i.providerMetadata)!=null?h:p.providerMetadata,delete c.activeTextParts[i.id],u();break}case"reasoning-start":{const p={type:"reasoning",text:"",providerMetadata:i.providerMetadata,state:"streaming"};c.activeReasoningParts[i.id]=p,c.message.parts.push(p),u();break}case"reasoning-delta":{const p=c.activeReasoningParts[i.id];p.text+=i.delta,p.providerMetadata=(g=i.providerMetadata)!=null?g:p.providerMetadata,u();break}case"reasoning-end":{const p=c.activeReasoningParts[i.id];p.providerMetadata=(z=i.providerMetadata)!=null?z:p.providerMetadata,p.state="done",delete c.activeReasoningParts[i.id],u();break}case"file":{c.message.parts.push({type:"file",mediaType:i.mediaType,url:i.url}),u();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:i.sourceId,url:i.url,title:i.title,providerMetadata:i.providerMetadata}),u();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:i.sourceId,mediaType:i.mediaType,title:i.title,filename:i.filename,providerMetadata:i.providerMetadata}),u();break}case"tool-input-start":{const p=c.message.parts.filter(Qt);c.partialToolCalls[i.toolCallId]={text:"",toolName:i.toolName,index:p.length,dynamic:i.dynamic,title:i.title},i.dynamic?E({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-streaming",input:void 0,providerExecuted:i.providerExecuted,title:i.title}):m({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-streaming",input:void 0,providerExecuted:i.providerExecuted,title:i.title}),u();break}case"tool-input-delta":{const p=c.partialToolCalls[i.toolCallId];p.text+=i.inputTextDelta;const{value:_}=await rt(p.text);p.dynamic?E({toolCallId:i.toolCallId,toolName:p.toolName,state:"input-streaming",input:_,title:p.title}):m({toolCallId:i.toolCallId,toolName:p.toolName,state:"input-streaming",input:_,title:p.title}),u();break}case"tool-input-available":{i.dynamic?E({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-available",input:i.input,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:i.title}):m({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-available",input:i.input,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:i.title}),u(),s&&!i.providerExecuted&&await s({toolCall:i});break}case"tool-input-error":{i.dynamic?E({toolCallId:i.toolCallId,toolName:i.toolName,state:"output-error",input:i.input,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata}):m({toolCallId:i.toolCallId,toolName:i.toolName,state:"output-error",input:void 0,rawInput:i.input,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata}),u();break}case"tool-approval-request":{const p=b(i.toolCallId);p.state="approval-requested",p.approval={id:i.approvalId},u();break}case"tool-output-denied":{const p=b(i.toolCallId);p.state="output-denied",u();break}case"tool-output-available":{const p=b(i.toolCallId);p.type==="dynamic-tool"?E({toolCallId:i.toolCallId,toolName:p.toolName,state:"output-available",input:p.input,output:i.output,preliminary:i.preliminary,providerExecuted:i.providerExecuted,title:p.title}):m({toolCallId:i.toolCallId,toolName:an(p),state:"output-available",input:p.input,output:i.output,providerExecuted:i.providerExecuted,preliminary:i.preliminary,title:p.title}),u();break}case"tool-output-error":{const p=b(i.toolCallId);p.type==="dynamic-tool"?E({toolCallId:i.toolCallId,toolName:p.toolName,state:"output-error",input:p.input,errorText:i.errorText,providerExecuted:i.providerExecuted,title:p.title}):m({toolCallId:i.toolCallId,toolName:an(p),state:"output-error",input:p.input,rawInput:p.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,title:p.title}),u();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{i.messageId!=null&&(c.message.id=i.messageId),await y(i.messageMetadata),(i.messageId!=null||i.messageMetadata!=null)&&u();break}case"finish":{i.finishReason!=null&&(c.finishReason=i.finishReason),await y(i.messageMetadata),i.messageMetadata!=null&&u();break}case"message-metadata":{await y(i.messageMetadata),i.messageMetadata!=null&&u();break}case"error":{o?.(new Error(i.errorText));break}default:if(xd(i)){r?.[i.type]!=null&&await on({value:i.data,schema:r[i.type]});const p=i;if(p.transient){a?.(p);break}const _=p.id!=null?c.message.parts.find(T=>p.type===T.type&&p.id===T.id):void 0;_!=null?_.data=p.data:c.message.parts.push(p),a?.(p),u()}}l.enqueue(i)})}}))}async function Id({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:n}=await r.read();if(n)break}}catch(n){t?.(n)}finally{r.releaseLock()}}tt({prefix:"aitxt",size:24});tt({prefix:"aiobj",size:24});var Td=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,r)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){r(n)}}),this.processQueue()})}};tt({prefix:"aiobj",size:24});async function Nd(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:r,type:n}=t,o=await new Promise((s,a)=>{const i=new FileReader;i.onload=l=>{var c;s((c=l.target)==null?void 0:c.result)},i.onerror=l=>a(l),i.readAsDataURL(t)});return{type:"file",mediaType:n,filename:r,url:o}}))}var Ad=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:o,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:a}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=o,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=a}async sendMessages({abortSignal:e,...t}){var r,n,o,s,a;const i=await he(this.body),l=await he(this.headers),c=await he(this.credentials),u={...Se(l),...Se(t.headers)},d=await((r=this.prepareSendMessagesRequest)==null?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...i,...t.body},headers:u,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),h=(n=d?.api)!=null?n:this.api,g=d?.headers!==void 0?Se(d.headers):u,z=d?.body!==void 0?d.body:{...i,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},b=(o=d?.credentials)!=null?o:c,E=await((s=this.fetch)!=null?s:globalThis.fetch)(h,{method:"POST",headers:en({"Content-Type":"application/json",...g},`ai-sdk/${sn}`,Qr()),body:JSON.stringify(z),credentials:b,signal:e});if(!E.ok)throw new Error((a=await E.text())!=null?a:"Failed to fetch the chat response.");if(!E.body)throw new Error("The response body is empty.");return this.processResponseStream(E.body)}async reconnectToStream(e){var t,r,n,o,s;const a=await he(this.body),i=await he(this.headers),l=await he(this.credentials),c={...Se(i),...Se(e.headers)},u=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...a,...e.body},headers:c,credentials:l,requestMetadata:e.metadata})),d=(r=u?.api)!=null?r:`${this.api}/${e.chatId}/stream`,h=u?.headers!==void 0?Se(u.headers):c,g=(n=u?.credentials)!=null?n:l,b=await((o=this.fetch)!=null?o:globalThis.fetch)(d,{method:"GET",headers:en(h,`ai-sdk/${sn}`,Qr()),credentials:g});if(b.status===204)return null;if(!b.ok)throw new Error((s=await b.text())!=null?s:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");return this.processResponseStream(b.body)}},Jo=class extends Ad{constructor(e={}){super(e)}processResponseStream(e){return td({stream:e,schema:kd}).pipeThrough(new TransformStream({async transform(t,r){if(!t.success)throw t.error;r.enqueue(t.value)}}))}},Od=class{constructor({generateId:e=ou,id:t=e(),transport:r=new Jo,messageMetadataSchema:n,dataPartSchemas:o,state:s,onError:a,onToolCall:i,onFinish:l,onData:c,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new Td,this.sendMessage=async(d,h)=>{var g,z,b,m;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(g=this.lastMessage)==null?void 0:g.id,...h});return}let E;if("text"in d||"files"in d?E={parts:[...Array.isArray(d.files)?d.files:await Nd(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:E=d,d.messageId!=null){const y=this.state.messages.findIndex(p=>p.id===d.messageId);if(y===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[y].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,y+1),this.state.replaceMessage(y,{...E,id:d.messageId,role:(z=E.role)!=null?z:"user",metadata:d.metadata})}else this.state.pushMessage({...E,id:(b=E.id)!=null?b:this.generateId(),role:(m=E.role)!=null?m:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...h})},this.regenerate=async({messageId:d,...h}={})=>{const g=d==null?this.state.messages.length-1:this.state.messages.findIndex(z=>z.id===d);if(g===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[g].role==="assistant"?g:g+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...h})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:h,reason:g})=>this.jobExecutor.run(async()=>{var z,b;const m=this.state.messages,E=m[m.length-1],y=p=>St(p)&&p.state==="approval-requested"&&p.approval.id===d?{...p,state:"approval-responded",approval:{id:d,approved:h,reason:g}}:p;this.state.replaceMessage(m.length-1,{...E,parts:E.parts.map(y)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(y)),this.status!=="streaming"&&this.status!=="submitted"&&((z=this.sendAutomaticallyWhen)!=null&&z.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(b=this.lastMessage)==null?void 0:b.id})}),this.addToolOutput=async({state:d="output-available",tool:h,toolCallId:g,output:z,errorText:b})=>this.jobExecutor.run(async()=>{var m,E;const y=this.state.messages,p=y[y.length-1],_=T=>St(T)&&T.toolCallId===g?{...T,state:d,output:z,errorText:b}:T;this.state.replaceMessage(y.length-1,{...p,parts:p.parts.map(_)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(_)),this.status!=="streaming"&&this.status!=="submitted"&&((m=this.sendAutomaticallyWhen)!=null&&m.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=r,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=o,this.state=s,this.onError=a,this.onToolCall=i,this.onFinish=l,this.onData=c,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async makeRequest({trigger:e,metadata:t,headers:r,body:n,messageId:o}){var s,a,i,l;this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let u=!1,d=!1,h=!1;try{const g={state:Ed({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};g.abortController.signal.addEventListener("abort",()=>{u=!0}),this.activeResponse=g;let z;if(e==="resume-stream"){const m=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(m==null){this.setStatus({status:"ready"});return}z=m}else z=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:g.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:o});const b=m=>this.jobExecutor.run(()=>m({state:g.state,write:()=>{var E;this.setStatus({status:"streaming"}),g.state.message.id===((E=this.lastMessage)==null?void 0:E.id)?this.state.replaceMessage(this.state.messages.length-1,g.state.message):this.state.pushMessage(g.state.message)}}));await Id({stream:zd({stream:z,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:b,onError:m=>{throw m}}),onError:m=>{throw m}}),this.setStatus({status:"ready"})}catch(g){if(u||g.name==="AbortError")return u=!0,this.setStatus({status:"ready"}),null;h=!0,g instanceof TypeError&&(g.message.toLowerCase().includes("fetch")||g.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&g instanceof Error&&this.onError(g),this.setStatus({status:"error",error:g})}finally{try{(a=this.onFinish)==null||a.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:u,isDisconnect:d,isError:h,finishReason:(s=this.activeResponse)==null?void 0:s.state.finishReason})}catch(g){console.error(g)}this.activeResponse=void 0}(i=this.sendAutomaticallyWhen)!=null&&i.call(this,{messages:this.state.messages})&&!h&&await this.makeRequest({trigger:"submit-message",messageId:(l=this.lastMessage)==null?void 0:l.id,metadata:t,headers:r,body:n})}};function $d({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const r=t.parts.reduce((o,s,a)=>s.type==="step-start"?a:o,-1),n=t.parts.slice(r+1).filter(St).filter(o=>!o.providerExecuted);return n.length>0&&n.every(o=>o.state==="output-available"||o.state==="output-error")}var Ut,cn;function Zd(){if(cn)return Ut;cn=1;function e(t,r){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let n,o=0;return function(...a){clearTimeout(n);const i=Date.now(),l=i-o,c=r-l;c<=0?(o=i,t.apply(this,a)):n=setTimeout(()=>{o=Date.now(),t.apply(this,a)},c)}}return Ut=e,Ut}var Cd=Zd();const Pd=ps(Cd);var Wo=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},F=(e,t,r)=>(Wo(e,t,"read from private field"),r?r.call(e):t.get(e)),ce=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},me=(e,t,r,n)=>(Wo(e,t,"write to private field"),t.set(e,r),r);function Rd(e,t){return t!=null?Pd(e,t):e}var oe,mt,ht,We,Ge,qe,$e,er,tr,jd=class{constructor(e=[]){ce(this,oe,void 0),ce(this,mt,"ready"),ce(this,ht,void 0),ce(this,We,new Set),ce(this,Ge,new Set),ce(this,qe,new Set),this.pushMessage=t=>{me(this,oe,F(this,oe).concat(t)),F(this,$e).call(this)},this.popMessage=()=>{me(this,oe,F(this,oe).slice(0,-1)),F(this,$e).call(this)},this.replaceMessage=(t,r)=>{me(this,oe,[...F(this,oe).slice(0,t),this.snapshot(r),...F(this,oe).slice(t+1)]),F(this,$e).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,r)=>{const n=r?Rd(t,r):t;return F(this,We).add(n),()=>{F(this,We).delete(n)}},this["~registerStatusCallback"]=t=>(F(this,Ge).add(t),()=>{F(this,Ge).delete(t)}),this["~registerErrorCallback"]=t=>(F(this,qe).add(t),()=>{F(this,qe).delete(t)}),ce(this,$e,()=>{F(this,We).forEach(t=>t())}),ce(this,er,()=>{F(this,Ge).forEach(t=>t())}),ce(this,tr,()=>{F(this,qe).forEach(t=>t())}),me(this,oe,e)}get status(){return F(this,mt)}set status(e){me(this,mt,e),F(this,er).call(this)}get error(){return F(this,ht)}set error(e){me(this,ht,e),F(this,tr).call(this)}get messages(){return F(this,oe)}set messages(e){me(this,oe,[...e]),F(this,$e).call(this)}};oe=new WeakMap;mt=new WeakMap;ht=new WeakMap;We=new WeakMap;Ge=new WeakMap;qe=new WeakMap;$e=new WeakMap;er=new WeakMap;tr=new WeakMap;var Ze,ln=class extends Od{constructor({messages:e,...t}){const r=new jd(e);super({...t,state:r}),ce(this,Ze,void 0),this["~registerMessagesCallback"]=(n,o)=>F(this,Ze)["~registerMessagesCallback"](n,o),this["~registerStatusCallback"]=n=>F(this,Ze)["~registerStatusCallback"](n),this["~registerErrorCallback"]=n=>F(this,Ze)["~registerErrorCallback"](n),me(this,Ze,r)}};Ze=new WeakMap;function Md({experimental_throttle:e,resume:t=!1,...r}={}){const n=N.useRef("chat"in r?r.chat:new ln(r));("chat"in r&&r.chat!==n.current||"id"in r&&n.current.id!==r.id)&&(n.current="chat"in r?r.chat:new ln(r));const s=N.useCallback(u=>n.current["~registerMessagesCallback"](u,e),[e,n.current.id]),a=N.useSyncExternalStore(s,()=>n.current.messages,()=>n.current.messages),i=N.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),l=N.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),c=N.useCallback(u=>{typeof u=="function"&&(u=u(n.current.messages)),n.current.messages=u},[n]);return N.useEffect(()=>{t&&n.current.resumeStream()},[t,n]),{id:n.current.id,messages:a,setMessages:c,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:l,resumeStream:n.current.resumeStream,status:i,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}const Dd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ld=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),un=e=>{const t=Ld(e);return t.charAt(0).toUpperCase()+t.slice(1)},Go=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Fd=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Ud={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Vd=N.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:s,iconNode:a,...i},l)=>N.createElement("svg",{ref:l,...Ud,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Go("lucide",o),...!s&&!Fd(i)&&{"aria-hidden":"true"},...i},[...a.map(([c,u])=>N.createElement(c,u)),...Array.isArray(s)?s:[s]]));const nt=(e,t)=>{const r=N.forwardRef(({className:n,...o},s)=>N.createElement(Vd,{ref:s,iconNode:t,className:Go(`lucide-${Dd(un(e))}`,`lucide-${e}`,n),...o}));return r.displayName=un(e),r};const Bd=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Jd=nt("arrow-down",Bd);const Wd=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Gd=nt("arrow-up",Wd);const qd=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],dn=nt("bot",qd);const Yd=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Hd=nt("loader-circle",Yd);const Xd=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Kd=nt("user",Xd);const Qd={damping:.7,stiffness:.05,mass:1.25},ep=70,tp=1e3/60,rp=350;let Zt=!1;globalThis.document?.addEventListener("mousedown",()=>{Zt=!0});globalThis.document?.addEventListener("mouseup",()=>{Zt=!1});globalThis.document?.addEventListener("click",()=>{Zt=!1});const np=(e={})=>{const[t,r]=N.useState(!1),[n,o]=N.useState(e.initial!==!1),[s,a]=N.useState(!1),i=N.useRef(null);i.current=e;const l=N.useCallback(()=>{if(!Zt)return!1;const y=window.getSelection();if(!y||!y.rangeCount)return!1;const p=y.getRangeAt(0);return p.commonAncestorContainer.contains(m.current)||m.current?.contains(p.commonAncestorContainer)},[]),c=N.useCallback(y=>{d.isAtBottom=y,o(y)},[]),u=N.useCallback(y=>{d.escapedFromLock=y,r(y)},[]),d=N.useMemo(()=>{let y;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return m.current?.scrollTop??0},set scrollTop(p){m.current&&(m.current.scrollTop=p,d.ignoreScrollToTop=m.current.scrollTop)},get targetScrollTop(){return!m.current||!E.current?0:m.current.scrollHeight-1-m.current.clientHeight},get calculatedTargetScrollTop(){if(!m.current||!E.current)return 0;const{targetScrollTop:p}=this;if(!e.targetScrollTop)return p;if(y?.targetScrollTop===p)return y.calculatedScrollTop;const _=Math.max(Math.min(e.targetScrollTop(p,{scrollElement:m.current,contentElement:E.current}),p),0);return y={targetScrollTop:p,calculatedScrollTop:_},requestAnimationFrame(()=>{y=void 0}),_},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ep}}},[]),h=N.useCallback((y={})=>{typeof y=="string"&&(y={animation:y}),y.preserveScrollPosition||c(!0);const p=Date.now()+(Number(y.wait)||0),_=Bt(i.current,y.animation),{ignoreEscapes:T=!1}=y;let O,P=d.calculatedTargetScrollTop;y.duration instanceof Promise?y.duration.finally(()=>{O=Date.now()}):O=p+(y.duration??0);const x=async()=>{const Y=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:we}=d,Te=performance.now(),Ne=(Te-(d.lastTick??Te))/tp;if(d.animation||(d.animation={behavior:_,promise:Y,ignoreEscapes:T}),d.animation.behavior===_&&(d.lastTick=Te),l()||p>Date.now())return x();if(we<Math.min(P,d.calculatedTargetScrollTop)){if(d.animation?.behavior===_){if(_==="instant")return d.scrollTop=d.calculatedTargetScrollTop,x();d.velocity=(_.damping*d.velocity+_.stiffness*d.scrollDifference)/_.mass,d.accumulated+=d.velocity*Ne,d.scrollTop+=d.accumulated,d.scrollTop!==we&&(d.accumulated=0)}return x()}return O>Date.now()?(P=d.calculatedTargetScrollTop,x()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?h({animation:Bt(i.current,i.current.resize),ignoreEscapes:T,duration:Math.max(0,O-Date.now())||void 0}):d.isAtBottom)});return Y.then(we=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),we))};return y.wait!==!0&&(d.animation=void 0),d.animation?.behavior===_?d.animation.promise:x()},[c,l,d]),g=N.useCallback(()=>{u(!0),c(!1)},[u,c]),z=N.useCallback(({target:y})=>{if(y!==m.current)return;const{scrollTop:p,ignoreScrollToTop:_}=d;let{lastScrollTop:T=p}=d;d.lastScrollTop=p,d.ignoreScrollToTop=void 0,_&&_>p&&(T=_),a(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||p===_)return;if(l()){u(!0),c(!1);return}const O=p>T,P=p<T;if(d.animation?.ignoreEscapes){d.scrollTop=T;return}P&&(u(!0),c(!1)),O&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,l,d]),b=N.useCallback(({target:y,deltaY:p})=>{let _=y;for(;!["scroll","auto"].includes(getComputedStyle(_).overflow);){if(!_.parentElement)return;_=_.parentElement}_===m.current&&p<0&&m.current.scrollHeight>m.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),m=pn(y=>{m.current?.removeEventListener("scroll",z),m.current?.removeEventListener("wheel",b),y?.addEventListener("scroll",z,{passive:!0}),y?.addEventListener("wheel",b,{passive:!0})},[]),E=pn(y=>{if(d.resizeObserver?.disconnect(),!y)return;let p;d.resizeObserver=new ResizeObserver(([_])=>{const{height:T}=_.contentRect,O=T-(p??T);if(d.resizeDifference=O,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),a(d.isNearBottom),O>=0){const P=Bt(i.current,p?i.current.resize:i.current.initial);h({animation:P,wait:!0,preserveScrollPosition:!0,duration:P==="instant"?void 0:rp})}else d.isNearBottom&&(u(!1),c(!0));p=T,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===O&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(y)},[]);return{contentRef:E,scrollRef:m,scrollToBottom:h,stopScroll:g,isAtBottom:n||s,isNearBottom:s,escapedFromLock:t,state:d}};function pn(e,t){const r=N.useCallback(n=>(r.current=n,e(n)),t);return r}const Vt=new Map;function Bt(...e){const t={...Qd};let r=!1;for(const o of e){if(o==="instant"){r=!0;continue}typeof o=="object"&&(r=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const n=JSON.stringify(t);return Vt.has(n)||Vt.set(n,Object.freeze(t)),r?"instant":Vt.get(n)}const qo=N.createContext(null),op=typeof window<"u"?N.useLayoutEffect:N.useEffect;function Et({instance:e,children:t,resize:r,initial:n,mass:o,damping:s,stiffness:a,targetScrollTop:i,contextRef:l,...c}){const u=N.useRef(null),d=N.useCallback((T,O)=>(_?.targetScrollTop??i)?.(T,O)??T,[i]),h=np({mass:o,damping:s,stiffness:a,resize:r,initial:n,targetScrollTop:d}),{scrollRef:g,contentRef:z,scrollToBottom:b,stopScroll:m,isAtBottom:E,escapedFromLock:y,state:p}=e??h,_=N.useMemo(()=>({scrollToBottom:b,stopScroll:m,scrollRef:g,isAtBottom:E,escapedFromLock:y,contentRef:z,state:p,get targetScrollTop(){return u.current},set targetScrollTop(T){u.current=T}}),[b,E,z,g,m,y,p]);return N.useImperativeHandle(l,()=>_,[_]),op(()=>{g.current&&getComputedStyle(g.current).overflow==="visible"&&(g.current.style.overflow="auto")},[]),$.jsx(qo.Provider,{value:_,children:$.jsx("div",{...c,children:typeof t=="function"?t(_):t})})}(function(e){function t({children:r,...n}){const o=Yo();return $.jsx("div",{ref:o.scrollRef,style:{height:"100%",width:"100%"},children:$.jsx("div",{...n,ref:o.contentRef,children:typeof r=="function"?r(o):r})})}e.Content=t})(Et||(Et={}));function Yo(){const e=N.useContext(qo);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}function fn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function sp(...e){return t=>{let r=!1;const n=e.map(o=>{const s=fn(o,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let o=0;o<n.length;o++){const s=n[o];typeof s=="function"?s():fn(e[o],null)}}}}var ap=Symbol.for("react.lazy"),zt=fs[" use ".trim().toString()];function ip(e){return typeof e=="object"&&e!==null&&"then"in e}function Ho(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ap&&"_payload"in e&&ip(e._payload)}function cp(e){const t=up(e),r=N.forwardRef((n,o)=>{let{children:s,...a}=n;Ho(s)&&typeof zt=="function"&&(s=zt(s._payload));const i=N.Children.toArray(s),l=i.find(pp);if(l){const c=l.props.children,u=i.map(d=>d===l?N.Children.count(c)>1?N.Children.only(null):N.isValidElement(c)?c.props.children:null:d);return $.jsx(t,{...a,ref:o,children:N.isValidElement(c)?N.cloneElement(c,void 0,u):null})}return $.jsx(t,{...a,ref:o,children:s})});return r.displayName=`${e}.Slot`,r}var lp=cp("Slot");function up(e){const t=N.forwardRef((r,n)=>{let{children:o,...s}=r;if(Ho(o)&&typeof zt=="function"&&(o=zt(o._payload)),N.isValidElement(o)){const a=mp(o),i=fp(s,o.props);return o.type!==N.Fragment&&(i.ref=n?sp(n,a):a),N.cloneElement(o,i)}return N.Children.count(o)>1?N.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dp=Symbol("radix.slottable");function pp(e){return N.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dp}function fp(e,t){const r={...t};for(const n in t){const o=e[n],s=t[n];/^on[A-Z]/.test(n)?o&&s?r[n]=(...i)=>{const l=s(...i);return o(...i),l}:o&&(r[n]=o):n==="style"?r[n]={...o,...s}:n==="className"&&(r[n]=[o,s].filter(Boolean).join(" "))}return{...e,...r}}function mp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Xo(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Xo(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ko(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Xo(e))&&(n&&(n+=" "),n+=t);return n}const mn=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hn=Ko,dr=(e,t)=>r=>{var n;if(t?.variants==null)return hn(e,r?.class,r?.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(c=>{const u=r?.[c],d=s?.[c];if(u===null)return null;const h=mn(u)||mn(d);return o[c][h]}),i=r&&Object.entries(r).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:d,className:h,...g}=u;return Object.entries(g).every(z=>{let[b,m]=z;return Array.isArray(m)?m.includes({...s,...i}[b]):{...s,...i}[b]===m})?[...c,d,h]:c},[]);return hn(e,a,l,r?.class,r?.className)},hp=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},gp=(e,t)=>({classGroupId:e,validator:t}),Qo=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),It="-",gn=[],vp="arbitrary..",bp=e=>{const t=_p(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return yp(a);const i=a.split(It),l=i[0]===""&&i.length>1?1:0;return es(i,l,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const l=n[a],c=r[a];return l?c?hp(c,l):l:c||gn}return r[a]||gn}}},es=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],s=r.nextPart.get(o);if(s){const c=es(e,t+1,s);if(c)return c}const a=r.validators;if(a===null)return;const i=t===0?e.join(It):e.slice(t).join(It),l=a.length;for(let c=0;c<l;c++){const u=a[c];if(u.validator(i))return u.classGroupId}},yp=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?vp+n:void 0})(),_p=e=>{const{theme:t,classGroups:r}=e;return wp(r,t)},wp=(e,t)=>{const r=Qo();for(const n in e){const o=e[n];pr(o,r,n,t)}return r},pr=(e,t,r,n)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];kp(a,t,r,n)}},kp=(e,t,r,n)=>{if(typeof e=="string"){xp(e,t,r);return}if(typeof e=="function"){Sp(e,t,r,n);return}Ep(e,t,r,n)},xp=(e,t,r)=>{const n=e===""?t:ts(t,e);n.classGroupId=r},Sp=(e,t,r,n)=>{if(zp(e)){pr(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(gp(r,e))},Ep=(e,t,r,n)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[i,l]=o[a];pr(l,ts(t,i),r,n)}},ts=(e,t)=>{let r=e;const n=t.split(It),o=n.length;for(let s=0;s<o;s++){const a=n[s];let i=r.nextPart.get(a);i||(i=Qo(),r.nextPart.set(a,i)),r=i}return r},zp=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ip=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const o=(s,a)=>{r[s]=a,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let a=r[s];if(a!==void 0)return a;if((a=n[s])!==void 0)return o(s,a),a},set(s,a){s in r?r[s]=a:o(s,a)}}},rr="!",vn=":",Tp=[],bn=(e,t,r,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:o}),Np=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=o=>{const s=[];let a=0,i=0,l=0,c;const u=o.length;for(let b=0;b<u;b++){const m=o[b];if(a===0&&i===0){if(m===vn){s.push(o.slice(l,b)),l=b+1;continue}if(m==="/"){c=b;continue}}m==="["?a++:m==="]"?a--:m==="("?i++:m===")"&&i--}const d=s.length===0?o:o.slice(l);let h=d,g=!1;d.endsWith(rr)?(h=d.slice(0,-1),g=!0):d.startsWith(rr)&&(h=d.slice(1),g=!0);const z=c&&c>l?c-l:void 0;return bn(s,g,h,z)};if(t){const o=t+vn,s=n;n=a=>a.startsWith(o)?s(a.slice(o.length)):bn(Tp,!1,a,void 0,!0)}if(r){const o=n;n=s=>r({className:s,parseClassName:o})}return n},Ap=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let o=[];for(let s=0;s<r.length;s++){const a=r[s],i=a[0]==="[",l=t.has(a);i||l?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(a)):o.push(a)}return o.length>0&&(o.sort(),n.push(...o)),n}},Op=e=>({cache:Ip(e.cacheSize),parseClassName:Np(e),sortModifiers:Ap(e),...bp(e)}),$p=/\s+/,Zp=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:s}=t,a=[],i=e.trim().split($p);let l="";for(let c=i.length-1;c>=0;c-=1){const u=i[c],{isExternal:d,modifiers:h,hasImportantModifier:g,baseClassName:z,maybePostfixModifierPosition:b}=r(u);if(d){l=u+(l.length>0?" "+l:l);continue}let m=!!b,E=n(m?z.substring(0,b):z);if(!E){if(!m){l=u+(l.length>0?" "+l:l);continue}if(E=n(z),!E){l=u+(l.length>0?" "+l:l);continue}m=!1}const y=h.length===0?"":h.length===1?h[0]:s(h).join(":"),p=g?y+rr:y,_=p+E;if(a.indexOf(_)>-1)continue;a.push(_);const T=o(E,m);for(let O=0;O<T.length;++O){const P=T[O];a.push(p+P)}l=u+(l.length>0?" "+l:l)}return l},Cp=(...e)=>{let t=0,r,n,o="";for(;t<e.length;)(r=e[t++])&&(n=rs(r))&&(o&&(o+=" "),o+=n);return o},rs=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=rs(e[n]))&&(r&&(r+=" "),r+=t);return r},Pp=(e,...t)=>{let r,n,o,s;const a=l=>{const c=t.reduce((u,d)=>d(u),e());return r=Op(c),n=r.cache.get,o=r.cache.set,s=i,i(l)},i=l=>{const c=n(l);if(c)return c;const u=Zp(l,r);return o(l,u),u};return s=a,(...l)=>s(Cp(...l))},Rp=[],G=e=>{const t=r=>r[e]||Rp;return t.isThemeGetter=!0,t},ns=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,os=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jp=/^\d+\/\d+$/,Mp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Dp=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Lp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Up=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oe=e=>jp.test(e),C=e=>!!e&&!Number.isNaN(Number(e)),fe=e=>!!e&&Number.isInteger(Number(e)),Jt=e=>e.endsWith("%")&&C(e.slice(0,-1)),pe=e=>Mp.test(e),Vp=()=>!0,Bp=e=>Dp.test(e)&&!Lp.test(e),ss=()=>!1,Jp=e=>Fp.test(e),Wp=e=>Up.test(e),Gp=e=>!w(e)&&!k(e),qp=e=>Ue(e,cs,ss),w=e=>ns.test(e),xe=e=>Ue(e,ls,Bp),Wt=e=>Ue(e,Qp,C),yn=e=>Ue(e,as,ss),Yp=e=>Ue(e,is,Wp),dt=e=>Ue(e,us,Jp),k=e=>os.test(e),Be=e=>Ve(e,ls),Hp=e=>Ve(e,ef),_n=e=>Ve(e,as),Xp=e=>Ve(e,cs),Kp=e=>Ve(e,is),pt=e=>Ve(e,us,!0),Ue=(e,t,r)=>{const n=ns.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ve=(e,t,r=!1)=>{const n=os.exec(e);return n?n[1]?t(n[1]):r:!1},as=e=>e==="position"||e==="percentage",is=e=>e==="image"||e==="url",cs=e=>e==="length"||e==="size"||e==="bg-size",ls=e=>e==="length",Qp=e=>e==="number",ef=e=>e==="family-name",us=e=>e==="shadow",tf=()=>{const e=G("color"),t=G("font"),r=G("text"),n=G("font-weight"),o=G("tracking"),s=G("leading"),a=G("breakpoint"),i=G("container"),l=G("spacing"),c=G("radius"),u=G("shadow"),d=G("inset-shadow"),h=G("text-shadow"),g=G("drop-shadow"),z=G("blur"),b=G("perspective"),m=G("aspect"),E=G("ease"),y=G("animate"),p=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[..._(),k,w],O=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],x=()=>[k,w,l],Y=()=>[Oe,"full","auto",...x()],we=()=>[fe,"none","subgrid",k,w],Te=()=>["auto",{span:["full",fe,k,w]},fe,k,w],Ne=()=>[fe,"auto",k,w],fr=()=>["auto","min","max","fr",k,w],Ct=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ae=()=>["start","end","center","stretch","center-safe","end-safe"],de=()=>["auto",...x()],ke=()=>[Oe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],A=()=>[e,k,w],mr=()=>[..._(),_n,yn,{position:[k,w]}],hr=()=>["no-repeat",{repeat:["","x","y","space","round"]}],gr=()=>["auto","cover","contain",Xp,qp,{size:[k,w]}],Pt=()=>[Jt,Be,xe],H=()=>["","none","full",c,k,w],re=()=>["",C,Be,xe],ot=()=>["solid","dashed","dotted","double"],vr=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[C,Jt,_n,yn],br=()=>["","none",z,k,w],st=()=>["none",C,k,w],at=()=>["none",C,k,w],Rt=()=>[C,k,w],it=()=>[Oe,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pe],breakpoint:[pe],color:[Vp],container:[pe],"drop-shadow":[pe],ease:["in","out","in-out"],font:[Gp],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pe],shadow:[pe],spacing:["px",C],text:[pe],"text-shadow":[pe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oe,w,k,m]}],container:["container"],columns:[{columns:[C,w,k,i]}],"break-after":[{"break-after":p()}],"break-before":[{"break-before":p()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{start:Y()}],end:[{end:Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[fe,"auto",k,w]}],basis:[{basis:[Oe,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[C,Oe,"auto","initial","none",w]}],grow:[{grow:["",C,k,w]}],shrink:[{shrink:["",C,k,w]}],order:[{order:[fe,"first","last","none",k,w]}],"grid-cols":[{"grid-cols":we()}],"col-start-end":[{col:Te()}],"col-start":[{"col-start":Ne()}],"col-end":[{"col-end":Ne()}],"grid-rows":[{"grid-rows":we()}],"row-start-end":[{row:Te()}],"row-start":[{"row-start":Ne()}],"row-end":[{"row-end":Ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":fr()}],"auto-rows":[{"auto-rows":fr()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...Ct(),"normal"]}],"justify-items":[{"justify-items":[...Ae(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ae()]}],"align-content":[{content:["normal",...Ct()]}],"align-items":[{items:[...Ae(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ae(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ct()}],"place-items":[{"place-items":[...Ae(),"baseline"]}],"place-self":[{"place-self":["auto",...Ae()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:de()}],mx:[{mx:de()}],my:[{my:de()}],ms:[{ms:de()}],me:[{me:de()}],mt:[{mt:de()}],mr:[{mr:de()}],mb:[{mb:de()}],ml:[{ml:de()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:ke()}],w:[{w:[i,"screen",...ke()]}],"min-w":[{"min-w":[i,"screen","none",...ke()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...ke()]}],h:[{h:["screen","lh",...ke()]}],"min-h":[{"min-h":["screen","lh","none",...ke()]}],"max-h":[{"max-h":["screen","lh",...ke()]}],"font-size":[{text:["base",r,Be,xe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,k,Wt]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jt,w]}],"font-family":[{font:[Hp,w,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,k,w]}],"line-clamp":[{"line-clamp":[C,"none",k,Wt]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",k,w]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",k,w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ot(),"wavy"]}],"text-decoration-thickness":[{decoration:[C,"from-font","auto",k,xe]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[C,"auto",k,w]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",k,w]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",k,w]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:mr()}],"bg-repeat":[{bg:hr()}],"bg-size":[{bg:gr()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},fe,k,w],radial:["",k,w],conic:[fe,k,w]},Kp,Yp]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:Pt()}],"gradient-via-pos":[{via:Pt()}],"gradient-to-pos":[{to:Pt()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ot(),"hidden","none"]}],"divide-style":[{divide:[...ot(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...ot(),"none","hidden"]}],"outline-offset":[{"outline-offset":[C,k,w]}],"outline-w":[{outline:["",C,Be,xe]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",u,pt,dt]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",d,pt,dt]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[C,xe]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",h,pt,dt]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[C,k,w]}],"mix-blend":[{"mix-blend":[...vr(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":vr()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[C]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[k,w]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[C]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:mr()}],"mask-repeat":[{mask:hr()}],"mask-size":[{mask:gr()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",k,w]}],filter:[{filter:["","none",k,w]}],blur:[{blur:br()}],brightness:[{brightness:[C,k,w]}],contrast:[{contrast:[C,k,w]}],"drop-shadow":[{"drop-shadow":["","none",g,pt,dt]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",C,k,w]}],"hue-rotate":[{"hue-rotate":[C,k,w]}],invert:[{invert:["",C,k,w]}],saturate:[{saturate:[C,k,w]}],sepia:[{sepia:["",C,k,w]}],"backdrop-filter":[{"backdrop-filter":["","none",k,w]}],"backdrop-blur":[{"backdrop-blur":br()}],"backdrop-brightness":[{"backdrop-brightness":[C,k,w]}],"backdrop-contrast":[{"backdrop-contrast":[C,k,w]}],"backdrop-grayscale":[{"backdrop-grayscale":["",C,k,w]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[C,k,w]}],"backdrop-invert":[{"backdrop-invert":["",C,k,w]}],"backdrop-opacity":[{"backdrop-opacity":[C,k,w]}],"backdrop-saturate":[{"backdrop-saturate":[C,k,w]}],"backdrop-sepia":[{"backdrop-sepia":["",C,k,w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",k,w]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[C,"initial",k,w]}],ease:[{ease:["linear","initial",E,k,w]}],delay:[{delay:[C,k,w]}],animate:[{animate:["none",y,k,w]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,k,w]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:st()}],"rotate-x":[{"rotate-x":st()}],"rotate-y":[{"rotate-y":st()}],"rotate-z":[{"rotate-z":st()}],scale:[{scale:at()}],"scale-x":[{"scale-x":at()}],"scale-y":[{"scale-y":at()}],"scale-z":[{"scale-z":at()}],"scale-3d":["scale-3d"],skew:[{skew:Rt()}],"skew-x":[{"skew-x":Rt()}],"skew-y":[{"skew-y":Rt()}],transform:[{transform:[k,w,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:it()}],"translate-x":[{"translate-x":it()}],"translate-y":[{"translate-y":it()}],"translate-z":[{"translate-z":it()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",k,w]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",k,w]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[C,Be,xe,Wt]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},rf=Pp(tf);function ue(...e){return rf(Ko(e))}const nf=dr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive pointer",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ds({className:e,variant:t="default",size:r="default",asChild:n=!1,...o}){const s=n?lp:"button";return $.jsx(s,{"data-slot":"button","data-variant":t,"data-size":r,className:ue(nf({variant:t,size:r,className:e})),...o})}const of=({className:e,...t})=>$.jsx(Et,{className:ue("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),sf=({className:e,...t})=>$.jsx(Et.Content,{className:ue("flex flex-col gap-8 p-4",e),...t}),af=({className:e,title:t="No messages yet",description:r="Start a conversation to see messages here",icon:n,children:o,...s})=>$.jsx("div",{className:ue("flex size-full flex-col items-center justify-center gap-3 p-8 text-center",e),...s,children:o??$.jsxs($.Fragment,{children:[n&&$.jsx("div",{className:"text-muted-foreground",children:n}),$.jsxs("div",{className:"space-y-1",children:[$.jsx("h3",{className:"font-medium text-sm",children:t}),r&&$.jsx("p",{className:"text-muted-foreground text-sm",children:r})]})]})}),cf=({className:e,...t})=>{const{isAtBottom:r,scrollToBottom:n}=Yo(),o=N.useCallback(()=>{n()},[n]);return!r&&$.jsx(ds,{className:ue("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full",e),onClick:o,size:"icon",type:"button",variant:"outline",...t,children:$.jsx(Jd,{className:"size-4"})})};function lf({className:e,...t}){return $.jsx("textarea",{"data-slot":"textarea",className:ue("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}function uf({className:e,...t}){return $.jsx("div",{"data-slot":"input-group",role:"group",className:ue("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}const df=dr("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function pf({className:e,align:t="inline-start",...r}){return $.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:ue(df({align:t}),e),onClick:n=>{n.target.closest("button")||n.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}const ff=dr("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function mf({className:e,type:t="button",variant:r="ghost",size:n="xs",...o}){return $.jsx(ds,{type:t,"data-size":n,variant:r,className:ue(ff({size:n}),e),...o})}function hf({className:e,...t}){return $.jsx(lf,{"data-slot":"input-group-control",className:ue("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}function gf(e){const t=["☀️ Sunny","🌤️ Partly Cloudy","☁️ Cloudy","🌧️ Rainy","⛈️ Stormy","❄️ Snowy","🌫️ Foggy"],r=t[Math.floor(Math.random()*t.length)],n=Math.floor(Math.random()*35)+5,o=Math.floor(Math.random()*60)+30,s=Math.floor(Math.random()*30)+5;return{city:e,condition:r,temperature:`${n}°C`,humidity:`${o}%`,wind:`${s} km/h`}}function bf(){const[e,t]=N.useState(""),{messages:r,sendMessage:n,status:o,addToolOutput:s}=Md({transport:new Jo({api:"/api/chat"}),sendAutomaticallyWhen:$d,onToolCall:({toolCall:l})=>{if(l.toolName==="getWeather"){const c=l.input,u=gf(c.city);s({tool:"getWeather",toolCallId:l.toolCallId,output:u})}}}),a=o==="streaming"||o==="submitted",i=l=>{l.preventDefault(),!(!e.trim()||a)&&(n({text:e}),t(""))};return $.jsxs("div",{className:"flex h-screen flex-col bg-linear-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 gap-2",children:[$.jsxs(of,{children:[$.jsx(sf,{children:r.length===0?$.jsx(af,{icon:$.jsx(dn,{className:"size-8"}),title:"Welcome!",description:"Ask me about the weather in any city"}):r.map(l=>$.jsxs("div",{className:`flex gap-3 ${l.role==="user"?"justify-end":"justify-start"}`,children:[l.role==="assistant"&&$.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10",children:$.jsx(dn,{className:"size-4"})}),$.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2 ${l.role==="user"?"bg-primary text-primary-foreground":"bg-muted"}`,children:$.jsx("pre",{className:"whitespace-pre-wrap text-sm",children:JSON.stringify(l,null,2)})}),l.role==="user"&&$.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-primary",children:$.jsx(Kd,{className:"size-4 text-primary-foreground"})})]},l.id))}),$.jsx(cf,{})]}),$.jsx("div",{className:"border-t bg-white/50 p-4 backdrop-blur-sm dark:bg-slate-900/50 mt-auto",children:$.jsx("form",{onSubmit:i,className:"mx-auto max-w-3xl",children:$.jsxs(uf,{children:[$.jsx(hf,{placeholder:"Ask about the weather...",value:e,onChange:l=>t(l.target.value),onKeyDown:l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),i(l))}}),$.jsx(pf,{align:"block-end",children:$.jsxs(mf,{type:"submit",variant:"default",className:"rounded-full ml-auto",size:"icon-xs",disabled:!e||a,children:[a?$.jsx(Hd,{className:"animate-spin"}):$.jsx(Gd,{}),$.jsx("span",{className:"sr-only",children:"Send"})]})})]})})})]})}export{bf as component};