gci-chatbot-ai 1.0.18 → 1.0.20

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.
@@ -1,56 +1,56 @@
1
- (function(oe,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(oe=typeof globalThis<"u"?globalThis:oe||self,g(oe.GciChatbotAi={},oe.Vue))})(this,function(oe,g){"use strict";const Dl="",xn="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjMwIiB2aWV3Qm94PSIwIDAgMTIwIDMwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPg0KICA8Y2lyY2xlIGN4PSIxNSIgY3k9IjE1IiByPSI2IiBmaWxsPSIjNUI4Q0ZGIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjAuMzsxOzAuMyIgZHVyPSIxLjRzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgYmVnaW49IjBzIj48L2FuaW1hdGU+DQogIDwvY2lyY2xlPg0KDQogIDxjaXJjbGUgY3g9IjQ1IiBjeT0iMTUiIHI9IjYiIGZpbGw9IiM1QjhDRkYiPg0KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9Im9wYWNpdHkiIHZhbHVlcz0iMC4zOzE7MC4zIiBkdXI9IjEuNHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBiZWdpbj0iMC4ycyI+PC9hbmltYXRlPg0KICA8L2NpcmNsZT4NCg0KICA8Y2lyY2xlIGN4PSI3NSIgY3k9IjE1IiByPSI2IiBmaWxsPSIjNUI4Q0ZGIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjAuMzsxOzAuMyIgZHVyPSIxLjRzIiBy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c2V0PSIxIiBzdG9wLWNvbG9yPSIjODc4M0ZGIi8+CiAgICAgICAgICAgICAgICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgICAgICAgICAgICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzI3NjBfMjIwMTgiIHgxPSI0LjIzOTMyIiB5MT0iMi44MjYxNyIgeDI9IjQuMTcxMzUiIHkyPSI2LjgyNjEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgICAgICAgICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0Y2NkJGRSIvPgogICAgICAgICAgICAgICAgICAgICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM4NzgzRkYiLz4KICAgICAgICAgICAgICAgICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICAgICAgICAgICAgICAgICAgICA8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50Ml9saW5lYXJfMjc2MF8yMjAxOCIgeDE9IjguMzE1NTgiIHkxPSIyLjgyNjE3IiB4Mj0iOC4xNDU2NiIgeTI9IjEyLjgyNiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICAgICAgICAgICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRjY2QkZFIi8+CiAgICAgICAgICAgICAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzg3ODNGRiIvPgogICAgICAgICAgICAgICAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgICAgICAgICAgICAgICAgICA8L2RlZnM+CiAgICAgICAgICAgICAgICAgIDwvc3ZnPg==";var gt="vercel.ai.error",Ln=Symbol.for(gt),mt,ht,H=class Sn extends(ht=Error,mt=Ln,ht){constructor({name:t,message:r,cause:n}){super(r),this[mt]=!0,this.name=t,this.cause=n}static isInstance(t){return Sn.hasMarker(t,gt)}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 It(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var yt="AI_InvalidArgumentError",vt=`vercel.ai.error.${yt}`,Rn=Symbol.for(vt),Mt,_t,$n=class extends(_t=H,Mt=Rn,_t){constructor({message:e,cause:t,argument:r}){super({name:yt,message:e,cause:t}),this[Mt]=!0,this.argument=r}static isInstance(e){return H.hasMarker(e,vt)}},Nt="AI_JSONParseError",bt=`vercel.ai.error.${Nt}`,Un=Symbol.for(bt),At,zt,wt=class extends(zt=H,At=Un,zt){constructor({text:e,cause:t}){super({name:Nt,message:`JSON parsing failed: Text: ${e}.
1
+ (function(oe,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(oe=typeof globalThis<"u"?globalThis:oe||self,g(oe.GciChatbotAi={},oe.Vue))})(this,function(oe,g){"use strict";const Dl="",xn="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjMwIiB2aWV3Qm94PSIwIDAgMTIwIDMwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPg0KICA8Y2lyY2xlIGN4PSIxNSIgY3k9IjE1IiByPSI2IiBmaWxsPSIjNUI4Q0ZGIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjAuMzsxOzAuMyIgZHVyPSIxLjRzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgYmVnaW49IjBzIj48L2FuaW1hdGU+DQogIDwvY2lyY2xlPg0KDQogIDxjaXJjbGUgY3g9IjQ1IiBjeT0iMTUiIHI9IjYiIGZpbGw9IiM1QjhDRkYiPg0KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9Im9wYWNpdHkiIHZhbHVl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zIyMDE4IiB4MT0iMTMuMjEzOSIgeTE9IjguODI2MTciIHgyPSIxMy4xMzc1IiB5Mj0iMTEuODI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgICAgICAgICAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGNjZCRkUiLz4KICAgICAgICAgICAgICAgICAgICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjODc4M0ZGIi8+CiAgICAgICAgICAgICAgICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgICAgICAgICAgICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzI3NjBfMjIwMTgiIHgxPSI0LjIzOTMyIiB5MT0iMi44MjYxNyIgeDI9IjQuMTcxMzUiIHkyPSI2LjgyNjEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgICAgICAgICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0Y2NkJGRSIvPgogICAgICAgICAgICAgICAgICAgICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM4NzgzRkYiLz4KICAgICAgICAgICAgICAgICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICAgICAgICAgICAgICAgICAgICA8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50Ml9saW5lYXJfMjc2MF8yMjAxOCIgeDE9IjguMzE1NTgiIHkxPSIyLjgyNjE3IiB4Mj0iOC4xNDU2NiIgeTI9IjEyLjgyNiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICAgICAgICAgICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRjY2QkZFIi8+CiAgICAgICAgICAgICAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzg3ODNGRiIvPgogICAgICAgICAgICAgICAgICAgICAgPC9sa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AgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzVFODRGRiIvPgogICAgICAgICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICAgICAgICAgIDwvZGVmcz4KICAgICAgICAgIDwvc3ZnPg==";var gt="vercel.ai.error",Ln=Symbol.for(gt),mt,ht,H=class Sn extends(ht=Error,mt=Ln,ht){constructor({name:t,message:r,cause:n}){super(r),this[mt]=!0,this.name=t,this.cause=n}static isInstance(t){return Sn.hasMarker(t,gt)}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 It(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var yt="AI_InvalidArgumentError",vt=`vercel.ai.error.${yt}`,Rn=Symbol.for(vt),Mt,_t,$n=class extends(_t=H,Mt=Rn,_t){constructor({message:e,cause:t,argument:r}){super({name:yt,message:e,cause:t}),this[Mt]=!0,this.argument=r}static isInstance(e){return H.hasMarker(e,vt)}},Nt="AI_JSONParseError",bt=`vercel.ai.error.${Nt}`,Un=Symbol.for(bt),At,zt,wt=class extends(zt=H,At=Un,zt){constructor({text:e,cause:t}){super({name:Nt,message:`JSON parsing failed: Text: ${e}.
2
2
  Error message: ${It(t)}`,cause:t}),this[At]=!0,this.text=e}static isInstance(e){return H.hasMarker(e,bt)}},Dt="AI_TypeValidationError",jt=`vercel.ai.error.${Dt}`,Yn=Symbol.for(jt),Et,Tt,ue=class ft extends(Tt=H,Et=Yn,Tt){constructor({value:t,cause:r}){super({name:Dt,message:`Type validation failed: Value: ${JSON.stringify(t)}.
3
- Error message: ${It(r)}`,cause:r}),this[Et]=!0,this.value=t}static isInstance(t){return H.hasMarker(t,jt)}static wrap({value:t,cause:r}){return ft.isInstance(r)&&r.value===t?r:new ft({value:t,cause:r})}};function f(e,t,r){function n(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const c=i.prototype,l=Object.keys(c);for(let d=0;d<l.length;d++){const y=l[d];y in a||(a[y]=c[y].bind(a))}}const o=(r==null?void 0:r.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var u;const c=r!=null&&r.Parent?new s:this;n(c,a),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var u,c;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(c=(u=a==null?void 0:a._zod)==null?void 0:u.traits)==null?void 0:c.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class le extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ot extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Qe={};function q(e){return e&&Object.assign(Qe,e),Qe}function Ct(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 Je(e,t){return typeof t=="bigint"?t.toString():t}function je(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Be(e){return e==null}function Fe(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Vn(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 u=n.match(/\d?e-(\d?)/);u!=null&&u[1]&&(o=Number.parseInt(u[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const kt=Symbol("evaluating");function D(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==kt)return n===void 0&&(n=kt,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function se(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function K(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function St(e){return JSON.stringify(e)}function Qn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const xt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Jn=je(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function de(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 Zt(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e}const Bn=new Set(["string","number","symbol"]);function pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ee(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function M(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0: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 Fn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Gn={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 Wn(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=K(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return se(this,"shape",i),i},checks:[]});return ee(e,s)}function Hn(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=K(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return se(this,"shape",i),i},checks:[]});return ee(e,s)}function Xn(e,t){if(!de(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=K(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return se(this,"shape",s),s}});return ee(e,o)}function qn(e,t){if(!de(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=K(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return se(this,"shape",n),n}});return ee(e,r)}function Kn(e,t){const r=K(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return se(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ee(e,r)}function eo(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=K(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(r)for(const c in r){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(u[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)u[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return se(this,"shape",u),u},checks:[]});return ee(t,i)}function to(e,t,r){const n=K(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return se(this,"shape",s),s}});return ee(t,n)}function fe(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function ge(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ee(e){return typeof e=="string"?e:e==null?void 0:e.message}function te(e,t,r){var o,s,i,a,u,c;const n={...e,path:e.path??[]};if(!e.message){const l=Ee((i=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??Ee((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Ee((u=r.customError)==null?void 0:u.call(r,e))??Ee((c=r.localeError)==null?void 0:c.call(r,e))??"Invalid input";n.message=l}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function Ge(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ve(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Pt=(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,Je,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Lt=f("$ZodError",Pt),Rt=f("$ZodError",Pt,{Parent:Error});function ro(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 no(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(i=>n({issues:i}));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 i=r,a=0;for(;a<s.path.length;){const u=s.path[a];a===s.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(s))):i[u]=i[u]||{_errors:[]},i=i[u],a++}}};return n(e),r}const We=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new le;if(i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(u=>te(u,s,q())));throw xt(a,o==null?void 0:o.callee),a}return i.value},He=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(u=>te(u,s,q())));throw xt(a,o==null?void 0:o.callee),a}return i.value},Te=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 le;return s.issues.length?{success:!1,error:new(e??Lt)(s.issues.map(i=>te(i,o,q())))}:{success:!0,data:s.value}},oo=Te(Rt),Oe=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(i=>te(i,o,q())))}:{success:!0,data:s.value}},so=Oe(Rt),ao=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return We(e)(t,r,o)},io=e=>(t,r,n)=>We(e)(t,r,n),co=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,o)},uo=e=>async(t,r,n)=>He(e)(t,r,n),lo=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Te(e)(t,r,o)},po=e=>(t,r,n)=>Te(e)(t,r,n),fo=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Oe(e)(t,r,o)},go=e=>async(t,r,n)=>Oe(e)(t,r,n),mo=/^[cC][^\s-]{8,}$/,ho=/^[0-9a-z]+$/,Io=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yo=/^[0-9a-vA-V]{20}$/,vo=/^[A-Za-z0-9]{27}$/,Mo=/^[a-zA-Z0-9_-]{21}$/,_o=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,No=/^([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})$/,$t=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)$/,bo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ao="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function zo(){return new RegExp(Ao,"u")}const wo=/^(?:(?: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])$/,Do=/^(([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}|:))$/,jo=/^((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])$/,Eo=/^(([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])$/,To=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ut=/^[A-Za-z0-9_-]*$/,Oo=/^\+[1-9]\d{6,14}$/,Yt="(?:(?:\\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])))",Co=new RegExp(`^${Yt}$`);function Vt(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 ko(e){return new RegExp(`^${Vt(e)}$`)}function So(e){const t=Vt({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(`^${Yt}T(?:${n})$`)}const xo=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Zo=/^-?\d+$/,Qt=/^-?\d+(?:\.\d+)?$/,Po=/^(?:true|false)$/i,Lo=/^null$/i,Ro=/^[^A-Z]*$/,$o=/^[^a-z]*$/,Q=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Jt={number:"number",bigint:"bigint",object:"date"},Bt=f("$ZodCheckLessThan",(e,t)=>{Q.init(e,t);const r=Jt[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:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ft=f("$ZodCheckGreaterThan",(e,t)=>{Q.init(e,t);const r=Jt[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:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uo=f("$ZodCheckMultipleOf",(e,t)=>{Q.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):Vn(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})}}),Yo=f("$ZodCheckNumberFormat",(e,t)=>{var i;Q.init(e,t),t.format=t.format||"float64";const r=(i=t.format)==null?void 0:i.includes("int"),n=r?"int":"number",[o,s]=Gn[t.format];e._zod.onattach.push(a=>{const u=a._zod.bag;u.format=t.format,u.minimum=o,u.maximum=s,r&&(u.pattern=Zo)}),e._zod.check=a=>{const u=a.value;if(r){if(!Number.isInteger(u)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}u<o&&a.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>s&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Vo=f("$ZodCheckMaxLength",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Be(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 i=Ge(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qo=f("$ZodCheckMinLength",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Be(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 i=Ge(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Jo=f("$ZodCheckLengthEquals",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Be(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 i=Ge(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ce=f("$ZodCheckStringFormat",(e,t)=>{var r,n;Q.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=()=>{})}),Bo=f("$ZodCheckRegex",(e,t)=>{Ce.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})}}),Fo=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ro),Ce.init(e,t)}),Go=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$o),Ce.init(e,t)}),Wo=f("$ZodCheckIncludes",(e,t)=>{Q.init(e,t);const r=pe(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})}}),Ho=f("$ZodCheckStartsWith",(e,t)=>{Q.init(e,t);const r=new RegExp(`^${pe(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})}}),Xo=f("$ZodCheckEndsWith",(e,t)=>{Q.init(e,t);const r=new RegExp(`.*${pe(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})}}),qo=f("$ZodCheckOverwrite",(e,t)=>{Q.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Ko{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(`
3
+ Error message: ${It(r)}`,cause:r}),this[Et]=!0,this.value=t}static isInstance(t){return H.hasMarker(t,jt)}static wrap({value:t,cause:r}){return ft.isInstance(r)&&r.value===t?r:new ft({value:t,cause:r})}};function p(e,t,r){function n(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const c=i.prototype,l=Object.keys(c);for(let d=0;d<l.length;d++){const v=l[d];v in a||(a[v]=c[v].bind(a))}}const o=(r==null?void 0:r.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var u;const c=r!=null&&r.Parent?new s:this;n(c,a),(u=c._zod).deferred??(u.deferred=[]);for(const l of c._zod.deferred)l();return c}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var u,c;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(c=(u=a==null?void 0:a._zod)==null?void 0:u.traits)==null?void 0:c.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class le extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ot extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Qe={};function q(e){return e&&Object.assign(Qe,e),Qe}function Ct(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 Je(e,t){return typeof t=="bigint"?t.toString():t}function je(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Be(e){return e==null}function Fe(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Vn(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 u=n.match(/\d?e-(\d?)/);u!=null&&u[1]&&(o=Number.parseInt(u[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const kt=Symbol("evaluating");function E(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==kt)return n===void 0&&(n=kt,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function se(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function K(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function St(e){return JSON.stringify(e)}function Qn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const xt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Jn=je(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function de(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 Zt(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e}const Bn=new Set(["string","number","symbol"]);function pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ee(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function M(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0: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 Fn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Gn={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 Wn(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=K(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return se(this,"shape",i),i},checks:[]});return ee(e,s)}function Hn(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=K(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return se(this,"shape",i),i},checks:[]});return ee(e,s)}function Xn(e,t){if(!de(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=K(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return se(this,"shape",s),s}});return ee(e,o)}function qn(e,t){if(!de(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=K(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return se(this,"shape",n),n}});return ee(e,r)}function Kn(e,t){const r=K(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return se(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ee(e,r)}function eo(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=K(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(r)for(const c in r){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(u[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)u[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return se(this,"shape",u),u},checks:[]});return ee(t,i)}function to(e,t,r){const n=K(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return se(this,"shape",s),s}});return ee(t,n)}function fe(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function ge(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ee(e){return typeof e=="string"?e:e==null?void 0:e.message}function te(e,t,r){var o,s,i,a,u,c;const n={...e,path:e.path??[]};if(!e.message){const l=Ee((i=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??Ee((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Ee((u=r.customError)==null?void 0:u.call(r,e))??Ee((c=r.localeError)==null?void 0:c.call(r,e))??"Invalid input";n.message=l}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function Ge(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ve(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Pt=(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,Je,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Lt=p("$ZodError",Pt),Rt=p("$ZodError",Pt,{Parent:Error});function ro(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 no(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(i=>n({issues:i}));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 i=r,a=0;for(;a<s.path.length;){const u=s.path[a];a===s.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(s))):i[u]=i[u]||{_errors:[]},i=i[u],a++}}};return n(e),r}const We=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new le;if(i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(u=>te(u,s,q())));throw xt(a,o==null?void 0:o.callee),a}return i.value},He=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(u=>te(u,s,q())));throw xt(a,o==null?void 0:o.callee),a}return i.value},Te=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 le;return s.issues.length?{success:!1,error:new(e??Lt)(s.issues.map(i=>te(i,o,q())))}:{success:!0,data:s.value}},oo=Te(Rt),Oe=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(i=>te(i,o,q())))}:{success:!0,data:s.value}},so=Oe(Rt),ao=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return We(e)(t,r,o)},io=e=>(t,r,n)=>We(e)(t,r,n),co=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,o)},uo=e=>async(t,r,n)=>He(e)(t,r,n),lo=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Te(e)(t,r,o)},po=e=>(t,r,n)=>Te(e)(t,r,n),fo=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Oe(e)(t,r,o)},go=e=>async(t,r,n)=>Oe(e)(t,r,n),mo=/^[cC][^\s-]{8,}$/,ho=/^[0-9a-z]+$/,Io=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yo=/^[0-9a-vA-V]{20}$/,vo=/^[A-Za-z0-9]{27}$/,Mo=/^[a-zA-Z0-9_-]{21}$/,_o=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,No=/^([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})$/,$t=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)$/,bo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ao="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function zo(){return new RegExp(Ao,"u")}const wo=/^(?:(?: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])$/,Do=/^(([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}|:))$/,jo=/^((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])$/,Eo=/^(([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])$/,To=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ut=/^[A-Za-z0-9_-]*$/,Oo=/^\+[1-9]\d{6,14}$/,Yt="(?:(?:\\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])))",Co=new RegExp(`^${Yt}$`);function Vt(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 ko(e){return new RegExp(`^${Vt(e)}$`)}function So(e){const t=Vt({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(`^${Yt}T(?:${n})$`)}const xo=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Zo=/^-?\d+$/,Qt=/^-?\d+(?:\.\d+)?$/,Po=/^(?:true|false)$/i,Lo=/^null$/i,Ro=/^[^A-Z]*$/,$o=/^[^a-z]*$/,Q=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Jt={number:"number",bigint:"bigint",object:"date"},Bt=p("$ZodCheckLessThan",(e,t)=>{Q.init(e,t);const r=Jt[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:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ft=p("$ZodCheckGreaterThan",(e,t)=>{Q.init(e,t);const r=Jt[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:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uo=p("$ZodCheckMultipleOf",(e,t)=>{Q.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):Vn(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})}}),Yo=p("$ZodCheckNumberFormat",(e,t)=>{var i;Q.init(e,t),t.format=t.format||"float64";const r=(i=t.format)==null?void 0:i.includes("int"),n=r?"int":"number",[o,s]=Gn[t.format];e._zod.onattach.push(a=>{const u=a._zod.bag;u.format=t.format,u.minimum=o,u.maximum=s,r&&(u.pattern=Zo)}),e._zod.check=a=>{const u=a.value;if(r){if(!Number.isInteger(u)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}u<o&&a.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>s&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Vo=p("$ZodCheckMaxLength",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Be(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 i=Ge(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qo=p("$ZodCheckMinLength",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Be(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 i=Ge(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Jo=p("$ZodCheckLengthEquals",(e,t)=>{var r;Q.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Be(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 i=Ge(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ce=p("$ZodCheckStringFormat",(e,t)=>{var r,n;Q.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=()=>{})}),Bo=p("$ZodCheckRegex",(e,t)=>{Ce.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})}}),Fo=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ro),Ce.init(e,t)}),Go=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$o),Ce.init(e,t)}),Wo=p("$ZodCheckIncludes",(e,t)=>{Q.init(e,t);const r=pe(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})}}),Ho=p("$ZodCheckStartsWith",(e,t)=>{Q.init(e,t);const r=new RegExp(`^${pe(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})}}),Xo=p("$ZodCheckEndsWith",(e,t)=>{Q.init(e,t);const r=new RegExp(`.*${pe(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})}}),qo=p("$ZodCheckOverwrite",(e,t)=>{Q.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Ko{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
4
  `).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,r=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
5
- `))}}const es={major:4,minor:3,patch:5},x=f("$ZodType",(e,t)=>{var o;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=es;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,u,c)=>{let l=fe(a),d;for(const y of u){if(y._zod.def.when){if(!y._zod.def.when(a))continue}else if(l)continue;const h=a.issues.length,_=y._zod.check(a);if(_ instanceof Promise&&(c==null?void 0:c.async)===!1)throw new le;if(d||_ instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await _,a.issues.length!==h&&(l||(l=fe(a,h)))});else{if(a.issues.length===h)continue;l||(l=fe(a,h))}}return d?d.then(()=>a):a},i=(a,u,c)=>{if(fe(a))return a.aborted=!0,a;const l=s(u,n,c);if(l instanceof Promise){if(c.async===!1)throw new le;return l.then(d=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,u)):i(l,a,u)}const c=e._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new le;return c.then(l=>s(l,n,u))}return s(c,n,u)}}D(e,"~standard",()=>({validate:s=>{var i;try{const a=oo(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return so(e,s).then(u=>{var c;return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Xe=f("$ZodString",(e,t)=>{var r;x.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??xo(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),L=f("$ZodStringFormat",(e,t)=>{Ce.init(e,t),Xe.init(e,t)}),ts=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=No),L.init(e,t)}),rs=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=$t(n))}else t.pattern??(t.pattern=$t());L.init(e,t)}),ns=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bo),L.init(e,t)}),os=f("$ZodURL",(e,t)=>{L.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})}}}),ss=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zo()),L.init(e,t)}),as=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Mo),L.init(e,t)}),is=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mo),L.init(e,t)}),cs=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ho),L.init(e,t)}),us=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Io),L.init(e,t)}),ls=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yo),L.init(e,t)}),ds=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vo),L.init(e,t)}),ps=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=So(t)),L.init(e,t)}),fs=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Co),L.init(e,t)}),gs=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ko(t)),L.init(e,t)}),ms=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_o),L.init(e,t)}),hs=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wo),L.init(e,t),e._zod.bag.format="ipv4"}),Is=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Do),L.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})}}}),ys=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=jo),L.init(e,t)}),vs=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Eo),L.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 i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>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 Gt(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ms=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=To),L.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Gt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function _s(e){if(!Ut.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gt(r)}const Ns=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ut),L.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{_s(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),bs=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Oo),L.init(e,t)});function As(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==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const zs=f("$ZodJWT",(e,t)=>{L.init(e,t),e._zod.check=r=>{As(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Wt=f("$ZodNumber",(e,t)=>{x.init(e,t),e._zod.pattern=e._zod.bag.pattern??Qt,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}}),ws=f("$ZodNumberFormat",(e,t)=>{Yo.init(e,t),Wt.init(e,t)}),Ds=f("$ZodBoolean",(e,t)=>{x.init(e,t),e._zod.pattern=Po,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}}),js=f("$ZodNull",(e,t)=>{x.init(e,t),e._zod.pattern=Lo,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}}),Es=f("$ZodUnknown",(e,t)=>{x.init(e,t),e._zod.parse=r=>r}),Ts=f("$ZodNever",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Ht(e,t,r){e.issues.length&&t.issues.push(...ge(r,e.issues)),t.value[r]=e.value}const Os=f("$ZodArray",(e,t)=>{x.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 i=0;i<o.length;i++){const a=o[i],u=t.element._zod.run({value:a,issues:[]},n);u instanceof Promise?s.push(u.then(c=>Ht(c,r,i))):Ht(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function ke(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...ge(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Xt(e){var n,o,s,i;const t=Object.keys(e.shape);for(const a of t)if(!((i=(s=(o=(n=e.shape)==null?void 0:n[a])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&i.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const r=Fn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function qt(e,t,r,n,o,s){const i=[],a=o.keySet,u=o.catchall._zod,c=u.def.type,l=u.optout==="optional";for(const d in t){if(a.has(d))continue;if(c==="never"){i.push(d);continue}const y=u.run({value:t[d],issues:[]},n);y instanceof Promise?e.push(y.then(h=>ke(h,r,d,t,l))):ke(y,r,d,t,l)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const Cs=f("$ZodObject",(e,t)=>{x.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!(r!=null&&r.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const n=je(()=>Xt(t));D(e._zod,"propValues",()=>{const a=t.shape,u={};for(const c in a){const l=a[c]._zod;if(l.values){u[c]??(u[c]=new Set);for(const d of l.values)u[c].add(d)}}return u});const o=ye,s=t.catchall;let i;e._zod.parse=(a,u)=>{i??(i=n.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const l=[],d=i.shape;for(const y of i.keys){const h=d[y],_=h._zod.optout==="optional",m=h._zod.run({value:c[y],issues:[]},u);m instanceof Promise?l.push(m.then(v=>ke(v,a,y,c,_))):ke(m,a,y,c,_)}return s?qt(l,c,a,u,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),ks=f("$ZodObjectJIT",(e,t)=>{Cs.init(e,t);const r=e._zod.parse,n=je(()=>Xt(t)),o=y=>{var p;const h=new Ko(["shape","payload","ctx"]),_=n.value,m=T=>{const E=St(T);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};h.write("const input = payload.value;");const v=Object.create(null);let b=0;for(const T of _.keys)v[T]=`key_${b++}`;h.write("const newResult = {};");for(const T of _.keys){const E=v[T],w=St(T),k=y[T],J=((p=k==null?void 0:k._zod)==null?void 0:p.optout)==="optional";h.write(`const ${E} = ${m(T)};`),J?h.write(`
6
- if (${E}.issues.length) {
7
- if (${w} in input) {
8
- payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
5
+ `))}}const es={major:4,minor:3,patch:5},x=p("$ZodType",(e,t)=>{var o;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=es;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,u,c)=>{let l=fe(a),d;for(const v of u){if(v._zod.def.when){if(!v._zod.def.when(a))continue}else if(l)continue;const m=a.issues.length,_=v._zod.check(a);if(_ instanceof Promise&&(c==null?void 0:c.async)===!1)throw new le;if(d||_ instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await _,a.issues.length!==m&&(l||(l=fe(a,m)))});else{if(a.issues.length===m)continue;l||(l=fe(a,m))}}return d?d.then(()=>a):a},i=(a,u,c)=>{if(fe(a))return a.aborted=!0,a;const l=s(u,n,c);if(l instanceof Promise){if(c.async===!1)throw new le;return l.then(d=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,u)):i(l,a,u)}const c=e._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new le;return c.then(l=>s(l,n,u))}return s(c,n,u)}}E(e,"~standard",()=>({validate:s=>{var i;try{const a=oo(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return so(e,s).then(u=>{var c;return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Xe=p("$ZodString",(e,t)=>{var r;x.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??xo(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),L=p("$ZodStringFormat",(e,t)=>{Ce.init(e,t),Xe.init(e,t)}),ts=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=No),L.init(e,t)}),rs=p("$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=$t(n))}else t.pattern??(t.pattern=$t());L.init(e,t)}),ns=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bo),L.init(e,t)}),os=p("$ZodURL",(e,t)=>{L.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})}}}),ss=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zo()),L.init(e,t)}),as=p("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Mo),L.init(e,t)}),is=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mo),L.init(e,t)}),cs=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ho),L.init(e,t)}),us=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Io),L.init(e,t)}),ls=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yo),L.init(e,t)}),ds=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vo),L.init(e,t)}),ps=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=So(t)),L.init(e,t)}),fs=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Co),L.init(e,t)}),gs=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ko(t)),L.init(e,t)}),ms=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_o),L.init(e,t)}),hs=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wo),L.init(e,t),e._zod.bag.format="ipv4"}),Is=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Do),L.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})}}}),ys=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=jo),L.init(e,t)}),vs=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Eo),L.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 i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>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 Gt(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ms=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=To),L.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Gt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function _s(e){if(!Ut.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gt(r)}const Ns=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ut),L.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{_s(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),bs=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Oo),L.init(e,t)});function As(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==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const zs=p("$ZodJWT",(e,t)=>{L.init(e,t),e._zod.check=r=>{As(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Wt=p("$ZodNumber",(e,t)=>{x.init(e,t),e._zod.pattern=e._zod.bag.pattern??Qt,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}}),ws=p("$ZodNumberFormat",(e,t)=>{Yo.init(e,t),Wt.init(e,t)}),Ds=p("$ZodBoolean",(e,t)=>{x.init(e,t),e._zod.pattern=Po,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}}),js=p("$ZodNull",(e,t)=>{x.init(e,t),e._zod.pattern=Lo,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}}),Es=p("$ZodUnknown",(e,t)=>{x.init(e,t),e._zod.parse=r=>r}),Ts=p("$ZodNever",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Ht(e,t,r){e.issues.length&&t.issues.push(...ge(r,e.issues)),t.value[r]=e.value}const Os=p("$ZodArray",(e,t)=>{x.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 i=0;i<o.length;i++){const a=o[i],u=t.element._zod.run({value:a,issues:[]},n);u instanceof Promise?s.push(u.then(c=>Ht(c,r,i))):Ht(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function ke(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...ge(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Xt(e){var n,o,s,i;const t=Object.keys(e.shape);for(const a of t)if(!((i=(s=(o=(n=e.shape)==null?void 0:n[a])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&i.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const r=Fn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function qt(e,t,r,n,o,s){const i=[],a=o.keySet,u=o.catchall._zod,c=u.def.type,l=u.optout==="optional";for(const d in t){if(a.has(d))continue;if(c==="never"){i.push(d);continue}const v=u.run({value:t[d],issues:[]},n);v instanceof Promise?e.push(v.then(m=>ke(m,r,d,t,l))):ke(v,r,d,t,l)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const Cs=p("$ZodObject",(e,t)=>{x.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!(r!=null&&r.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const n=je(()=>Xt(t));E(e._zod,"propValues",()=>{const a=t.shape,u={};for(const c in a){const l=a[c]._zod;if(l.values){u[c]??(u[c]=new Set);for(const d of l.values)u[c].add(d)}}return u});const o=ye,s=t.catchall;let i;e._zod.parse=(a,u)=>{i??(i=n.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const l=[],d=i.shape;for(const v of i.keys){const m=d[v],_=m._zod.optout==="optional",I=m._zod.run({value:c[v],issues:[]},u);I instanceof Promise?l.push(I.then(h=>ke(h,a,v,c,_))):ke(I,a,v,c,_)}return s?qt(l,c,a,u,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),ks=p("$ZodObjectJIT",(e,t)=>{Cs.init(e,t);const r=e._zod.parse,n=je(()=>Xt(t)),o=v=>{var f;const m=new Ko(["shape","payload","ctx"]),_=n.value,I=w=>{const D=St(w);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};m.write("const input = payload.value;");const h=Object.create(null);let A=0;for(const w of _.keys)h[w]=`key_${A++}`;m.write("const newResult = {};");for(const w of _.keys){const D=h[w],j=St(w),k=v[w],J=((f=k==null?void 0:k._zod)==null?void 0:f.optout)==="optional";m.write(`const ${D} = ${I(w)};`),J?m.write(`
6
+ if (${D}.issues.length) {
7
+ if (${j} in input) {
8
+ payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
9
9
  ...iss,
10
- path: iss.path ? [${w}, ...iss.path] : [${w}]
10
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
11
11
  })));
12
12
  }
13
13
  }
14
14
 
15
- if (${E}.value === undefined) {
16
- if (${w} in input) {
17
- newResult[${w}] = undefined;
15
+ if (${D}.value === undefined) {
16
+ if (${j} in input) {
17
+ newResult[${j}] = undefined;
18
18
  }
19
19
  } else {
20
- newResult[${w}] = ${E}.value;
20
+ newResult[${j}] = ${D}.value;
21
21
  }
22
22
 
23
- `):h.write(`
24
- if (${E}.issues.length) {
25
- payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
23
+ `):m.write(`
24
+ if (${D}.issues.length) {
25
+ payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
26
26
  ...iss,
27
- path: iss.path ? [${w}, ...iss.path] : [${w}]
27
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
28
28
  })));
29
29
  }
30
30
 
31
- if (${E}.value === undefined) {
32
- if (${w} in input) {
33
- newResult[${w}] = undefined;
31
+ if (${D}.value === undefined) {
32
+ if (${j} in input) {
33
+ newResult[${j}] = undefined;
34
34
  }
35
35
  } else {
36
- newResult[${w}] = ${E}.value;
36
+ newResult[${j}] = ${D}.value;
37
37
  }
38
38
 
39
- `)}h.write("payload.value = newResult;"),h.write("return payload;");const z=h.compile();return(T,E)=>z(y,T,E)};let s;const i=ye,a=!Qe.jitless,c=a&&Jn.value,l=t.catchall;let d;e._zod.parse=(y,h)=>{d??(d=n.value);const _=y.value;return i(_)?a&&c&&(h==null?void 0:h.async)===!1&&h.jitless!==!0?(s||(s=o(t.shape)),y=s(y,h),l?qt([],_,y,h,d,e):y):r(y,h):(y.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),y)}});function Kt(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=>!fe(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(i=>te(i,n,q())))}),t)}const er=f("$ZodUnion",(e,t)=>{x.init(e,t),D(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),D(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),D(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),D(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=>Fe(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 i=!1;const a=[];for(const u of t.options){const c=u._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}return i?Promise.all(a).then(u=>Kt(u,o,e,s)):Kt(a,o,e,s)}}),Ss=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,er.init(e,t);const r=e._zod.parse;D(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,u]of Object.entries(i)){o[a]||(o[a]=new Set);for(const c of u)o[a].add(c)}}return o});const n=je(()=>{var i;const o=t.options,s=new Map;for(const a of o){const u=(i=a._zod.propValues)==null?void 0:i[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const c of u){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!ye(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=n.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),xs=f("$ZodIntersection",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([u,c])=>tr(r,u,c)):tr(r,s,i)}});function qe(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(de(e)&&de(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 i=qe(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.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],i=qe(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function tr(e,t,r){const n=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const u of a.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const u of a.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else e.issues.push(a);const s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),fe(e))return e;const i=qe(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Zs=f("$ZodRecord",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!de(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[],i=t.keyType._zod.values;if(i){r.value={};const a=new Set;for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const l=t.valueType._zod.run({value:o[c],issues:[]},n);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...ge(c,d.issues)),r.value[c]=d.value})):(l.issues.length&&r.issues.push(...ge(c,l.issues)),r.value[c]=l.value)}let u;for(const c in o)a.has(c)||(u=u??[],u.push(c));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{r.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let u=t.keyType._zod.run({value:a,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Qt.test(a)&&u.issues.length&&u.issues.some(d=>d.code==="invalid_type"&&d.expected==="number")){const d=t.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(u=d)}if(u.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>te(d,n,q())),input:a,path:[a],inst:e});continue}const l=t.valueType._zod.run({value:o[a],issues:[]},n);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...ge(a,d.issues)),r.value[u.value]=d.value})):(l.issues.length&&r.issues.push(...ge(a,l.issues)),r.value[u.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Ps=f("$ZodEnum",(e,t)=>{x.init(e,t);const r=Ct(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Bn.has(typeof o)).map(o=>typeof o=="string"?pe(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Ls=f("$ZodLiteral",(e,t)=>{if(x.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"?pe(n):n?pe(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}}),Rs=f("$ZodTransform",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ot(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new le;return r.value=o,r}});function rr(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const nr=f("$ZodOptional",(e,t)=>{x.init(e,t),e._zod.optin="optional",e._zod.optout="optional",D(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),D(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fe(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=>rr(s,r.value)):rr(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),$s=f("$ZodExactOptional",(e,t)=>{nr.init(e,t),D(e._zod,"values",()=>t.innerType._zod.values),D(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Us=f("$ZodNullable",(e,t)=>{x.init(e,t),D(e._zod,"optin",()=>t.innerType._zod.optin),D(e._zod,"optout",()=>t.innerType._zod.optout),D(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fe(r.source)}|null)$`):void 0}),D(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)}),Ys=f("$ZodDefault",(e,t)=>{x.init(e,t),e._zod.optin="optional",D(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=>or(s,t)):or(o,t)}});function or(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Vs=f("$ZodPrefault",(e,t)=>{x.init(e,t),e._zod.optin="optional",D(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))}),Qs=f("$ZodNonOptional",(e,t)=>{x.init(e,t),D(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=>sr(s,e)):sr(o,e)}});function sr(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 Js=f("$ZodCatch",(e,t)=>{x.init(e,t),D(e._zod,"optin",()=>t.innerType._zod.optin),D(e._zod,"optout",()=>t.innerType._zod.optout),D(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(i=>te(i,n,q()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>te(s,n,q()))},input:r.value}),r.issues=[]),r)}}),Bs=f("$ZodPipe",(e,t)=>{x.init(e,t),D(e._zod,"values",()=>t.in._zod.values),D(e._zod,"optin",()=>t.in._zod.optin),D(e._zod,"optout",()=>t.out._zod.optout),D(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(i=>Se(i,t.in,n)):Se(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Se(s,t.out,n)):Se(o,t.out,n)}});function Se(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Fs=f("$ZodReadonly",(e,t)=>{x.init(e,t),D(e._zod,"propValues",()=>t.innerType._zod.propValues),D(e._zod,"values",()=>t.innerType._zod.values),D(e._zod,"optin",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.optin}),D(e._zod,"optout",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.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(ar):ar(o)}});function ar(e){return e.value=Object.freeze(e.value),e}const Gs=f("$ZodLazy",(e,t)=>{x.init(e,t),D(e._zod,"innerType",()=>t.getter()),D(e._zod,"pattern",()=>{var r,n;return(n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.pattern}),D(e._zod,"propValues",()=>{var r,n;return(n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.propValues}),D(e._zod,"optin",()=>{var r,n;return((n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.optin)??void 0}),D(e._zod,"optout",()=>{var r,n;return((n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.optout)??void 0}),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ws=f("$ZodCustom",(e,t)=>{Q.init(e,t),x.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=>ir(s,r,n,e));ir(o,r,n,e)}});function ir(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(ve(o))}}var cr;class Hs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),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 Xs(){return new Hs}(cr=globalThis).__zod_globalRegistry??(cr.__zod_globalRegistry=Xs());const Me=globalThis.__zod_globalRegistry;function qs(e,t){return new e({type:"string",...M(t)})}function Ks(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...M(t)})}function ur(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...M(t)})}function ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...M(t)})}function ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...M(t)})}function ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...M(t)})}function na(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...M(t)})}function oa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...M(t)})}function sa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...M(t)})}function aa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...M(t)})}function ia(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...M(t)})}function ca(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...M(t)})}function ua(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...M(t)})}function la(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...M(t)})}function da(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...M(t)})}function pa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...M(t)})}function fa(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...M(t)})}function ga(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...M(t)})}function ma(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...M(t)})}function ha(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...M(t)})}function Ia(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...M(t)})}function ya(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...M(t)})}function va(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...M(t)})}function Ma(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...M(t)})}function _a(e,t){return new e({type:"string",format:"date",check:"string_format",...M(t)})}function Na(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...M(t)})}function ba(e,t){return new e({type:"string",format:"duration",check:"string_format",...M(t)})}function Aa(e,t){return new e({type:"number",checks:[],...M(t)})}function za(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...M(t)})}function wa(e,t){return new e({type:"boolean",...M(t)})}function Da(e,t){return new e({type:"null",...M(t)})}function ja(e){return new e({type:"unknown"})}function Ea(e,t){return new e({type:"never",...M(t)})}function lr(e,t){return new Bt({check:"less_than",...M(t),value:e,inclusive:!1})}function Ke(e,t){return new Bt({check:"less_than",...M(t),value:e,inclusive:!0})}function dr(e,t){return new Ft({check:"greater_than",...M(t),value:e,inclusive:!1})}function et(e,t){return new Ft({check:"greater_than",...M(t),value:e,inclusive:!0})}function pr(e,t){return new Uo({check:"multiple_of",...M(t),value:e})}function fr(e,t){return new Vo({check:"max_length",...M(t),maximum:e})}function xe(e,t){return new Qo({check:"min_length",...M(t),minimum:e})}function gr(e,t){return new Jo({check:"length_equals",...M(t),length:e})}function Ta(e,t){return new Bo({check:"string_format",format:"regex",...M(t),pattern:e})}function Oa(e){return new Fo({check:"string_format",format:"lowercase",...M(e)})}function Ca(e){return new Go({check:"string_format",format:"uppercase",...M(e)})}function ka(e,t){return new Wo({check:"string_format",format:"includes",...M(t),includes:e})}function Sa(e,t){return new Ho({check:"string_format",format:"starts_with",...M(t),prefix:e})}function xa(e,t){return new Xo({check:"string_format",format:"ends_with",...M(t),suffix:e})}function me(e){return new qo({check:"overwrite",tx:e})}function Za(e){return me(t=>t.normalize(e))}function Pa(){return me(e=>e.trim())}function La(){return me(e=>e.toLowerCase())}function Ra(){return me(e=>e.toUpperCase())}function $a(){return me(e=>Qn(e))}function Ua(e,t,r){return new e({type:"array",element:t,...M(r)})}function Ya(e,t,r){const n=M(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Va(e,t,r){return new e({type:"custom",check:"custom",fn:t,...M(r)})}function Qa(e){const t=Ja(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(ve(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(ve(o))}},e(r.value,r)));return t}function Ja(e,t){const r=new Q({check:"custom",...M(t)});return r._zod.check=e,r}function Ze(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Me,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function S(e,t,r={path:[],schemaPath:[]}){var l,d;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 i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const a=(d=(l=e._zod).toJSONSchema)==null?void 0:d.call(l);if(a)i.schema=a;else{const y={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,y);else{const _=i.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,_,y)}const h=e._zod.parent;h&&(i.ref||(i.ref=h),S(h,t,y),t.seen.get(h).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),t.io==="input"&&$(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Pe(e,t){var i,a,u,c;const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const l of e.seen.entries()){const d=(i=e.metadataRegistry.get(l[0]))==null?void 0:i.id;if(d){const y=n.get(d);if(y&&y!==l[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(d,l[0])}}const o=l=>{var m;const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const v=(m=e.external.registry.get(l[0]))==null?void 0:m.id,b=e.external.uri??(p=>p);if(v)return{ref:b(v)};const z=l[1].defId??l[1].schema.id??`schema${e.counter++}`;return l[1].defId=z,{defId:z,ref:`${b("__shared")}#/${d}/${z}`}}if(l[1]===r)return{ref:"#"};const h=`#/${d}/`,_=l[1].schema.id??`__schema${e.counter++}`;return{defId:_,ref:h+_}},s=l=>{if(l[1].schema.$ref)return;const d=l[1],{ref:y,defId:h}=o(l);d.def={...d.schema},h&&(d.defId=h);const _=d.schema;for(const m in _)delete _[m];_.$ref=y};if(e.cycles==="throw")for(const l of e.seen.entries()){const d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${(a=d.cycle)==null?void 0:a.join("/")}/<root>
39
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");const b=m.compile();return(w,D)=>b(v,w,D)};let s;const i=ye,a=!Qe.jitless,c=a&&Jn.value,l=t.catchall;let d;e._zod.parse=(v,m)=>{d??(d=n.value);const _=v.value;return i(_)?a&&c&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=o(t.shape)),v=s(v,m),l?qt([],_,v,m,d,e):v):r(v,m):(v.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),v)}});function Kt(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=>!fe(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(i=>te(i,n,q())))}),t)}const er=p("$ZodUnion",(e,t)=>{x.init(e,t),E(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),E(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),E(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=>Fe(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 i=!1;const a=[];for(const u of t.options){const c=u._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}return i?Promise.all(a).then(u=>Kt(u,o,e,s)):Kt(a,o,e,s)}}),Ss=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,er.init(e,t);const r=e._zod.parse;E(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,u]of Object.entries(i)){o[a]||(o[a]=new Set);for(const c of u)o[a].add(c)}}return o});const n=je(()=>{var i;const o=t.options,s=new Map;for(const a of o){const u=(i=a._zod.propValues)==null?void 0:i[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const c of u){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!ye(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=n.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),xs=p("$ZodIntersection",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([u,c])=>tr(r,u,c)):tr(r,s,i)}});function qe(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(de(e)&&de(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 i=qe(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.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],i=qe(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function tr(e,t,r){const n=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const u of a.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const u of a.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else e.issues.push(a);const s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),fe(e))return e;const i=qe(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Zs=p("$ZodRecord",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!de(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[],i=t.keyType._zod.values;if(i){r.value={};const a=new Set;for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const l=t.valueType._zod.run({value:o[c],issues:[]},n);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...ge(c,d.issues)),r.value[c]=d.value})):(l.issues.length&&r.issues.push(...ge(c,l.issues)),r.value[c]=l.value)}let u;for(const c in o)a.has(c)||(u=u??[],u.push(c));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{r.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let u=t.keyType._zod.run({value:a,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Qt.test(a)&&u.issues.length&&u.issues.some(d=>d.code==="invalid_type"&&d.expected==="number")){const d=t.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(u=d)}if(u.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>te(d,n,q())),input:a,path:[a],inst:e});continue}const l=t.valueType._zod.run({value:o[a],issues:[]},n);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...ge(a,d.issues)),r.value[u.value]=d.value})):(l.issues.length&&r.issues.push(...ge(a,l.issues)),r.value[u.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Ps=p("$ZodEnum",(e,t)=>{x.init(e,t);const r=Ct(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Bn.has(typeof o)).map(o=>typeof o=="string"?pe(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Ls=p("$ZodLiteral",(e,t)=>{if(x.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"?pe(n):n?pe(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}}),Rs=p("$ZodTransform",(e,t)=>{x.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ot(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new le;return r.value=o,r}});function rr(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const nr=p("$ZodOptional",(e,t)=>{x.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),E(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fe(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=>rr(s,r.value)):rr(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),$s=p("$ZodExactOptional",(e,t)=>{nr.init(e,t),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Us=p("$ZodNullable",(e,t)=>{x.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fe(r.source)}|null)$`):void 0}),E(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)}),Ys=p("$ZodDefault",(e,t)=>{x.init(e,t),e._zod.optin="optional",E(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=>or(s,t)):or(o,t)}});function or(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Vs=p("$ZodPrefault",(e,t)=>{x.init(e,t),e._zod.optin="optional",E(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))}),Qs=p("$ZodNonOptional",(e,t)=>{x.init(e,t),E(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=>sr(s,e)):sr(o,e)}});function sr(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 Js=p("$ZodCatch",(e,t)=>{x.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(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(i=>te(i,n,q()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>te(s,n,q()))},input:r.value}),r.issues=[]),r)}}),Bs=p("$ZodPipe",(e,t)=>{x.init(e,t),E(e._zod,"values",()=>t.in._zod.values),E(e._zod,"optin",()=>t.in._zod.optin),E(e._zod,"optout",()=>t.out._zod.optout),E(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(i=>Se(i,t.in,n)):Se(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Se(s,t.out,n)):Se(o,t.out,n)}});function Se(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Fs=p("$ZodReadonly",(e,t)=>{x.init(e,t),E(e._zod,"propValues",()=>t.innerType._zod.propValues),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"optin",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.optin}),E(e._zod,"optout",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.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(ar):ar(o)}});function ar(e){return e.value=Object.freeze(e.value),e}const Gs=p("$ZodLazy",(e,t)=>{x.init(e,t),E(e._zod,"innerType",()=>t.getter()),E(e._zod,"pattern",()=>{var r,n;return(n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.pattern}),E(e._zod,"propValues",()=>{var r,n;return(n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.propValues}),E(e._zod,"optin",()=>{var r,n;return((n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.optin)??void 0}),E(e._zod,"optout",()=>{var r,n;return((n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.optout)??void 0}),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ws=p("$ZodCustom",(e,t)=>{Q.init(e,t),x.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=>ir(s,r,n,e));ir(o,r,n,e)}});function ir(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(ve(o))}}var cr;class Hs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),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 Xs(){return new Hs}(cr=globalThis).__zod_globalRegistry??(cr.__zod_globalRegistry=Xs());const Me=globalThis.__zod_globalRegistry;function qs(e,t){return new e({type:"string",...M(t)})}function Ks(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...M(t)})}function ur(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...M(t)})}function ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...M(t)})}function ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...M(t)})}function ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...M(t)})}function na(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...M(t)})}function oa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...M(t)})}function sa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...M(t)})}function aa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...M(t)})}function ia(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...M(t)})}function ca(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...M(t)})}function ua(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...M(t)})}function la(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...M(t)})}function da(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...M(t)})}function pa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...M(t)})}function fa(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...M(t)})}function ga(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...M(t)})}function ma(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...M(t)})}function ha(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...M(t)})}function Ia(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...M(t)})}function ya(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...M(t)})}function va(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...M(t)})}function Ma(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...M(t)})}function _a(e,t){return new e({type:"string",format:"date",check:"string_format",...M(t)})}function Na(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...M(t)})}function ba(e,t){return new e({type:"string",format:"duration",check:"string_format",...M(t)})}function Aa(e,t){return new e({type:"number",checks:[],...M(t)})}function za(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...M(t)})}function wa(e,t){return new e({type:"boolean",...M(t)})}function Da(e,t){return new e({type:"null",...M(t)})}function ja(e){return new e({type:"unknown"})}function Ea(e,t){return new e({type:"never",...M(t)})}function lr(e,t){return new Bt({check:"less_than",...M(t),value:e,inclusive:!1})}function Ke(e,t){return new Bt({check:"less_than",...M(t),value:e,inclusive:!0})}function dr(e,t){return new Ft({check:"greater_than",...M(t),value:e,inclusive:!1})}function et(e,t){return new Ft({check:"greater_than",...M(t),value:e,inclusive:!0})}function pr(e,t){return new Uo({check:"multiple_of",...M(t),value:e})}function fr(e,t){return new Vo({check:"max_length",...M(t),maximum:e})}function xe(e,t){return new Qo({check:"min_length",...M(t),minimum:e})}function gr(e,t){return new Jo({check:"length_equals",...M(t),length:e})}function Ta(e,t){return new Bo({check:"string_format",format:"regex",...M(t),pattern:e})}function Oa(e){return new Fo({check:"string_format",format:"lowercase",...M(e)})}function Ca(e){return new Go({check:"string_format",format:"uppercase",...M(e)})}function ka(e,t){return new Wo({check:"string_format",format:"includes",...M(t),includes:e})}function Sa(e,t){return new Ho({check:"string_format",format:"starts_with",...M(t),prefix:e})}function xa(e,t){return new Xo({check:"string_format",format:"ends_with",...M(t),suffix:e})}function me(e){return new qo({check:"overwrite",tx:e})}function Za(e){return me(t=>t.normalize(e))}function Pa(){return me(e=>e.trim())}function La(){return me(e=>e.toLowerCase())}function Ra(){return me(e=>e.toUpperCase())}function $a(){return me(e=>Qn(e))}function Ua(e,t,r){return new e({type:"array",element:t,...M(r)})}function Ya(e,t,r){const n=M(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Va(e,t,r){return new e({type:"custom",check:"custom",fn:t,...M(r)})}function Qa(e){const t=Ja(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(ve(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(ve(o))}},e(r.value,r)));return t}function Ja(e,t){const r=new Q({check:"custom",...M(t)});return r._zod.check=e,r}function Ze(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Me,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function S(e,t,r={path:[],schemaPath:[]}){var l,d;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 i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const a=(d=(l=e._zod).toJSONSchema)==null?void 0:d.call(l);if(a)i.schema=a;else{const v={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,v);else{const _=i.schema,I=t.processors[o.type];if(!I)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);I(e,t,_,v)}const m=e._zod.parent;m&&(i.ref||(i.ref=m),S(m,t,v),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),t.io==="input"&&$(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Pe(e,t){var i,a,u,c;const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const l of e.seen.entries()){const d=(i=e.metadataRegistry.get(l[0]))==null?void 0:i.id;if(d){const v=n.get(d);if(v&&v!==l[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(d,l[0])}}const o=l=>{var I;const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=(I=e.external.registry.get(l[0]))==null?void 0:I.id,A=e.external.uri??(f=>f);if(h)return{ref:A(h)};const b=l[1].defId??l[1].schema.id??`schema${e.counter++}`;return l[1].defId=b,{defId:b,ref:`${A("__shared")}#/${d}/${b}`}}if(l[1]===r)return{ref:"#"};const m=`#/${d}/`,_=l[1].schema.id??`__schema${e.counter++}`;return{defId:_,ref:m+_}},s=l=>{if(l[1].schema.$ref)return;const d=l[1],{ref:v,defId:m}=o(l);d.def={...d.schema},m&&(d.defId=m);const _=d.schema;for(const I in _)delete _[I];_.$ref=v};if(e.cycles==="throw")for(const l of e.seen.entries()){const d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${(a=d.cycle)==null?void 0:a.join("/")}/<root>
40
40
 
41
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const d=l[1];if(t===l[0]){s(l);continue}if(e.external){const h=(u=e.external.registry.get(l[0]))==null?void 0:u.id;if(t!==l[0]&&h){s(l);continue}}if((c=e.metadataRegistry.get(l[0]))==null?void 0:c.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&e.reused==="ref"){s(l);continue}}}function Le(e,t){var i,a,u;const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=c=>{const l=e.seen.get(c);if(l.ref===null)return;const d=l.def??l.schema,y={...d},h=l.ref;if(l.ref=null,h){n(h);const m=e.seen.get(h),v=m.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(v)):Object.assign(d,v),Object.assign(d,y),c._zod.parent===h)for(const z in d)z==="$ref"||z==="allOf"||z in y||delete d[z];if(v.$ref)for(const z in d)z==="$ref"||z==="allOf"||z in m.def&&JSON.stringify(d[z])===JSON.stringify(m.def[z])&&delete d[z]}const _=c._zod.parent;if(_&&_!==h){n(_);const m=e.seen.get(_);if(m!=null&&m.schema.$ref&&(d.$ref=m.schema.$ref,m.def))for(const v in d)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(d[v])===JSON.stringify(m.def[v])&&delete d[v]}e.override({zodSchema:c,jsonSchema:d,path:l.path??[]})};for(const c of[...e.seen.entries()].reverse())n(c[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,(i=e.external)!=null&&i.uri){const c=(a=e.external.registry.get(t))==null?void 0:a.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,r.def??r.schema);const s=((u=e.external)==null?void 0:u.defs)??{};for(const c of e.seen.entries()){const l=c[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Re(t,"input",e.processors),output:Re(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function $(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 $(n.element,r);if(n.type==="set")return $(n.valueType,r);if(n.type==="lazy")return $(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 $(n.innerType,r);if(n.type==="intersection")return $(n.left,r)||$(n.right,r);if(n.type==="record"||n.type==="map")return $(n.keyType,r)||$(n.valueType,r);if(n.type==="pipe")return $(n.in,r)||$(n.out,r);if(n.type==="object"){for(const o in n.shape)if($(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if($(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if($(o,r))return!0;return!!(n.rest&&$(n.rest,r))}return!1}const Ba=(e,t={})=>r=>{const n=Ze({...r,processors:t});return S(e,n),Pe(n,e),Le(n,e)},Re=(e,t,r={})=>n=>{const{libraryOptions:o,target:s}=n??{},i=Ze({...o??{},target:s,io:t,processors:r});return S(e,i),Pe(i,e),Le(i,e)},Fa={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mr=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Fa[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),c&&(o.contentEncoding=c),u&&u.size>0){const l=[...u];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},hr=(e,t,r,n)=>{const o=r,{minimum:s,maximum:i,format:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof s=="number"&&(o.minimum=s,typeof l=="number"&&t.target!=="draft-04"&&(l>=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 i=="number"&&(o.maximum=i,typeof c=="number"&&t.target!=="draft-04"&&(c<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},Ir=(e,t,r,n)=>{r.type="boolean"},Ga=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Wa=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},yr=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Ha=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Xa=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},vr=(e,t,r,n)=>{r.not={}},qa=(e,t,r,n)=>{},Mr=(e,t,r,n)=>{},Ka=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},_r=(e,t,r,n)=>{const o=e._zod.def,s=Ct(o.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Nr=(e,t,r,n)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},ei=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},ti=(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},ri=(e,t,r,n)=>{const o=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:u}=e._zod.bag;i!==void 0&&(s.minLength=i),a!==void 0&&(s.maxLength=a),u?u.length===1?(s.contentMediaType=u[0],Object.assign(o,s)):(Object.assign(o,s),o.anyOf=u.map(c=>({contentMediaType:c}))):Object.assign(o,s)},ni=(e,t,r,n)=>{r.type="boolean"},br=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},oi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Ar=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},si=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},ai=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},zr=(e,t,r,n)=>{const o=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=S(s.element,t,{...n,path:[...n.path,"items"]})},wr=(e,t,r,n)=>{var c;const o=r,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const l in i)o.properties[l]=S(i[l],t,{...n,path:[...n.path,"properties",l]});const a=new Set(Object.keys(i)),u=new Set([...a].filter(l=>{const d=s.shape[l]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((c=s.catchall)==null?void 0:c._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=S(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Dr=(e,t,r,n)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,u)=>S(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",u]}));s?r.oneOf=i:r.anyOf=i},jr=(e,t,r,n)=>{const o=e._zod.def,s=S(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=S(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=u},ii=(e,t,r,n)=>{const o=r,s=e._zod.def;o.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=s.items.map((y,h)=>S(y,t,{...n,path:[...n.path,i,h]})),c=s.rest?S(s.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=u,c&&(o.items=c)):t.target==="openapi-3.0"?(o.items={anyOf:u},c&&o.items.anyOf.push(c),o.minItems=u.length,c||(o.maxItems=u.length)):(o.items=u,c&&(o.additionalItems=c));const{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Er=(e,t,r,n)=>{const o=r,s=e._zod.def;o.type="object";const i=s.keyType,a=i._zod.bag,u=a==null?void 0:a.patterns;if(s.mode==="loose"&&u&&u.size>0){const l=S(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(const d of u)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=S(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=S(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const c=i._zod.values;if(c){const l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Tr=(e,t,r,n)=>{const o=e._zod.def,s=S(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Or=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},Cr=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},kr=(e,t,r,n)=>{const o=e._zod.def;S(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)))},Sr=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},xr=(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;S(s,t,n);const i=t.seen.get(e);i.ref=s},Zr=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},ci=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},tt=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},Pr=(e,t,r,n)=>{const o=e._zod.innerType;S(o,t,n);const s=t.seen.get(e);s.ref=o},Lr={string:mr,number:hr,boolean:Ir,bigint:Ga,symbol:Wa,null:yr,undefined:Ha,void:Xa,never:vr,any:qa,unknown:Mr,date:Ka,enum:_r,literal:Nr,nan:ei,template_literal:ti,file:ri,success:ni,custom:br,function:oi,transform:Ar,map:si,set:ai,array:zr,object:wr,union:Dr,intersection:jr,tuple:ii,record:Er,nullable:Tr,nonoptional:Or,default:Cr,prefault:kr,catch:Sr,pipe:xr,readonly:Zr,promise:ci,optional:tt,lazy:Pr};function ui(e,t){if("_idmap"in e){const n=e,o=Ze({...t,processors:Lr}),s={};for(const u of n._idmap.entries()){const[c,l]=u;S(l,o)}const i={},a={registry:n,uri:t==null?void 0:t.uri,defs:s};o.external=a;for(const u of n._idmap.entries()){const[c,l]=u;Pe(o,l),i[c]=Le(o,l)}if(Object.keys(s).length>0){const u=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[u]:s}}return{schemas:i}}const r=Ze({...t,processors:Lr});return S(e,r),Pe(r,e),Le(r,e)}const li=f("ZodISODateTime",(e,t)=>{ps.init(e,t),R.init(e,t)});function di(e){return Ma(li,e)}const pi=f("ZodISODate",(e,t)=>{fs.init(e,t),R.init(e,t)});function fi(e){return _a(pi,e)}const gi=f("ZodISOTime",(e,t)=>{gs.init(e,t),R.init(e,t)});function mi(e){return Na(gi,e)}const hi=f("ZodISODuration",(e,t)=>{ms.init(e,t),R.init(e,t)});function Ii(e){return ba(hi,e)}const F=f("ZodError",(e,t)=>{Lt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>no(e,r)},flatten:{value:r=>ro(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Je,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Je,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),yi=We(F),vi=He(F),Mi=Te(F),Rr=Oe(F),_i=ao(F),Ni=io(F),bi=co(F),Ai=uo(F),zi=lo(F),wi=po(F),Di=fo(F),ji=go(F),Z=f("ZodType",(e,t)=>(x.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Re(e,"input"),output:Re(e,"output")}}),e.toJSONSchema=Ba(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(K(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>ee(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>yi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Mi(e,r,n),e.parseAsync=async(r,n)=>vi(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Rr(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>_i(e,r,n),e.decode=(r,n)=>Ni(e,r,n),e.encodeAsync=async(r,n)=>bi(e,r,n),e.decodeAsync=async(r,n)=>Ai(e,r,n),e.safeEncode=(r,n)=>zi(e,r,n),e.safeDecode=(r,n)=>wi(e,r,n),e.safeEncodeAsync=async(r,n)=>Di(e,r,n),e.safeDecodeAsync=async(r,n)=>ji(e,r,n),e.refine=(r,n)=>e.check(Ac(r,n)),e.superRefine=r=>e.check(zc(r)),e.overwrite=r=>e.check(me(r)),e.optional=()=>Wr(e),e.exactOptional=()=>lc(e),e.nullable=()=>Hr(e),e.nullish=()=>Wr(Hr(e)),e.nonoptional=r=>hc(e,r),e.array=()=>he(e),e.or=r=>Y([e,r]),e.and=r=>oc(e,r),e.transform=r=>qr(e,cc(r)),e.default=r=>fc(e,r),e.prefault=r=>mc(e,r),e.catch=r=>yc(e,r),e.pipe=r=>qr(e,r),e.readonly=()=>_c(e),e.describe=r=>{const n=e.clone();return Me.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=Me.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Me.get(e);const n=e.clone();return Me.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),$r=f("_ZodString",(e,t)=>{Xe.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,s)=>mr(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(Ta(...n)),e.includes=(...n)=>e.check(ka(...n)),e.startsWith=(...n)=>e.check(Sa(...n)),e.endsWith=(...n)=>e.check(xa(...n)),e.min=(...n)=>e.check(xe(...n)),e.max=(...n)=>e.check(fr(...n)),e.length=(...n)=>e.check(gr(...n)),e.nonempty=(...n)=>e.check(xe(1,...n)),e.lowercase=n=>e.check(Oa(n)),e.uppercase=n=>e.check(Ca(n)),e.trim=()=>e.check(Pa()),e.normalize=(...n)=>e.check(Za(...n)),e.toLowerCase=()=>e.check(La()),e.toUpperCase=()=>e.check(Ra()),e.slugify=()=>e.check($a())}),Ei=f("ZodString",(e,t)=>{Xe.init(e,t),$r.init(e,t),e.email=r=>e.check(Ks(Ti,r)),e.url=r=>e.check(oa(Oi,r)),e.jwt=r=>e.check(va(Bi,r)),e.emoji=r=>e.check(sa(Ci,r)),e.guid=r=>e.check(ur(Ur,r)),e.uuid=r=>e.check(ea($e,r)),e.uuidv4=r=>e.check(ta($e,r)),e.uuidv6=r=>e.check(ra($e,r)),e.uuidv7=r=>e.check(na($e,r)),e.nanoid=r=>e.check(aa(ki,r)),e.guid=r=>e.check(ur(Ur,r)),e.cuid=r=>e.check(ia(Si,r)),e.cuid2=r=>e.check(ca(xi,r)),e.ulid=r=>e.check(ua(Zi,r)),e.base64=r=>e.check(ha(Vi,r)),e.base64url=r=>e.check(Ia(Qi,r)),e.xid=r=>e.check(la(Pi,r)),e.ksuid=r=>e.check(da(Li,r)),e.ipv4=r=>e.check(pa(Ri,r)),e.ipv6=r=>e.check(fa($i,r)),e.cidrv4=r=>e.check(ga(Ui,r)),e.cidrv6=r=>e.check(ma(Yi,r)),e.e164=r=>e.check(ya(Ji,r)),e.datetime=r=>e.check(di(r)),e.date=r=>e.check(fi(r)),e.time=r=>e.check(mi(r)),e.duration=r=>e.check(Ii(r))});function I(e){return qs(Ei,e)}const R=f("ZodStringFormat",(e,t)=>{L.init(e,t),$r.init(e,t)}),Ti=f("ZodEmail",(e,t)=>{ns.init(e,t),R.init(e,t)}),Ur=f("ZodGUID",(e,t)=>{ts.init(e,t),R.init(e,t)}),$e=f("ZodUUID",(e,t)=>{rs.init(e,t),R.init(e,t)}),Oi=f("ZodURL",(e,t)=>{os.init(e,t),R.init(e,t)}),Ci=f("ZodEmoji",(e,t)=>{ss.init(e,t),R.init(e,t)}),ki=f("ZodNanoID",(e,t)=>{as.init(e,t),R.init(e,t)}),Si=f("ZodCUID",(e,t)=>{is.init(e,t),R.init(e,t)}),xi=f("ZodCUID2",(e,t)=>{cs.init(e,t),R.init(e,t)}),Zi=f("ZodULID",(e,t)=>{us.init(e,t),R.init(e,t)}),Pi=f("ZodXID",(e,t)=>{ls.init(e,t),R.init(e,t)}),Li=f("ZodKSUID",(e,t)=>{ds.init(e,t),R.init(e,t)}),Ri=f("ZodIPv4",(e,t)=>{hs.init(e,t),R.init(e,t)}),$i=f("ZodIPv6",(e,t)=>{Is.init(e,t),R.init(e,t)}),Ui=f("ZodCIDRv4",(e,t)=>{ys.init(e,t),R.init(e,t)}),Yi=f("ZodCIDRv6",(e,t)=>{vs.init(e,t),R.init(e,t)}),Vi=f("ZodBase64",(e,t)=>{Ms.init(e,t),R.init(e,t)}),Qi=f("ZodBase64URL",(e,t)=>{Ns.init(e,t),R.init(e,t)}),Ji=f("ZodE164",(e,t)=>{bs.init(e,t),R.init(e,t)}),Bi=f("ZodJWT",(e,t)=>{zs.init(e,t),R.init(e,t)}),Yr=f("ZodNumber",(e,t)=>{Wt.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,s)=>hr(e,n,o),e.gt=(n,o)=>e.check(dr(n,o)),e.gte=(n,o)=>e.check(et(n,o)),e.min=(n,o)=>e.check(et(n,o)),e.lt=(n,o)=>e.check(lr(n,o)),e.lte=(n,o)=>e.check(Ke(n,o)),e.max=(n,o)=>e.check(Ke(n,o)),e.int=n=>e.check(Vr(n)),e.safe=n=>e.check(Vr(n)),e.positive=n=>e.check(dr(0,n)),e.nonnegative=n=>e.check(et(0,n)),e.negative=n=>e.check(lr(0,n)),e.nonpositive=n=>e.check(Ke(0,n)),e.multipleOf=(n,o)=>e.check(pr(n,o)),e.step=(n,o)=>e.check(pr(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 Fi(e){return Aa(Yr,e)}const Gi=f("ZodNumberFormat",(e,t)=>{ws.init(e,t),Yr.init(e,t)});function Vr(e){return za(Gi,e)}const Wi=f("ZodBoolean",(e,t)=>{Ds.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ir(e,r,n)});function U(e){return wa(Wi,e)}const Hi=f("ZodNull",(e,t)=>{js.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yr(e,r,n)});function Xi(e){return Da(Hi,e)}const qi=f("ZodUnknown",(e,t)=>{Es.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mr()});function X(){return ja(qi)}const Ki=f("ZodNever",(e,t)=>{Ts.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vr(e,r,n)});function Qr(e){return Ea(Ki,e)}const ec=f("ZodArray",(e,t)=>{Os.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zr(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(xe(r,n)),e.nonempty=r=>e.check(xe(1,r)),e.max=(r,n)=>e.check(fr(r,n)),e.length=(r,n)=>e.check(gr(r,n)),e.unwrap=()=>e.element});function he(e,t){return Ua(ec,e,t)}const Jr=f("ZodObject",(e,t)=>{ks.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wr(e,r,n,o),D(e,"shape",()=>t.shape),e.keyof=()=>Fr(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:X()}),e.loose=()=>e.clone({...e._zod.def,catchall:X()}),e.strict=()=>e.clone({...e._zod.def,catchall:Qr()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Xn(e,r),e.safeExtend=r=>qn(e,r),e.merge=r=>Kn(e,r),e.pick=r=>Wn(e,r),e.omit=r=>Hn(e,r),e.partial=(...r)=>eo(Gr,e,r[0]),e.required=(...r)=>to(Xr,e,r[0])});function C(e,t){const r={type:"object",shape:e??{},...M(t)};return new Jr(r)}function P(e,t){return new Jr({type:"object",shape:e,catchall:Qr(),...M(t)})}const Br=f("ZodUnion",(e,t)=>{er.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dr(e,r,n,o),e.options=t.options});function Y(e,t){return new Br({type:"union",options:e,...M(t)})}const tc=f("ZodDiscriminatedUnion",(e,t)=>{Br.init(e,t),Ss.init(e,t)});function rc(e,t,r){return new tc({type:"union",options:t,discriminator:e,...M(r)})}const nc=f("ZodIntersection",(e,t)=>{xs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jr(e,r,n,o)});function oc(e,t){return new nc({type:"intersection",left:e,right:t})}const sc=f("ZodRecord",(e,t)=>{Zs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Er(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function _e(e,t,r){return new sc({type:"record",keyType:e,valueType:t,...M(r)})}const rt=f("ZodEnum",(e,t)=>{Ps.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,s)=>_r(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 i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new rt({...t,checks:[],...M(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new rt({...t,checks:[],...M(o),entries:s})}});function Fr(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new rt({type:"enum",entries:r,...M(t)})}const ac=f("ZodLiteral",(e,t)=>{Ls.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(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 N(e,t){return new ac({type:"literal",values:Array.isArray(e)?e:[e],...M(t)})}const ic=f("ZodTransform",(e,t)=>{Rs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ar(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ot(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ve(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ve(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function cc(e){return new ic({type:"transform",transform:e})}const Gr=f("ZodOptional",(e,t)=>{nr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wr(e){return new Gr({type:"optional",innerType:e})}const uc=f("ZodExactOptional",(e,t)=>{$s.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new uc({type:"optional",innerType:e})}const dc=f("ZodNullable",(e,t)=>{Us.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hr(e){return new dc({type:"nullable",innerType:e})}const pc=f("ZodDefault",(e,t)=>{Ys.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new pc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Zt(t)}})}const gc=f("ZodPrefault",(e,t)=>{Vs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new gc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Zt(t)}})}const Xr=f("ZodNonOptional",(e,t)=>{Qs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Or(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hc(e,t){return new Xr({type:"nonoptional",innerType:e,...M(t)})}const Ic=f("ZodCatch",(e,t)=>{Js.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yc(e,t){return new Ic({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vc=f("ZodPipe",(e,t)=>{Bs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xr(e,r,n,o),e.in=t.in,e.out=t.out});function qr(e,t){return new vc({type:"pipe",in:e,out:t})}const Mc=f("ZodReadonly",(e,t)=>{Fs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _c(e){return new Mc({type:"readonly",innerType:e})}const Nc=f("ZodLazy",(e,t)=>{Gs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pr(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function bc(e){return new Nc({type:"lazy",getter:e})}const nt=f("ZodCustom",(e,t)=>{Ws.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>br(e,r)});function Kr(e,t){return Ya(nt,e??(()=>!0),t)}function Ac(e,t={}){return Va(nt,e,t)}function zc(e){return Qa(e)}function Ue(e,t={}){const r=new nt({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...M(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Ne;(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 i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},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 i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},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(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Ne||(Ne={}));var en;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(en||(en={})),Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ne.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 Ye 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 i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(i))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof Ye))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.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()}}Ye.create=e=>new Ye(e);var tn;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(tn||(tn={}));var A;(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"})(A||(A={}));class rn 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 ot(e){}function wc(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=ot,onError:r=ot,onRetry:n=ot,onComment:o}=e;let s="",i=!0,a,u="",c="";function l(m){const v=i?m.replace(/^\xEF\xBB\xBF/,""):m,[b,z]=Dc(`${s}${v}`);for(const p of b)d(p);s=z,i=!1}function d(m){if(m===""){h();return}if(m.startsWith(":")){o&&o(m.slice(m.startsWith(": ")?2:1));return}const v=m.indexOf(":");if(v!==-1){const b=m.slice(0,v),z=m[v+1]===" "?2:1,p=m.slice(v+z);y(b,p,m);return}y(m,"",m)}function y(m,v,b){switch(m){case"event":c=v;break;case"data":u=`${u}${v}
42
- `;break;case"id":a=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?n(parseInt(v,10)):r(new rn(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:b}));break;default:r(new rn(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:v,line:b}));break}}function h(){u.length>0&&t({id:a,event:c||void 0,data:u.endsWith(`
43
- `)?u.slice(0,-1):u}),a=void 0,u="",c=""}function _(m={}){s&&m.consume&&d(s),i=!0,a=void 0,u="",c="",s=""}return{feed:l,reset:_}}function Dc(e){const t=[];let r="",n=0;for(;n<e.length;){const o=e.indexOf("\r",n),s=e.indexOf(`
41
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const d=l[1];if(t===l[0]){s(l);continue}if(e.external){const m=(u=e.external.registry.get(l[0]))==null?void 0:u.id;if(t!==l[0]&&m){s(l);continue}}if((c=e.metadataRegistry.get(l[0]))==null?void 0:c.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&e.reused==="ref"){s(l);continue}}}function Le(e,t){var i,a,u;const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=c=>{const l=e.seen.get(c);if(l.ref===null)return;const d=l.def??l.schema,v={...d},m=l.ref;if(l.ref=null,m){n(m);const I=e.seen.get(m),h=I.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(h)):Object.assign(d,h),Object.assign(d,v),c._zod.parent===m)for(const b in d)b==="$ref"||b==="allOf"||b in v||delete d[b];if(h.$ref)for(const b in d)b==="$ref"||b==="allOf"||b in I.def&&JSON.stringify(d[b])===JSON.stringify(I.def[b])&&delete d[b]}const _=c._zod.parent;if(_&&_!==m){n(_);const I=e.seen.get(_);if(I!=null&&I.schema.$ref&&(d.$ref=I.schema.$ref,I.def))for(const h in d)h==="$ref"||h==="allOf"||h in I.def&&JSON.stringify(d[h])===JSON.stringify(I.def[h])&&delete d[h]}e.override({zodSchema:c,jsonSchema:d,path:l.path??[]})};for(const c of[...e.seen.entries()].reverse())n(c[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,(i=e.external)!=null&&i.uri){const c=(a=e.external.registry.get(t))==null?void 0:a.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,r.def??r.schema);const s=((u=e.external)==null?void 0:u.defs)??{};for(const c of e.seen.entries()){const l=c[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Re(t,"input",e.processors),output:Re(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function $(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 $(n.element,r);if(n.type==="set")return $(n.valueType,r);if(n.type==="lazy")return $(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 $(n.innerType,r);if(n.type==="intersection")return $(n.left,r)||$(n.right,r);if(n.type==="record"||n.type==="map")return $(n.keyType,r)||$(n.valueType,r);if(n.type==="pipe")return $(n.in,r)||$(n.out,r);if(n.type==="object"){for(const o in n.shape)if($(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if($(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if($(o,r))return!0;return!!(n.rest&&$(n.rest,r))}return!1}const Ba=(e,t={})=>r=>{const n=Ze({...r,processors:t});return S(e,n),Pe(n,e),Le(n,e)},Re=(e,t,r={})=>n=>{const{libraryOptions:o,target:s}=n??{},i=Ze({...o??{},target:s,io:t,processors:r});return S(e,i),Pe(i,e),Le(i,e)},Fa={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mr=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Fa[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),c&&(o.contentEncoding=c),u&&u.size>0){const l=[...u];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},hr=(e,t,r,n)=>{const o=r,{minimum:s,maximum:i,format:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof s=="number"&&(o.minimum=s,typeof l=="number"&&t.target!=="draft-04"&&(l>=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 i=="number"&&(o.maximum=i,typeof c=="number"&&t.target!=="draft-04"&&(c<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},Ir=(e,t,r,n)=>{r.type="boolean"},Ga=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Wa=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},yr=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Ha=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Xa=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},vr=(e,t,r,n)=>{r.not={}},qa=(e,t,r,n)=>{},Mr=(e,t,r,n)=>{},Ka=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},_r=(e,t,r,n)=>{const o=e._zod.def,s=Ct(o.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Nr=(e,t,r,n)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},ei=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},ti=(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},ri=(e,t,r,n)=>{const o=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:u}=e._zod.bag;i!==void 0&&(s.minLength=i),a!==void 0&&(s.maxLength=a),u?u.length===1?(s.contentMediaType=u[0],Object.assign(o,s)):(Object.assign(o,s),o.anyOf=u.map(c=>({contentMediaType:c}))):Object.assign(o,s)},ni=(e,t,r,n)=>{r.type="boolean"},br=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},oi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Ar=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},si=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},ai=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},zr=(e,t,r,n)=>{const o=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=S(s.element,t,{...n,path:[...n.path,"items"]})},wr=(e,t,r,n)=>{var c;const o=r,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const l in i)o.properties[l]=S(i[l],t,{...n,path:[...n.path,"properties",l]});const a=new Set(Object.keys(i)),u=new Set([...a].filter(l=>{const d=s.shape[l]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((c=s.catchall)==null?void 0:c._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=S(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Dr=(e,t,r,n)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,u)=>S(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",u]}));s?r.oneOf=i:r.anyOf=i},jr=(e,t,r,n)=>{const o=e._zod.def,s=S(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=S(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=u},ii=(e,t,r,n)=>{const o=r,s=e._zod.def;o.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=s.items.map((v,m)=>S(v,t,{...n,path:[...n.path,i,m]})),c=s.rest?S(s.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=u,c&&(o.items=c)):t.target==="openapi-3.0"?(o.items={anyOf:u},c&&o.items.anyOf.push(c),o.minItems=u.length,c||(o.maxItems=u.length)):(o.items=u,c&&(o.additionalItems=c));const{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Er=(e,t,r,n)=>{const o=r,s=e._zod.def;o.type="object";const i=s.keyType,a=i._zod.bag,u=a==null?void 0:a.patterns;if(s.mode==="loose"&&u&&u.size>0){const l=S(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(const d of u)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=S(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=S(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const c=i._zod.values;if(c){const l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Tr=(e,t,r,n)=>{const o=e._zod.def,s=S(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Or=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},Cr=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},kr=(e,t,r,n)=>{const o=e._zod.def;S(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)))},Sr=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},xr=(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;S(s,t,n);const i=t.seen.get(e);i.ref=s},Zr=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},ci=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},tt=(e,t,r,n)=>{const o=e._zod.def;S(o.innerType,t,n);const s=t.seen.get(e);s.ref=o.innerType},Pr=(e,t,r,n)=>{const o=e._zod.innerType;S(o,t,n);const s=t.seen.get(e);s.ref=o},Lr={string:mr,number:hr,boolean:Ir,bigint:Ga,symbol:Wa,null:yr,undefined:Ha,void:Xa,never:vr,any:qa,unknown:Mr,date:Ka,enum:_r,literal:Nr,nan:ei,template_literal:ti,file:ri,success:ni,custom:br,function:oi,transform:Ar,map:si,set:ai,array:zr,object:wr,union:Dr,intersection:jr,tuple:ii,record:Er,nullable:Tr,nonoptional:Or,default:Cr,prefault:kr,catch:Sr,pipe:xr,readonly:Zr,promise:ci,optional:tt,lazy:Pr};function ui(e,t){if("_idmap"in e){const n=e,o=Ze({...t,processors:Lr}),s={};for(const u of n._idmap.entries()){const[c,l]=u;S(l,o)}const i={},a={registry:n,uri:t==null?void 0:t.uri,defs:s};o.external=a;for(const u of n._idmap.entries()){const[c,l]=u;Pe(o,l),i[c]=Le(o,l)}if(Object.keys(s).length>0){const u=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[u]:s}}return{schemas:i}}const r=Ze({...t,processors:Lr});return S(e,r),Pe(r,e),Le(r,e)}const li=p("ZodISODateTime",(e,t)=>{ps.init(e,t),R.init(e,t)});function di(e){return Ma(li,e)}const pi=p("ZodISODate",(e,t)=>{fs.init(e,t),R.init(e,t)});function fi(e){return _a(pi,e)}const gi=p("ZodISOTime",(e,t)=>{gs.init(e,t),R.init(e,t)});function mi(e){return Na(gi,e)}const hi=p("ZodISODuration",(e,t)=>{ms.init(e,t),R.init(e,t)});function Ii(e){return ba(hi,e)}const F=p("ZodError",(e,t)=>{Lt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>no(e,r)},flatten:{value:r=>ro(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Je,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Je,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),yi=We(F),vi=He(F),Mi=Te(F),Rr=Oe(F),_i=ao(F),Ni=io(F),bi=co(F),Ai=uo(F),zi=lo(F),wi=po(F),Di=fo(F),ji=go(F),Z=p("ZodType",(e,t)=>(x.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Re(e,"input"),output:Re(e,"output")}}),e.toJSONSchema=Ba(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(K(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>ee(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>yi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Mi(e,r,n),e.parseAsync=async(r,n)=>vi(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Rr(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>_i(e,r,n),e.decode=(r,n)=>Ni(e,r,n),e.encodeAsync=async(r,n)=>bi(e,r,n),e.decodeAsync=async(r,n)=>Ai(e,r,n),e.safeEncode=(r,n)=>zi(e,r,n),e.safeDecode=(r,n)=>wi(e,r,n),e.safeEncodeAsync=async(r,n)=>Di(e,r,n),e.safeDecodeAsync=async(r,n)=>ji(e,r,n),e.refine=(r,n)=>e.check(Ac(r,n)),e.superRefine=r=>e.check(zc(r)),e.overwrite=r=>e.check(me(r)),e.optional=()=>Wr(e),e.exactOptional=()=>lc(e),e.nullable=()=>Hr(e),e.nullish=()=>Wr(Hr(e)),e.nonoptional=r=>hc(e,r),e.array=()=>he(e),e.or=r=>Y([e,r]),e.and=r=>oc(e,r),e.transform=r=>qr(e,cc(r)),e.default=r=>fc(e,r),e.prefault=r=>mc(e,r),e.catch=r=>yc(e,r),e.pipe=r=>qr(e,r),e.readonly=()=>_c(e),e.describe=r=>{const n=e.clone();return Me.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=Me.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Me.get(e);const n=e.clone();return Me.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),$r=p("_ZodString",(e,t)=>{Xe.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,s)=>mr(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(Ta(...n)),e.includes=(...n)=>e.check(ka(...n)),e.startsWith=(...n)=>e.check(Sa(...n)),e.endsWith=(...n)=>e.check(xa(...n)),e.min=(...n)=>e.check(xe(...n)),e.max=(...n)=>e.check(fr(...n)),e.length=(...n)=>e.check(gr(...n)),e.nonempty=(...n)=>e.check(xe(1,...n)),e.lowercase=n=>e.check(Oa(n)),e.uppercase=n=>e.check(Ca(n)),e.trim=()=>e.check(Pa()),e.normalize=(...n)=>e.check(Za(...n)),e.toLowerCase=()=>e.check(La()),e.toUpperCase=()=>e.check(Ra()),e.slugify=()=>e.check($a())}),Ei=p("ZodString",(e,t)=>{Xe.init(e,t),$r.init(e,t),e.email=r=>e.check(Ks(Ti,r)),e.url=r=>e.check(oa(Oi,r)),e.jwt=r=>e.check(va(Bi,r)),e.emoji=r=>e.check(sa(Ci,r)),e.guid=r=>e.check(ur(Ur,r)),e.uuid=r=>e.check(ea($e,r)),e.uuidv4=r=>e.check(ta($e,r)),e.uuidv6=r=>e.check(ra($e,r)),e.uuidv7=r=>e.check(na($e,r)),e.nanoid=r=>e.check(aa(ki,r)),e.guid=r=>e.check(ur(Ur,r)),e.cuid=r=>e.check(ia(Si,r)),e.cuid2=r=>e.check(ca(xi,r)),e.ulid=r=>e.check(ua(Zi,r)),e.base64=r=>e.check(ha(Vi,r)),e.base64url=r=>e.check(Ia(Qi,r)),e.xid=r=>e.check(la(Pi,r)),e.ksuid=r=>e.check(da(Li,r)),e.ipv4=r=>e.check(pa(Ri,r)),e.ipv6=r=>e.check(fa($i,r)),e.cidrv4=r=>e.check(ga(Ui,r)),e.cidrv6=r=>e.check(ma(Yi,r)),e.e164=r=>e.check(ya(Ji,r)),e.datetime=r=>e.check(di(r)),e.date=r=>e.check(fi(r)),e.time=r=>e.check(mi(r)),e.duration=r=>e.check(Ii(r))});function y(e){return qs(Ei,e)}const R=p("ZodStringFormat",(e,t)=>{L.init(e,t),$r.init(e,t)}),Ti=p("ZodEmail",(e,t)=>{ns.init(e,t),R.init(e,t)}),Ur=p("ZodGUID",(e,t)=>{ts.init(e,t),R.init(e,t)}),$e=p("ZodUUID",(e,t)=>{rs.init(e,t),R.init(e,t)}),Oi=p("ZodURL",(e,t)=>{os.init(e,t),R.init(e,t)}),Ci=p("ZodEmoji",(e,t)=>{ss.init(e,t),R.init(e,t)}),ki=p("ZodNanoID",(e,t)=>{as.init(e,t),R.init(e,t)}),Si=p("ZodCUID",(e,t)=>{is.init(e,t),R.init(e,t)}),xi=p("ZodCUID2",(e,t)=>{cs.init(e,t),R.init(e,t)}),Zi=p("ZodULID",(e,t)=>{us.init(e,t),R.init(e,t)}),Pi=p("ZodXID",(e,t)=>{ls.init(e,t),R.init(e,t)}),Li=p("ZodKSUID",(e,t)=>{ds.init(e,t),R.init(e,t)}),Ri=p("ZodIPv4",(e,t)=>{hs.init(e,t),R.init(e,t)}),$i=p("ZodIPv6",(e,t)=>{Is.init(e,t),R.init(e,t)}),Ui=p("ZodCIDRv4",(e,t)=>{ys.init(e,t),R.init(e,t)}),Yi=p("ZodCIDRv6",(e,t)=>{vs.init(e,t),R.init(e,t)}),Vi=p("ZodBase64",(e,t)=>{Ms.init(e,t),R.init(e,t)}),Qi=p("ZodBase64URL",(e,t)=>{Ns.init(e,t),R.init(e,t)}),Ji=p("ZodE164",(e,t)=>{bs.init(e,t),R.init(e,t)}),Bi=p("ZodJWT",(e,t)=>{zs.init(e,t),R.init(e,t)}),Yr=p("ZodNumber",(e,t)=>{Wt.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,s)=>hr(e,n,o),e.gt=(n,o)=>e.check(dr(n,o)),e.gte=(n,o)=>e.check(et(n,o)),e.min=(n,o)=>e.check(et(n,o)),e.lt=(n,o)=>e.check(lr(n,o)),e.lte=(n,o)=>e.check(Ke(n,o)),e.max=(n,o)=>e.check(Ke(n,o)),e.int=n=>e.check(Vr(n)),e.safe=n=>e.check(Vr(n)),e.positive=n=>e.check(dr(0,n)),e.nonnegative=n=>e.check(et(0,n)),e.negative=n=>e.check(lr(0,n)),e.nonpositive=n=>e.check(Ke(0,n)),e.multipleOf=(n,o)=>e.check(pr(n,o)),e.step=(n,o)=>e.check(pr(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 Fi(e){return Aa(Yr,e)}const Gi=p("ZodNumberFormat",(e,t)=>{ws.init(e,t),Yr.init(e,t)});function Vr(e){return za(Gi,e)}const Wi=p("ZodBoolean",(e,t)=>{Ds.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ir(e,r,n)});function U(e){return wa(Wi,e)}const Hi=p("ZodNull",(e,t)=>{js.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yr(e,r,n)});function Xi(e){return Da(Hi,e)}const qi=p("ZodUnknown",(e,t)=>{Es.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mr()});function X(){return ja(qi)}const Ki=p("ZodNever",(e,t)=>{Ts.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vr(e,r,n)});function Qr(e){return Ea(Ki,e)}const ec=p("ZodArray",(e,t)=>{Os.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zr(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(xe(r,n)),e.nonempty=r=>e.check(xe(1,r)),e.max=(r,n)=>e.check(fr(r,n)),e.length=(r,n)=>e.check(gr(r,n)),e.unwrap=()=>e.element});function he(e,t){return Ua(ec,e,t)}const Jr=p("ZodObject",(e,t)=>{ks.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wr(e,r,n,o),E(e,"shape",()=>t.shape),e.keyof=()=>Fr(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:X()}),e.loose=()=>e.clone({...e._zod.def,catchall:X()}),e.strict=()=>e.clone({...e._zod.def,catchall:Qr()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Xn(e,r),e.safeExtend=r=>qn(e,r),e.merge=r=>Kn(e,r),e.pick=r=>Wn(e,r),e.omit=r=>Hn(e,r),e.partial=(...r)=>eo(Gr,e,r[0]),e.required=(...r)=>to(Xr,e,r[0])});function C(e,t){const r={type:"object",shape:e??{},...M(t)};return new Jr(r)}function P(e,t){return new Jr({type:"object",shape:e,catchall:Qr(),...M(t)})}const Br=p("ZodUnion",(e,t)=>{er.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dr(e,r,n,o),e.options=t.options});function Y(e,t){return new Br({type:"union",options:e,...M(t)})}const tc=p("ZodDiscriminatedUnion",(e,t)=>{Br.init(e,t),Ss.init(e,t)});function rc(e,t,r){return new tc({type:"union",options:t,discriminator:e,...M(r)})}const nc=p("ZodIntersection",(e,t)=>{xs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jr(e,r,n,o)});function oc(e,t){return new nc({type:"intersection",left:e,right:t})}const sc=p("ZodRecord",(e,t)=>{Zs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Er(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function _e(e,t,r){return new sc({type:"record",keyType:e,valueType:t,...M(r)})}const rt=p("ZodEnum",(e,t)=>{Ps.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,s)=>_r(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 i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new rt({...t,checks:[],...M(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new rt({...t,checks:[],...M(o),entries:s})}});function Fr(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new rt({type:"enum",entries:r,...M(t)})}const ac=p("ZodLiteral",(e,t)=>{Ls.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(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 N(e,t){return new ac({type:"literal",values:Array.isArray(e)?e:[e],...M(t)})}const ic=p("ZodTransform",(e,t)=>{Rs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ar(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ot(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ve(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ve(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function cc(e){return new ic({type:"transform",transform:e})}const Gr=p("ZodOptional",(e,t)=>{nr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wr(e){return new Gr({type:"optional",innerType:e})}const uc=p("ZodExactOptional",(e,t)=>{$s.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new uc({type:"optional",innerType:e})}const dc=p("ZodNullable",(e,t)=>{Us.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hr(e){return new dc({type:"nullable",innerType:e})}const pc=p("ZodDefault",(e,t)=>{Ys.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new pc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Zt(t)}})}const gc=p("ZodPrefault",(e,t)=>{Vs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new gc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Zt(t)}})}const Xr=p("ZodNonOptional",(e,t)=>{Qs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Or(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hc(e,t){return new Xr({type:"nonoptional",innerType:e,...M(t)})}const Ic=p("ZodCatch",(e,t)=>{Js.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yc(e,t){return new Ic({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vc=p("ZodPipe",(e,t)=>{Bs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xr(e,r,n,o),e.in=t.in,e.out=t.out});function qr(e,t){return new vc({type:"pipe",in:e,out:t})}const Mc=p("ZodReadonly",(e,t)=>{Fs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _c(e){return new Mc({type:"readonly",innerType:e})}const Nc=p("ZodLazy",(e,t)=>{Gs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pr(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function bc(e){return new Nc({type:"lazy",getter:e})}const nt=p("ZodCustom",(e,t)=>{Ws.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>br(e,r)});function Kr(e,t){return Ya(nt,e??(()=>!0),t)}function Ac(e,t={}){return Va(nt,e,t)}function zc(e){return Qa(e)}function Ue(e,t={}){const r=new nt({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...M(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Ne;(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 i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},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 i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},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(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Ne||(Ne={}));var en;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(en||(en={})),Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ne.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 Ye 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 i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(i))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof Ye))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.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()}}Ye.create=e=>new Ye(e);var tn;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(tn||(tn={}));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 rn 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 ot(e){}function wc(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=ot,onError:r=ot,onRetry:n=ot,onComment:o}=e;let s="",i=!0,a,u="",c="";function l(I){const h=i?I.replace(/^\xEF\xBB\xBF/,""):I,[A,b]=Dc(`${s}${h}`);for(const f of A)d(f);s=b,i=!1}function d(I){if(I===""){m();return}if(I.startsWith(":")){o&&o(I.slice(I.startsWith(": ")?2:1));return}const h=I.indexOf(":");if(h!==-1){const A=I.slice(0,h),b=I[h+1]===" "?2:1,f=I.slice(h+b);v(A,f,I);return}v(I,"",I)}function v(I,h,A){switch(I){case"event":c=h;break;case"data":u=`${u}${h}
42
+ `;break;case"id":a=h.includes("\0")?void 0:h;break;case"retry":/^\d+$/.test(h)?n(parseInt(h,10)):r(new rn(`Invalid \`retry\` value: "${h}"`,{type:"invalid-retry",value:h,line:A}));break;default:r(new rn(`Unknown field "${I.length>20?`${I.slice(0,20)}…`:I}"`,{type:"unknown-field",field:I,value:h,line:A}));break}}function m(){u.length>0&&t({id:a,event:c||void 0,data:u.endsWith(`
43
+ `)?u.slice(0,-1):u}),a=void 0,u="",c=""}function _(I={}){s&&I.consume&&d(s),i=!0,a=void 0,u="",c="",s=""}return{feed:l,reset:_}}function Dc(e){const t=[];let r="",n=0;for(;n<e.length;){const o=e.indexOf("\r",n),s=e.indexOf(`
44
44
  `,n);let i=-1;if(o!==-1&&s!==-1?i=Math.min(o,s):o!==-1?o===e.length-1?i=-1:i=o:s!==-1&&(i=s),i===-1){r=e.slice(n);break}else{const a=e.slice(n,i);t.push(a),n=i+1,e[n-1]==="\r"&&e[n]===`
45
- `&&n++}}return[t,r]}class jc extends TransformStream{constructor({onError:t,onRetry:r,onComment:n}={}){let o;super({start(s){o=wc({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}var be=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const o=()=>{const s=r.length,i=new Array(t);for(let a=0;a<t;a++)i[a]=r[Math.random()*s|0];return i.join("")};if(e==null)return o;if(r.includes(n))throw new $n({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${o()}`},Ec=be();function nn(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 ae(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 on(e,...t){const r=new Headers(ae(e)),n=r.get("user-agent")||"";return r.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var Tc=/"__proto__"\s*:/,Oc=/"constructor"\s*:/;function sn(e){const t=JSON.parse(e);return t===null||typeof t!="object"||Tc.test(e)===!1&&Oc.test(e)===!1?t:Cc(t)}function Cc(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 kc(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return sn(e)}try{return sn(e)}finally{Error.stackTraceLimit=t}}function st(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:r}=e;if(r!=null)for(const n of Object.keys(r))r[n]=ie(r[n])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(ie):ie(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(ie)),e.allOf!=null&&(e.allOf=e.allOf.map(ie)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(ie));const{definitions:t}=e;if(t!=null)for(const r of Object.keys(t))t[r]=ie(t[r]);return e}function ie(e){return typeof e=="boolean"?e:st(e)}var Sc=Symbol("Let zodToJsonSchema decide on which parser to use"),an={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"},xc=e=>typeof e=="string"?{...an,name:e}:{...an,...e};function B(){return{}}function Zc(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)!==A.ZodAny&&(s.items=O(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 Pc(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 Lc(){return{type:"boolean"}}function cn(e,t){return O(e.type._def,t)}var Rc=(e,t)=>O(e.innerType._def,t);function un(e,t,r){const n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>un(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 $c(e)}}var $c=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 Uc(e,t){return{...O(e.innerType._def,t),default:e.defaultValue()}}function Yc(e,t){return t.effectStrategy==="input"?O(e.schema._def,t):B()}function Vc(e){return{type:"string",enum:Array.from(e.values)}}var Qc=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Jc(e,t){const r=[O(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),O(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),n=[];return r.forEach(o=>{if(Qc(o))n.push(...o.allOf);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:i,...a}=o;s=a}n.push(s)}}),n.length?{allOf:n}:void 0}function Bc(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 at=void 0,G={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:()=>(at===void 0&&(at=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),at),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 ln(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":W(r,"email",n.message,t);break;case"format:idn-email":W(r,"idn-email",n.message,t);break;case"pattern:zod":V(r,G.email,n.message,t);break}break;case"url":W(r,"uri",n.message,t);break;case"uuid":W(r,"uuid",n.message,t);break;case"regex":V(r,n.regex,n.message,t);break;case"cuid":V(r,G.cuid,n.message,t);break;case"cuid2":V(r,G.cuid2,n.message,t);break;case"startsWith":V(r,RegExp(`^${it(n.value,t)}`),n.message,t);break;case"endsWith":V(r,RegExp(`${it(n.value,t)}$`),n.message,t);break;case"datetime":W(r,"date-time",n.message,t);break;case"date":W(r,"date",n.message,t);break;case"time":W(r,"time",n.message,t);break;case"duration":W(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":{V(r,RegExp(it(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&W(r,"ipv4",n.message,t),n.version!=="v4"&&W(r,"ipv6",n.message,t);break}case"base64url":V(r,G.base64url,n.message,t);break;case"jwt":V(r,G.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&V(r,G.ipv4Cidr,n.message,t),n.version!=="v4"&&V(r,G.ipv6Cidr,n.message,t);break}case"emoji":V(r,G.emoji(),n.message,t);break;case"ulid":{V(r,G.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{W(r,"binary",n.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{V(r,G.base64,n.message,t);break}}break}case"nanoid":V(r,G.nanoid,n.message,t)}return r}function it(e,t){return t.patternStrategy==="escape"?Gc(e):e}var Fc=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Gc(e){let t="";for(let r=0;r<e.length;r++)Fc.has(e[r])||(t+="\\"),t+=e[r];return t}function W(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 V(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:dn(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=dn(t,n)}function dn(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="",i=!1,a=!1,u=!1;for(let c=0;c<o.length;c++){if(i){s+=o[c],i=!1;continue}if(n.i){if(a){if(o[c].match(/[a-z]/)){u?(s+=o[c],s+=`${o[c-2]}-${o[c]}`.toUpperCase(),u=!1):o[c+1]==="-"&&((r=o[c+2])!=null&&r.match(/[a-z]/))?(s+=o[c],u=!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
45
+ `&&n++}}return[t,r]}class jc extends TransformStream{constructor({onError:t,onRetry:r,onComment:n}={}){let o;super({start(s){o=wc({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}var be=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const o=()=>{const s=r.length,i=new Array(t);for(let a=0;a<t;a++)i[a]=r[Math.random()*s|0];return i.join("")};if(e==null)return o;if(r.includes(n))throw new $n({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${o()}`},Ec=be();function nn(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 ae(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 on(e,...t){const r=new Headers(ae(e)),n=r.get("user-agent")||"";return r.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var Tc=/"__proto__"\s*:/,Oc=/"constructor"\s*:/;function sn(e){const t=JSON.parse(e);return t===null||typeof t!="object"||Tc.test(e)===!1&&Oc.test(e)===!1?t:Cc(t)}function Cc(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 kc(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return sn(e)}try{return sn(e)}finally{Error.stackTraceLimit=t}}function st(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:r}=e;if(r!=null)for(const n of Object.keys(r))r[n]=ie(r[n])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(ie):ie(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(ie)),e.allOf!=null&&(e.allOf=e.allOf.map(ie)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(ie));const{definitions:t}=e;if(t!=null)for(const r of Object.keys(t))t[r]=ie(t[r]);return e}function ie(e){return typeof e=="boolean"?e:st(e)}var Sc=Symbol("Let zodToJsonSchema decide on which parser to use"),an={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"},xc=e=>typeof e=="string"?{...an,name:e}:{...an,...e};function B(){return{}}function Zc(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=O(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 Pc(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 Lc(){return{type:"boolean"}}function cn(e,t){return O(e.type._def,t)}var Rc=(e,t)=>O(e.innerType._def,t);function un(e,t,r){const n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>un(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 $c(e)}}var $c=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 Uc(e,t){return{...O(e.innerType._def,t),default:e.defaultValue()}}function Yc(e,t){return t.effectStrategy==="input"?O(e.schema._def,t):B()}function Vc(e){return{type:"string",enum:Array.from(e.values)}}var Qc=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Jc(e,t){const r=[O(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),O(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),n=[];return r.forEach(o=>{if(Qc(o))n.push(...o.allOf);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:i,...a}=o;s=a}n.push(s)}}),n.length?{allOf:n}:void 0}function Bc(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 at=void 0,G={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:()=>(at===void 0&&(at=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),at),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 ln(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":W(r,"email",n.message,t);break;case"format:idn-email":W(r,"idn-email",n.message,t);break;case"pattern:zod":V(r,G.email,n.message,t);break}break;case"url":W(r,"uri",n.message,t);break;case"uuid":W(r,"uuid",n.message,t);break;case"regex":V(r,n.regex,n.message,t);break;case"cuid":V(r,G.cuid,n.message,t);break;case"cuid2":V(r,G.cuid2,n.message,t);break;case"startsWith":V(r,RegExp(`^${it(n.value,t)}`),n.message,t);break;case"endsWith":V(r,RegExp(`${it(n.value,t)}$`),n.message,t);break;case"datetime":W(r,"date-time",n.message,t);break;case"date":W(r,"date",n.message,t);break;case"time":W(r,"time",n.message,t);break;case"duration":W(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":{V(r,RegExp(it(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&W(r,"ipv4",n.message,t),n.version!=="v4"&&W(r,"ipv6",n.message,t);break}case"base64url":V(r,G.base64url,n.message,t);break;case"jwt":V(r,G.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&V(r,G.ipv4Cidr,n.message,t),n.version!=="v4"&&V(r,G.ipv6Cidr,n.message,t);break}case"emoji":V(r,G.emoji(),n.message,t);break;case"ulid":{V(r,G.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{W(r,"binary",n.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{V(r,G.base64,n.message,t);break}}break}case"nanoid":V(r,G.nanoid,n.message,t)}return r}function it(e,t){return t.patternStrategy==="escape"?Gc(e):e}var Fc=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Gc(e){let t="";for(let r=0;r<e.length;r++)Fc.has(e[r])||(t+="\\"),t+=e[r];return t}function W(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 V(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:dn(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=dn(t,n)}function dn(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="",i=!1,a=!1,u=!1;for(let c=0;c<o.length;c++){if(i){s+=o[c],i=!1;continue}if(n.i){if(a){if(o[c].match(/[a-z]/)){u?(s+=o[c],s+=`${o[c-2]}-${o[c]}`.toUpperCase(),u=!1):o[c+1]==="-"&&((r=o[c+2])!=null&&r.match(/[a-z]/))?(s+=o[c],u=!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
46
46
  ]))`;continue}else if(o[c]==="$"){s+=`($|(?=[\r
47
47
  ]))`;continue}}if(n.s&&o[c]==="."){s+=a?`${o[c]}\r
48
48
  `:`[${o[c]}\r
49
- ]`;continue}s+=o[c],o[c]==="\\"?i=!0:a&&o[c]==="]"?a=!1:!a&&o[c]==="["&&(a=!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 pn(e,t){var r,n,o,s,i,a;const u={type:"object",additionalProperties:(r=O(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===A.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:c,...l}=ln(e.keyType._def,t);return{...u,propertyNames:l}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===A.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===A.ZodBranded&&e.keyType._def.type._def.typeName===A.ZodString&&((a=e.keyType._def.type._def.checks)!=null&&a.length)){const{type:c,...l}=cn(e.keyType._def,t);return{...u,propertyNames:l}}}return u}function Wc(e,t){if(t.mapStrategy==="record")return pn(e,t);const r=O(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||B(),n=O(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||B();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Hc(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 Xc(){return{not:B()}}function qc(){return{type:"null"}}var ct={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Kc(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in ct&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((o,s)=>{const i=ct[s._def.typeName];return i&&!o.includes(i)?[...o,i]: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 i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){const o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._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 eu(e,t)}var eu=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>O(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 tu(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[ct[e.innerType._def.typeName],"null"]};const r=O(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function ru(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 nu(e,t){const r={type:"object",properties:{}},n=[],o=e.shape();for(const i in o){let a=o[i];if(a===void 0||a._def===void 0)continue;const u=su(a),c=O(a._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});c!==void 0&&(r.properties[i]=c,u||n.push(i))}n.length&&(r.required=n);const s=ou(e,t);return s!==void 0&&(r.additionalProperties=s),r}function ou(e,t){if(e.catchall._def.typeName!=="ZodNever")return O(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 su(e){try{return e.isOptional()}catch{return!0}}var au=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return O(e.innerType._def,t);const n=O(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:B()},n]}:B()},iu=(e,t)=>{if(t.pipeStrategy==="input")return O(e.in._def,t);if(t.pipeStrategy==="output")return O(e.out._def,t);const r=O(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=O(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function cu(e,t){return O(e.type._def,t)}function uu(e,t){const n={type:"array",uniqueItems:!0,items:O(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 lu(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>O(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:O(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>O(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function du(){return{not:B()}}function pu(){return B()}var fu=(e,t)=>O(e.innerType._def,t),gu=(e,t,r)=>{switch(t){case A.ZodString:return ln(e,r);case A.ZodNumber:return ru(e);case A.ZodObject:return nu(e,r);case A.ZodBigInt:return Pc(e);case A.ZodBoolean:return Lc();case A.ZodDate:return un(e,r);case A.ZodUndefined:return du();case A.ZodNull:return qc();case A.ZodArray:return Zc(e,r);case A.ZodUnion:case A.ZodDiscriminatedUnion:return Kc(e,r);case A.ZodIntersection:return Jc(e,r);case A.ZodTuple:return lu(e,r);case A.ZodRecord:return pn(e,r);case A.ZodLiteral:return Bc(e);case A.ZodEnum:return Vc(e);case A.ZodNativeEnum:return Hc(e);case A.ZodNullable:return tu(e,r);case A.ZodOptional:return au(e,r);case A.ZodMap:return Wc(e,r);case A.ZodSet:return uu(e,r);case A.ZodLazy:return()=>e.getter()._def;case A.ZodPromise:return cu(e,r);case A.ZodNaN:case A.ZodNever:return Xc();case A.ZodEffects:return Yc(e,r);case A.ZodAny:return B();case A.ZodUnknown:return pu();case A.ZodDefault:return Uc(e,r);case A.ZodBranded:return cn(e,r);case A.ZodReadonly:return fu(e,r);case A.ZodCatch:return Rc(e,r);case A.ZodPipeline:return iu(e,r);case A.ZodFunction:case A.ZodVoid:case A.ZodSymbol:return;default:return(n=>{})()}},mu=(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 O(e,t,r=!1){var n;const o=t.seen.get(e);if(t.override){const u=(n=t.override)==null?void 0:n.call(t,e,t,o,r);if(u!==Sc)return u}if(o&&!r){const u=hu(o,t);if(u!==void 0)return u}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=gu(e,e.typeName,t),a=typeof i=="function"?O(i(),t):i;if(a&&Iu(e,t,a),t.postProcess){const u=t.postProcess(a,e,t);return s.jsonSchema=a,u}return s.jsonSchema=a,a}var hu=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:mu(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`),B()):t.$refStrategy==="seen"?B():void 0}},Iu=(e,t,r)=>(e.description&&(r.description=e.description),r),yu=e=>{const t=xc(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}]))}},vu=(e,t)=>{var r;const n=yu(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[l,d])=>{var y;return{...c,[l]:(y=O(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,l]},!0))!=null?y:B()}},{}):void 0;const s=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,i=(r=O(e._def,s===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1))!=null?r:B(),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(i.title=a);const u=s===void 0?o?{...i,[n.definitionPath]:o}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...o,[s]:i}};return u.$schema="http://json-schema.org/draft-07/schema#",u},ut=Symbol.for("vercel.ai.schema");function Mu(e){let t;return()=>(t==null&&(t=e()),t)}function Ve(e,{validate:t}={}){return{[ut]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function _u(e){return typeof e=="object"&&e!==null&&ut in e&&e[ut]===!0&&"jsonSchema"in e&&"validate"in e}function lt(e){return e==null?Ve({properties:{},additionalProperties:!1}):_u(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?fn(e):Nu(e):e()}function Nu(e){return Ve(()=>st(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 ue({value:t,cause:r.issues})}}})}function bu(e,t){var r;const n=(r=t==null?void 0:t.useReferences)!=null?r:!1;return Ve(()=>vu(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 Au(e,t){var r;const n=(r=t==null?void 0:t.useReferences)!=null?r:!1;return Ve(()=>st(ui(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async o=>{const s=await Rr(e,o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function zu(e){return"_zod"in e}function fn(e,t){return zu(e)?Au(e,t):bu(e,t)}async function gn({value:e,schema:t}){const r=await Ae({value:e,schema:t});if(!r.success)throw ue.wrap({value:e,cause:r.error});return r.value}async function Ae({value:e,schema:t}){const r=lt(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:ue.wrap({value:e,cause:n.error}),rawValue:e}}catch(n){return{success:!1,error:ue.wrap({value:e,cause:n}),rawValue:e}}}async function ce({text:e,schema:t}){try{const r=kc(e);return t==null?{success:!0,value:r,rawValue:r}:await Ae({value:r,schema:t})}catch(r){return{success:!1,error:wt.isInstance(r)?r:new wt({text:e,cause:r}),rawValue:void 0}}}function wu({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new jc).pipeThrough(new TransformStream({async transform({data:r},n){r!=="[DONE]"&&n.enqueue(await ce({text:r,schema:t}))}}))}async function re(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var Du=Object.defineProperty,ju=(e,t)=>{for(var r in t)Du(e,r,{get:t[r],enumerable:!0})},mn="AI_NoObjectGeneratedError",hn=`vercel.ai.error.${mn}`,Eu=Symbol.for(hn),In,ne=class extends H{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:o,finishReason:s}){super({name:mn,message:e,cause:t}),this[In]=!0,this.text=r,this.response=n,this.usage=o,this.finishReason=s}static isInstance(e){return H.hasMarker(e,hn)}};In=Eu;var yn="AI_UIMessageStreamError",vn=`vercel.ai.error.${yn}`,Tu=Symbol.for(vn),Mn,Ie=class extends H{constructor({chunkType:e,chunkId:t,message:r}){super({name:yn,message:r}),this[Mn]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return H.hasMarker(e,vn)}};Mn=Tu;var _n="6.0.42",Nn=Y([I(),Ue(Uint8Array),Ue(ArrayBuffer),Kr(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]),ze=bc(()=>Y([Xi(),I(),Fi(),U(),_e(I(),ze.optional()),he(ze)])),j=_e(I(),_e(I(),ze.optional())),bn=C({type:N("text"),text:I(),providerOptions:j.optional()}),Ou=C({type:N("image"),image:Y([Nn,Ue(URL)]),mediaType:I().optional(),providerOptions:j.optional()}),An=C({type:N("file"),data:Y([Nn,Ue(URL)]),filename:I().optional(),mediaType:I(),providerOptions:j.optional()}),Cu=C({type:N("reasoning"),text:I(),providerOptions:j.optional()}),ku=C({type:N("tool-call"),toolCallId:I(),toolName:I(),input:X(),providerOptions:j.optional(),providerExecuted:U().optional()}),Su=rc("type",[C({type:N("text"),value:I(),providerOptions:j.optional()}),C({type:N("json"),value:ze,providerOptions:j.optional()}),C({type:N("execution-denied"),reason:I().optional(),providerOptions:j.optional()}),C({type:N("error-text"),value:I(),providerOptions:j.optional()}),C({type:N("error-json"),value:ze,providerOptions:j.optional()}),C({type:N("content"),value:he(Y([C({type:N("text"),text:I(),providerOptions:j.optional()}),C({type:N("media"),data:I(),mediaType:I()}),C({type:N("file-data"),data:I(),mediaType:I(),filename:I().optional(),providerOptions:j.optional()}),C({type:N("file-url"),url:I(),providerOptions:j.optional()}),C({type:N("file-id"),fileId:Y([I(),_e(I(),I())]),providerOptions:j.optional()}),C({type:N("image-data"),data:I(),mediaType:I(),providerOptions:j.optional()}),C({type:N("image-url"),url:I(),providerOptions:j.optional()}),C({type:N("image-file-id"),fileId:Y([I(),_e(I(),I())]),providerOptions:j.optional()}),C({type:N("custom"),providerOptions:j.optional()})]))})]),zn=C({type:N("tool-result"),toolCallId:I(),toolName:I(),output:Su,providerOptions:j.optional()}),xu=C({type:N("tool-approval-request"),approvalId:I(),toolCallId:I()}),Zu=C({type:N("tool-approval-response"),approvalId:I(),approved:U(),reason:I().optional()}),Pu=C({role:N("system"),content:I(),providerOptions:j.optional()}),Lu=C({role:N("user"),content:Y([I(),he(Y([bn,Ou,An]))]),providerOptions:j.optional()}),Ru=C({role:N("assistant"),content:Y([I(),he(Y([bn,An,Cu,ku,zn,xu]))]),providerOptions:j.optional()}),$u=C({role:N("tool"),content:he(Y([zn,Zu])),providerOptions:j.optional()});Y([Pu,Lu,Ru,$u]);function wn(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,i=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),a=s!=null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);i&&a?r[n]=wn(s,o):r[n]=o}return r}var Uu={};ju(Uu,{array:()=>Ju,choice:()=>Bu,json:()=>Fu,object:()=>Qu,text:()=>Vu});function Yu(e){const t=["ROOT"];let r=-1,n=null;function o(u,c,l){switch(u){case'"':{r=c,t.pop(),t.push(l),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=c,n=c,t.pop(),t.push(l),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(l),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(l),t.push("INSIDE_NUMBER");break}case"{":{r=c,t.pop(),t.push(l),t.push("INSIDE_OBJECT_START");break}case"[":{r=c,t.pop(),t.push(l),t.push("INSIDE_ARRAY_START");break}}}function s(u,c){switch(u){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=c,t.pop();break}}}function i(u,c){switch(u){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=c,t.pop();break}}}for(let u=0;u<e.length;u++){const c=e[u];switch(t[t.length-1]){case"ROOT":o(c,u,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=u,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(c){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,u,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{s(c,u);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),r=u;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=u}break}case"INSIDE_ARRAY_START":{switch(c){case"]":{r=u,t.pop();break}default:{r=u,o(c,u,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=u,t.pop();break}default:{r=u;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,u,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),r=u;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=u;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,u),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,u);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,u);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,u);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(n,u+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?s(c,u):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,u)):r=u;break}}}let a=e.slice(0,r+1);for(let u=t.length-1;u>=0;u--)switch(t[u]){case"INSIDE_STRING":{a+='"';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":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const l=e.substring(n,e.length);"true".startsWith(l)?a+="true".slice(l.length):"false".startsWith(l)?a+="false".slice(l.length):"null".startsWith(l)&&(a+="null".slice(l.length))}}return a}async function we(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await ce({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await ce({text:Yu(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Vu=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),Qu=({schema:e,name:t,description:r})=>{const n=lt(e);return{name:"object",responseFormat:re(n.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...r!=null&&{description:r}})),async parseCompleteOutput({text:o},s){const i=await ce({text:o});if(!i.success)throw new ne({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=await Ae({value:i.value,schema:n});if(!a.success)throw new ne({message:"No object generated: response did not match schema.",cause:a.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});return a.value},async parsePartialOutput({text:o}){const s=await we(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:s.value}}},createElementStreamTransform(){}}},Ju=({element:e,name:t,description:r})=>{const n=lt(e);return{name:"array",responseFormat:re(n.jsonSchema).then(o=>{const{$schema:s,...i}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}}),async parseCompleteOutput({text:o},s){const i=await ce({text:o});if(!i.success)throw new ne({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=i.value;if(a==null||typeof a!="object"||!("elements"in a)||!Array.isArray(a.elements))throw new ne({message:"No object generated: response did not match schema.",cause:new ue({value:a,cause:"response must be an object with an elements array"}),text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});for(const u of a.elements){const c=await Ae({value:u,schema:n});if(!c.success)throw new ne({message:"No object generated: response did not match schema.",cause:c.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason})}return a.elements},async parsePartialOutput({text:o}){const s=await we(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=s.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const a=s.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,u=[];for(const c of a){const l=await Ae({value:c,schema:n});l.success&&u.push(l.value)}return{partial:u}}}},createElementStreamTransform(){let o=0;return new TransformStream({transform({partialOutput:s},i){if(s!=null)for(;o<s.length;o++)i.enqueue(s[o])}})}}},Bu=({options:e,name:t,description:r})=>({name:"choice",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 ce({text:n});if(!s.success)throw new ne({message:"No object generated: could not parse the response.",cause:s.error,text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});const i=s.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new ne({message:"No object generated: response did not match schema.",cause:new ue({value:i,cause:"response must be an object that contains a choice value."}),text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});return i.result},async parsePartialOutput({text:n}){const o=await we(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 i=e.filter(a=>a.startsWith(s.result));return o.state==="successful-parse"?i.includes(s.result)?{partial:s.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),Fu=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:r},n){const o=await ce({text:r});if(!o.success)throw new ne({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 we(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}}},createElementStreamTransform(){}});be({prefix:"aitxt",size:24}),class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
49
+ ]`;continue}s+=o[c],o[c]==="\\"?i=!0:a&&o[c]==="]"?a=!1:!a&&o[c]==="["&&(a=!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 pn(e,t){var r,n,o,s,i,a;const u={type:"object",additionalProperties:(r=O(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,...l}=ln(e.keyType._def,t);return{...u,propertyNames:l}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===z.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===z.ZodBranded&&e.keyType._def.type._def.typeName===z.ZodString&&((a=e.keyType._def.type._def.checks)!=null&&a.length)){const{type:c,...l}=cn(e.keyType._def,t);return{...u,propertyNames:l}}}return u}function Wc(e,t){if(t.mapStrategy==="record")return pn(e,t);const r=O(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||B(),n=O(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||B();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Hc(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 Xc(){return{not:B()}}function qc(){return{type:"null"}}var ct={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Kc(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in ct&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((o,s)=>{const i=ct[s._def.typeName];return i&&!o.includes(i)?[...o,i]: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 i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){const o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._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 eu(e,t)}var eu=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>O(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 tu(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[ct[e.innerType._def.typeName],"null"]};const r=O(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function ru(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 nu(e,t){const r={type:"object",properties:{}},n=[],o=e.shape();for(const i in o){let a=o[i];if(a===void 0||a._def===void 0)continue;const u=su(a),c=O(a._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});c!==void 0&&(r.properties[i]=c,u||n.push(i))}n.length&&(r.required=n);const s=ou(e,t);return s!==void 0&&(r.additionalProperties=s),r}function ou(e,t){if(e.catchall._def.typeName!=="ZodNever")return O(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 su(e){try{return e.isOptional()}catch{return!0}}var au=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return O(e.innerType._def,t);const n=O(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:B()},n]}:B()},iu=(e,t)=>{if(t.pipeStrategy==="input")return O(e.in._def,t);if(t.pipeStrategy==="output")return O(e.out._def,t);const r=O(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=O(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function cu(e,t){return O(e.type._def,t)}function uu(e,t){const n={type:"array",uniqueItems:!0,items:O(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 lu(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>O(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:O(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>O(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function du(){return{not:B()}}function pu(){return B()}var fu=(e,t)=>O(e.innerType._def,t),gu=(e,t,r)=>{switch(t){case z.ZodString:return ln(e,r);case z.ZodNumber:return ru(e);case z.ZodObject:return nu(e,r);case z.ZodBigInt:return Pc(e);case z.ZodBoolean:return Lc();case z.ZodDate:return un(e,r);case z.ZodUndefined:return du();case z.ZodNull:return qc();case z.ZodArray:return Zc(e,r);case z.ZodUnion:case z.ZodDiscriminatedUnion:return Kc(e,r);case z.ZodIntersection:return Jc(e,r);case z.ZodTuple:return lu(e,r);case z.ZodRecord:return pn(e,r);case z.ZodLiteral:return Bc(e);case z.ZodEnum:return Vc(e);case z.ZodNativeEnum:return Hc(e);case z.ZodNullable:return tu(e,r);case z.ZodOptional:return au(e,r);case z.ZodMap:return Wc(e,r);case z.ZodSet:return uu(e,r);case z.ZodLazy:return()=>e.getter()._def;case z.ZodPromise:return cu(e,r);case z.ZodNaN:case z.ZodNever:return Xc();case z.ZodEffects:return Yc(e,r);case z.ZodAny:return B();case z.ZodUnknown:return pu();case z.ZodDefault:return Uc(e,r);case z.ZodBranded:return cn(e,r);case z.ZodReadonly:return fu(e,r);case z.ZodCatch:return Rc(e,r);case z.ZodPipeline:return iu(e,r);case z.ZodFunction:case z.ZodVoid:case z.ZodSymbol:return;default:return(n=>{})()}},mu=(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 O(e,t,r=!1){var n;const o=t.seen.get(e);if(t.override){const u=(n=t.override)==null?void 0:n.call(t,e,t,o,r);if(u!==Sc)return u}if(o&&!r){const u=hu(o,t);if(u!==void 0)return u}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=gu(e,e.typeName,t),a=typeof i=="function"?O(i(),t):i;if(a&&Iu(e,t,a),t.postProcess){const u=t.postProcess(a,e,t);return s.jsonSchema=a,u}return s.jsonSchema=a,a}var hu=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:mu(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`),B()):t.$refStrategy==="seen"?B():void 0}},Iu=(e,t,r)=>(e.description&&(r.description=e.description),r),yu=e=>{const t=xc(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}]))}},vu=(e,t)=>{var r;const n=yu(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[l,d])=>{var v;return{...c,[l]:(v=O(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,l]},!0))!=null?v:B()}},{}):void 0;const s=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,i=(r=O(e._def,s===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1))!=null?r:B(),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(i.title=a);const u=s===void 0?o?{...i,[n.definitionPath]:o}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...o,[s]:i}};return u.$schema="http://json-schema.org/draft-07/schema#",u},ut=Symbol.for("vercel.ai.schema");function Mu(e){let t;return()=>(t==null&&(t=e()),t)}function Ve(e,{validate:t}={}){return{[ut]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function _u(e){return typeof e=="object"&&e!==null&&ut in e&&e[ut]===!0&&"jsonSchema"in e&&"validate"in e}function lt(e){return e==null?Ve({properties:{},additionalProperties:!1}):_u(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?fn(e):Nu(e):e()}function Nu(e){return Ve(()=>st(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 ue({value:t,cause:r.issues})}}})}function bu(e,t){var r;const n=(r=t==null?void 0:t.useReferences)!=null?r:!1;return Ve(()=>vu(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 Au(e,t){var r;const n=(r=t==null?void 0:t.useReferences)!=null?r:!1;return Ve(()=>st(ui(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async o=>{const s=await Rr(e,o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function zu(e){return"_zod"in e}function fn(e,t){return zu(e)?Au(e,t):bu(e,t)}async function gn({value:e,schema:t}){const r=await Ae({value:e,schema:t});if(!r.success)throw ue.wrap({value:e,cause:r.error});return r.value}async function Ae({value:e,schema:t}){const r=lt(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:ue.wrap({value:e,cause:n.error}),rawValue:e}}catch(n){return{success:!1,error:ue.wrap({value:e,cause:n}),rawValue:e}}}async function ce({text:e,schema:t}){try{const r=kc(e);return t==null?{success:!0,value:r,rawValue:r}:await Ae({value:r,schema:t})}catch(r){return{success:!1,error:wt.isInstance(r)?r:new wt({text:e,cause:r}),rawValue:void 0}}}function wu({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new jc).pipeThrough(new TransformStream({async transform({data:r},n){r!=="[DONE]"&&n.enqueue(await ce({text:r,schema:t}))}}))}async function re(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var Du=Object.defineProperty,ju=(e,t)=>{for(var r in t)Du(e,r,{get:t[r],enumerable:!0})},mn="AI_NoObjectGeneratedError",hn=`vercel.ai.error.${mn}`,Eu=Symbol.for(hn),In,ne=class extends H{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:o,finishReason:s}){super({name:mn,message:e,cause:t}),this[In]=!0,this.text=r,this.response=n,this.usage=o,this.finishReason=s}static isInstance(e){return H.hasMarker(e,hn)}};In=Eu;var yn="AI_UIMessageStreamError",vn=`vercel.ai.error.${yn}`,Tu=Symbol.for(vn),Mn,Ie=class extends H{constructor({chunkType:e,chunkId:t,message:r}){super({name:yn,message:r}),this[Mn]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return H.hasMarker(e,vn)}};Mn=Tu;var _n="6.0.42",Nn=Y([y(),Ue(Uint8Array),Ue(ArrayBuffer),Kr(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]),ze=bc(()=>Y([Xi(),y(),Fi(),U(),_e(y(),ze.optional()),he(ze)])),T=_e(y(),_e(y(),ze.optional())),bn=C({type:N("text"),text:y(),providerOptions:T.optional()}),Ou=C({type:N("image"),image:Y([Nn,Ue(URL)]),mediaType:y().optional(),providerOptions:T.optional()}),An=C({type:N("file"),data:Y([Nn,Ue(URL)]),filename:y().optional(),mediaType:y(),providerOptions:T.optional()}),Cu=C({type:N("reasoning"),text:y(),providerOptions:T.optional()}),ku=C({type:N("tool-call"),toolCallId:y(),toolName:y(),input:X(),providerOptions:T.optional(),providerExecuted:U().optional()}),Su=rc("type",[C({type:N("text"),value:y(),providerOptions:T.optional()}),C({type:N("json"),value:ze,providerOptions:T.optional()}),C({type:N("execution-denied"),reason:y().optional(),providerOptions:T.optional()}),C({type:N("error-text"),value:y(),providerOptions:T.optional()}),C({type:N("error-json"),value:ze,providerOptions:T.optional()}),C({type:N("content"),value:he(Y([C({type:N("text"),text:y(),providerOptions:T.optional()}),C({type:N("media"),data:y(),mediaType:y()}),C({type:N("file-data"),data:y(),mediaType:y(),filename:y().optional(),providerOptions:T.optional()}),C({type:N("file-url"),url:y(),providerOptions:T.optional()}),C({type:N("file-id"),fileId:Y([y(),_e(y(),y())]),providerOptions:T.optional()}),C({type:N("image-data"),data:y(),mediaType:y(),providerOptions:T.optional()}),C({type:N("image-url"),url:y(),providerOptions:T.optional()}),C({type:N("image-file-id"),fileId:Y([y(),_e(y(),y())]),providerOptions:T.optional()}),C({type:N("custom"),providerOptions:T.optional()})]))})]),zn=C({type:N("tool-result"),toolCallId:y(),toolName:y(),output:Su,providerOptions:T.optional()}),xu=C({type:N("tool-approval-request"),approvalId:y(),toolCallId:y()}),Zu=C({type:N("tool-approval-response"),approvalId:y(),approved:U(),reason:y().optional()}),Pu=C({role:N("system"),content:y(),providerOptions:T.optional()}),Lu=C({role:N("user"),content:Y([y(),he(Y([bn,Ou,An]))]),providerOptions:T.optional()}),Ru=C({role:N("assistant"),content:Y([y(),he(Y([bn,An,Cu,ku,zn,xu]))]),providerOptions:T.optional()}),$u=C({role:N("tool"),content:he(Y([zn,Zu])),providerOptions:T.optional()});Y([Pu,Lu,Ru,$u]);function wn(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,i=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),a=s!=null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);i&&a?r[n]=wn(s,o):r[n]=o}return r}var Uu={};ju(Uu,{array:()=>Ju,choice:()=>Bu,json:()=>Fu,object:()=>Qu,text:()=>Vu});function Yu(e){const t=["ROOT"];let r=-1,n=null;function o(u,c,l){switch(u){case'"':{r=c,t.pop(),t.push(l),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=c,n=c,t.pop(),t.push(l),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(l),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(l),t.push("INSIDE_NUMBER");break}case"{":{r=c,t.pop(),t.push(l),t.push("INSIDE_OBJECT_START");break}case"[":{r=c,t.pop(),t.push(l),t.push("INSIDE_ARRAY_START");break}}}function s(u,c){switch(u){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=c,t.pop();break}}}function i(u,c){switch(u){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=c,t.pop();break}}}for(let u=0;u<e.length;u++){const c=e[u];switch(t[t.length-1]){case"ROOT":o(c,u,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=u,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(c){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,u,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{s(c,u);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),r=u;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=u}break}case"INSIDE_ARRAY_START":{switch(c){case"]":{r=u,t.pop();break}default:{r=u,o(c,u,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=u,t.pop();break}default:{r=u;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,u,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),r=u;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=u;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,u),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,u);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,u);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,u);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(n,u+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?s(c,u):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,u)):r=u;break}}}let a=e.slice(0,r+1);for(let u=t.length-1;u>=0;u--)switch(t[u]){case"INSIDE_STRING":{a+='"';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":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const l=e.substring(n,e.length);"true".startsWith(l)?a+="true".slice(l.length):"false".startsWith(l)?a+="false".slice(l.length):"null".startsWith(l)&&(a+="null".slice(l.length))}}return a}async function we(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await ce({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await ce({text:Yu(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Vu=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),Qu=({schema:e,name:t,description:r})=>{const n=lt(e);return{name:"object",responseFormat:re(n.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...r!=null&&{description:r}})),async parseCompleteOutput({text:o},s){const i=await ce({text:o});if(!i.success)throw new ne({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=await Ae({value:i.value,schema:n});if(!a.success)throw new ne({message:"No object generated: response did not match schema.",cause:a.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});return a.value},async parsePartialOutput({text:o}){const s=await we(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:s.value}}},createElementStreamTransform(){}}},Ju=({element:e,name:t,description:r})=>{const n=lt(e);return{name:"array",responseFormat:re(n.jsonSchema).then(o=>{const{$schema:s,...i}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}}),async parseCompleteOutput({text:o},s){const i=await ce({text:o});if(!i.success)throw new ne({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=i.value;if(a==null||typeof a!="object"||!("elements"in a)||!Array.isArray(a.elements))throw new ne({message:"No object generated: response did not match schema.",cause:new ue({value:a,cause:"response must be an object with an elements array"}),text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});for(const u of a.elements){const c=await Ae({value:u,schema:n});if(!c.success)throw new ne({message:"No object generated: response did not match schema.",cause:c.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason})}return a.elements},async parsePartialOutput({text:o}){const s=await we(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=s.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const a=s.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,u=[];for(const c of a){const l=await Ae({value:c,schema:n});l.success&&u.push(l.value)}return{partial:u}}}},createElementStreamTransform(){let o=0;return new TransformStream({transform({partialOutput:s},i){if(s!=null)for(;o<s.length;o++)i.enqueue(s[o])}})}}},Bu=({options:e,name:t,description:r})=>({name:"choice",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 ce({text:n});if(!s.success)throw new ne({message:"No object generated: could not parse the response.",cause:s.error,text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});const i=s.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new ne({message:"No object generated: response did not match schema.",cause:new ue({value:i,cause:"response must be an object that contains a choice value."}),text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});return i.result},async parsePartialOutput({text:n}){const o=await we(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 i=e.filter(a=>a.startsWith(s.result));return o.state==="successful-parse"?i.includes(s.result)?{partial:s.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),Fu=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:r},n){const o=await ce({text:r});if(!o.success)throw new ne({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 we(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}}},createElementStreamTransform(){}});be({prefix:"aitxt",size:24}),class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
50
50
 
51
51
  `)},flush(e){e.enqueue(`data: [DONE]
52
52
 
53
- `)}})}};var Gu=Mu(()=>fn(Y([P({type:N("text-start"),id:I(),providerMetadata:j.optional()}),P({type:N("text-delta"),id:I(),delta:I(),providerMetadata:j.optional()}),P({type:N("text-end"),id:I(),providerMetadata:j.optional()}),P({type:N("error"),errorText:I()}),P({type:N("tool-input-start"),toolCallId:I(),toolName:I(),providerExecuted:U().optional(),providerMetadata:j.optional(),dynamic:U().optional(),title:I().optional()}),P({type:N("tool-input-delta"),toolCallId:I(),inputTextDelta:I()}),P({type:N("tool-input-available"),toolCallId:I(),toolName:I(),input:X(),providerExecuted:U().optional(),providerMetadata:j.optional(),dynamic:U().optional(),title:I().optional()}),P({type:N("tool-input-error"),toolCallId:I(),toolName:I(),input:X(),providerExecuted:U().optional(),providerMetadata:j.optional(),dynamic:U().optional(),errorText:I(),title:I().optional()}),P({type:N("tool-approval-request"),approvalId:I(),toolCallId:I()}),P({type:N("tool-output-available"),toolCallId:I(),output:X(),providerExecuted:U().optional(),dynamic:U().optional(),preliminary:U().optional()}),P({type:N("tool-output-error"),toolCallId:I(),errorText:I(),providerExecuted:U().optional(),dynamic:U().optional()}),P({type:N("tool-output-denied"),toolCallId:I()}),P({type:N("reasoning-start"),id:I(),providerMetadata:j.optional()}),P({type:N("reasoning-delta"),id:I(),delta:I(),providerMetadata:j.optional()}),P({type:N("reasoning-end"),id:I(),providerMetadata:j.optional()}),P({type:N("source-url"),sourceId:I(),url:I(),title:I().optional(),providerMetadata:j.optional()}),P({type:N("source-document"),sourceId:I(),mediaType:I(),title:I(),filename:I().optional(),providerMetadata:j.optional()}),P({type:N("file"),url:I(),mediaType:I(),providerMetadata:j.optional()}),P({type:Kr(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:I().optional(),data:X(),transient:U().optional()}),P({type:N("start-step")}),P({type:N("finish-step")}),P({type:N("start"),messageId:I().optional(),messageMetadata:X().optional()}),P({type:N("finish"),finishReason:Fr(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:X().optional()}),P({type:N("abort"),reason:I().optional()}),P({type:N("message-metadata"),messageMetadata:X()})])));function Wu(e){return e.type.startsWith("data-")}function dt(e){return e.type.startsWith("tool-")}function Hu(e){return e.type==="dynamic-tool"}function pt(e){return dt(e)||Hu(e)}function Dn(e){return e.type.split("-").slice(1).join("-")}function Xu({lastMessage:e,messageId:t}){return{message:(e==null?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function qu({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:o,onToolCall:s,onData:i}){return e.pipeThrough(new TransformStream({async transform(a,u){await n(async({state:c,write:l})=>{var d,y,h,_;function m(p){const E=c.message.parts.filter(pt).find(w=>w.toolCallId===p);if(E==null)throw new Ie({chunkType:"tool-invocation",chunkId:p,message:`No tool invocation found for tool call ID "${p}".`});return E}function v(p){var T;const E=c.message.parts.find(J=>dt(J)&&J.toolCallId===p.toolCallId),w=p,k=E;E!=null?(E.state=p.state,k.input=w.input,k.output=w.output,k.errorText=w.errorText,k.rawInput=w.rawInput,k.preliminary=w.preliminary,p.title!==void 0&&(k.title=p.title),k.providerExecuted=(T=w.providerExecuted)!=null?T:E.providerExecuted,w.providerMetadata!=null&&(E.callProviderMetadata=w.providerMetadata)):c.message.parts.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,state:p.state,title:p.title,input:w.input,output:w.output,rawInput:w.rawInput,errorText:w.errorText,providerExecuted:w.providerExecuted,preliminary:w.preliminary,...w.providerMetadata!=null?{callProviderMetadata:w.providerMetadata}:{}})}function b(p){var T,E;const w=c.message.parts.find(kn=>kn.type==="dynamic-tool"&&kn.toolCallId===p.toolCallId),k=p,J=w;w!=null?(w.state=p.state,J.toolName=p.toolName,J.input=k.input,J.output=k.output,J.errorText=k.errorText,J.rawInput=(T=k.rawInput)!=null?T:J.rawInput,J.preliminary=k.preliminary,p.title!==void 0&&(J.title=p.title),J.providerExecuted=(E=k.providerExecuted)!=null?E:w.providerExecuted,k.providerMetadata!=null&&(w.callProviderMetadata=k.providerMetadata)):c.message.parts.push({type:"dynamic-tool",toolName:p.toolName,toolCallId:p.toolCallId,state:p.state,input:k.input,output:k.output,errorText:k.errorText,preliminary:k.preliminary,providerExecuted:k.providerExecuted,title:p.title,...k.providerMetadata!=null?{callProviderMetadata:k.providerMetadata}:{}})}async function z(p){if(p!=null){const T=c.message.metadata!=null?wn(c.message.metadata,p):p;t!=null&&await gn({value:T,schema:t}),c.message.metadata=T}}switch(a.type){case"text-start":{const p={type:"text",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeTextParts[a.id]=p,c.message.parts.push(p),l();break}case"text-delta":{const p=c.activeTextParts[a.id];if(p==null)throw new Ie({chunkType:"text-delta",chunkId:a.id,message:`Received text-delta for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});p.text+=a.delta,p.providerMetadata=(d=a.providerMetadata)!=null?d:p.providerMetadata,l();break}case"text-end":{const p=c.activeTextParts[a.id];if(p==null)throw new Ie({chunkType:"text-end",chunkId:a.id,message:`Received text-end for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});p.state="done",p.providerMetadata=(y=a.providerMetadata)!=null?y:p.providerMetadata,delete c.activeTextParts[a.id],l();break}case"reasoning-start":{const p={type:"reasoning",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeReasoningParts[a.id]=p,c.message.parts.push(p),l();break}case"reasoning-delta":{const p=c.activeReasoningParts[a.id];if(p==null)throw new Ie({chunkType:"reasoning-delta",chunkId:a.id,message:`Received reasoning-delta for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});p.text+=a.delta,p.providerMetadata=(h=a.providerMetadata)!=null?h:p.providerMetadata,l();break}case"reasoning-end":{const p=c.activeReasoningParts[a.id];if(p==null)throw new Ie({chunkType:"reasoning-end",chunkId:a.id,message:`Received reasoning-end for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});p.providerMetadata=(_=a.providerMetadata)!=null?_:p.providerMetadata,p.state="done",delete c.activeReasoningParts[a.id],l();break}case"file":{c.message.parts.push({type:"file",mediaType:a.mediaType,url:a.url}),l();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:a.sourceId,url:a.url,title:a.title,providerMetadata:a.providerMetadata}),l();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:a.sourceId,mediaType:a.mediaType,title:a.title,filename:a.filename,providerMetadata:a.providerMetadata}),l();break}case"tool-input-start":{const p=c.message.parts.filter(dt);c.partialToolCalls[a.toolCallId]={text:"",toolName:a.toolName,index:p.length,dynamic:a.dynamic,title:a.title},a.dynamic?b({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}):v({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}),l();break}case"tool-input-delta":{const p=c.partialToolCalls[a.toolCallId];if(p==null)throw new Ie({chunkType:"tool-input-delta",chunkId:a.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${a.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});p.text+=a.inputTextDelta;const{value:T}=await we(p.text);p.dynamic?b({toolCallId:a.toolCallId,toolName:p.toolName,state:"input-streaming",input:T,title:p.title}):v({toolCallId:a.toolCallId,toolName:p.toolName,state:"input-streaming",input:T,title:p.title}),l();break}case"tool-input-available":{a.dynamic?b({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}):v({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}),l(),s&&!a.providerExecuted&&await s({toolCall:a});break}case"tool-input-error":{a.dynamic?b({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}):v({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:void 0,rawInput:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}),l();break}case"tool-approval-request":{const p=m(a.toolCallId);p.state="approval-requested",p.approval={id:a.approvalId},l();break}case"tool-output-denied":{const p=m(a.toolCallId);p.state="output-denied",l();break}case"tool-output-available":{const p=m(a.toolCallId);p.type==="dynamic-tool"?b({toolCallId:a.toolCallId,toolName:p.toolName,state:"output-available",input:p.input,output:a.output,preliminary:a.preliminary,providerExecuted:a.providerExecuted,title:p.title}):v({toolCallId:a.toolCallId,toolName:Dn(p),state:"output-available",input:p.input,output:a.output,providerExecuted:a.providerExecuted,preliminary:a.preliminary,title:p.title}),l();break}case"tool-output-error":{const p=m(a.toolCallId);p.type==="dynamic-tool"?b({toolCallId:a.toolCallId,toolName:p.toolName,state:"output-error",input:p.input,errorText:a.errorText,providerExecuted:a.providerExecuted,title:p.title}):v({toolCallId:a.toolCallId,toolName:Dn(p),state:"output-error",input:p.input,rawInput:p.rawInput,errorText:a.errorText,providerExecuted:a.providerExecuted,title:p.title}),l();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{a.messageId!=null&&(c.message.id=a.messageId),await z(a.messageMetadata),(a.messageId!=null||a.messageMetadata!=null)&&l();break}case"finish":{a.finishReason!=null&&(c.finishReason=a.finishReason),await z(a.messageMetadata),a.messageMetadata!=null&&l();break}case"message-metadata":{await z(a.messageMetadata),a.messageMetadata!=null&&l();break}case"error":{o==null||o(new Error(a.errorText));break}default:if(Wu(a)){(r==null?void 0:r[a.type])!=null&&await gn({value:a.data,schema:r[a.type]});const p=a;if(p.transient){i==null||i(p);break}const T=p.id!=null?c.message.parts.find(E=>p.type===E.type&&p.id===E.id):void 0;T!=null?T.data=p.data:c.message.parts.push(p),i==null||i(p),l()}}u.enqueue(a)})}}))}async function Ku({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:n}=await r.read();if(n)break}}catch(n){t==null||t(n)}finally{r.releaseLock()}}be({prefix:"aitxt",size:24}),be({prefix:"aiobj",size:24});var el=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()})}};be({prefix:"aiobj",size:24});async function tl(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,i)=>{const a=new FileReader;a.onload=u=>{var c;s((c=u.target)==null?void 0:c.result)},a.onerror=u=>i(u),a.readAsDataURL(t)});return{type:"file",mediaType:n,filename:r,url:o}}))}var rl=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:o,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=o,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var r,n,o,s,i;const a=await re(this.body),u=await re(this.headers),c=await re(this.credentials),l={...ae(u),...ae(t.headers)},d=await((r=this.prepareSendMessagesRequest)==null?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...a,...t.body},headers:l,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),y=(n=d==null?void 0:d.api)!=null?n:this.api,h=(d==null?void 0:d.headers)!==void 0?ae(d.headers):l,_=(d==null?void 0:d.body)!==void 0?d.body:{...a,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},m=(o=d==null?void 0:d.credentials)!=null?o:c,b=await((s=this.fetch)!=null?s:globalThis.fetch)(y,{method:"POST",headers:on({"Content-Type":"application/json",...h},`ai-sdk/${_n}`,nn()),body:JSON.stringify(_),credentials:m,signal:e});if(!b.ok)throw new Error((i=await b.text())!=null?i:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");return this.processResponseStream(b.body)}async reconnectToStream(e){var t,r,n,o,s;const i=await re(this.body),a=await re(this.headers),u=await re(this.credentials),c={...ae(a),...ae(e.headers)},l=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:c,credentials:u,requestMetadata:e.metadata})),d=(r=l==null?void 0:l.api)!=null?r:`${this.api}/${e.chatId}/stream`,y=(l==null?void 0:l.headers)!==void 0?ae(l.headers):c,h=(n=l==null?void 0:l.credentials)!=null?n:u,m=await((o=this.fetch)!=null?o:globalThis.fetch)(d,{method:"GET",headers:on(y,`ai-sdk/${_n}`,nn()),credentials:h});if(m.status===204)return null;if(!m.ok)throw new Error((s=await m.text())!=null?s:"Failed to fetch the chat response.");if(!m.body)throw new Error("The response body is empty.");return this.processResponseStream(m.body)}},jn=class extends rl{constructor(e={}){super(e)}processResponseStream(e){return wu({stream:e,schema:Gu}).pipeThrough(new TransformStream({async transform(t,r){if(!t.success)throw t.error;r.enqueue(t.value)}}))}},nl=class{constructor({generateId:e=Ec,id:t=e(),transport:r=new jn,messageMetadataSchema:n,dataPartSchemas:o,state:s,onError:i,onToolCall:a,onFinish:u,onData:c,sendAutomaticallyWhen:l}){this.activeResponse=void 0,this.jobExecutor=new el,this.sendMessage=async(d,y)=>{var h,_,m,v;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(h=this.lastMessage)==null?void 0:h.id,...y});return}let b;if("text"in d||"files"in d?b={parts:[...Array.isArray(d.files)?d.files:await tl(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:b=d,d.messageId!=null){const z=this.state.messages.findIndex(p=>p.id===d.messageId);if(z===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[z].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,z+1),this.state.replaceMessage(z,{...b,id:d.messageId,role:(_=b.role)!=null?_:"user",metadata:d.metadata})}else this.state.pushMessage({...b,id:(m=b.id)!=null?m:this.generateId(),role:(v=b.role)!=null?v:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...y})},this.regenerate=async({messageId:d,...y}={})=>{const h=d==null?this.state.messages.length-1:this.state.messages.findIndex(_=>_.id===d);if(h===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[h].role==="assistant"?h:h+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...y})},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:y,reason:h})=>this.jobExecutor.run(async()=>{var _,m;const v=this.state.messages,b=v[v.length-1],z=p=>pt(p)&&p.state==="approval-requested"&&p.approval.id===d?{...p,state:"approval-responded",approval:{id:d,approved:y,reason:h}}:p;this.state.replaceMessage(v.length-1,{...b,parts:b.parts.map(z)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(z)),this.status!=="streaming"&&this.status!=="submitted"&&((_=this.sendAutomaticallyWhen)!=null&&_.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(m=this.lastMessage)==null?void 0:m.id})}),this.addToolOutput=async({state:d="output-available",tool:y,toolCallId:h,output:_,errorText:m})=>this.jobExecutor.run(async()=>{var v,b;const z=this.state.messages,p=z[z.length-1],T=E=>pt(E)&&E.toolCallId===h?{...E,state:d,output:_,errorText:m}:E;this.state.replaceMessage(z.length-1,{...p,parts:p.parts.map(T)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(T)),this.status!=="streaming"&&this.status!=="submitted"&&((v=this.sendAutomaticallyWhen)!=null&&v.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(b=this.lastMessage)==null?void 0:b.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=i,this.onToolCall=a,this.onFinish=u,this.onData=c,this.sendAutomaticallyWhen=l}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,i,a,u;this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let l=!1,d=!1,y=!1;try{const h={state:Xu({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};h.abortController.signal.addEventListener("abort",()=>{l=!0}),this.activeResponse=h;let _;if(e==="resume-stream"){const v=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(v==null){this.setStatus({status:"ready"});return}_=v}else _=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:o});const m=v=>this.jobExecutor.run(()=>v({state:h.state,write:()=>{var b;this.setStatus({status:"streaming"}),h.state.message.id===((b=this.lastMessage)==null?void 0:b.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await Ku({stream:qu({stream:_,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:m,onError:v=>{throw v}}),onError:v=>{throw v}}),this.setStatus({status:"ready"})}catch(h){if(l||h.name==="AbortError")return l=!0,this.setStatus({status:"ready"}),null;y=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:l,isDisconnect:d,isError:y,finishReason:(s=this.activeResponse)==null?void 0:s.state.finishReason})}catch(h){console.error(h)}this.activeResponse=void 0}(a=this.sendAutomaticallyWhen)!=null&&a.call(this,{messages:this.state.messages})&&!y&&await this.makeRequest({trigger:"submit-message",messageId:(u=this.lastMessage)==null?void 0:u.id,metadata:t,headers:r,body:n})}},En=globalThis&&globalThis.__assign||function(){return En=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},En.apply(this,arguments)};globalThis&&globalThis.__awaiter,globalThis&&globalThis.__generator,globalThis&&globalThis.__read,globalThis&&globalThis.__spreadArray;var ol=class{constructor(e){this.statusRef=g.ref("ready"),this.errorRef=g.ref(void 0),this.pushMessage=t=>{this.messagesRef.value=[...this.messagesRef.value,t]},this.popMessage=()=>{this.messagesRef.value=this.messagesRef.value.slice(0,-1)},this.replaceMessage=(t,r)=>{this.messagesRef.value[t]={...r}},this.snapshot=t=>t,this.messagesRef=g.ref(e??[])}get messages(){return this.messagesRef.value}set messages(e){this.messagesRef.value=e}get status(){return this.statusRef.value}set status(e){this.statusRef.value=e}get error(){return this.errorRef.value}set error(e){this.errorRef.value=e}},sl=class extends nl{constructor({messages:e,...t}){super({...t,state:new ol(e)})}};/**
53
+ `)}})}};var Gu=Mu(()=>fn(Y([P({type:N("text-start"),id:y(),providerMetadata:T.optional()}),P({type:N("text-delta"),id:y(),delta:y(),providerMetadata:T.optional()}),P({type:N("text-end"),id:y(),providerMetadata:T.optional()}),P({type:N("error"),errorText:y()}),P({type:N("tool-input-start"),toolCallId:y(),toolName:y(),providerExecuted:U().optional(),providerMetadata:T.optional(),dynamic:U().optional(),title:y().optional()}),P({type:N("tool-input-delta"),toolCallId:y(),inputTextDelta:y()}),P({type:N("tool-input-available"),toolCallId:y(),toolName:y(),input:X(),providerExecuted:U().optional(),providerMetadata:T.optional(),dynamic:U().optional(),title:y().optional()}),P({type:N("tool-input-error"),toolCallId:y(),toolName:y(),input:X(),providerExecuted:U().optional(),providerMetadata:T.optional(),dynamic:U().optional(),errorText:y(),title:y().optional()}),P({type:N("tool-approval-request"),approvalId:y(),toolCallId:y()}),P({type:N("tool-output-available"),toolCallId:y(),output:X(),providerExecuted:U().optional(),dynamic:U().optional(),preliminary:U().optional()}),P({type:N("tool-output-error"),toolCallId:y(),errorText:y(),providerExecuted:U().optional(),dynamic:U().optional()}),P({type:N("tool-output-denied"),toolCallId:y()}),P({type:N("reasoning-start"),id:y(),providerMetadata:T.optional()}),P({type:N("reasoning-delta"),id:y(),delta:y(),providerMetadata:T.optional()}),P({type:N("reasoning-end"),id:y(),providerMetadata:T.optional()}),P({type:N("source-url"),sourceId:y(),url:y(),title:y().optional(),providerMetadata:T.optional()}),P({type:N("source-document"),sourceId:y(),mediaType:y(),title:y(),filename:y().optional(),providerMetadata:T.optional()}),P({type:N("file"),url:y(),mediaType:y(),providerMetadata:T.optional()}),P({type:Kr(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:y().optional(),data:X(),transient:U().optional()}),P({type:N("start-step")}),P({type:N("finish-step")}),P({type:N("start"),messageId:y().optional(),messageMetadata:X().optional()}),P({type:N("finish"),finishReason:Fr(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:X().optional()}),P({type:N("abort"),reason:y().optional()}),P({type:N("message-metadata"),messageMetadata:X()})])));function Wu(e){return e.type.startsWith("data-")}function dt(e){return e.type.startsWith("tool-")}function Hu(e){return e.type==="dynamic-tool"}function pt(e){return dt(e)||Hu(e)}function Dn(e){return e.type.split("-").slice(1).join("-")}function Xu({lastMessage:e,messageId:t}){return{message:(e==null?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function qu({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:o,onToolCall:s,onData:i}){return e.pipeThrough(new TransformStream({async transform(a,u){await n(async({state:c,write:l})=>{var d,v,m,_;function I(f){const D=c.message.parts.filter(pt).find(j=>j.toolCallId===f);if(D==null)throw new Ie({chunkType:"tool-invocation",chunkId:f,message:`No tool invocation found for tool call ID "${f}".`});return D}function h(f){var w;const D=c.message.parts.find(J=>dt(J)&&J.toolCallId===f.toolCallId),j=f,k=D;D!=null?(D.state=f.state,k.input=j.input,k.output=j.output,k.errorText=j.errorText,k.rawInput=j.rawInput,k.preliminary=j.preliminary,f.title!==void 0&&(k.title=f.title),k.providerExecuted=(w=j.providerExecuted)!=null?w:D.providerExecuted,j.providerMetadata!=null&&(D.callProviderMetadata=j.providerMetadata)):c.message.parts.push({type:`tool-${f.toolName}`,toolCallId:f.toolCallId,state:f.state,title:f.title,input:j.input,output:j.output,rawInput:j.rawInput,errorText:j.errorText,providerExecuted:j.providerExecuted,preliminary:j.preliminary,...j.providerMetadata!=null?{callProviderMetadata:j.providerMetadata}:{}})}function A(f){var w,D;const j=c.message.parts.find(kn=>kn.type==="dynamic-tool"&&kn.toolCallId===f.toolCallId),k=f,J=j;j!=null?(j.state=f.state,J.toolName=f.toolName,J.input=k.input,J.output=k.output,J.errorText=k.errorText,J.rawInput=(w=k.rawInput)!=null?w:J.rawInput,J.preliminary=k.preliminary,f.title!==void 0&&(J.title=f.title),J.providerExecuted=(D=k.providerExecuted)!=null?D:j.providerExecuted,k.providerMetadata!=null&&(j.callProviderMetadata=k.providerMetadata)):c.message.parts.push({type:"dynamic-tool",toolName:f.toolName,toolCallId:f.toolCallId,state:f.state,input:k.input,output:k.output,errorText:k.errorText,preliminary:k.preliminary,providerExecuted:k.providerExecuted,title:f.title,...k.providerMetadata!=null?{callProviderMetadata:k.providerMetadata}:{}})}async function b(f){if(f!=null){const w=c.message.metadata!=null?wn(c.message.metadata,f):f;t!=null&&await gn({value:w,schema:t}),c.message.metadata=w}}switch(a.type){case"text-start":{const f={type:"text",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeTextParts[a.id]=f,c.message.parts.push(f),l();break}case"text-delta":{const f=c.activeTextParts[a.id];if(f==null)throw new Ie({chunkType:"text-delta",chunkId:a.id,message:`Received text-delta for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});f.text+=a.delta,f.providerMetadata=(d=a.providerMetadata)!=null?d:f.providerMetadata,l();break}case"text-end":{const f=c.activeTextParts[a.id];if(f==null)throw new Ie({chunkType:"text-end",chunkId:a.id,message:`Received text-end for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});f.state="done",f.providerMetadata=(v=a.providerMetadata)!=null?v:f.providerMetadata,delete c.activeTextParts[a.id],l();break}case"reasoning-start":{const f={type:"reasoning",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeReasoningParts[a.id]=f,c.message.parts.push(f),l();break}case"reasoning-delta":{const f=c.activeReasoningParts[a.id];if(f==null)throw new Ie({chunkType:"reasoning-delta",chunkId:a.id,message:`Received reasoning-delta for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});f.text+=a.delta,f.providerMetadata=(m=a.providerMetadata)!=null?m:f.providerMetadata,l();break}case"reasoning-end":{const f=c.activeReasoningParts[a.id];if(f==null)throw new Ie({chunkType:"reasoning-end",chunkId:a.id,message:`Received reasoning-end for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});f.providerMetadata=(_=a.providerMetadata)!=null?_:f.providerMetadata,f.state="done",delete c.activeReasoningParts[a.id],l();break}case"file":{c.message.parts.push({type:"file",mediaType:a.mediaType,url:a.url}),l();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:a.sourceId,url:a.url,title:a.title,providerMetadata:a.providerMetadata}),l();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:a.sourceId,mediaType:a.mediaType,title:a.title,filename:a.filename,providerMetadata:a.providerMetadata}),l();break}case"tool-input-start":{const f=c.message.parts.filter(dt);c.partialToolCalls[a.toolCallId]={text:"",toolName:a.toolName,index:f.length,dynamic:a.dynamic,title:a.title},a.dynamic?A({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}):h({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}),l();break}case"tool-input-delta":{const f=c.partialToolCalls[a.toolCallId];if(f==null)throw new Ie({chunkType:"tool-input-delta",chunkId:a.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${a.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});f.text+=a.inputTextDelta;const{value:w}=await we(f.text);f.dynamic?A({toolCallId:a.toolCallId,toolName:f.toolName,state:"input-streaming",input:w,title:f.title}):h({toolCallId:a.toolCallId,toolName:f.toolName,state:"input-streaming",input:w,title:f.title}),l();break}case"tool-input-available":{a.dynamic?A({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}):h({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}),l(),s&&!a.providerExecuted&&await s({toolCall:a});break}case"tool-input-error":{a.dynamic?A({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}):h({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:void 0,rawInput:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}),l();break}case"tool-approval-request":{const f=I(a.toolCallId);f.state="approval-requested",f.approval={id:a.approvalId},l();break}case"tool-output-denied":{const f=I(a.toolCallId);f.state="output-denied",l();break}case"tool-output-available":{const f=I(a.toolCallId);f.type==="dynamic-tool"?A({toolCallId:a.toolCallId,toolName:f.toolName,state:"output-available",input:f.input,output:a.output,preliminary:a.preliminary,providerExecuted:a.providerExecuted,title:f.title}):h({toolCallId:a.toolCallId,toolName:Dn(f),state:"output-available",input:f.input,output:a.output,providerExecuted:a.providerExecuted,preliminary:a.preliminary,title:f.title}),l();break}case"tool-output-error":{const f=I(a.toolCallId);f.type==="dynamic-tool"?A({toolCallId:a.toolCallId,toolName:f.toolName,state:"output-error",input:f.input,errorText:a.errorText,providerExecuted:a.providerExecuted,title:f.title}):h({toolCallId:a.toolCallId,toolName:Dn(f),state:"output-error",input:f.input,rawInput:f.rawInput,errorText:a.errorText,providerExecuted:a.providerExecuted,title:f.title}),l();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{a.messageId!=null&&(c.message.id=a.messageId),await b(a.messageMetadata),(a.messageId!=null||a.messageMetadata!=null)&&l();break}case"finish":{a.finishReason!=null&&(c.finishReason=a.finishReason),await b(a.messageMetadata),a.messageMetadata!=null&&l();break}case"message-metadata":{await b(a.messageMetadata),a.messageMetadata!=null&&l();break}case"error":{o==null||o(new Error(a.errorText));break}default:if(Wu(a)){(r==null?void 0:r[a.type])!=null&&await gn({value:a.data,schema:r[a.type]});const f=a;if(f.transient){i==null||i(f);break}const w=f.id!=null?c.message.parts.find(D=>f.type===D.type&&f.id===D.id):void 0;w!=null?w.data=f.data:c.message.parts.push(f),i==null||i(f),l()}}u.enqueue(a)})}}))}async function Ku({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:n}=await r.read();if(n)break}}catch(n){t==null||t(n)}finally{r.releaseLock()}}be({prefix:"aitxt",size:24}),be({prefix:"aiobj",size:24});var el=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()})}};be({prefix:"aiobj",size:24});async function tl(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,i)=>{const a=new FileReader;a.onload=u=>{var c;s((c=u.target)==null?void 0:c.result)},a.onerror=u=>i(u),a.readAsDataURL(t)});return{type:"file",mediaType:n,filename:r,url:o}}))}var rl=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:o,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=o,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var r,n,o,s,i;const a=await re(this.body),u=await re(this.headers),c=await re(this.credentials),l={...ae(u),...ae(t.headers)},d=await((r=this.prepareSendMessagesRequest)==null?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...a,...t.body},headers:l,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),v=(n=d==null?void 0:d.api)!=null?n:this.api,m=(d==null?void 0:d.headers)!==void 0?ae(d.headers):l,_=(d==null?void 0:d.body)!==void 0?d.body:{...a,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},I=(o=d==null?void 0:d.credentials)!=null?o:c,A=await((s=this.fetch)!=null?s:globalThis.fetch)(v,{method:"POST",headers:on({"Content-Type":"application/json",...m},`ai-sdk/${_n}`,nn()),body:JSON.stringify(_),credentials:I,signal:e});if(!A.ok)throw new Error((i=await A.text())!=null?i:"Failed to fetch the chat response.");if(!A.body)throw new Error("The response body is empty.");return this.processResponseStream(A.body)}async reconnectToStream(e){var t,r,n,o,s;const i=await re(this.body),a=await re(this.headers),u=await re(this.credentials),c={...ae(a),...ae(e.headers)},l=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:c,credentials:u,requestMetadata:e.metadata})),d=(r=l==null?void 0:l.api)!=null?r:`${this.api}/${e.chatId}/stream`,v=(l==null?void 0:l.headers)!==void 0?ae(l.headers):c,m=(n=l==null?void 0:l.credentials)!=null?n:u,I=await((o=this.fetch)!=null?o:globalThis.fetch)(d,{method:"GET",headers:on(v,`ai-sdk/${_n}`,nn()),credentials:m});if(I.status===204)return null;if(!I.ok)throw new Error((s=await I.text())!=null?s:"Failed to fetch the chat response.");if(!I.body)throw new Error("The response body is empty.");return this.processResponseStream(I.body)}},jn=class extends rl{constructor(e={}){super(e)}processResponseStream(e){return wu({stream:e,schema:Gu}).pipeThrough(new TransformStream({async transform(t,r){if(!t.success)throw t.error;r.enqueue(t.value)}}))}},nl=class{constructor({generateId:e=Ec,id:t=e(),transport:r=new jn,messageMetadataSchema:n,dataPartSchemas:o,state:s,onError:i,onToolCall:a,onFinish:u,onData:c,sendAutomaticallyWhen:l}){this.activeResponse=void 0,this.jobExecutor=new el,this.sendMessage=async(d,v)=>{var m,_,I,h;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(m=this.lastMessage)==null?void 0:m.id,...v});return}let A;if("text"in d||"files"in d?A={parts:[...Array.isArray(d.files)?d.files:await tl(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:A=d,d.messageId!=null){const b=this.state.messages.findIndex(f=>f.id===d.messageId);if(b===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[b].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,b+1),this.state.replaceMessage(b,{...A,id:d.messageId,role:(_=A.role)!=null?_:"user",metadata:d.metadata})}else this.state.pushMessage({...A,id:(I=A.id)!=null?I:this.generateId(),role:(h=A.role)!=null?h:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...v})},this.regenerate=async({messageId:d,...v}={})=>{const m=d==null?this.state.messages.length-1:this.state.messages.findIndex(_=>_.id===d);if(m===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[m].role==="assistant"?m:m+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...v})},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:v,reason:m})=>this.jobExecutor.run(async()=>{var _,I;const h=this.state.messages,A=h[h.length-1],b=f=>pt(f)&&f.state==="approval-requested"&&f.approval.id===d?{...f,state:"approval-responded",approval:{id:d,approved:v,reason:m}}:f;this.state.replaceMessage(h.length-1,{...A,parts:A.parts.map(b)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(b)),this.status!=="streaming"&&this.status!=="submitted"&&((_=this.sendAutomaticallyWhen)!=null&&_.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(I=this.lastMessage)==null?void 0:I.id})}),this.addToolOutput=async({state:d="output-available",tool:v,toolCallId:m,output:_,errorText:I})=>this.jobExecutor.run(async()=>{var h,A;const b=this.state.messages,f=b[b.length-1],w=D=>pt(D)&&D.toolCallId===m?{...D,state:d,output:_,errorText:I}:D;this.state.replaceMessage(b.length-1,{...f,parts:f.parts.map(w)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(w)),this.status!=="streaming"&&this.status!=="submitted"&&((h=this.sendAutomaticallyWhen)!=null&&h.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(A=this.lastMessage)==null?void 0:A.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=i,this.onToolCall=a,this.onFinish=u,this.onData=c,this.sendAutomaticallyWhen=l}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,i,a,u;this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let l=!1,d=!1,v=!1;try{const m={state:Xu({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};m.abortController.signal.addEventListener("abort",()=>{l=!0}),this.activeResponse=m;let _;if(e==="resume-stream"){const h=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(h==null){this.setStatus({status:"ready"});return}_=h}else _=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:m.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:o});const I=h=>this.jobExecutor.run(()=>h({state:m.state,write:()=>{var A;this.setStatus({status:"streaming"}),m.state.message.id===((A=this.lastMessage)==null?void 0:A.id)?this.state.replaceMessage(this.state.messages.length-1,m.state.message):this.state.pushMessage(m.state.message)}}));await Ku({stream:qu({stream:_,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:I,onError:h=>{throw h}}),onError:h=>{throw h}}),this.setStatus({status:"ready"})}catch(m){if(l||m.name==="AbortError")return l=!0,this.setStatus({status:"ready"}),null;v=!0,m instanceof TypeError&&(m.message.toLowerCase().includes("fetch")||m.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&m instanceof Error&&this.onError(m),this.setStatus({status:"error",error:m})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:l,isDisconnect:d,isError:v,finishReason:(s=this.activeResponse)==null?void 0:s.state.finishReason})}catch(m){console.error(m)}this.activeResponse=void 0}(a=this.sendAutomaticallyWhen)!=null&&a.call(this,{messages:this.state.messages})&&!v&&await this.makeRequest({trigger:"submit-message",messageId:(u=this.lastMessage)==null?void 0:u.id,metadata:t,headers:r,body:n})}},En=globalThis&&globalThis.__assign||function(){return En=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},En.apply(this,arguments)};globalThis&&globalThis.__awaiter,globalThis&&globalThis.__generator,globalThis&&globalThis.__read,globalThis&&globalThis.__spreadArray;var ol=class{constructor(e){this.statusRef=g.ref("ready"),this.errorRef=g.ref(void 0),this.pushMessage=t=>{this.messagesRef.value=[...this.messagesRef.value,t]},this.popMessage=()=>{this.messagesRef.value=this.messagesRef.value.slice(0,-1)},this.replaceMessage=(t,r)=>{this.messagesRef.value[t]={...r}},this.snapshot=t=>t,this.messagesRef=g.ref(e??[])}get messages(){return this.messagesRef.value}set messages(e){this.messagesRef.value=e}get status(){return this.statusRef.value}set status(e){this.statusRef.value=e}get error(){return this.errorRef.value}set error(e){this.errorRef.value=e}},sl=class extends nl{constructor({messages:e,...t}){super({...t,state:new ol(e)})}};/**
54
54
  * @license lucide-vue-next v0.562.0 - ISC
55
55
  *
56
56
  * This source code is licensed under the ISC license.
@@ -80,4 +80,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
80
80
  *
81
81
  * This source code is licensed under the ISC license.
82
82
  * See the LICENSE file in the root directory of this source tree.
83
- */const dl=Cn("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),pl={class:"z-[1000] w-fit flex flex-col items-end relative gci-chatbot"},fl={class:"flex items-center justify-between"},gl={key:0,class:"chat-empty-state"},ml={class:"chat-empty-heading"},hl={class:"chat-empty-greeting"},Il={key:0,class:"flex justify-end"},yl={class:"message-user"},vl={key:1,class:"message-assistant"},Ml={key:1,src:xn,alt:"",class:"loading-message"},_l=["disabled"],Nl={class:"chat-actions"},bl={class:"tooltip bg-tooltip-chatbot"},Al={class:"px-[9px] py-[3px] flex-center w-full flex-1"},zl={class:"tooltip-label-bot"},wl=g.defineComponent({__name:"ChatbotComponent",props:{clientId:{type:String,default:""},endpoint:{type:String,default:""},token:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,n=g.ref(""),o=g.ref(!1),s=g.ref(null),i=g.ref(!1),a=g.ref(0),u=g.ref(!0),c=["Ask me anything you're curious about, and I will help you understand it clearly.","Have questions? I’m here to help make things easier.","Need clarity? Let me explain it in simple terms.","I can assist you with anything you're unsure about.","Don't hesitate—I'm just a question away!"],l=new sl({transport:new jn({api:"https://ai-chat-backend.dev02.dtsmart.dev/api/chat",body:{client_id:r.clientId,mcp_token:r.token}})}),d=async _=>{try{if(!n.value.trim())return;const m=n.value.trim();n.value="",i.value=!0,_.preventDefault(),await l.sendMessage({text:m})}catch(m){console.error(m)}finally{i.value=!1}},y=()=>{o.value=!o.value},h=()=>{o.value=!1,l.messages=[]};return g.watch(()=>l.messages,async()=>{var _;await g.nextTick(),(_=s.value)==null||_.scrollTo({top:s.value.scrollHeight,behavior:"smooth"})},{deep:!0}),g.onMounted(()=>{setInterval(()=>{u.value=!1,setTimeout(()=>{a.value=(a.value+1)%(c==null?void 0:c.length),u.value=!0},300)},6e3)}),(_,m)=>{var v;return g.openBlock(),g.createElementBlock(g.Fragment,null,[o.value?(g.openBlock(),g.createElementBlock("div",{key:0,class:"bg-[#ffffff00] absolute w-full h-full",onClick:m[0]||(m[0]=b=>o.value=!1)})):g.createCommentVNode("",!0),g.createElementVNode("div",pl,[g.createElementVNode("div",{class:g.normalizeClass(["ai-card chat-popup transition-all duration-7",{"opacity-0":!o.value,"opacity-100":o.value}])},[g.createElementVNode("div",fl,[m[2]||(m[2]=g.createElementVNode("p",{class:"ai-hello"},"Hi, I’m Boko AI",-1)),g.createElementVNode("button",{class:"ai-close",onClick:h},[g.createVNode(g.unref(dl))])]),g.createElementVNode("div",{ref_key:"scrollRef",ref:s,class:"chat-popup-message"},[g.unref(l).messages.length===0?(g.openBlock(),g.createElementBlock("div",gl,[g.createElementVNode("div",ml,[g.createElementVNode("p",hl," Hello "+g.toDisplayString(e.clientId),1),m[3]||(m[3]=g.createElementVNode("p",{class:"chat-empty-title"}," How Can I Help You Today ? ",-1))]),m[4]||(m[4]=g.createElementVNode("p",{class:"chat-empty-description"}," I’m Boko, your friendly assistant. ",-1)),m[5]||(m[5]=g.createElementVNode("p",{class:"chat-empty-description"}," Here to help — anytime you’re ready! ",-1))])):g.createCommentVNode("",!0),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(l).messages,(b,z)=>(g.openBlock(),g.createElementBlock("div",{key:b.id??z,class:"mb-3"},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(b==null?void 0:b.parts,(p,T)=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:`${b.id}-${p.type}-${T}`},[(p==null?void 0:p.type)==="text"?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[b.role==="user"?(g.openBlock(),g.createElementBlock("div",Il,[g.createElementVNode("div",yl,[g.createElementVNode("div",null,g.toDisplayString(p==null?void 0:p.text),1)])])):(g.openBlock(),g.createElementBlock("div",vl,[g.createElementVNode("div",null,g.toDisplayString(p==null?void 0:p.text),1)]))],64)):g.createCommentVNode("",!0)],64))),128))]))),128)),i.value?(g.openBlock(),g.createElementBlock("img",Ml)):g.createCommentVNode("",!0)],512),g.createElementVNode("form",{onSubmit:d,class:"ai-input-wrap"},[g.withDirectives(g.createElementVNode("input",{class:"ai-input","onUpdate:modelValue":m[1]||(m[1]=b=>n.value=b),placeholder:"Ask me anything…"},null,512),[[g.vModelText,n.value]]),g.createElementVNode("button",{class:"ai-send",disabled:!n.value||((v=n.value)==null?void 0:v.length)==0||i.value},[g.createVNode(g.unref(ll),{class:"w-5 h-5 text-white"})],8,_l)],32)],2),g.createVNode(g.Transition,{name:"fade-slide"},{default:g.withCtx(()=>[g.createElementVNode("div",Nl,[g.createElementVNode("div",{onClick:y,class:"chat-float"},[...m[6]||(m[6]=[g.createElementVNode("img",{src:Zn,alt:""},null,-1)])]),g.withDirectives(g.createElementVNode("div",{class:"content",onClick:y},[g.createElementVNode("div",bl,[m[7]||(m[7]=g.createElementVNode("span",{class:"tooltip-arrow"},[g.createElementVNode("svg",{width:"15",height:"23",viewBox:"0 0 15 23",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M14.5547 22.3335V0.000163078L0 9.19624L14.5547 22.3335Z",fill:"currentColor"})])],-1)),m[8]||(m[8]=g.createElementVNode("div",{class:"tooltip-header"},[g.createElementVNode("div",{class:"flex justify-start items-center"},[g.createElementVNode("p",{class:"tooltip-label"},"DigiAI"),g.createElementVNode("span",null,[g.createElementVNode("img",{src:Pn,alt:""})])]),g.createElementVNode("div",{class:"flex justify-start items-center"},[g.createElementVNode("p",{class:"tooltip-label"},"Try Now"),g.createElementVNode("span",null,[g.createElementVNode("svg",{width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M5.25003 3.82617L8.75 7.32617L5.25 10.8262",stroke:"#9970E2","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})])])])],-1)),g.createElementVNode("div",Al,[g.createElementVNode("p",zl,g.toDisplayString(c[a.value]),1)])])],512),[[g.vShow,u.value&&!o.value]])])]),_:1})])],64)}}});oe.ChatbotComponent=wl,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
83
+ */const dl=Cn("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),pl={class:"z-[1000] w-fit flex flex-col items-end relative gci-chatbot"},fl={class:"flex items-center justify-between"},gl={key:0,class:"chat-empty-state"},ml={class:"chat-empty-heading"},hl={class:"chat-empty-greeting"},Il={key:0,class:"flex justify-end"},yl={class:"message-user"},vl={key:1,class:"message-assistant"},Ml={key:1,src:xn,alt:"",class:"loading-message"},_l=["disabled"],Nl={class:"content"},bl={class:"tooltip bg-tooltip-chatbot"},Al={class:"px-[9px] py-[3px] flex-center w-full flex-1"},zl={class:"tooltip-label-bot"},wl=g.defineComponent({__name:"ChatbotComponent",props:{clientId:{type:String,default:""},endpoint:{type:String,default:""},token:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,n=g.ref(""),o=g.ref(!1),s=g.ref(null),i=g.ref(!1),a=g.ref(0),u=g.ref(!0),c=["Ask me anything you're curious about, and I will help you understand it clearly.","Have questions? I’m here to help make things easier.","Need clarity? Let me explain it in simple terms.","I can assist you with anything you're unsure about.","Don't hesitate—I'm just a question away!"],l=new sl({transport:new jn({api:"https://ai-chat-backend.dev02.dtsmart.dev/api/chat",body:{client_id:r.clientId,mcp_token:r.token}})}),d=async I=>{try{if(!n.value.trim())return;const h=n.value.trim();n.value="",i.value=!0,I.preventDefault(),await l.sendMessage({text:h})}catch(h){console.error(h)}finally{i.value=!1}},v=()=>{o.value=!o.value},m=()=>{o.value=!1,l.messages=[]};g.watch(()=>l.messages,async()=>{var I;await g.nextTick(),(I=s.value)==null||I.scrollTo({top:s.value.scrollHeight,behavior:"smooth"})},{deep:!0});let _;return g.onMounted(()=>{_=window.setInterval(()=>{c.length&&(u.value=!1,setTimeout(()=>{console.log(a.value,"182"),a.value=(a.value+1)%c.length,console.log(a.value,"185"),u.value=!0},300))},6e3)}),g.onUnmounted(()=>{_&&clearInterval(_)}),(I,h)=>{var A;return g.openBlock(),g.createElementBlock(g.Fragment,null,[o.value?(g.openBlock(),g.createElementBlock("div",{key:0,class:"bg-[#ffffff00] absolute w-full h-full",onClick:h[0]||(h[0]=b=>o.value=!1)})):g.createCommentVNode("",!0),g.createElementVNode("div",pl,[g.createElementVNode("div",{class:g.normalizeClass(["ai-card chat-popup transition-all duration-7",{"opacity-0":!o.value,"opacity-100":o.value}])},[g.createElementVNode("div",fl,[h[2]||(h[2]=g.createElementVNode("p",{class:"ai-hello"},"Hi, I’m Boko AI",-1)),g.createElementVNode("button",{class:"ai-close",onClick:m},[g.createVNode(g.unref(dl))])]),g.createElementVNode("div",{ref_key:"scrollRef",ref:s,class:"chat-popup-message"},[g.unref(l).messages.length===0?(g.openBlock(),g.createElementBlock("div",gl,[g.createElementVNode("div",ml,[g.createElementVNode("p",hl," Hello "+g.toDisplayString(e.clientId),1),h[3]||(h[3]=g.createElementVNode("p",{class:"chat-empty-title"}," How Can I Help You Today ? ",-1))]),h[4]||(h[4]=g.createElementVNode("p",{class:"chat-empty-description"}," I’m Boko, your friendly assistant. ",-1)),h[5]||(h[5]=g.createElementVNode("p",{class:"chat-empty-description"}," Here to help — anytime you’re ready! ",-1))])):g.createCommentVNode("",!0),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(l).messages,(b,f)=>(g.openBlock(),g.createElementBlock("div",{key:b.id??f,class:"mb-3"},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(b==null?void 0:b.parts,(w,D)=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:`${b.id}-${w.type}-${D}`},[(w==null?void 0:w.type)==="text"?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[b.role==="user"?(g.openBlock(),g.createElementBlock("div",Il,[g.createElementVNode("div",yl,[g.createElementVNode("div",null,g.toDisplayString(w==null?void 0:w.text),1)])])):(g.openBlock(),g.createElementBlock("div",vl,[g.createElementVNode("div",null,g.toDisplayString(w==null?void 0:w.text),1)]))],64)):g.createCommentVNode("",!0)],64))),128))]))),128)),i.value?(g.openBlock(),g.createElementBlock("img",Ml)):g.createCommentVNode("",!0)],512),g.createElementVNode("form",{onSubmit:d,class:"ai-input-wrap"},[g.withDirectives(g.createElementVNode("input",{class:"ai-input","onUpdate:modelValue":h[1]||(h[1]=b=>n.value=b),placeholder:"Ask me anything…"},null,512),[[g.vModelText,n.value]]),g.createElementVNode("button",{class:"ai-send",disabled:!n.value||((A=n.value)==null?void 0:A.length)==0||i.value},[g.createVNode(g.unref(ll),{class:"w-5 h-5 text-white"})],8,_l)],32)],2),g.createElementVNode("div",{class:"chat-actions",onClick:v},[g.createTextVNode(g.toDisplayString(u.value+"aaa")+" "+g.toDisplayString(a.value+"bbb")+" ",1),g.createVNode(g.Transition,{name:"fade-slide"},{default:g.withCtx(()=>[g.withDirectives(g.createElementVNode("div",Nl,[g.createElementVNode("div",bl,[h[6]||(h[6]=g.createElementVNode("span",{class:"tooltip-arrow"},[g.createElementVNode("svg",{width:"15",height:"23",viewBox:"0 0 15 23",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M14.5547 22.3335V0.000163078L0 9.19624L14.5547 22.3335Z",fill:"currentColor"})])],-1)),h[7]||(h[7]=g.createElementVNode("div",{class:"tooltip-header"},[g.createElementVNode("div",{class:"flex justify-start items-center"},[g.createElementVNode("p",{class:"tooltip-label"},"DigiAI"),g.createElementVNode("span",null,[g.createElementVNode("img",{src:Zn,alt:""})])]),g.createElementVNode("div",{class:"flex justify-start items-center"},[g.createElementVNode("p",{class:"tooltip-label"},"Try Now"),g.createElementVNode("span",null,[g.createElementVNode("svg",{width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M5.25003 3.82617L8.75 7.32617L5.25 10.8262",stroke:"#9970E2","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})])])])],-1)),g.createElementVNode("div",Al,[g.createElementVNode("p",zl,g.toDisplayString(c[a.value]),1)])])],512),[[g.vShow,u.value&&!o.value]])]),_:1}),g.createVNode(g.Transition,{name:"fade-slide"},{default:g.withCtx(()=>[...h[8]||(h[8]=[g.createElementVNode("div",{class:"chat-float"},[g.createElementVNode("img",{src:Pn,alt:""})],-1)])]),_:1})])])],64)}}});oe.ChatbotComponent=wl,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});