@mongodb-js/compass-web 0.30.4 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/10.1f1a54d3a40efd8c2017.mjs +2 -0
  2. package/dist/17.362fcb811ee2ff871d32.mjs +2 -0
  3. package/dist/{305.mjs → 273.f8171afff21603205990.mjs} +2 -2
  4. package/dist/276.30ea2a26f486be6e78b1.mjs +1 -0
  5. package/dist/414.1038db81de0771ae4f6c.mjs +371 -0
  6. package/dist/{737.mjs.LICENSE.txt → 414.1038db81de0771ae4f6c.mjs.LICENSE.txt} +10 -0
  7. package/dist/423.45723618046344488182.mjs +2 -0
  8. package/dist/{427.mjs → 427.ea0869d385dd7ebc1ee3.mjs} +1 -1
  9. package/dist/752.be311c1a6bd153169544.mjs +2 -0
  10. package/dist/887.a7a72716c079e9aa117e.mjs +2 -0
  11. package/dist/assets-manifest.json +13 -0
  12. package/dist/compass-web.d.ts +35 -12
  13. package/dist/compass-web.mjs +22 -22
  14. package/dist/{index-bde52cb3.mjs → index-bde52cb3.0f5ab0c9a2dfc578bd9d.mjs} +1 -1
  15. package/dist/tsdoc-metadata.json +1 -1
  16. package/package.json +45 -42
  17. package/dist/120.mjs +0 -2
  18. package/dist/680f69f3c2e6b90c1812.png +0 -0
  19. package/dist/737.mjs +0 -352
  20. package/dist/752.mjs +0 -2
  21. package/dist/790.mjs +0 -2
  22. package/dist/7ea3a6d428136b87ab95.png +0 -0
  23. package/dist/858.mjs +0 -2
  24. package/dist/955.mjs +0 -2
  25. package/dist/a4e0eb7ad904a4858361.svg +0 -156
  26. /package/dist/{858.mjs.LICENSE.txt → 10.1f1a54d3a40efd8c2017.mjs.LICENSE.txt} +0 -0
  27. /package/dist/{790.mjs.LICENSE.txt → 17.362fcb811ee2ff871d32.mjs.LICENSE.txt} +0 -0
  28. /package/dist/{305.mjs.LICENSE.txt → 273.f8171afff21603205990.mjs.LICENSE.txt} +0 -0
  29. /package/dist/{955.mjs.LICENSE.txt → 423.45723618046344488182.mjs.LICENSE.txt} +0 -0
  30. /package/dist/{427.mjs.LICENSE.txt → 427.ea0869d385dd7ebc1ee3.mjs.LICENSE.txt} +0 -0
  31. /package/dist/{752.mjs.LICENSE.txt → 752.be311c1a6bd153169544.mjs.LICENSE.txt} +0 -0
  32. /package/dist/{120.mjs.LICENSE.txt → 887.a7a72716c079e9aa117e.mjs.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__=276;export const __webpack_esm_ids__=[276];export const __webpack_esm_modules__={160:(e,t,n)=>{const a=n(98855);e.exports=(e,t)=>{const n=a(e,t);return n&&n.prerelease.length?n.prerelease:null}},1280:(e,t,n)=>{n.d(t,{$O:()=>x,$S:()=>X,Au:()=>z,Be:()=>l,Bj:()=>g,Ct:()=>v,Dl:()=>h,ER:()=>Q,Eb:()=>V,F7:()=>j,FO:()=>se,Fk:()=>G,Fn:()=>d,G1:()=>T,G8:()=>D,Hi:()=>U,Il:()=>ae,KA:()=>Y,KB:()=>E,Kn:()=>N,LK:()=>R,Mu:()=>s,Ny:()=>b,Pw:()=>y,Rl:()=>o,Tx:()=>q,Uy:()=>I,WN:()=>ne,YA:()=>W,Zm:()=>F,_L:()=>M,_z:()=>_,aC:()=>m,bS:()=>ee,cU:()=>$,dR:()=>J,dZ:()=>oe,db:()=>A,em:()=>L,f2:()=>O,fU:()=>ie,fs:()=>f,gP:()=>w,hH:()=>K,jw:()=>P,lo:()=>te,m9:()=>B,nA:()=>u,pY:()=>c,qF:()=>H,qG:()=>C,qm:()=>Z,rk:()=>S,rt:()=>k,tB:()=>i,wA:()=>p,xY:()=>re});var a=n(71295),r=n(72510);function o(e,t){return new e({type:"string",...r.A2(t)})}function s(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...r.A2(t)})}function i(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...r.A2(t)})}function l(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...r.A2(t)})}function u(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...r.A2(t)})}function c(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...r.A2(t)})}function p(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...r.A2(t)})}function d(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...r.A2(t)})}function m(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...r.A2(t)})}function h(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...r.A2(t)})}function f(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...r.A2(t)})}function g(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...r.A2(t)})}function v(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...r.A2(t)})}function y(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...r.A2(t)})}function _(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...r.A2(t)})}function b(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...r.A2(t)})}function x(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...r.A2(t)})}function I(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...r.A2(t)})}function w(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...r.A2(t)})}function k(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...r.A2(t)})}function $(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...r.A2(t)})}function E(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...r.A2(t)})}function S(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...r.A2(t)})}function T(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...r.A2(t)})}function A(e,t){return new e({type:"string",format:"date",check:"string_format",...r.A2(t)})}function N(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...r.A2(t)})}function O(e,t){return new e({type:"string",format:"duration",check:"string_format",...r.A2(t)})}function j(e,t){return new e({type:"number",checks:[],...r.A2(t)})}function C(e,t){return new e({type:"number",coerce:!0,checks:[],...r.A2(t)})}function R(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...r.A2(t)})}function M(e,t){return new e({type:"boolean",...r.A2(t)})}function P(e,t){return new e({type:"null",...r.A2(t)})}function Y(e){return new e({type:"any"})}function L(e){return new e({type:"unknown"})}function D(e,t){return new e({type:"never",...r.A2(t)})}function z(e,t){return new a.sm({check:"less_than",...r.A2(t),value:e,inclusive:!1})}function F(e,t){return new a.sm({check:"less_than",...r.A2(t),value:e,inclusive:!0})}function q(e,t){return new a.J_({check:"greater_than",...r.A2(t),value:e,inclusive:!1})}function Z(e,t){return new a.J_({check:"greater_than",...r.A2(t),value:e,inclusive:!0})}function U(e,t){return new a.Jk({check:"multiple_of",...r.A2(t),value:e})}function V(e,t){return new a.Yk({check:"max_length",...r.A2(t),maximum:e})}function B(e,t){return new a.Kk({check:"min_length",...r.A2(t),minimum:e})}function W(e,t){return new a.RM({check:"length_equals",...r.A2(t),length:e})}function G(e,t){return new a.DG({check:"string_format",format:"regex",...r.A2(t),pattern:e})}function K(e){return new a.NI({check:"string_format",format:"lowercase",...r.A2(e)})}function H(e){return new a.kH({check:"string_format",format:"uppercase",...r.A2(e)})}function J(e,t){return new a.Tt({check:"string_format",format:"includes",...r.A2(t),includes:e})}function X(e,t){return new a.J({check:"string_format",format:"starts_with",...r.A2(t),prefix:e})}function Q(e,t){return new a.E6({check:"string_format",format:"ends_with",...r.A2(t),suffix:e})}function ee(e){return new a.v$({check:"overwrite",tx:e})}function te(e){return ee((t=>t.normalize(e)))}function ne(){return ee((e=>e.trim()))}function ae(){return ee((e=>e.toLowerCase()))}function re(){return ee((e=>e.toUpperCase()))}function oe(e,t,n){return new e({type:"array",element:t,...r.A2(n)})}function se(e,t,n){const a=r.A2(n);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:t,...a})}function ie(e,t,n){return new e({type:"custom",check:"custom",fn:t,...r.A2(n)})}},1726:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},2420:(e,t,n)=>{n.d(t,{qg:()=>l,EJ:()=>u,xL:()=>c,bp:()=>p});var a=n(84527),r=n(99629),o=n(49189);const s=(e,t)=>{r.a$.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>r.Wk(e,t)},flatten:{value:t=>r.JM(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},i=(o.xI("ZodError",s),o.xI("ZodError",s,{Parent:Error})),l=a.Tj(i),u=a.Rb(i),c=a.Od(i),p=a.wG(i)},4113:(e,t,n)=>{const a=n(98855);e.exports=(e,t)=>{const n=a(e,null,!0),r=a(t,null,!0),o=n.compare(r);if(0===o)return null;const s=o>0,i=s?n:r,l=s?r:n,u=!!i.prerelease.length;if(l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(i))return l.minor&&!l.patch?"minor":"patch"}const c=u?"pre":"";return n.major!==r.major?c+"major":n.minor!==r.minor?c+"minor":n.patch!==r.patch?c+"patch":"prerelease"}},4414:e=>{function t(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},e.exports=t},4827:(e,t,n)=>{const a=n(87866);e.exports=(e,t,n)=>a(e,t,"<",n)},5544:(e,t,n)=>{const a=n(26620),r=n(32056),o=n(51269),s=n(54838),i=n(18082),l=n(71851);e.exports=(e,t,n,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return a(e,n,u);case"!=":return r(e,n,u);case">":return o(e,n,u);case">=":return s(e,n,u);case"<":return i(e,n,u);case"<=":return l(e,n,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},6340:(e,t,n)=>{var a=n(54420);e.exports=new a({include:[n(15037)]})},7263:(e,t,n)=>{n.d(t,{AC:()=>C,Ak:()=>l,Gl:()=>r,K3:()=>_,OI:()=>x,Os:()=>c,Rp:()=>d,Yj:()=>T,Z0:()=>o,Zg:()=>h,Zv:()=>R,ai:()=>N,ch:()=>j,fO:()=>i,gF:()=>a,hQ:()=>I,kB:()=>E,kM:()=>s,l7:()=>y,nd:()=>A,p0:()=>u,p6:()=>k,r0:()=>b,uR:()=>p,uX:()=>f,ug:()=>g,w$:()=>S,zM:()=>O,zr:()=>v});const a=/^[cC][^\s-]{8,}$/,r=/^[0-9a-z]+$/,o=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,s=/^[0-9a-vA-V]{20}$/,i=/^[A-Za-z0-9]{27}$/,l=/^[a-zA-Z0-9_-]{21}$/,u=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,c=/^([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})$/,p=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)$/,d=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,m="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function h(){return new RegExp(m,"u")}const f=/^(?:(?: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])$/,g=/^(([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})$/,v=/^((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])$/,y=/^(([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])$/,_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,b=/^[A-Za-z0-9_-]*$/,x=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,I=/^\+(?:[0-9]){6,14}[0-9]$/,w="(?:(?:\\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])))",k=new RegExp(`^${w}$`);function $(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function E(e){return new RegExp(`^${$(e)}$`)}function S(e){const t=$({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${w}T(?:${a})$`)}const T=e=>new RegExp(`^${e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*"}$`),A=/^\d+$/,N=/^-?\d+(?:\.\d+)?/i,O=/true|false/i,j=/null/i,C=/^[^A-Z]*$/,R=/^[^a-z]*$/},7774:(e,t,n)=>{n.d(t,{e1:()=>Ze,mD:()=>Ft,m2:()=>De,Z9:()=>cn,ej:()=>dn,n_:()=>pn,HD:()=>sn,Ds:()=>rn,hK:()=>Ve,sl:()=>an,cV:()=>on,wA:()=>tn,CR:()=>ze,cb:()=>Fe,o8:()=>hn,$C:()=>Be,u1:()=>We,$b:()=>nt,G1:()=>Je,zf:()=>Ge,R:()=>at,v0:()=>Gt,qs:()=>rt,ID:()=>Dt,WL:()=>ot,x3:()=>st,HQ:()=>it,qx:()=>Xe,_Z:()=>Kt,xI:()=>Ht,S:()=>Qt,GU:()=>Xt,hd:()=>nn,N8:()=>Wt,ZZ:()=>Bt,k5:()=>Vt,WZ:()=>Qe,ae:()=>mn,jN:()=>Ut});var a=n(12240),r=n(39581),o=n(72510);class s{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??r.fd,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;const a=e._zod.def,r={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema;const l={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,l);const u=e._zod.toJSONSchema?.();if(u)l.schema=u;else{const n={...t,schemaPath:[...t.schemaPath,e],path:t.path},s=e._zod.parent;if(s)l.ref=s,this.process(s,n),this.seen.get(s).isParent=!0;else{const t=l.schema;switch(a.type){case"string":{const n=t;n.type="string";const{minimum:a,maximum:o,format:s,patterns:i,contentEncoding:u}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),s&&(n.format=r[s]??s,""===n.format&&delete n.format),u&&(n.contentEncoding=u),i&&i.size>0){const e=[...i];1===e.length?n.pattern=e[0].source:e.length>1&&(l.schema.allOf=[...e.map((e=>({..."draft-7"===this.target?{type:"string"}:{},pattern:e.source})))])}break}case"number":{const n=t,{minimum:a,maximum:r,format:o,multipleOf:s,exclusiveMaximum:i,exclusiveMinimum:l}=e._zod.bag;"string"==typeof o&&o.includes("int")?n.type="integer":n.type="number","number"==typeof l&&(n.exclusiveMinimum=l),"number"==typeof a&&(n.minimum=a,"number"==typeof l&&(l>=a?delete n.minimum:delete n.exclusiveMinimum)),"number"==typeof i&&(n.exclusiveMaximum=i),"number"==typeof r&&(n.maximum=r,"number"==typeof i&&(i<=r?delete n.maximum:delete n.exclusiveMaximum)),"number"==typeof s&&(n.multipleOf=s);break}case"boolean":case"success":t.type="boolean";break;case"bigint":if("throw"===this.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema");break;case"symbol":if("throw"===this.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema");break;case"null":t.type="null";break;case"any":case"unknown":break;case"undefined":if("throw"===this.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema");break;case"void":if("throw"===this.unrepresentable)throw new Error("Void cannot be represented in JSON Schema");break;case"never":t.not={};break;case"date":if("throw"===this.unrepresentable)throw new Error("Date cannot be represented in JSON Schema");break;case"array":{const r=t,{minimum:o,maximum:s}=e._zod.bag;"number"==typeof o&&(r.minItems=o),"number"==typeof s&&(r.maxItems=s),r.type="array",r.items=this.process(a.element,{...n,path:[...n.path,"items"]});break}case"object":{const e=t;e.type="object",e.properties={};const r=a.shape;for(const t in r)e.properties[t]=this.process(r[t],{...n,path:[...n.path,"properties",t]});const o=new Set(Object.keys(r)),s=new Set([...o].filter((e=>{const t=a.shape[e]._zod;return"input"===this.io?void 0===t.optin:void 0===t.optout})));s.size>0&&(e.required=Array.from(s)),"never"===a.catchall?._zod.def.type?e.additionalProperties=!1:a.catchall?a.catchall&&(e.additionalProperties=this.process(a.catchall,{...n,path:[...n.path,"additionalProperties"]})):"output"===this.io&&(e.additionalProperties=!1);break}case"union":t.anyOf=a.options.map(((e,t)=>this.process(e,{...n,path:[...n.path,"anyOf",t]})));break;case"intersection":{const e=t,r=this.process(a.left,{...n,path:[...n.path,"allOf",0]}),o=this.process(a.right,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,i=[...s(r)?r.allOf:[r],...s(o)?o.allOf:[o]];e.allOf=i;break}case"tuple":{const r=t;r.type="array";const o=a.items.map(((e,t)=>this.process(e,{...n,path:[...n.path,"prefixItems",t]})));if("draft-2020-12"===this.target?r.prefixItems=o:r.items=o,a.rest){const e=this.process(a.rest,{...n,path:[...n.path,"items"]});"draft-2020-12"===this.target?r.items=e:r.additionalItems=e}a.rest&&(r.items=this.process(a.rest,{...n,path:[...n.path,"items"]}));const{minimum:s,maximum:i}=e._zod.bag;"number"==typeof s&&(r.minItems=s),"number"==typeof i&&(r.maxItems=i);break}case"record":{const e=t;e.type="object",e.propertyNames=this.process(a.keyType,{...n,path:[...n.path,"propertyNames"]}),e.additionalProperties=this.process(a.valueType,{...n,path:[...n.path,"additionalProperties"]});break}case"map":if("throw"===this.unrepresentable)throw new Error("Map cannot be represented in JSON Schema");break;case"set":if("throw"===this.unrepresentable)throw new Error("Set cannot be represented in JSON Schema");break;case"enum":{const e=t,n=(0,o.w5)(a.entries);n.every((e=>"number"==typeof e))&&(e.type="number"),n.every((e=>"string"==typeof e))&&(e.type="string"),e.enum=n;break}case"literal":{const e=t,n=[];for(const e of a.values)if(void 0===e){if("throw"===this.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===this.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");n.push(Number(e))}else n.push(e);if(0===n.length);else if(1===n.length){const t=n[0];e.type=null===t?"null":typeof t,e.const=t}else n.every((e=>"number"==typeof e))&&(e.type="number"),n.every((e=>"string"==typeof e))&&(e.type="string"),n.every((e=>"boolean"==typeof e))&&(e.type="string"),n.every((e=>null===e))&&(e.type="null"),e.enum=n;break}case"file":{const n=t,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:r,maximum:o,mime:s}=e._zod.bag;void 0!==r&&(a.minLength=r),void 0!==o&&(a.maxLength=o),s?1===s.length?(a.contentMediaType=s[0],Object.assign(n,a)):n.anyOf=s.map((e=>({...a,contentMediaType:e}))):Object.assign(n,a);break}case"transform":if("throw"===this.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema");break;case"nullable":{const e=this.process(a.innerType,n);t.anyOf=[e,{type:"null"}];break}case"nonoptional":case"promise":case"optional":this.process(a.innerType,n),l.ref=a.innerType;break;case"default":this.process(a.innerType,n),l.ref=a.innerType,t.default=JSON.parse(JSON.stringify(a.defaultValue));break;case"prefault":this.process(a.innerType,n),l.ref=a.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(a.defaultValue)));break;case"catch":{let e;this.process(a.innerType,n),l.ref=a.innerType;try{e=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=e;break}case"nan":if("throw"===this.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema");break;case"template_literal":{const n=t,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=a.source;break}case"pipe":{const e="input"===this.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;this.process(e,n),l.ref=e;break}case"readonly":this.process(a.innerType,n),l.ref=a.innerType,t.readOnly=!0;break;case"lazy":{const t=e._zod.innerType;this.process(t,n),l.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")}}}const c=this.metadataRegistry.get(e);return c&&Object.assign(l.schema,c),"input"===this.io&&i(e)&&(delete l.schema.examples,delete l.schema.default),"input"===this.io&&l.schema._prefault&&((n=l.schema).default??(n.default=l.schema._prefault)),delete l.schema._prefault,this.seen.get(e).schema}emit(e,t){const n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},a=this.seen.get(e);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=e=>{const t="draft-2020-12"===this.target?"$defs":"definitions";if(n.external){const a=n.external.registry.get(e[0])?.id,r=n.external.uri??(e=>e);if(a)return{ref:r(a)};const o=e[1].defId??e[1].schema.id??"schema"+this.counter++;return e[1].defId=o,{defId:o,ref:`${r("__shared")}#/${t}/${o}`}}if(e[1]===a)return{ref:"#"};const r=`#/${t}/`,o=e[1].schema.id??"__schema"+this.counter++;return{defId:o,ref:r+o}},o=e=>{if(e[1].schema.$ref)return;const t=e[1],{ref:n,defId:a}=r(e);t.def={...t.schema},a&&(t.defId=a);const o=t.schema;for(const e in o)delete o[e];o.$ref=n};if("throw"===n.cycles)for(const e of this.seen.entries()){const t=e[1];if(t.cycle)throw new Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const t of this.seen.entries()){const a=t[1];if(e===t[0]){o(t);continue}if(n.external){const a=n.external.registry.get(t[0])?.id;if(e!==t[0]&&a){o(t);continue}}const r=this.metadataRegistry.get(t[0])?.id;(r||a.cycle||a.count>1&&"ref"===n.reused)&&o(t)}const s=(e,t)=>{const n=this.seen.get(e),a=n.def??n.schema,r={...a};if(null===n.ref)return;const o=n.ref;if(n.ref=null,o){s(o,t);const e=this.seen.get(o).schema;e.$ref&&"draft-7"===t.target?(a.allOf=a.allOf??[],a.allOf.push(e)):(Object.assign(a,e),Object.assign(a,r))}n.isParent||this.override({zodSchema:e,jsonSchema:a,path:n.path??[]})};for(const e of[...this.seen.entries()].reverse())s(e[0],{target:this.target});const i={};if("draft-2020-12"===this.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-7"===this.target?i.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){const t=n.external.registry.get(e)?.id;if(!t)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(t)}Object.assign(i,a.def);const l=n.external?.defs??{};for(const e of this.seen.entries()){const t=e[1];t.def&&t.defId&&(l[t.defId]=t.def)}n.external||Object.keys(l).length>0&&("draft-2020-12"===this.target?i.$defs=l:i.definitions=l);try{return JSON.parse(JSON.stringify(i))}catch(e){throw new Error("Error converting schema to JSON.")}}}function i(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;switch(a.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":case"custom":case"success":case"catch":return!1;case"array":return i(a.element,n);case"object":for(const e in a.shape)if(i(a.shape[e],n))return!0;return!1;case"union":for(const e of a.options)if(i(e,n))return!0;return!1;case"intersection":return i(a.left,n)||i(a.right,n);case"tuple":for(const e of a.items)if(i(e,n))return!0;return!(!a.rest||!i(a.rest,n));case"record":case"map":return i(a.keyType,n)||i(a.valueType,n);case"set":return i(a.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":case"default":case"prefault":return i(a.innerType,n);case"lazy":return i(a.getter(),n);case"transform":return!0;case"pipe":return i(a.in,n)||i(a.out,n)}throw new Error(`Unknown schema type: ${a.type}`)}var l,u,c=n(2420);!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(l||(l={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(u||(u={}));const p=l.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),d=e=>{switch(typeof e){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(e)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(e)?p.array:null===e?p.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?p.promise:"undefined"!=typeof Map&&e instanceof Map?p.map:"undefined"!=typeof Set&&e instanceof Set?p.set:"undefined"!=typeof Date&&e instanceof Date?p.date:p.object;default:return p.unknown}},m=l.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 h extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(e){if(!(e instanceof h))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,l.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}h.create=e=>new h(e);const f=(e,t)=>{let n;switch(e.code){case m.invalid_type:n=e.received===p.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,l.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:n=`Unrecognized key(s) in object: ${l.joinValues(e.keys,", ")}`;break;case m.invalid_union:n="Invalid input";break;case m.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${l.joinValues(e.options)}`;break;case m.invalid_enum_value:n=`Invalid enum value. Expected ${l.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:n="Invalid function arguments";break;case m.invalid_return_type:n="Invalid function return type";break;case m.invalid_date:n="Invalid date";break;case m.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:l.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case m.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case m.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case m.custom:n="Invalid input";break;case m.invalid_intersection_types:n="Intersection results could not be merged";break;case m.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:n="Number must be finite";break;default:n=t.defaultError,l.assertNever(e)}return{message:n}};let g=f;var v;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(v||(v={}));function y(e,t){const n=g,a=(e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,o=[...n,...r.path||[]],s={...r,path:o};if(void 0!==r.message)return{...r,path:o,message:r.message};let i="";const l=a.filter((e=>!!e)).slice().reverse();for(const e of l)i=e(s,{data:t,defaultError:i}).message;return{...r,path:o,message:i}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===f?void 0:f].filter((e=>!!e))});e.common.issues.push(a)}class _{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return b;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return _.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return b;if("aborted"===r.status)return b;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}}const b=Object.freeze({status:"aborted"}),x=e=>({status:"dirty",value:e}),I=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,k=e=>"dirty"===e.status,$=e=>"valid"===e.status,E=e=>"undefined"!=typeof Promise&&e instanceof Promise;var S=n(9606).URL;class T{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const A=(e,t)=>{if($(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new h(e.common.issues);return this._error=t,this._error}}};function N(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:r}:{errorMap:(t,r)=>{const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??r.defaultError}:void 0===r.data?{message:o??a??r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:o??n??r.defaultError}},description:r}}class O{get description(){return this._def.description}_getType(e){return d(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:d(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _,ctx:{common:e.parent.common,data:e.data,parsedType:d(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(E(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)},a=this._parseSync({data:e,path:n.path,parent:n});return A(n,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return $(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>$(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(E(a)?a:Promise.resolve(a));return A(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const r=e(t),o=()=>a.addIssue({code:m.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(o(),!1))):!!r||(o(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new Se({schema:this,typeName:Pe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Te.create(this,this._def)}nullable(){return Ae.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return de.create(this)}promise(){return Ee.create(this,this._def)}or(e){return fe.create([this,e],this._def)}and(e){return ve.create(this,e,this._def)}transform(e){return new Se({...N(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ne({...N(this._def),innerType:this,defaultValue:t,typeName:Pe.ZodDefault})}brand(){return new Ce({typeName:Pe.ZodBranded,type:this,...N(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Oe({...N(this._def),innerType:this,catchValue:t,typeName:Pe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const j=/^c[^\s-]{8,}$/i,C=/^[0-9a-z]+$/,R=/^[0-9A-HJKMNP-TV-Z]{26}$/i,M=/^[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}$/i,P=/^[a-z0-9_-]{21}$/i,Y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,L=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,D=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let z;const F=/^(?:(?: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])$/,q=/^(?:(?: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])$/,Z=/^(([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]))$/,U=/^(([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])$/,V=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,W="((\\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])))",G=new RegExp(`^${W}$`);function K(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function H(e){let t=`${W}T${K(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function J(e,t){if(!Y.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return!("object"!=typeof r||null===r||"typ"in r&&"JWT"!==r?.typ||!r.alg||t&&r.alg!==t)}catch{return!1}}function X(e,t){return!("v4"!==t&&t||!q.test(e))||!("v6"!==t&&t||!U.test(e))}class Q extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.string,received:t.parsedType}),b}const t=new _;let n;for(const o of this._def.checks)if("min"===o.kind)e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("max"===o.kind)e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("length"===o.kind){const a=e.data.length>o.value,r=e.data.length<o.value;(a||r)&&(n=this._getOrReturnCtx(e,n),a?y(n,{code:m.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):r&&y(n,{code:m.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),t.dirty())}else if("email"===o.kind)D.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"email",code:m.invalid_string,message:o.message}),t.dirty());else if("emoji"===o.kind)z||(z=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),z.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"emoji",code:m.invalid_string,message:o.message}),t.dirty());else if("uuid"===o.kind)M.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"uuid",code:m.invalid_string,message:o.message}),t.dirty());else if("nanoid"===o.kind)P.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"nanoid",code:m.invalid_string,message:o.message}),t.dirty());else if("cuid"===o.kind)j.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid",code:m.invalid_string,message:o.message}),t.dirty());else if("cuid2"===o.kind)C.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid2",code:m.invalid_string,message:o.message}),t.dirty());else if("ulid"===o.kind)R.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ulid",code:m.invalid_string,message:o.message}),t.dirty());else if("url"===o.kind)try{new S(e.data)}catch{n=this._getOrReturnCtx(e,n),y(n,{validation:"url",code:m.invalid_string,message:o.message}),t.dirty()}else"regex"===o.kind?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"regex",code:m.invalid_string,message:o.message}),t.dirty())):"trim"===o.kind?e.data=e.data.trim():"includes"===o.kind?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),t.dirty()):"toLowerCase"===o.kind?e.data=e.data.toLowerCase():"toUpperCase"===o.kind?e.data=e.data.toUpperCase():"startsWith"===o.kind?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{startsWith:o.value},message:o.message}),t.dirty()):"endsWith"===o.kind?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{endsWith:o.value},message:o.message}),t.dirty()):"datetime"===o.kind?H(o).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"datetime",message:o.message}),t.dirty()):"date"===o.kind?G.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"date",message:o.message}),t.dirty()):"time"===o.kind?new RegExp(`^${K(o)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"time",message:o.message}),t.dirty()):"duration"===o.kind?L.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"duration",code:m.invalid_string,message:o.message}),t.dirty()):"ip"===o.kind?(a=e.data,("v4"!==(r=o.version)&&r||!F.test(a))&&("v6"!==r&&r||!Z.test(a))&&(n=this._getOrReturnCtx(e,n),y(n,{validation:"ip",code:m.invalid_string,message:o.message}),t.dirty())):"jwt"===o.kind?J(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"jwt",code:m.invalid_string,message:o.message}),t.dirty()):"cidr"===o.kind?X(e.data,o.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cidr",code:m.invalid_string,message:o.message}),t.dirty()):"base64"===o.kind?V.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64",code:m.invalid_string,message:o.message}),t.dirty()):"base64url"===o.kind?B.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64url",code:m.invalid_string,message:o.message}),t.dirty()):l.assertNever(o);var a,r;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:m.invalid_string,...v.errToObj(n)})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...v.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new Q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ee(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}Q.create=e=>new Q({checks:[],typeName:Pe.ZodString,coerce:e?.coerce??!1,...N(e)});class te extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.number,received:t.parsedType}),b}let t;const n=new _;for(const a of this._def.checks)"int"===a.kind?l.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),y(t,{code:m.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:m.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:m.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==ee(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),y(t,{code:m.not_finite,message:a.message}),n.dirty()):l.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,a){return new te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(a)}]})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&l.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}te.create=e=>new te({checks:[],typeName:Pe.ZodNumber,coerce:e?.coerce||!1,...N(e)});class ne extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let t;const n=new _;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:m.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:m.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),y(t,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):l.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.bigint,received:t.parsedType}),b}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,a){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(a)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ne.create=e=>new ne({checks:[],typeName:Pe.ZodBigInt,coerce:e?.coerce??!1,...N(e)});class ae extends O{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==p.boolean){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.boolean,received:t.parsedType}),b}return I(e.data)}}ae.create=e=>new ae({typeName:Pe.ZodBoolean,coerce:e?.coerce||!1,...N(e)});class re extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.date,received:t.parsedType}),b}if(Number.isNaN(e.data.getTime()))return y(this._getOrReturnCtx(e),{code:m.invalid_date}),b;const t=new _;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):l.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}re.create=e=>new re({checks:[],coerce:e?.coerce||!1,typeName:Pe.ZodDate,...N(e)});class oe extends O{_parse(e){if(this._getType(e)!==p.symbol){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.symbol,received:t.parsedType}),b}return I(e.data)}}oe.create=e=>new oe({typeName:Pe.ZodSymbol,...N(e)});class se extends O{_parse(e){if(this._getType(e)!==p.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.undefined,received:t.parsedType}),b}return I(e.data)}}se.create=e=>new se({typeName:Pe.ZodUndefined,...N(e)});class ie extends O{_parse(e){if(this._getType(e)!==p.null){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.null,received:t.parsedType}),b}return I(e.data)}}ie.create=e=>new ie({typeName:Pe.ZodNull,...N(e)});class le extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}}le.create=e=>new le({typeName:Pe.ZodAny,...N(e)});class ue extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}}ue.create=e=>new ue({typeName:Pe.ZodUnknown,...N(e)});class ce extends O{_parse(e){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.never,received:t.parsedType}),b}}ce.create=e=>new ce({typeName:Pe.ZodNever,...N(e)});class pe extends O{_parse(e){if(this._getType(e)!==p.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.void,received:t.parsedType}),b}return I(e.data)}}pe.create=e=>new pe({typeName:Pe.ZodVoid,...N(e)});class de extends O{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==p.array)return y(t,{code:m.invalid_type,expected:p.array,received:t.parsedType}),b;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(y(t,{code:e?m.too_big:m.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(y(t,{code:m.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(y(t,{code:m.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new T(t,e,t.path,n))))).then((e=>_.mergeArray(n,e)));const r=[...t.data].map(((e,n)=>a.type._parseSync(new T(t,e,t.path,n))));return _.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new de({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new de({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new de({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}function me(e){if(e instanceof he){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Te.create(me(a))}return new he({...e._def,shape:()=>t})}return e instanceof de?new de({...e._def,type:me(e.element)}):e instanceof Te?Te.create(me(e.unwrap())):e instanceof Ae?Ae.create(me(e.unwrap())):e instanceof ye?ye.create(e.items.map((e=>me(e)))):e}de.create=(e,t)=>new de({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...N(t)});class he extends O{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=l.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.object,received:t.parsedType}),b}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),o=[];if(!(this._def.catchall instanceof ce&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||o.push(e);const s=[];for(const e of r){const t=a[e],r=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new T(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ce){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)o.length>0&&(y(n,{code:m.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const a=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new T(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of s){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>_.mergeObjectSync(t,e))):_.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new he({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const a=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:v.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new he({...this._def,unknownKeys:"strip"})}passthrough(){return new he({...this._def,unknownKeys:"passthrough"})}extend(e){return new he({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new he({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new he({...this._def,catchall:e})}pick(e){const t={};for(const n of l.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new he({...this._def,shape:()=>t})}omit(e){const t={};for(const n of l.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new he({...this._def,shape:()=>t})}deepPartial(){return me(this)}partial(e){const t={};for(const n of l.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()}return new he({...this._def,shape:()=>t})}required(e){const t={};for(const n of l.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Te;)e=e._def.innerType;t[n]=e}return new he({...this._def,shape:()=>t})}keyof(){return we(l.objectKeys(this.shape))}}he.create=(e,t)=>new he({shape:()=>e,unknownKeys:"strip",catchall:ce.create(),typeName:Pe.ZodObject,...N(t)}),he.strictCreate=(e,t)=>new he({shape:()=>e,unknownKeys:"strict",catchall:ce.create(),typeName:Pe.ZodObject,...N(t)}),he.lazycreate=(e,t)=>new he({shape:e,unknownKeys:"strip",catchall:ce.create(),typeName:Pe.ZodObject,...N(t)});class fe extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new h(e.ctx.common.issues)));return y(t,{code:m.invalid_union,unionErrors:n}),b}));{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},o=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map((e=>new h(e)));return y(t,{code:m.invalid_union,unionErrors:r}),b}}get options(){return this._def.options}}function ge(e,t){const n=d(e),a=d(t);if(e===t)return{valid:!0,data:e};if(n===p.object&&a===p.object){const n=l.objectKeys(t),a=l.objectKeys(e).filter((e=>-1!==n.indexOf(e))),r={...e,...t};for(const n of a){const a=ge(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===p.array&&a===p.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=ge(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===p.date&&a===p.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}fe.create=(e,t)=>new fe({options:e,typeName:Pe.ZodUnion,...N(t)});class ve extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(w(e)||w(a))return b;const r=ge(e.value,a.value);return r.valid?((k(e)||k(a))&&t.dirty(),{status:t.value,value:r.data}):(y(n,{code:m.invalid_intersection_types}),b)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ve.create=(e,t,n)=>new ve({left:e,right:t,typeName:Pe.ZodIntersection,...N(n)});class ye extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return y(n,{code:m.invalid_type,expected:p.array,received:n.parsedType}),b;if(n.data.length<this._def.items.length)return y(n,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&n.data.length>this._def.items.length&&(y(n,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new T(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>_.mergeArray(t,e))):_.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ye({...this._def,rest:e})}}ye.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ye({items:e,typeName:Pe.ZodTuple,rest:null,...N(t)})};class _e extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return y(n,{code:m.invalid_type,expected:p.map,received:n.parsedType}),b;const a=this._def.keyType,r=this._def.valueType,o=[...n.data.entries()].map((([e,t],o)=>({key:a._parse(new T(n,e,n.path,[o,"key"])),value:r._parse(new T(n,t,n.path,[o,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of o){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return b;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of o){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return b;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}}_e.create=(e,t,n)=>new _e({valueType:t,keyType:e,typeName:Pe.ZodMap,...N(n)});class be extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return y(n,{code:m.invalid_type,expected:p.set,received:n.parsedType}),b;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(y(n,{code:m.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(y(n,{code:m.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function o(e){const n=new Set;for(const a of e){if("aborted"===a.status)return b;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map(((e,t)=>r._parse(new T(n,e,n.path,t))));return n.common.async?Promise.all(s).then((e=>o(e))):o(s)}min(e,t){return new be({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new be({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}be.create=(e,t)=>new be({valueType:e,minSize:null,maxSize:null,typeName:Pe.ZodSet,...N(t)});class xe extends O{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}xe.create=(e,t)=>new xe({getter:e,typeName:Pe.ZodLazy,...N(t)});class Ie extends O{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}}function we(e,t){return new ke({values:e,typeName:Pe.ZodEnum,...N(t)})}Ie.create=(e,t)=>new Ie({value:e,typeName:Pe.ZodLiteral,...N(t)});class ke extends O{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return y(t,{expected:l.joinValues(n),received:t.parsedType,code:m.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return y(t,{received:t.data,code:m.invalid_enum_value,options:n}),b}return I(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ke.create(e,{...this._def,...t})}exclude(e,t=this._def){return ke.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ke.create=we;class $e extends O{_parse(e){const t=l.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const e=l.objectValues(t);return y(n,{expected:l.joinValues(e),received:n.parsedType,code:m.invalid_type}),b}if(this._cache||(this._cache=new Set(l.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=l.objectValues(t);return y(n,{received:n.data,code:m.invalid_enum_value,options:e}),b}return I(e.data)}get enum(){return this._def.values}}$e.create=(e,t)=>new $e({values:e,typeName:Pe.ZodNativeEnum,...N(t)});class Ee extends O{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&!1===t.common.async)return y(t,{code:m.invalid_type,expected:p.promise,received:t.parsedType}),b;const n=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return I(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ee.create=(e,t)=>new Ee({type:e,typeName:Pe.ZodPromise,...N(t)});class Se extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return b;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?b:"dirty"===a.status||"dirty"===t.value?x(a.value):a}));{if("aborted"===t.value)return b;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?b:"dirty"===a.status||"dirty"===t.value?x(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?b:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?b:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$(e))return b;const o=a.transform(e.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>$(e)?Promise.resolve(a.transform(e.value,r)).then((e=>({status:t.value,value:e}))):b))}l.assertNever(a)}}Se.create=(e,t,n)=>new Se({schema:e,typeName:Pe.ZodEffects,effect:t,...N(n)}),Se.createWithPreprocess=(e,t,n)=>new Se({schema:t,effect:{type:"preprocess",transform:e},typeName:Pe.ZodEffects,...N(n)});class Te extends O{_parse(e){return this._getType(e)===p.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Te.create=(e,t)=>new Te({innerType:e,typeName:Pe.ZodOptional,...N(t)});class Ae extends O{_parse(e){return this._getType(e)===p.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:Pe.ZodNullable,...N(t)});class Ne extends O{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ne.create=(e,t)=>new Ne({innerType:e,typeName:Pe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...N(t)});class Oe extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return E(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new h(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new h(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Oe.create=(e,t)=>new Oe({innerType:e,typeName:Pe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...N(t)});class je extends O{_parse(e){if(this._getType(e)!==p.nan){const t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:p.nan,received:t.parsedType}),b}return{status:"valid",value:e.data}}}je.create=e=>new je({typeName:Pe.ZodNaN,...N(e)}),Symbol("zod_brand");class Ce extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Re extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?b:"dirty"===e.status?(t.dirty(),x(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?b:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Re({in:e,out:t,typeName:Pe.ZodPipeline})}}class Me extends O{_parse(e){const t=this._def.innerType._parse(e),n=e=>($(e)&&(e.value=Object.freeze(e.value)),e);return E(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}var Pe;Me.create=(e,t)=>new Me({innerType:e,typeName:Pe.ZodReadonly,...N(t)}),he.lazycreate,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"}(Pe||(Pe={})),Q.create,te.create,je.create,ne.create,ae.create,re.create,oe.create,se.create,ie.create,le.create,ue.create,ce.create,pe.create,de.create,he.create,he.strictCreate,fe.create,ve.create,ye.create,_e.create,be.create,xe.create,Ie.create,ke.create,$e.create,Ee.create,Se.create,Te.create,Ae.create,Se.createWithPreprocess,Re.create;var Ye=n(29744),Le=n(65994).e;function De(...e){return e.reduce(((e,t)=>({...e,...null!=t?t:{}})),{})}function ze({tools:e=[],providerToolNames:t}){const n={},a={};for(const r of e)if("provider"===r.type&&r.id in t){const e=t[r.id];n[r.name]=e,a[e]=r.name}return{toProviderToolName:e=>{var t;return null!=(t=n[e])?t:e},toCustomToolName:e=>{var t;return null!=(t=a[e])?t:e}}}async function Fe(e,t){if(null==e)return Promise.resolve();const n=null==t?void 0:t.abortSignal;return new Promise(((t,a)=>{if(null==n?void 0:n.aborted)return void a(qe());const r=setTimeout((()=>{o(),t()}),e),o=()=>{clearTimeout(r),null==n||n.removeEventListener("abort",s)},s=()=>{o(),a(qe())};null==n||n.addEventListener("abort",s)}))}function qe(){return new DOMException("Delay was aborted","AbortError")}var Ze=class{constructor(){this.status={type:"pending"},this._resolve=void 0,this._reject=void 0}get promise(){return this._promise||(this._promise=new Promise(((e,t)=>{"resolved"===this.status.type?e(this.status.value):"rejected"===this.status.type&&t(this.status.error),this._resolve=e,this._reject=t}))),this._promise}resolve(e){var t;this.status={type:"resolved",value:e},this._promise&&(null==(t=this._resolve)||t.call(this,e))}reject(e){var t;this.status={type:"rejected",error:e},this._promise&&(null==(t=this._reject)||t.call(this,e))}isResolved(){return"resolved"===this.status.type}isRejected(){return"rejected"===this.status.type}isPending(){return"pending"===this.status.type}};function Ue(e){return Object.fromEntries([...e.headers])}var Ve=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const o=()=>{const e=n.length,a=new Array(t);for(let r=0;r<t;r++)a[r]=n[Math.random()*e|0];return a.join("")};if(null==e)return o;if(n.includes(r))throw new a.Di({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${o()}`},Be=Ve();function We(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}function Ge(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}var Ke=["fetch failed","failed to fetch"];function He({error:e,url:t,requestBodyValues:n}){if(Ge(e))return e;if(e instanceof TypeError&&Ke.includes(e.message.toLowerCase())){const r=e.cause;if(null!=r)return new a.hL({message:`Cannot connect to API: ${r.message}`,cause:r,url:t,requestBodyValues:n,isRetryable:!0})}return e}function Je(e=globalThis){var t,n,a;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(a=null==(n=e.process)?void 0:n.versions)?void 0:a.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Xe(e){if(null==e)return{};const t={};if(e instanceof Headers)e.forEach(((e,n)=>{t[n.toLowerCase()]=e}));else{Array.isArray(e)||(e=Object.entries(e));for(const[n,a]of e)null!=a&&(t[n.toLowerCase()]=a)}return t}function Qe(e,...t){const n=new Headers(Xe(e)),a=n.get("user-agent")||"";return n.set("user-agent",[a,...t].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var et="4.0.0-beta.47",tt=()=>globalThis.fetch,nt=async({url:e,headers:t={},successfulResponseHandler:n,failedResponseHandler:r,abortSignal:o,fetch:s=tt()})=>{try{const i=await s(e,{method:"GET",headers:Qe(t,`ai-sdk/provider-utils/${et}`,Je()),signal:o}),l=Ue(i);if(!i.ok){let t;try{t=await r({response:i,url:e,requestBodyValues:{}})}catch(t){if(Ge(t)||a.hL.isInstance(t))throw t;throw new a.hL({message:"Failed to process error response",cause:t,statusCode:i.status,url:e,responseHeaders:l,requestBodyValues:{}})}throw t.value}try{return await n({response:i,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(Ge(t)||a.hL.isInstance(t)))throw t;throw new a.hL({message:"Failed to process successful response",cause:t,statusCode:i.status,url:e,responseHeaders:l,requestBodyValues:{}})}}catch(t){throw He({error:t,url:e,requestBodyValues:{}})}};function at(e){return null!=e}function rt({mediaType:e,url:t,supportedUrls:n}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(n).map((([e,t])=>{const n=e.toLowerCase();return"*"===n||"*/*"===n?{mediaTypePrefix:"",regexes:t}:{mediaTypePrefix:n.replace(/\*/,""),regexes:t}})).filter((({mediaTypePrefix:t})=>e.startsWith(t))).flatMap((({regexes:e})=>e)).some((e=>e.test(t)))}function ot({apiKey:e,environmentVariableName:t,apiKeyParameterName:n="apiKey",description:r}){if("string"==typeof e)return e;if(null!=e)throw new a.Kq({message:`${r} API key must be a string.`});if(void 0===Le)throw new a.Kq({message:`${r} API key is missing. Pass it using the '${n}' parameter. Environment variables is not supported in this environment.`});if(null==(e=Le.env[t]))throw new a.Kq({message:`${r} API key is missing. Pass it using the '${n}' parameter or the ${t} environment variable.`});if("string"!=typeof e)throw new a.Kq({message:`${r} API key must be a string. The value of the ${t} environment variable is not a string.`});return e}function st({settingValue:e,environmentVariableName:t}){return"string"==typeof e||null==e&&void 0!==Le&&null!=(e=Le.env[t])&&"string"==typeof e?e:void 0}function it(e){var t;const[n,a=""]=e.toLowerCase().split("/");return null!=(t={mpeg:"mp3","x-wav":"wav",opus:"ogg",mp4:"m4a","x-m4a":"m4a"}[a])?t:a}var lt=/"__proto__"\s*:/,ut=/"constructor"\s*:/;function ct(e){const t=JSON.parse(e);return null===t||"object"!=typeof t||!1===lt.test(e)&&!1===ut.test(e)?t:function(e){let t=[e];for(;t.length;){const e=t;t=[];for(const n of e){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 e in n){const a=n[e];a&&"object"==typeof a&&t.push(a)}}}return e}(t)}function pt(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return ct(e)}try{return ct(e)}finally{Error.stackTraceLimit=t}}function dt(e){if("object"===e.type){e.additionalProperties=!1;const t=e.properties;if(null!=t)for(const e in t)t[e]=dt(t[e])}return"array"===e.type&&null!=e.items&&(Array.isArray(e.items)?e.items=e.items.map((e=>dt(e))):e.items=dt(e.items)),e}var mt=e=>()=>e.toJsonSchema(),ht=e=>async()=>{try{const{JSONSchema:t}=await Promise.resolve().then((function(){var e=new Error("Cannot find module 'effect'");throw e.code="MODULE_NOT_FOUND",e}));return t.make(e)}catch(e){throw new Error("Failed to import module 'effect'")}},ft=e=>async()=>{try{const{toJsonSchema:t}=await Promise.resolve().then((function(){var e=new Error("Cannot find module '@valibot/to-json-schema'");throw e.code="MODULE_NOT_FOUND",e}));return t(e)}catch(e){throw new Error("Failed to import module '@valibot/to-json-schema'")}},gt=Symbol("Let zodToJsonSchema decide on which parser to use"),vt={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"};function yt(e,t){return Rt(e.type._def,t)}function _t(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map(((n,a)=>_t(e,t,n)))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return bt(e)}}var bt=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value}return t},xt=void 0,It={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:()=>(void 0===xt&&(xt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),xt),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 wt(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":n.minLength="number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value;break;case"max":n.maxLength="number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value;break;case"email":switch(t.emailStrategy){case"format:email":Et(n,"email",a.message,t);break;case"format:idn-email":Et(n,"idn-email",a.message,t);break;case"pattern:zod":St(n,It.email,a.message,t)}break;case"url":Et(n,"uri",a.message,t);break;case"uuid":Et(n,"uuid",a.message,t);break;case"regex":St(n,a.regex,a.message,t);break;case"cuid":St(n,It.cuid,a.message,t);break;case"cuid2":St(n,It.cuid2,a.message,t);break;case"startsWith":St(n,RegExp(`^${kt(a.value,t)}`),a.message,t);break;case"endsWith":St(n,RegExp(`${kt(a.value,t)}$`),a.message,t);break;case"datetime":Et(n,"date-time",a.message,t);break;case"date":Et(n,"date",a.message,t);break;case"time":Et(n,"time",a.message,t);break;case"duration":Et(n,"duration",a.message,t);break;case"length":n.minLength="number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,n.maxLength="number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value;break;case"includes":St(n,RegExp(kt(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&Et(n,"ipv4",a.message,t),"v4"!==a.version&&Et(n,"ipv6",a.message,t);break;case"base64url":St(n,It.base64url,a.message,t);break;case"jwt":St(n,It.jwt,a.message,t);break;case"cidr":"v6"!==a.version&&St(n,It.ipv4Cidr,a.message,t),"v4"!==a.version&&St(n,It.ipv6Cidr,a.message,t);break;case"emoji":St(n,It.emoji(),a.message,t);break;case"ulid":St(n,It.ulid,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Et(n,"binary",a.message,t);break;case"contentEncoding:base64":n.contentEncoding="base64";break;case"pattern:zod":St(n,It.base64,a.message,t)}break;case"nanoid":St(n,It.nanoid,a.message,t)}return n}function kt(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)$t.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var $t=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Et(e,t,n,a){var r;e.format||(null==(r=e.anyOf)?void 0:r.some((e=>e.format)))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&a.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function St(e,t,n,a){var r;e.pattern||(null==(r=e.allOf)?void 0:r.some((e=>e.pattern)))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Tt(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Tt(t,a)}function Tt(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),o=e.flags.includes("s"),s=a?e.source.toLowerCase():e.source;let i="",l=!1,u=!1,c=!1;for(let e=0;e<s.length;e++)if(l)i+=s[e],l=!1;else{if(a)if(u){if(s[e].match(/[a-z]/)){c?(i+=s[e],i+=`${s[e-2]}-${s[e]}`.toUpperCase(),c=!1):"-"===s[e+1]&&(null==(n=s[e+2])?void 0:n.match(/[a-z]/))?(i+=s[e],c=!0):i+=`${s[e]}${s[e].toUpperCase()}`;continue}}else if(s[e].match(/[a-z]/)){i+=`[${s[e]}${s[e].toUpperCase()}]`;continue}if(r){if("^"===s[e]){i+="(^|(?<=[\r\n]))";continue}if("$"===s[e]){i+="($|(?=[\r\n]))";continue}}o&&"."===s[e]?i+=u?`${s[e]}\r\n`:`[${s[e]}\r\n]`:(i+=s[e],"\\"===s[e]?l=!0:u&&"]"===s[e]?u=!1:u||"["!==s[e]||(u=!0))}try{new RegExp(i)}catch(n){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 i}function At(e,t){var n,a,r,o,s,i;const l={type:"object",additionalProperties:null!=(n=Rt(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?n:t.allowedAdditionalProperties};if((null==(a=e.keyType)?void 0:a._def.typeName)===Pe.ZodString&&(null==(r=e.keyType._def.checks)?void 0:r.length)){const{type:n,...a}=wt(e.keyType._def,t);return{...l,propertyNames:a}}if((null==(o=e.keyType)?void 0:o._def.typeName)===Pe.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if((null==(s=e.keyType)?void 0:s._def.typeName)===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&(null==(i=e.keyType._def.type._def.checks)?void 0:i.length)){const{type:n,...a}=yt(e.keyType._def,t);return{...l,propertyNames:a}}return l}var Nt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Ot(e){try{return e.isOptional()}catch(e){return!0}}var jt=(e,t,n)=>{switch(t){case Pe.ZodString:return wt(e,n);case Pe.ZodNumber:return function(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}(e);case Pe.ZodObject:return function(e,t){const n={type:"object",properties:{}},a=[],r=e.shape();for(const e in r){let o=r[e];if(void 0===o||void 0===o._def)continue;const s=Ot(o),i=Rt(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==i&&(n.properties[e]=i,s||a.push(e))}a.length&&(n.required=a);const o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Rt(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(n.additionalProperties=o),n}(e,n);case Pe.ZodBigInt:return function(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}(e);case Pe.ZodBoolean:return{type:"boolean"};case Pe.ZodDate:return _t(e,n);case Pe.ZodUndefined:return{not:{}};case Pe.ZodNull:return{type:"null"};case Pe.ZodArray:return function(e,t){var n,a,r;const o={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(r=null==(a=e.type)?void 0:a._def)?void 0:r.typeName)!==Pe.ZodAny&&(o.items=Rt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(o.minItems=e.minLength.value),e.maxLength&&(o.maxItems=e.maxLength.value),e.exactLength&&(o.minItems=e.exactLength.value,o.maxItems=e.exactLength.value),o}(e,n);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return function(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every((e=>e._def.typeName in Nt&&(!e._def.checks||!e._def.checks.length)))){const e=n.reduce(((e,t)=>{const n=Nt[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e}),[]);return{type:e.length>1?e:e[0]}}if(n.every((e=>"ZodLiteral"===e._def.typeName&&!e.description))){const e=n.reduce(((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}}),[]);if(e.length===n.length){const t=e.filter(((e,t,n)=>n.indexOf(e)===t));return{type:t.length>1?t:t[0],enum:n.reduce(((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value]),[])}}}else if(n.every((e=>"ZodEnum"===e._def.typeName)))return{type:"string",enum:n.reduce(((e,t)=>[...e,...t._def.values.filter((t=>!e.includes(t)))]),[])};return((e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map(((e,n)=>Rt(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]}))).filter((e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0)));return n.length?{anyOf:n}:void 0})(e,t)}(e,n);case Pe.ZodIntersection:return function(e,t){const n=[Rt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Rt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((e=>!!e)),a=[];return n.forEach((e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...a}=e;t=a}a.push(t)}else a.push(...e.allOf);var t})),a.length?{allOf:a}:void 0}(e,n);case Pe.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map(((e,n)=>Rt(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[]),additionalItems:Rt(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map(((e,n)=>Rt(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[])}}(e,n);case Pe.ZodRecord:return At(e,n);case Pe.ZodLiteral:return function(e){const t=typeof e.value;return"bigint"!==t&&"number"!==t&&"boolean"!==t&&"string"!==t?{type:Array.isArray(e.value)?"array":"object"}:{type:"bigint"===t?"integer":t,const:e.value}}(e);case Pe.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Pe.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter((e=>"number"!=typeof t[t[e]])).map((e=>t[e])),a=Array.from(new Set(n.map((e=>typeof e))));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:n}}(e);case Pe.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Nt[e.innerType._def.typeName],"null"]};const n=Rt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Pe.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Rt(e.innerType._def,t);const a=Rt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:{}},a]}:{}})(e,n);case Pe.ZodMap:return function(e,t){return"record"===t.mapStrategy?At(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Rt(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},Rt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}(e,n);case Pe.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Rt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}(e,n);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return function(e,t){return Rt(e.type._def,t)}(e,n);case Pe.ZodNaN:case Pe.ZodNever:return{not:{}};case Pe.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Rt(e.schema._def,t):{}}(e,n);case Pe.ZodAny:case Pe.ZodUnknown:return{};case Pe.ZodDefault:return function(e,t){return{...Rt(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Pe.ZodBranded:return yt(e,n);case Pe.ZodReadonly:case Pe.ZodCatch:return((e,t)=>Rt(e.innerType._def,t))(e,n);case Pe.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Rt(e.in._def,t);if("output"===t.pipeStrategy)return Rt(e.out._def,t);const n=Rt(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Rt(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter((e=>void 0!==e))}})(e,n);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:default:return}},Ct=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Rt(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const o=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(o!==gt)return o}if(r&&!n){const e=Mt(r,t);if(void 0!==e)return e}const o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);const s=jt(e,e.typeName,t),i="function"==typeof s?Rt(s(),t):s;if(i&&Pt(e,t,i),t.postProcess){const n=t.postProcess(i,e,t);return o.jsonSchema=i,n}return o.jsonSchema=i,i}var Mt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ct(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(((e,n)=>t.currentPath[n]===e))?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):"seen"===t.$refStrategy?{}:void 0}},Pt=(e,t,n)=>(e.description&&(n.description=e.description),n),Yt=(e,t)=>{var n;const a=(e=>{const t=(e=>"string"==typeof e?{...vt,name:e}:{...vt,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map((([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}])))}})(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce(((e,[t,n])=>{var r;return{...e,[t]:null!=(r=Rt(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:{}}}),{}):void 0;const o="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,s=null!=(n=Rt(e._def,void 0===o?a:{...a,currentPath:[...a.basePath,a.definitionPath,o]},!1))?n:{},i="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==i&&(s.title=i);const l=void 0===o?r?{...s,[a.definitionPath]:r}:s:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,o].join("/"),[a.definitionPath]:{...r,[o]:s}};return l.$schema="http://json-schema.org/draft-07/schema#",l},Lt=Symbol.for("vercel.ai.schema");function Dt(e){let t;return()=>(null==t&&(t=e()),t)}function zt(e,{validate:t}={}){return{[Lt]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function Ft(e){return null==e?zt({properties:{},additionalProperties:!1}):"object"==typeof(t=e)&&null!==t&&Lt in t&&!0===t[Lt]&&"jsonSchema"in t&&"validate"in t?e:"~standard"in e?function(e){const t=e["~standard"].vendor;switch(t){case"zod":return Ut(e);case"arktype":return qt(e,mt);case"effect":return qt(e,ht);case"valibot":return qt(e,ft);default:return qt(e,(()=>()=>{throw new Error(`Unsupported standard schema vendor: ${t}`)}))}}(e):e();var t}function qt(e,t){return zt(t(e),{validate:async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new a.iM({value:t,cause:n.issues})}}})}function Zt(e,t){var n;const a=null!=(n=null==t?void 0:t.useReferences)&&n;return zt((()=>dt(function(e,t){if(e instanceof r.rs){const n=new s(t),a={};for(const t of e._idmap.entries()){const[e,a]=t;n.process(a)}const r={},o={registry:e,uri:t?.uri,defs:a};for(const a of e._idmap.entries()){const[e,s]=a;r[e]=n.emit(s,{...t,external:o})}if(Object.keys(a).length>0){const e="draft-2020-12"===n.target?"$defs":"definitions";r.__shared={[e]:a}}return{schemas:r}}const n=new s(t);return n.process(e),n.emit(e,t)}(e,{target:"draft-7",io:"input",reused:a?"ref":"inline"}))),{validate:async t=>{const n=await c.bp(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Ut(e,t){return function(e){return"_zod"in e}(e)?Zt(e,t):function(e,t){var n;const a=null!=(n=null==t?void 0:t.useReferences)&&n;return zt((()=>Yt(e,{$refStrategy:a?"root":"none"})),{validate:async t=>{const n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}(e,t)}async function Vt({value:e,schema:t}){const n=await Bt({value:e,schema:t});if(!n.success)throw a.iM.wrap({value:e,cause:n.error});return n.value}async function Bt({value:e,schema:t}){const n=Ft(t);try{if(null==n.validate)return{success:!0,value:e,rawValue:e};const t=await n.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:a.iM.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:a.iM.wrap({value:e,cause:t}),rawValue:e}}}async function Wt({text:e,schema:t}){try{const n=pt(e);return null==t?{success:!0,value:n,rawValue:n}:await Bt({value:n,schema:t})}catch(t){return{success:!1,error:a.u6.isInstance(t)?t:new a.u6({text:e,cause:t}),rawValue:void 0}}}function Gt(e){try{return pt(e),!0}catch(e){return!1}}function Kt({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ye.Z).pipeThrough(new TransformStream({async transform({data:e},n){"[DONE]"!==e&&n.enqueue(await Wt({text:e,schema:t}))}}))}async function Ht({provider:e,providerOptions:t,schema:n}){if(null==(null==t?void 0:t[e]))return;const r=await Bt({value:t[e],schema:n});if(!r.success)throw new a.Di({argument:"providerOptions",message:`invalid ${e} provider options`,cause:r.error});return r.value}var Jt=()=>globalThis.fetch,Xt=async({url:e,headers:t,body:n,failedResponseHandler:a,successfulResponseHandler:r,abortSignal:o,fetch:s})=>en({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:a,successfulResponseHandler:r,abortSignal:o,fetch:s}),Qt=async({url:e,headers:t,formData:n,failedResponseHandler:a,successfulResponseHandler:r,abortSignal:o,fetch:s})=>en({url:e,headers:t,body:{content:n,values:Object.fromEntries(n.entries())},failedResponseHandler:a,successfulResponseHandler:r,abortSignal:o,fetch:s}),en=async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:o,abortSignal:s,fetch:i=Jt()})=>{try{const l=await i(e,{method:"POST",headers:Qe(t,`ai-sdk/provider-utils/${et}`,Je()),body:n.content,signal:s}),u=Ue(l);if(!l.ok){let t;try{t=await o({response:l,url:e,requestBodyValues:n.values})}catch(t){if(Ge(t)||a.hL.isInstance(t))throw t;throw new a.hL({message:"Failed to process error response",cause:t,statusCode:l.status,url:e,responseHeaders:u,requestBodyValues:n.values})}throw t.value}try{return await r({response:l,url:e,requestBodyValues:n.values})}catch(t){if(t instanceof Error&&(Ge(t)||a.hL.isInstance(t)))throw t;throw new a.hL({message:"Failed to process successful response",cause:t,statusCode:l.status,url:e,responseHeaders:u,requestBodyValues:n.values})}}catch(t){throw He({error:t,url:e,requestBodyValues:n.values})}};function tn({id:e,inputSchema:t,outputSchema:n}){return({execute:a,needsApproval:r,toModelOutput:o,onInputStart:s,onInputDelta:i,onInputAvailable:l,...u})=>({type:"provider",id:e,args:u,inputSchema:t,outputSchema:n,execute:a,needsApproval:r,toModelOutput:o,onInputStart:s,onInputDelta:i,onInputAvailable:l})}async function nn(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var an=({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:o,requestBodyValues:s})=>{const i=await r.text(),l=Ue(r);if(""===i.trim())return{responseHeaders:l,value:new a.hL({message:r.statusText,url:o,requestBodyValues:s,statusCode:r.status,responseHeaders:l,responseBody:i,isRetryable:null==n?void 0:n(r)})};try{const u=await async function({text:e,schema:t}){try{const n=pt(e);return null==t?n:Vt({value:n,schema:t})}catch(t){if(a.u6.isInstance(t)||a.iM.isInstance(t))throw t;throw new a.u6({text:e,cause:t})}}({text:i,schema:e});return{responseHeaders:l,value:new a.hL({message:t(u),url:o,requestBodyValues:s,statusCode:r.status,responseHeaders:l,responseBody:i,data:u,isRetryable:null==n?void 0:n(r,u)})}}catch(e){return{responseHeaders:l,value:new a.hL({message:r.statusText,url:o,requestBodyValues:s,statusCode:r.status,responseHeaders:l,responseBody:i,isRetryable:null==n?void 0:n(r)})}}},rn=e=>async({response:t})=>{const n=Ue(t);if(null==t.body)throw new a.Tt({});return{responseHeaders:n,value:Kt({stream:t.body,schema:e})}},on=e=>async({response:t,url:n,requestBodyValues:r})=>{const o=await t.text(),s=await Wt({text:o,schema:e}),i=Ue(t);if(!s.success)throw new a.hL({message:"Invalid JSON response",cause:s.error,statusCode:t.status,responseHeaders:i,responseBody:o,url:n,requestBodyValues:r});return{responseHeaders:i,value:s.value,rawValue:s.rawValue}},sn=()=>async({response:e,url:t,requestBodyValues:n})=>{const r=Ue(e);if(!e.body)throw new a.hL({message:"Response body is empty",url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0});try{const t=await e.arrayBuffer();return{responseHeaders:r,value:new Uint8Array(t)}}catch(o){throw new a.hL({message:"Failed to read response as array buffer",url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0,cause:o})}},{btoa:ln,atob:un}=globalThis;function cn(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=un(t);return Uint8Array.from(n,(e=>e.codePointAt(0)))}function pn(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCodePoint(e[n]);return ln(t)}function dn(e){return e instanceof Uint8Array?pn(e):e}function mn(e){return null==e?void 0:e.replace(/\/$/,"")}async function*hn({execute:e,input:t,options:n}){const a=e(t,n);if(null!=(r=a)&&"function"==typeof r[Symbol.asyncIterator]){let e;for await(const t of a)e=t,yield{type:"preliminary",output:t};yield{type:"final",output:e}}else yield{type:"final",output:await a};var r}},9357:(e,t,n)=>{const a=n(88825);e.exports=(e,t)=>new a(e,t).minor},9982:(e,t,n)=>{const a=n(56206);e.exports=(e,t)=>e.sort(((e,n)=>a(e,n,t)))},10560:(e,t,n)=>{var a;try{a=n(20745)}catch(e){"undefined"!=typeof window&&(a=window.esprima)}var r=n(40811);e.exports=new r("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=a.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",r=a.parse(n,{range:!0}),o=[];if("Program"!==r.type||1!==r.body.length||"ExpressionStatement"!==r.body[0].type||"ArrowFunctionExpression"!==r.body[0].expression.type&&"FunctionExpression"!==r.body[0].expression.type)throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach((function(e){o.push(e.name)})),t=r.body[0].expression.body.range,"BlockStatement"===r.body[0].expression.body.type?new Function(o,n.slice(t[0]+1,t[1]-1)):new Function(o,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},11710:(e,t,n)=>{var a=n(99174);function r(e,t,n,a,r){this.name=e,this.buffer=t,this.position=n,this.line=a,this.column=r}r.prototype.getSnippet=function(e,t){var n,r,o,s,i;if(!this.buffer)return null;for(e=e||4,t=t||75,n="",r=this.position;r>0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(r-1));)if(r-=1,this.position-r>t/2-1){n=" ... ",r+=5;break}for(o="",s=this.position;s<this.buffer.length&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(s));)if((s+=1)-this.position>t/2-1){o=" ... ",s-=5;break}return i=this.buffer.slice(r,s),a.repeat(" ",e)+n+i+o+"\n"+a.repeat(" ",e+this.position-r+n.length)+"^"},r.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},e.exports=r},12169:(e,t,n)=>{const a=n(88825);e.exports=(e,t)=>new a(e,t).major},13349:e=>{e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},13445:(e,t,n)=>{var a=n(40811),r=Object.prototype.toString;e.exports=new a("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,o,s,i=e;for(s=new Array(i.length),t=0,n=i.length;t<n;t+=1){if(a=i[t],"[object Object]"!==r.call(a))return!1;if(1!==(o=Object.keys(a)).length)return!1;s[t]=[o[0],a[o[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,a,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1)a=s[t],r=Object.keys(a),o[t]=[r[0],a[r[0]]];return o}})},14753:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),a="";if("/"===t[0]){if(n&&(a=n[1]),a.length>3)return!1;if("/"!==t[t.length-a.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),a="";return"/"===t[0]&&(n&&(a=n[1]),t=t.slice(1,t.length-a.length-1)),new RegExp(t,a)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},14982:function(e,t,n){var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,r)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.wrapField=t.getFilteredCompletions=void 0,r(n(63131),t),r(n(93766),t),r(n(51626),t),r(n(64900),t),r(n(92133),t),r(n(85070),t),r(n(48080),t),r(n(79223),t),r(n(51098),t),r(n(79984),t),r(n(35593),t),r(n(40214),t);var o=n(21410);Object.defineProperty(t,"getFilteredCompletions",{enumerable:!0,get:function(){return o.getFilteredCompletions}}),Object.defineProperty(t,"wrapField",{enumerable:!0,get:function(){return o.wrapField}}),r(n(57136),t),r(n(37504),t)},15037:(e,t,n)=>{var a=n(54420);e.exports=new a({include:[n(91714)],implicit:[n(89295),n(81602),n(48013),n(44490)]})},18082:(e,t,n)=>{const a=n(25583);e.exports=(e,t,n)=>a(e,t,n)<0},18184:(e,t,n)=>{var a=n(54420);e.exports=new a({include:[n(6340)],implicit:[n(78316),n(45848)],explicit:[n(52711),n(27195),n(13445),n(51228)]})},20360:(e,t,n)=>{const a=/\s+/g;class r{constructor(e,t){if(t=s(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof i)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(a," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!v(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&y(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&f)|(this.options.loose&&g))+":"+e,n=o.get(t);if(n)return n;const a=this.options.loose,r=a?c[p.HYPHENRANGELOOSE]:c[p.HYPHENRANGE];e=e.replace(r,N(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(c[p.COMPARATORTRIM],d),l("comparator trim",e),e=e.replace(c[p.TILDETRIM],m),l("tilde trim",e),e=e.replace(c[p.CARETTRIM],h),l("caret trim",e);let s=e.split(" ").map((e=>b(e,this.options))).join(" ").split(/\s+/).map((e=>A(e,this.options)));a&&(s=s.filter((e=>(l("loose invalid filter",e,this.options),!!e.match(c[p.COMPARATORLOOSE]))))),l("range list",s);const u=new Map,y=s.map((e=>new i(e,this.options)));for(const e of y){if(v(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");const _=[...u.values()];return o.set(t,_),_}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some((n=>_(n,t)&&e.set.some((e=>_(e,t)&&n.every((n=>e.every((e=>n.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(O(this.set[t],e,this.options))return!0;return!1}}e.exports=r;const o=new(n(13349)),s=n(40594),i=n(67105),l=n(95869),u=n(88825),{safeRe:c,t:p,comparatorTrimReplace:d,tildeTrimReplace:m,caretTrimReplace:h}=n(36165),{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:g}=n(64136),v=e=>"<0.0.0-0"===e.value,y=e=>""===e.value,_=(e,t)=>{let n=!0;const a=e.slice();let r=a.pop();for(;n&&a.length;)n=a.every((e=>r.intersects(e,t))),r=a.pop();return n},b=(e,t)=>(l("comp",e,t),e=k(e,t),l("caret",e),e=I(e,t),l("tildes",e),e=E(e,t),l("xrange",e),e=T(e,t),l("stars",e),e),x=e=>!e||"x"===e.toLowerCase()||"*"===e,I=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const n=t.loose?c[p.TILDELOOSE]:c[p.TILDE];return e.replace(n,((t,n,a,r,o)=>{let s;return l("tilde",e,t,n,a,r,o),x(n)?s="":x(a)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:x(r)?s=`>=${n}.${a}.0 <${n}.${+a+1}.0-0`:o?(l("replaceTilde pr",o),s=`>=${n}.${a}.${r}-${o} <${n}.${+a+1}.0-0`):s=`>=${n}.${a}.${r} <${n}.${+a+1}.0-0`,l("tilde return",s),s}))},k=(e,t)=>e.trim().split(/\s+/).map((e=>$(e,t))).join(" "),$=(e,t)=>{l("caret",e,t);const n=t.loose?c[p.CARETLOOSE]:c[p.CARET],a=t.includePrerelease?"-0":"";return e.replace(n,((t,n,r,o,s)=>{let i;return l("caret",e,t,n,r,o,s),x(n)?i="":x(r)?i=`>=${n}.0.0${a} <${+n+1}.0.0-0`:x(o)?i="0"===n?`>=${n}.${r}.0${a} <${n}.${+r+1}.0-0`:`>=${n}.${r}.0${a} <${+n+1}.0.0-0`:s?(l("replaceCaret pr",s),i="0"===n?"0"===r?`>=${n}.${r}.${o}-${s} <${n}.${r}.${+o+1}-0`:`>=${n}.${r}.${o}-${s} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${o}-${s} <${+n+1}.0.0-0`):(l("no pr"),i="0"===n?"0"===r?`>=${n}.${r}.${o}${a} <${n}.${r}.${+o+1}-0`:`>=${n}.${r}.${o}${a} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${o} <${+n+1}.0.0-0`),l("caret return",i),i}))},E=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map((e=>S(e,t))).join(" ")),S=(e,t)=>{e=e.trim();const n=t.loose?c[p.XRANGELOOSE]:c[p.XRANGE];return e.replace(n,((n,a,r,o,s,i)=>{l("xRange",e,n,a,r,o,s,i);const u=x(r),c=u||x(o),p=c||x(s),d=p;return"="===a&&d&&(a=""),i=t.includePrerelease?"-0":"",u?n=">"===a||"<"===a?"<0.0.0-0":"*":a&&d?(c&&(o=0),s=0,">"===a?(a=">=",c?(r=+r+1,o=0,s=0):(o=+o+1,s=0)):"<="===a&&(a="<",c?r=+r+1:o=+o+1),"<"===a&&(i="-0"),n=`${a+r}.${o}.${s}${i}`):c?n=`>=${r}.0.0${i} <${+r+1}.0.0-0`:p&&(n=`>=${r}.${o}.0${i} <${r}.${+o+1}.0-0`),l("xRange return",n),n}))},T=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[p.STAR],"")),A=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),N=e=>(t,n,a,r,o,s,i,l,u,c,p,d)=>`${n=x(a)?"":x(r)?`>=${a}.0.0${e?"-0":""}`:x(o)?`>=${a}.${r}.0${e?"-0":""}`:s?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=x(u)?"":x(c)?`<${+u+1}.0.0-0`:x(p)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${p}-${d}`:e?`<${u}.${c}.${+p+1}-0`:`<=${l}`}`.trim(),O=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(l(e[n].semver),e[n].semver!==i.ANY&&e[n].semver.prerelease.length>0){const a=e[n].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0}},21410:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ALL_CONSTANTS=void 0,t.createConstantFilter=f,t.wrapField=function(e,t=!1){return t||!function(e){if(/[.\s"'()[\];={}:]/.test(e))return!1;try{return new Function(`"use strict";let _ = { ${e}: 0 };`),!0}catch{return!1}}(e)?`"${e.replace(/["\\]/g,"\\$&")}"`:e},t.getFilteredCompletions=function(e={},n=t.ALL_CONSTANTS){const{serverVersion:a=m,fields:r=[],meta:o,stage:s}=e,i=f({serverVersion:a,meta:o,stage:s});return n.concat(r.flatMap((e=>{const{value:t,description:n}=function(e){return"string"==typeof e?{value:e}:{value:e.name,description:e.description}}(e);return[{value:t,meta:"field:identifier",version:"0.0.0",description:n},{value:`$${t}`,meta:"field:reference",version:"0.0.0",description:n}]}))).filter((e=>i(e)))};const a=n(75982),r=n(63131),o=n(93766),s=n(51626),i=n(64900),l=n(85070),u=n(48080),c=n(51098),p=n(79984),d=n(35593);t.ALL_CONSTANTS=[...r.ACCUMULATORS,...s.BSON_TYPES,...o.BSON_TYPE_ALIASES,...i.CONVERSION_OPERATORS,...l.EXPRESSION_OPERATORS,...u.JSON_SCHEMA,...c.QUERY_OPERATORS,...p.STAGE_OPERATORS,...d.SYSTEM_VARIABLES];const m="999.999.999";function h(e,t){return void 0===e||void 0===t||(e=Array.isArray(e)?e:[e]).some((e=>t.includes(e)))}function f({meta:e,serverVersion:t=m,stage:n={}}={}){const r=/^(?<version>\d+\.\d+\.\d+)/.exec(t)?.groups?.version??m;return({version:t,meta:o,env:s,namespaces:i,apiVersions:l})=>function(e,t){const n=/^\d+\.\d+\.\d+$/.test(t);return(0,a.satisfies)(e,n?`>=${t}`:t)}(r,t)&&h(n.env,s)&&h(n.namespace,i)&&h(n.apiVersion,l)&&(!e||function(e,t){const n=t.split(":");return e.some((e=>{const t=e.split(":");return t.length===n.length&&t.every(((e,t)=>"*"===e||e===n[t]))}))}(e,o))}},21665:(e,t,n)=>{var a=n(29520);e.exports=a},22038:(e,t,n)=>{const a=n(87866);e.exports=(e,t,n)=>a(e,t,">",n)},23252:(e,t,n)=>{const a=n(88825),r=n(20360),o=n(51269);e.exports=(e,t)=>{e=new r(e,t);let n=new a("0.0.0");if(e.test(n))return n;if(n=new a("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t<e.set.length;++t){const r=e.set[t];let s=null;r.forEach((e=>{const t=new a(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":s&&!o(t,s)||(s=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!s||n&&!o(n,s)||(n=s)}return n&&e.test(n)?n:null}},24975:(e,t,n)=>{const a=n(25583);e.exports=(e,t,n)=>a(t,e,n)},25583:(e,t,n)=>{const a=n(88825);e.exports=(e,t,n)=>new a(e,n).compare(new a(t,n))},26620:(e,t,n)=>{const a=n(25583);e.exports=(e,t,n)=>0===a(e,t,n)},27195:(e,t,n)=>{var a=n(40811),r=Object.prototype.hasOwnProperty,o=Object.prototype.toString;e.exports=new a("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,s,i,l=[],u=e;for(t=0,n=u.length;t<n;t+=1){if(a=u[t],i=!1,"[object Object]"!==o.call(a))return!1;for(s in a)if(r.call(a,s)){if(i)return!1;i=!0}if(!i)return!1;if(-1!==l.indexOf(s))return!1;l.push(s)}return!0},construct:function(e){return null!==e?e:[]}})},27995:(e,t,n)=>{const a=n(20360);e.exports=(e,t,n)=>(e=new a(e,n),t=new a(t,n),e.intersects(t,n))},29478:(e,t,n)=>{const a=n(88825);e.exports=(e,t)=>new a(e,t).patch},29520:(e,t,n)=>{var a=n(69316),r=n(76462);function o(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=n(40811),e.exports.Schema=n(54420),e.exports.FAILSAFE_SCHEMA=n(91714),e.exports.JSON_SCHEMA=n(15037),e.exports.CORE_SCHEMA=n(6340),e.exports.DEFAULT_SAFE_SCHEMA=n(18184),e.exports.DEFAULT_FULL_SCHEMA=n(57116),e.exports.load=a.load,e.exports.loadAll=a.loadAll,e.exports.safeLoad=a.safeLoad,e.exports.safeLoadAll=a.safeLoadAll,e.exports.dump=r.dump,e.exports.safeDump=r.safeDump,e.exports.YAMLException=n(4414),e.exports.MINIMAL_SCHEMA=n(91714),e.exports.SAFE_SCHEMA=n(18184),e.exports.DEFAULT_SCHEMA=n(57116),e.exports.scan=o("scan"),e.exports.parse=o("parse"),e.exports.compose=o("compose"),e.exports.addConstructor=o("addConstructor")},32056:(e,t,n)=>{const a=n(25583);e.exports=(e,t,n)=>0!==a(e,t,n)},35593:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SYSTEM_VARIABLES=void 0,t.SYSTEM_VARIABLES=[{name:"$$NOW",value:"$$NOW",score:1,meta:"variable:system",version:"4.2.0",description:"A variable that returns the current datetime value. NOW returns the same value for all members of the deployment and remains the same throughout all stages of the aggregation pipeline."},{name:"$$CLUSTER_TIME",value:"$$CLUSTER_TIME",score:1,meta:"variable:system",version:"4.2.0",description:"A variable that returns the current timestamp value. CLUSTER_TIME is only available on replica sets and sharded clusters. CLUSTER_TIME returns the same value for all members of the deployment and remains the same throughout all stages of the pipeline."},{name:"$$ROOT",value:"$$ROOT",score:1,meta:"variable:system",version:"2.4.0",description:"References the root document, i.e. the top-level document, currently being processed in the aggregation pipeline stage."},{name:"$$CURRENT",value:"$$CURRENT",score:1,meta:"variable:system",version:"2.4.0",description:"References the start of the field path being processed in the aggregation pipeline stage. Unless documented otherwise, all stages start with CURRENT the same as ROOT. CURRENT is modifiable. However, since `$<field>` is equivalent to `$$CURRENT.<field>`, rebinding CURRENT changes the meaning of `$` accesses."},{name:"$$REMOVE",value:"$$REMOVE",score:1,meta:"variable:system",version:"3.6.0",description:"A variable which evaluates to the missing value. Allows for the conditional exclusion of fields. In a `$project`, a field set to the variable REMOVE is excluded from the output."},{name:"$$DESCEND",value:"$$DESCEND",score:1,meta:"variable:system",version:"3.0.0",description:"One of the allowed results of a `$redact` expression."},{name:"$$PRUNE",value:"$$PRUNE",score:1,meta:"variable:system",version:"3.0.0",description:"One of the allowed results of a `$redact` expression."},{name:"$$KEEP",value:"$$KEEP",score:1,meta:"variable:system",version:"3.0.0",description:"One of the allowed results of a `$redact` expression."},{name:"$$SEARCH_META",value:"$$SEARCH_META",score:1,meta:"variable:system",version:"5.0.0",description:"A variable that stores the metadata results of an Atlas Search query. In all supported aggregation pipeline stages, a field set to the variable SEARCH_META returns the metadata results for the query. For an example of its usage, see Atlas Search facet and count."},{name:"$$USER_ROLES",value:"$$USER_ROLES",score:1,meta:"variable:system",version:"7.0.0",description:"A variable that stores the role names of the authenticated user running the command."}]},36165:(e,t,n)=>{const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=n(64136),s=n(95869),i=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],p=t.t={};let d=0;const m="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",o],[m,r]],f=(e,t,n)=>{const a=(e=>{for(const[t,n]of h)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),r=d++;s(e,r,t),p[e]=r,u[r]=t,c[r]=a,i[r]=new RegExp(t,n?"g":void 0),l[r]=new RegExp(a,n?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${m}*`),f("MAINVERSION",`(${u[p.NUMERICIDENTIFIER]})\\.(${u[p.NUMERICIDENTIFIER]})\\.(${u[p.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${u[p.NUMERICIDENTIFIERLOOSE]})\\.(${u[p.NUMERICIDENTIFIERLOOSE]})\\.(${u[p.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${u[p.NONNUMERICIDENTIFIER]}|${u[p.NUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${u[p.NONNUMERICIDENTIFIER]}|${u[p.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASE",`(?:-(${u[p.PRERELEASEIDENTIFIER]}(?:\\.${u[p.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${u[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[p.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${m}+`),f("BUILD",`(?:\\+(${u[p.BUILDIDENTIFIER]}(?:\\.${u[p.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${u[p.MAINVERSION]}${u[p.PRERELEASE]}?${u[p.BUILD]}?`),f("FULL",`^${u[p.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${u[p.MAINVERSIONLOOSE]}${u[p.PRERELEASELOOSE]}?${u[p.BUILD]}?`),f("LOOSE",`^${u[p.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${u[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${u[p.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${u[p.XRANGEIDENTIFIER]})(?:\\.(${u[p.XRANGEIDENTIFIER]})(?:\\.(${u[p.XRANGEIDENTIFIER]})(?:${u[p.PRERELEASE]})?${u[p.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${u[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[p.XRANGEIDENTIFIERLOOSE]})(?:${u[p.PRERELEASELOOSE]})?${u[p.BUILD]}?)?)?`),f("XRANGE",`^${u[p.GTLT]}\\s*${u[p.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${u[p.GTLT]}\\s*${u[p.XRANGEPLAINLOOSE]}$`),f("COERCEPLAIN",`(^|[^\\d])(\\d{1,${a}})(?:\\.(\\d{1,${a}}))?(?:\\.(\\d{1,${a}}))?`),f("COERCE",`${u[p.COERCEPLAIN]}(?:$|[^\\d])`),f("COERCEFULL",u[p.COERCEPLAIN]+`(?:${u[p.PRERELEASE]})?`+`(?:${u[p.BUILD]})?(?:$|[^\\d])`),f("COERCERTL",u[p.COERCE],!0),f("COERCERTLFULL",u[p.COERCEFULL],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${u[p.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${u[p.LONETILDE]}${u[p.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${u[p.LONETILDE]}${u[p.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${u[p.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${u[p.LONECARET]}${u[p.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${u[p.LONECARET]}${u[p.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${u[p.GTLT]}\\s*(${u[p.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${u[p.GTLT]}\\s*(${u[p.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${u[p.GTLT]}\\s*(${u[p.LOOSEPLAIN]}|${u[p.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${u[p.XRANGEPLAIN]})\\s+-\\s+(${u[p.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${u[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[p.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},37504:function(e,t,n){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.VIEW_PIPELINE_UTILS=void 0;const r=a(n(75982)),o="8.0.0",s="8.1.0";t.VIEW_PIPELINE_UTILS={MIN_VERSION_FOR_VIEW_SEARCH_COMPATIBILITY_DE:o,MIN_VERSION_FOR_VIEW_SEARCH_COMPATIBILITY_COMPASS:s,isPipelineSearchQueryable:e=>{for(const t of e){const e=Object.keys(t)[0];if("$addFields"!==e&&"$set"!==e&&"$match"!==e)return!1;if("$match"===e){const e=t.$match,n=Object.keys(e||{});if(1!==n.length||!n.includes("$expr"))return!1}}return!0},isVersionSearchCompatibleForViewsDataExplorer:e=>{try{return r.default.gte(e,o)}catch{return!1}},isVersionSearchCompatibleForViewsCompass:e=>{try{return r.default.gte(e,s)}catch{return!1}}}},38185:(e,t,n)=>{const a=n(88825),r=n(20360);e.exports=(e,t,n)=>{let o=null,s=null,i=null;try{i=new r(t,n)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(o&&1!==s.compare(e)||(o=e,s=new a(o,n)))})),o}},39581:(e,t,n)=>{n.d(t,{fd:()=>o,rs:()=>a}),Symbol("ZodOutput"),Symbol("ZodInput");class a{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function r(){return new a}const o=r()},40214:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VALIDATION_TEMPLATE=void 0,t.VALIDATION_TEMPLATE='/**\n * This is a starter template for a schema validation rule for a collection.\n * More information on schema validation rules can be found at:\n * https://www.mongodb.com/docs/manual/core/schema-validation/\n */\n{\n $jsonSchema: {\n title: "Library.books",\n bsonType: "object",\n required: ["fieldname1", "fieldname2"],\n properties: {\n fieldname1: {\n bsonType: "string",\n description: "Fieldname1 must be a string",\n },\n fieldname2: {\n bsonType: "int",\n description: "Fieldname2 must be an integer",\n },\n arrayFieldName: {\n bsonType: "array",\n items: {\n bsonType: "string"\n },\n description: "arrayFieldName must be an array of strings"\n },\n }\n }\n}'},40594:e=>{const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},40811:(e,t,n)=>{var a=n(4414),r=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];e.exports=function(e,t){var n,s;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===r.indexOf(t))throw new a('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,s={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){s[String(t)]=e}))})),s),-1===o.indexOf(this.kind))throw new a('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},41573:(e,t,n)=>{n.d(t,{Ay:()=>r});var a=n(87494);const r=a;a.MAX_DATABASE_NAME_LENGTH,a.sort},44490:(e,t,n)=>{var a=n(99174),r=n(40811),o=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),s=/^[-+]?[0-9]+e/;e.exports=new r("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,a,r;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,r=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){r.unshift(parseFloat(e,10))})),t=0,a=1,r.forEach((function(e){t+=e*a,a*=60})),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||a.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(a.isNegativeZero(e))return"-0.0";return n=e.toString(10),s.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},45848:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},46526:(e,t,n)=>{const a=n(98855);e.exports=(e,t)=>{const n=a(e,t);return n?n.version:null}},47384:(e,t,n)=>{const a=n(88825);e.exports=(e,t,n,r,o)=>{"string"==typeof n&&(o=r,r=n,n=void 0);try{return new a(e instanceof a?e.version:e,n).inc(t,r,o).version}catch(e){return null}}},47544:(e,t,n)=>{const a=n(20360);e.exports=(e,t)=>new a(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},48013:(e,t,n)=>{var a=n(99174),r=n(40811);function o(e){return 48<=e&&e<=55}function s(e){return 48<=e&&e<=57}e.exports=new r("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=e.length,r=0,i=!1;if(!a)return!1;if("-"!==(t=e[r])&&"+"!==t||(t=e[++r]),"0"===t){if(r+1===a)return!0;if("b"===(t=e[++r])){for(r++;r<a;r++)if("_"!==(t=e[r])){if("0"!==t&&"1"!==t)return!1;i=!0}return i&&"_"!==t}if("x"===t){for(r++;r<a;r++)if("_"!==(t=e[r])){if(!(48<=(n=e.charCodeAt(r))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1;i=!0}return i&&"_"!==t}for(;r<a;r++)if("_"!==(t=e[r])){if(!o(e.charCodeAt(r)))return!1;i=!0}return i&&"_"!==t}if("_"===t)return!1;for(;r<a;r++)if("_"!==(t=e[r])){if(":"===t)break;if(!s(e.charCodeAt(r)))return!1;i=!0}return!(!i||"_"===t)&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(r)))},construct:function(e){var t,n,a=e,r=1,o=[];return-1!==a.indexOf("_")&&(a=a.replace(/_/g,"")),"-"!==(t=a[0])&&"+"!==t||("-"===t&&(r=-1),t=(a=a.slice(1))[0]),"0"===a?0:"0"===t?"b"===a[1]?r*parseInt(a.slice(2),2):"x"===a[1]?r*parseInt(a,16):r*parseInt(a,8):-1!==a.indexOf(":")?(a.split(":").forEach((function(e){o.unshift(parseInt(e,10))})),a=0,n=1,o.forEach((function(e){a+=e*n,n*=60})),r*a):r*parseInt(a,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!a.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},48080:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JSON_SCHEMA=void 0,t.JSON_SCHEMA=[{name:"bsonType",value:"bsonType",label:"bsonType",score:1,meta:"json-schema",version:"3.6.0",description:"Accepts same string aliases used for the $type operator"},{name:"enum",value:"enum",label:"enum",score:1,meta:"json-schema",version:"3.6.0",description:"Enumerates all possible values of the field"},{name:"type",value:"type",label:"type",score:1,meta:"json-schema",version:"3.6.0",description:"Enumerates the possible JSON types of the field"},{name:"allOf",value:"allOf",label:"allOf",score:1,meta:"json-schema",version:"3.6.0",description:"Field must match all specified schemas"},{name:"anyOf",value:"anyOf",label:"anyOf",score:1,meta:"json-schema",version:"3.6.0",description:"Field must match at least one of the specified schemas"},{name:"oneOf",value:"oneOf",label:"oneOf",score:1,meta:"json-schema",version:"3.6.0",description:"Field must match exactly one of the specified schemas"},{name:"not",value:"not",label:"not",score:1,meta:"json-schema",version:"3.6.0",description:"Field must not match the schema"},{name:"multipleOf",value:"multipleOf",label:"multipleOf",score:1,meta:"json-schema",version:"3.6.0",description:"Field must be a multiple of this value"},{name:"maximum",value:"maximum",label:"maximum",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the maximum value of the field"},{name:"exclusiveMaximum",value:"exclusiveMaximum",label:"exclusiveMaximum",score:1,meta:"json-schema",version:"3.6.0",description:"If true and field is a number, maximum is an exclusive maximum"},{name:"minimum",value:"minimum",label:"minimum",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the minimum value of the field"},{name:"exclusiveMinimum",value:"exclusiveMinimum",label:"exclusiveMinimum",score:1,meta:"json-schema",version:"3.6.0",description:"If true, minimum is an exclusive minimum"},{name:"maxLength",value:"maxLength",label:"maxLength",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the maximum length of the field"},{name:"minLength",value:"minLength",label:"minLength",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the minimum length of the field"},{name:"pattern",value:"pattern",label:"pattern",score:1,meta:"json-schema",version:"3.6.0",description:"Field must match the regular expression"},{name:"maxProperties",value:"maxProperties",label:"maxProperties",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the field’s maximum number of properties"},{name:"minProperties",value:"minProperties",label:"minProperties",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the field’s minimum number of properties"},{name:"required",value:"required",label:"required",score:1,meta:"json-schema",version:"3.6.0",description:"Object’s property set must contain all the specified elements in the array"},{name:"additionalProperties",value:"additionalProperties",label:"additionalProperties",score:1,meta:"json-schema",version:"3.6.0",description:"If true, additional fields are allowed"},{name:"properties",value:"properties",label:"properties",score:1,meta:"json-schema",version:"3.6.0",description:"A valid JSON Schema where each value is also a valid JSON Schema object"},{name:"patternProperties",value:"patternProperties",label:"patternProperties",score:1,meta:"json-schema",version:"3.6.0",description:"In addition to properties requirements, each property name of this object must be a valid regular expression"},{name:"dependencies",value:"dependencies",label:"dependencies",score:1,meta:"json-schema",version:"3.6.0",description:"Describes field or schema dependencies"},{name:"additionalItems",value:"additionalItems",label:"additionalItems",score:1,meta:"json-schema",version:"3.6.0",description:"If an object, must be a valid JSON Schema"},{name:"items",value:"items",label:"items",score:1,meta:"json-schema",version:"3.6.0",description:"Must be either a valid JSON Schema, or an array of valid JSON Schemas"},{name:"maxItems",value:"maxItems",label:"maxItems",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the maximum length of array"},{name:"minItems",value:"minItems",label:"minItems",score:1,meta:"json-schema",version:"3.6.0",description:"Indicates the minimum length of array"},{name:"uniqueItems",value:"uniqueItems",label:"uniqueItems",score:1,meta:"json-schema",version:"3.6.0",description:"If true, each item in the array must be unique"},{name:"title",value:"title",label:"title",score:1,meta:"json-schema",version:"3.6.0",description:"A descriptive title string with no effect"},{name:"description",value:"description",label:"description",score:1,meta:"json-schema",version:"3.6.0",description:"A string that describes the schema and has no effect."}]},49189:(e,t,n)=>{function a(e,t,n){function a(n,a){var r;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(r=n._zod).traits??(r.traits=new Set),n._zod.traits.add(e),t(n,a);for(const e in s.prototype)e in n||Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=a}const r=n?.Parent??Object;class o extends r{}function s(e){var t;const r=n?.Parent?new o:this;a(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(s,"init",{value:a}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}n.d(t,{$W:()=>s,GT:()=>r,cr:()=>o,xI:()=>a}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const o={};function s(e){return e&&Object.assign(o,e),o}},51098:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QUERY_OPERATORS=void 0,t.QUERY_OPERATORS=[{name:"$all",value:"$all",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$and",value:"$and",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$bitsAllClear",value:"$bitsAllClear",score:1,meta:"query",version:"3.2.0",geospatial:!1},{name:"$bitsAllSet",value:"$bitsAllSet",score:1,meta:"query",version:"3.2.0",geospatial:!1},{name:"$bitsAnyClear",value:"$bitsAnyClear",score:1,meta:"query",version:"3.2.0",geospatial:!1},{name:"$bitsAnySet",value:"$bitsAnySet",score:1,meta:"query",version:"3.2.0",geospatial:!1},{name:"$comment",value:"$comment",score:1,meta:"query",version:"3.2.0",geospatial:!1},{name:"$elemMatch",value:"$elemMatch",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$eq",value:"$eq",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$exists",value:"$exists",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$expr",value:"$expr",score:1,meta:"query",version:"3.6.0",geospatial:!1},{name:"$geoIntersects",value:"$geoIntersects",score:1,meta:"query",version:"2.2.0",geospatial:!0},{name:"$geoWithin",value:"$geoWithin",score:1,meta:"query",version:"2.2.0",geospatial:!0},{name:"$gt",value:"$gt",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$gte",value:"$gte",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$in",value:"$in",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$jsonSchema",value:"$jsonSchema",score:1,meta:"query",version:"3.6.0",geospatial:!1},{name:"$lt",value:"$lt",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$lte",value:"$lte",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$mod",value:"$mod",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$ne",value:"$ne",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$near",value:"$near",score:1,meta:"query",version:"2.2.0",geospatial:!0},{name:"$nearSphere",value:"$nearSphere",score:1,meta:"query",version:"2.2.0",geospatial:!0},{name:"$nin",value:"$nin",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$not",value:"$not",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$nor",value:"$nor",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$or",value:"$or",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$regex",value:"$regex",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$size",value:"$size",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$slice",value:"$slice",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$text",value:"$text",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$type",value:"$type",score:1,meta:"query",version:"2.2.0",geospatial:!1},{name:"$where",value:"$where",score:1,meta:"query",version:"2.2.0",geospatial:!1}]},51138:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})},51228:(e,t,n)=>{var a=n(40811),r=Object.prototype.hasOwnProperty;e.exports=new a("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(r.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}})},51269:(e,t,n)=>{const a=n(25583);e.exports=(e,t,n)=>a(e,t,n)>0},51626:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BSON_TYPES=void 0,t.BSON_TYPES=[{name:"Code",value:"Code",label:"Code",score:1,meta:"bson",version:"0.0.0",description:"BSON Code type",snippet:"Code('${1:code}')"},{name:"ObjectId",value:"ObjectId",label:"ObjectId",score:1,meta:"bson",version:"0.0.0",description:"BSON ObjectId type",snippet:"ObjectId('${1:id}')"},{name:"Binary",value:"Binary",label:"Binary",score:1,meta:"bson",version:"0.0.0",description:"BSON Binary type",snippet:"Binary('${1:data}', '${2:subType}')"},{name:"DBRef",value:"DBRef",label:"DBRef",score:1,meta:"bson",version:"0.0.0",description:"BSON DBRef type",snippet:"DBRef('${1:ns}', '${2:oid}')"},{name:"Timestamp",value:"Timestamp",label:"Timestamp",score:1,meta:"bson",version:"0.0.0",description:"BSON Timestamp type",snippet:"Timestamp(${1:low}, ${2:high})"},{name:"NumberInt",value:"NumberInt",label:"NumberInt",score:1,meta:"bson",version:"0.0.0",description:"BSON 32 bit Integer type",snippet:"NumberInt(${1:value})"},{name:"NumberLong",value:"NumberLong",label:"NumberLong",score:1,meta:"bson",version:"0.0.0",description:"BSON 64 but Integer type",snippet:"NumberLong('${1:value}')"},{name:"NumberDecimal",value:"NumberDecimal",label:"NumberDecimal",score:1,meta:"bson",version:"3.4.0",description:"BSON Decimal128 type",snippet:"NumberDecimal('${1:value}')"},{name:"MaxKey",value:"MaxKey",label:"MaxKey",score:1,meta:"bson",version:"0.0.0",description:"BSON MaxKey type",snippet:"MaxKey()"},{name:"MinKey",value:"MinKey",label:"MinKey",score:1,meta:"bson",version:"0.0.0",description:"BSON MinKey type",snippet:"MinKey()"},{name:"ISODate",value:"ISODate",label:"ISODate",score:1,meta:"bson",version:"0.0.0",description:"BSON Date type",snippet:"ISODate('${1:date}')"},{name:"RegExp",value:"RegExp",label:"RegExp",score:1,meta:"bson",version:"0.0.0",description:"BSON Regex type",snippet:"RegExp('${1:source}', '${2:opts}')"},{name:"LegacyJavaUUID",value:"LegacyJavaUUID",label:"LegacyJavaUUID",score:1,meta:"bson-legacy-uuid",version:"0.0.0",description:"BSON Binary subtype 3 (Java legacy UUID)",snippet:"LegacyJavaUUID('${1:uuid}')"},{name:"LegacyCSharpUUID",value:"LegacyCSharpUUID",label:"LegacyCSharpUUID",score:1,meta:"bson-legacy-uuid",version:"0.0.0",description:"BSON Binary subtype 3 (CSharp legacy UUID)",snippet:"LegacyCSharpUUID('${1:uuid}')"},{name:"LegacyPythonUUID",value:"LegacyPythonUUID",label:"LegacyPythonUUID",score:1,meta:"bson-legacy-uuid",version:"0.0.0",description:"BSON Binary subtype 3 (Python legacy UUID)",snippet:"LegacyPythonUUID('${1:uuid}')"},{name:"UUID",value:"UUID",label:"UUID",score:1,meta:"bson",version:"0.0.0",description:"BSON Binary subtype 4",snippet:"UUID('${1:uuid}')"}]},52539:(e,t,n)=>{const a=n(88825),r=n(98855),{safeRe:o,t:s}=n(36165);e.exports=(e,t)=>{if(e instanceof a)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){const a=t.includePrerelease?o[s.COERCERTLFULL]:o[s.COERCERTL];let r;for(;(r=a.exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),a.lastIndex=r.index+r[1].length+r[2].length;a.lastIndex=-1}else n=e.match(t.includePrerelease?o[s.COERCEFULL]:o[s.COERCE]);if(null===n)return null;const i=n[2],l=n[3]||"0",u=n[4]||"0",c=t.includePrerelease&&n[5]?`-${n[5]}`:"",p=t.includePrerelease&&n[6]?`+${n[6]}`:"";return r(`${i}.${l}.${u}${c}${p}`,t)}},52711:(e,t,n)=>{var a;try{a=n(67787).Buffer}catch(e){}var r=n(40811),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,r=e.length,s=o;for(n=0;n<r;n++)if(!((t=s.indexOf(e.charAt(n)))>64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=o,l=0,u=[];for(t=0;t<s;t++)t%4==0&&t&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|i.indexOf(r.charAt(t));return 0==(n=s%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===n?(u.push(l>>10&255),u.push(l>>2&255)):12===n&&u.push(l>>4&255),a?a.from?a.from(u):new a(u):u},predicate:function(e){return a&&a.isBuffer(e)},represent:function(e){var t,n,a="",r=0,s=e.length,i=o;for(t=0;t<s;t++)t%3==0&&t&&(a+=i[r>>18&63],a+=i[r>>12&63],a+=i[r>>6&63],a+=i[63&r]),r=(r<<8)+e[t];return 0==(n=s%3)?(a+=i[r>>18&63],a+=i[r>>12&63],a+=i[r>>6&63],a+=i[63&r]):2===n?(a+=i[r>>10&63],a+=i[r>>4&63],a+=i[r<<2&63],a+=i[64]):1===n&&(a+=i[r>>2&63],a+=i[r<<4&63],a+=i[64],a+=i[64]),a}})},54420:(e,t,n)=>{var a=n(99174),r=n(4414),o=n(40811);function s(e,t,n){var a=[];return e.include.forEach((function(e){n=s(e,t,n)})),e[t].forEach((function(e){n.forEach((function(t,n){t.tag===e.tag&&t.kind===e.kind&&a.push(n)})),n.push(e)})),n.filter((function(e,t){return-1===a.indexOf(t)}))}function i(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach((function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=s(this,"implicit",[]),this.compiledExplicit=s(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function a(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(a);return n}(this.compiledImplicit,this.compiledExplicit)}i.DEFAULT=null,i.create=function(){var e,t;switch(arguments.length){case 1:e=i.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new r("Wrong number of arguments for Schema.create function")}if(e=a.toArray(e),t=a.toArray(t),!e.every((function(e){return e instanceof i})))throw new r("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every((function(e){return e instanceof o})))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new i({include:e,explicit:t})},e.exports=i},54838:(e,t,n)=>{const a=n(25583);e.exports=(e,t,n)=>a(e,t,n)>=0},56206:(e,t,n)=>{const a=n(88825);e.exports=(e,t,n)=>{const r=new a(e,n),o=new a(t,n);return r.compare(o)||r.compareBuild(o)}},57116:(e,t,n)=>{var a=n(54420);e.exports=a.DEFAULT=new a({include:[n(18184)],explicit:[n(51138),n(14753),n(10560)]})},57136:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ATLAS_VECTOR_SEARCH_TEMPLATE=t.ATLAS_SEARCH_TEMPLATES=void 0,t.ATLAS_SEARCH_TEMPLATES=[{name:"Dynamic field mappings",snippet:'{\n "mappings": {\n "dynamic": true\n }\n}',version:"4.4.0"},{name:"Static field mappings",snippet:'{\n "mappings": {\n "dynamic": false,\n "fields": {\n ${1:<string field name>}: {\n "type": "string"\n },\n ${2:<number field name>}: {\n "type": "number"\n },\n ${3:<date field name>}: {\n "type": "date"\n },\n ${4:<geo field name>}: {\n "type": "geo"\n },\n } \n }\n}',version:"4.4.0"},{name:"Text field mappings",snippet:'{\n "mappings": {\n "dynamic": true,\n "fields": {\n ${1:<string field name>}: [\n {\n // Enables text queries\n "type": "string"\n },\n {\n // Enables autocomplete queries\n "type": "autocomplete"\n \n },\n {\n // Enables sorting\n "type": "token"\n }\n ] \n } \n }\n}',version:"4.4.0"},{name:"Facet field mappings",snippet:'{\n "mappings": {\n "dynamic": true,\n "fields": {\n ${1:<number field name for faceting>}: [\n {\n "type": "numberFacet"\n },\n {\n "type": "number"\n },\n ],\n ${2:<date field name for faceting>}: [\n {\n "type": "dateFacet"\n }\n {\n "type": "date"\n }\n ],\n ${3:<string field name for faceting>}: [\n {\n "type": "stringFacet"\n },\n {\n "type": "string",\n "analyzer": "lucene.keyword"\n },\n ],\n } \n }\n}',version:"4.4.0"},{name:"KNN Vector field mapping",snippet:'{\n "mappings": {\n "dynamic": true,\n "fields": {\n ${1:<vector embedding field name>}: [\n {\n "type": "knnVector",\n "dimensions": ${2:<number of dimensions>},\n "similarity": "${3:<euclidean | cosine | dotProduct>}"\n } \n ] \n } \n }\n}',version:"4.4.0"}],t.ATLAS_VECTOR_SEARCH_TEMPLATE={name:"Vector Search default template",snippet:'{\n "fields": [{\n "type": "vector",\n "path": "${1:<field name to index>}",\n "numDimensions": ${2:<number of dimensions>},\n "similarity": "${3:<euclidean | cosine | dotProduct>}"\n }]\n}',version:"4.4.0"}},63131:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ACCUMULATORS=void 0,t.ACCUMULATORS=[{name:"$accumulator",value:"$accumulator",score:1,meta:"accumulator",version:"4.4.0"},{name:"$addToSet",value:"$addToSet",score:1,meta:"accumulator",version:"2.2.0"},{name:"$avg",value:"$avg",score:1,meta:"accumulator",version:"2.2.0",projectVersion:"3.2.0"},{name:"$bottom",value:"$bottom",score:1,meta:"accumulator:bottom-n",version:"5.2.0"},{name:"$bottomN",value:"$bottomN",score:1,meta:"accumulator:bottom-n",version:"5.2.0"},{name:"$covariancePop",value:"$covariancePop",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$covarianceSamp",value:"$covarianceSamp",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$count",value:"$count",score:1,meta:"accumulator",version:"5.0.0"},{name:"$derivative",value:"$derivative",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$denseRank",value:"$denseRank",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$documentNumber",value:"$documentNumber",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$expMovingAvg",value:"$expMovingAvg",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$first",value:"$first",score:1,meta:"accumulator",version:"2.2.0"},{name:"$firstN",value:"$firstN",score:1,meta:"accumulator",version:"5.1.0"},{name:"$integral",value:"$integral",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$last",value:"$last",score:1,meta:"accumulator",version:"2.2.0"},{name:"$lastN",value:"$lastN",score:1,meta:"accumulator",version:"5.2.0"},{name:"$max",value:"$max",score:1,meta:"accumulator",version:"2.2.0",projectVersion:"3.2.0"},{name:"$maxN",value:"$maxN",score:1,meta:"accumulator",version:"5.2.0"},{name:"$median",value:"$median",score:1,meta:"accumulator",version:"7.0.0"},{name:"$min",value:"$min",score:1,meta:"accumulator",version:"2.2.0",projectVersion:"3.2.0"},{name:"$minN",value:"$minN",score:1,meta:"accumulator",version:"5.2.0"},{name:"$percentile",value:"$percentile",score:1,meta:"accumulator",version:"7.0.0"},{name:"$push",value:"$push",score:1,meta:"accumulator",version:"2.2.0"},{name:"$rank",value:"$rank",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$stdDevPop",value:"$stdDevPop",score:1,meta:"accumulator",version:"3.2.0",projectVersion:"3.2.0"},{name:"$stdDevSamp",value:"$stdDevSamp",score:1,meta:"accumulator",version:"3.2.0",projectVersion:"3.2.0"},{name:"$shift",value:"$shift",score:1,meta:"accumulator:window",version:"5.0.0"},{name:"$sum",value:"$sum",score:1,meta:"accumulator",version:"2.2.0",projectVersion:"3.2.0"},{name:"$top",value:"$top",score:1,meta:"accumulator:top-n",version:"5.2.0"},{name:"$topN",value:"$topN",score:1,meta:"accumulator:top-n",version:"5.2.0"},{name:"$locf",value:"$locf",score:1,meta:"accumulator:window",version:"5.3.0"},{name:"$linearFill",value:"$linearFill",score:1,meta:"accumulator:window",version:"5.3.0"}]},64097:(e,t,n)=>{n.d(t,{Ah:()=>o,BF:()=>u,DP:()=>c,L5:()=>l,MD:()=>d,Ub:()=>r,gR:()=>m,n:()=>p,nP:()=>s,qp:()=>i,rd:()=>h,zM:()=>f});var a=n(14982);a.ACCUMULATORS;const r=a.ADL,o=(a.ANY_COLLECTION_NAMESPACE,a.ANY_NAMESPACE,a.ATLAS),s=(a.ATLAS_SEARCH_TEMPLATES,a.ATLAS_VECTOR_SEARCH_TEMPLATE,a.BSON_TYPES,a.BSON_TYPE_ALIASES,a.COLLECTION),i=(a.CONVERSION_OPERATORS,a.DATABASE,a.ENVS,a.EXPRESSION_OPERATORS,a.FULL_SCAN_STAGES),l=(a.JSON_SCHEMA,a.ON_PREM),u=a.OUT_STAGES,c=(a.QUERY_OPERATORS,a.REQUIRED_AS_FIRST_STAGE),p=a.STAGE_OPERATORS,d=(a.STAGE_OPERATOR_NAMES,a.SYSTEM_VARIABLES,a.TIME_SERIES),m=(a.VALIDATION_TEMPLATE,a.VIEW),h=a.VIEW_PIPELINE_UTILS,f=a.getFilteredCompletions;a.wrapField},64136:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},64900:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CONVERSION_OPERATORS=void 0,t.CONVERSION_OPERATORS=[{name:"$convert",value:"$convert",score:1,meta:"conv",version:"3.7.2"},{name:"$ltrim",value:"$ltrim",score:1,meta:"accumulator",version:"3.7.2"},{name:"$rtrim",value:"$rtrim",score:1,meta:"accumulator",version:"3.7.2"},{name:"$toBool",value:"$toBool",score:1,meta:"conv",version:"3.7.2"},{name:"$toDate",value:"$toDate",score:1,meta:"conv",version:"3.7.2"},{name:"$toDecimal",value:"$toDecimal",score:1,meta:"conv",version:"3.7.2"},{name:"$toDouble",value:"$toDouble",score:1,meta:"conv",version:"3.7.2"},{name:"$toInt",value:"$toInt",score:1,meta:"conv",version:"3.7.2"},{name:"$toLong",value:"$toLong",score:1,meta:"conv",version:"3.7.2"},{name:"$toObjectId",value:"$toObjectId",score:1,meta:"conv",version:"3.7.2"},{name:"$toString",value:"$toString",score:1,meta:"conv",version:"3.7.2"},{name:"$trim",value:"$trim",score:1,meta:"accumulator",version:"3.7.2"}]},65108:(e,t,n)=>{n.d(t,{ry:()=>Oe});var a=n(7774),r=n(12240),o=n(94893),s=n(1280),i=n(9606).URL,l=o.Ik({error:o.Ik({message:o.Yj(),type:o.Yj().nullish(),param:o.bz().nullish(),code:o.KC([o.Yj(),o.ai()]).nullish()})}),u=(0,a.sl)({errorSchema:l,errorToMessage:e=>e.error.message});function c(e){const t=e.startsWith("o3")||e.startsWith("o4-mini")||e.startsWith("gpt-5")&&!e.startsWith("gpt-5-chat"),n=e.startsWith("gpt-4")||e.startsWith("gpt-5-mini")||e.startsWith("gpt-5")&&!e.startsWith("gpt-5-nano")&&!e.startsWith("gpt-5-chat")||e.startsWith("o3")||e.startsWith("o4-mini"),a=!(e.startsWith("gpt-3")||e.startsWith("gpt-4")||e.startsWith("chatgpt-4o")||e.startsWith("gpt-5-chat"));return{supportsFlexProcessing:t,supportsPriorityProcessing:n,isReasoningModel:a,systemMessageMode:a?"developer":"system",supportsNonReasoningParameters:e.startsWith("gpt-5.1")}}function p(e){var t,n,a,r,o,s;if(null==e)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};const i=null!=(t=e.prompt_tokens)?t:0,l=null!=(n=e.completion_tokens)?n:0,u=null!=(r=null==(a=e.prompt_tokens_details)?void 0:a.cached_tokens)?r:0,c=null!=(s=null==(o=e.completion_tokens_details)?void 0:o.reasoning_tokens)?s:0;return{inputTokens:{total:i,noCache:i-u,cacheRead:u,cacheWrite:void 0},outputTokens:{total:l,text:l-c,reasoning:c},raw:e}}function d({id:e,model:t,created:n}){return{id:null!=e?e:void 0,modelId:null!=t?t:void 0,timestamp:n?new Date(1e3*n):void 0}}function m(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"unknown"}}var h=(0,a.ID)((()=>(0,a.jN)(o.Ik({id:o.Yj().nullish(),created:o.ai().nullish(),model:o.Yj().nullish(),choices:o.YO(o.Ik({message:o.Ik({role:o.eu("assistant").nullish(),content:o.Yj().nullish(),tool_calls:o.YO(o.Ik({id:o.Yj().nullish(),type:o.eu("function"),function:o.Ik({name:o.Yj(),arguments:o.Yj()})})).nullish(),annotations:o.YO(o.Ik({type:o.eu("url_citation"),url_citation:o.Ik({start_index:o.ai(),end_index:o.ai(),url:o.Yj(),title:o.Yj()})})).nullish()}),index:o.ai(),logprobs:o.Ik({content:o.YO(o.Ik({token:o.Yj(),logprob:o.ai(),top_logprobs:o.YO(o.Ik({token:o.Yj(),logprob:o.ai()}))})).nullish()}).nullish(),finish_reason:o.Yj().nullish()})),usage:o.Ik({prompt_tokens:o.ai().nullish(),completion_tokens:o.ai().nullish(),total_tokens:o.ai().nullish(),prompt_tokens_details:o.Ik({cached_tokens:o.ai().nullish()}).nullish(),completion_tokens_details:o.Ik({reasoning_tokens:o.ai().nullish(),accepted_prediction_tokens:o.ai().nullish(),rejected_prediction_tokens:o.ai().nullish()}).nullish()}).nullish()})))),f=(0,a.ID)((()=>(0,a.jN)(o.KC([o.Ik({id:o.Yj().nullish(),created:o.ai().nullish(),model:o.Yj().nullish(),choices:o.YO(o.Ik({delta:o.Ik({role:o.k5(["assistant"]).nullish(),content:o.Yj().nullish(),tool_calls:o.YO(o.Ik({index:o.ai(),id:o.Yj().nullish(),type:o.eu("function").nullish(),function:o.Ik({name:o.Yj().nullish(),arguments:o.Yj().nullish()})})).nullish(),annotations:o.YO(o.Ik({type:o.eu("url_citation"),url_citation:o.Ik({start_index:o.ai(),end_index:o.ai(),url:o.Yj(),title:o.Yj()})})).nullish()}).nullish(),logprobs:o.Ik({content:o.YO(o.Ik({token:o.Yj(),logprob:o.ai(),top_logprobs:o.YO(o.Ik({token:o.Yj(),logprob:o.ai()}))})).nullish()}).nullish(),finish_reason:o.Yj().nullish(),index:o.ai()})),usage:o.Ik({prompt_tokens:o.ai().nullish(),completion_tokens:o.ai().nullish(),total_tokens:o.ai().nullish(),prompt_tokens_details:o.Ik({cached_tokens:o.ai().nullish()}).nullish(),completion_tokens_details:o.Ik({reasoning_tokens:o.ai().nullish(),accepted_prediction_tokens:o.ai().nullish(),rejected_prediction_tokens:o.ai().nullish()}).nullish()}).nullish()}),l])))),g=(0,a.ID)((()=>(0,a.jN)(o.Ik({logitBias:o.g1(s.qG(o.rS,undefined),o.ai()).optional(),logprobs:o.KC([o.zM(),o.ai()]).optional(),parallelToolCalls:o.zM().optional(),user:o.Yj().optional(),reasoningEffort:o.k5(["none","minimal","low","medium","high","xhigh"]).optional(),maxCompletionTokens:o.ai().optional(),store:o.zM().optional(),metadata:o.g1(o.Yj().max(64),o.Yj().max(512)).optional(),prediction:o.g1(o.Yj(),o.bz()).optional(),serviceTier:o.k5(["auto","flex","priority","default"]).optional(),strictJsonSchema:o.zM().optional(),textVerbosity:o.k5(["low","medium","high"]).optional(),promptCacheKey:o.Yj().optional(),promptCacheRetention:o.k5(["in_memory","24h"]).optional(),safetyIdentifier:o.Yj().optional()})))),v=class{constructor(e,t){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:o,topK:s,frequencyPenalty:l,presencePenalty:u,stopSequences:p,responseFormat:d,seed:m,tools:h,toolChoice:f,providerOptions:v}){var y,_,b;const x=[],I=null!=(y=await(0,a.xI)({provider:"openai",providerOptions:v,schema:g}))?y:{},w=c(this.modelId);null!=s&&x.push({type:"unsupported",feature:"topK"});const{messages:k,warnings:$}=function({prompt:e,systemMessageMode:t="system"}){var n;const o=[],s=[];for(const{role:l,content:u}of e)switch(l){case"system":switch(t){case"system":o.push({role:"system",content:u});break;case"developer":o.push({role:"developer",content:u});break;case"remove":s.push({type:"other",message:"system messages are removed for this model"});break;default:throw new Error(`Unsupported system message mode: ${t}`)}break;case"user":if(1===u.length&&"text"===u[0].type){o.push({role:"user",content:u[0].text});break}o.push({role:"user",content:u.map(((e,t)=>{var n,o,s;switch(e.type){case"text":return{type:"text",text:e.text};case"file":if(e.mediaType.startsWith("image/")){const t="image/*"===e.mediaType?"image/jpeg":e.mediaType;return{type:"image_url",image_url:{url:e.data instanceof i?e.data.toString():`data:${t};base64,${(0,a.ej)(e.data)}`,detail:null==(o=null==(n=e.providerOptions)?void 0:n.openai)?void 0:o.imageDetail}}}if(!e.mediaType.startsWith("audio/")){if("application/pdf"===e.mediaType){if(e.data instanceof i)throw new r.b8({functionality:"PDF file parts with URLs"});return{type:"file",file:"string"==typeof e.data&&e.data.startsWith("file-")?{file_id:e.data}:{filename:null!=(s=e.filename)?s:`part-${t}.pdf`,file_data:`data:application/pdf;base64,${(0,a.ej)(e.data)}`}}}throw new r.b8({functionality:`file part media type ${e.mediaType}`})}if(e.data instanceof i)throw new r.b8({functionality:"audio file parts with URLs"});switch(e.mediaType){case"audio/wav":return{type:"input_audio",input_audio:{data:(0,a.ej)(e.data),format:"wav"}};case"audio/mp3":case"audio/mpeg":return{type:"input_audio",input_audio:{data:(0,a.ej)(e.data),format:"mp3"}};default:throw new r.b8({functionality:`audio content parts with media type ${e.mediaType}`})}}}))});break;case"assistant":{let e="";const t=[];for(const n of u)switch(n.type){case"text":e+=n.text;break;case"tool-call":t.push({id:n.toolCallId,type:"function",function:{name:n.toolName,arguments:JSON.stringify(n.input)}})}o.push({role:"assistant",content:e,tool_calls:t.length>0?t:void 0});break}case"tool":for(const e of u){const t=e.output;let a;switch(t.type){case"text":case"error-text":a=t.value;break;case"execution-denied":a=null!=(n=t.reason)?n:"Tool execution denied.";break;case"content":case"json":case"error-json":a=JSON.stringify(t.value)}o.push({role:"tool",tool_call_id:e.toolCallId,content:a})}break;default:throw new Error(`Unsupported role: ${l}`)}return{messages:o,warnings:s}}({prompt:e,systemMessageMode:w.systemMessageMode});x.push(...$);const E=null==(_=I.strictJsonSchema)||_,S={model:this.modelId,logit_bias:I.logitBias,logprobs:!0===I.logprobs||"number"==typeof I.logprobs||void 0,top_logprobs:"number"==typeof I.logprobs?I.logprobs:"boolean"==typeof I.logprobs&&I.logprobs?0:void 0,user:I.user,parallel_tool_calls:I.parallelToolCalls,max_tokens:t,temperature:n,top_p:o,frequency_penalty:l,presence_penalty:u,response_format:"json"===(null==d?void 0:d.type)?null!=d.schema?{type:"json_schema",json_schema:{schema:d.schema,strict:E,name:null!=(b=d.name)?b:"response",description:d.description}}:{type:"json_object"}:void 0,stop:p,seed:m,verbosity:I.textVerbosity,max_completion_tokens:I.maxCompletionTokens,store:I.store,metadata:I.metadata,prediction:I.prediction,reasoning_effort:I.reasoningEffort,service_tier:I.serviceTier,prompt_cache_key:I.promptCacheKey,prompt_cache_retention:I.promptCacheRetention,safety_identifier:I.safetyIdentifier,messages:k};w.isReasoningModel?("none"===I.reasoningEffort&&w.supportsNonReasoningParameters||(null!=S.temperature&&(S.temperature=void 0,x.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for reasoning models"})),null!=S.top_p&&(S.top_p=void 0,x.push({type:"unsupported",feature:"topP",details:"topP is not supported for reasoning models"})),null!=S.logprobs&&(S.logprobs=void 0,x.push({type:"other",message:"logprobs is not supported for reasoning models"}))),null!=S.frequency_penalty&&(S.frequency_penalty=void 0,x.push({type:"unsupported",feature:"frequencyPenalty",details:"frequencyPenalty is not supported for reasoning models"})),null!=S.presence_penalty&&(S.presence_penalty=void 0,x.push({type:"unsupported",feature:"presencePenalty",details:"presencePenalty is not supported for reasoning models"})),null!=S.logit_bias&&(S.logit_bias=void 0,x.push({type:"other",message:"logitBias is not supported for reasoning models"})),null!=S.top_logprobs&&(S.top_logprobs=void 0,x.push({type:"other",message:"topLogprobs is not supported for reasoning models"})),null!=S.max_tokens&&(null==S.max_completion_tokens&&(S.max_completion_tokens=S.max_tokens),S.max_tokens=void 0)):(this.modelId.startsWith("gpt-4o-search-preview")||this.modelId.startsWith("gpt-4o-mini-search-preview"))&&null!=S.temperature&&(S.temperature=void 0,x.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for the search preview models and has been removed."})),"flex"!==I.serviceTier||w.supportsFlexProcessing||(x.push({type:"unsupported",feature:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),S.service_tier=void 0),"priority"!==I.serviceTier||w.supportsPriorityProcessing||(x.push({type:"unsupported",feature:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),S.service_tier=void 0);const{tools:T,toolChoice:A,toolWarnings:N}=function({tools:e,toolChoice:t}){const n=[];if(null==(e=(null==e?void 0:e.length)?e:void 0))return{tools:void 0,toolChoice:void 0,toolWarnings:n};const a=[];for(const t of e)"function"===t.type?a.push({type:"function",function:{name:t.name,description:t.description,parameters:t.inputSchema,...null!=t.strict?{strict:t.strict}:{}}}):n.push({type:"unsupported",feature:`tool type: ${t.type}`});if(null==t)return{tools:a,toolChoice:void 0,toolWarnings:n};const o=t.type;switch(o){case"auto":case"none":case"required":return{tools:a,toolChoice:o,toolWarnings:n};case"tool":return{tools:a,toolChoice:{type:"function",function:{name:t.toolName}},toolWarnings:n};default:{const e=o;throw new r.b8({functionality:`tool choice type: ${e}`})}}}({tools:h,toolChoice:f});return{args:{...S,tools:T,tool_choice:A},warnings:[...x,...N]}}async doGenerate(e){var t,n,r,o,s,i;const{args:l,warnings:c}=await this.getArgs(e),{responseHeaders:f,value:g,rawValue:v}=await(0,a.GU)({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),e.headers),body:l,failedResponseHandler:u,successfulResponseHandler:(0,a.cV)(h),abortSignal:e.abortSignal,fetch:this.config.fetch}),y=g.choices[0],_=[],b=y.message.content;null!=b&&b.length>0&&_.push({type:"text",text:b});for(const e of null!=(t=y.message.tool_calls)?t:[])_.push({type:"tool-call",toolCallId:null!=(n=e.id)?n:(0,a.$C)(),toolName:e.function.name,input:e.function.arguments});for(const e of null!=(r=y.message.annotations)?r:[])_.push({type:"source",sourceType:"url",id:(0,a.$C)(),url:e.url_citation.url,title:e.url_citation.title});const x=null==(o=g.usage)?void 0:o.completion_tokens_details,I=(null==(s=g.usage)||s.prompt_tokens_details,{openai:{}});return null!=(null==x?void 0:x.accepted_prediction_tokens)&&(I.openai.acceptedPredictionTokens=null==x?void 0:x.accepted_prediction_tokens),null!=(null==x?void 0:x.rejected_prediction_tokens)&&(I.openai.rejectedPredictionTokens=null==x?void 0:x.rejected_prediction_tokens),null!=(null==(i=y.logprobs)?void 0:i.content)&&(I.openai.logprobs=y.logprobs.content),{content:_,finishReason:m(y.finish_reason),usage:p(g.usage),request:{body:l},response:{...d(g),headers:f,body:v},warnings:c,providerMetadata:I}}async doStream(e){const{args:t,warnings:n}=await this.getArgs(e),o={...t,stream:!0,stream_options:{include_usage:!0}},{responseHeaders:s,value:i}=await(0,a.GU)({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),e.headers),body:o,failedResponseHandler:u,successfulResponseHandler:(0,a.Ds)(f),abortSignal:e.abortSignal,fetch:this.config.fetch}),l=[];let c,h="unknown",g=!1,v=!1;const y={openai:{}};return{stream:i.pipeThrough(new TransformStream({start(e){e.enqueue({type:"stream-start",warnings:n})},transform(t,n){var o,s,i,u,p,f,_,b,x,I,w,k,$,E,S,T,A;if(e.includeRawChunks&&n.enqueue({type:"raw",rawValue:t.rawValue}),!t.success)return h="error",void n.enqueue({type:"error",error:t.error});const N=t.value;if("error"in N)return h="error",void n.enqueue({type:"error",error:N.error});if(!g){const e=d(N);Object.values(e).some(Boolean)&&(g=!0,n.enqueue({type:"response-metadata",...d(N)}))}null!=N.usage&&(c=N.usage,null!=(null==(o=N.usage.completion_tokens_details)?void 0:o.accepted_prediction_tokens)&&(y.openai.acceptedPredictionTokens=null==(s=N.usage.completion_tokens_details)?void 0:s.accepted_prediction_tokens),null!=(null==(i=N.usage.completion_tokens_details)?void 0:i.rejected_prediction_tokens)&&(y.openai.rejectedPredictionTokens=null==(u=N.usage.completion_tokens_details)?void 0:u.rejected_prediction_tokens));const O=N.choices[0];if(null!=(null==O?void 0:O.finish_reason)&&(h=m(O.finish_reason)),null!=(null==(p=null==O?void 0:O.logprobs)?void 0:p.content)&&(y.openai.logprobs=O.logprobs.content),null==(null==O?void 0:O.delta))return;const j=O.delta;if(null!=j.content&&(v||(n.enqueue({type:"text-start",id:"0"}),v=!0),n.enqueue({type:"text-delta",id:"0",delta:j.content})),null!=j.tool_calls)for(const e of j.tool_calls){const t=e.index;if(null==l[t]){if("function"!==e.type)throw new r.xn({data:e,message:"Expected 'function' type."});if(null==e.id)throw new r.xn({data:e,message:"Expected 'id' to be a string."});if(null==(null==(f=e.function)?void 0:f.name))throw new r.xn({data:e,message:"Expected 'function.name' to be a string."});n.enqueue({type:"tool-input-start",id:e.id,toolName:e.function.name}),l[t]={id:e.id,type:"function",function:{name:e.function.name,arguments:null!=(_=e.function.arguments)?_:""},hasFinished:!1};const o=l[t];null!=(null==(b=o.function)?void 0:b.name)&&null!=(null==(x=o.function)?void 0:x.arguments)&&(o.function.arguments.length>0&&n.enqueue({type:"tool-input-delta",id:o.id,delta:o.function.arguments}),(0,a.v0)(o.function.arguments)&&(n.enqueue({type:"tool-input-end",id:o.id}),n.enqueue({type:"tool-call",toolCallId:null!=(I=o.id)?I:(0,a.$C)(),toolName:o.function.name,input:o.function.arguments}),o.hasFinished=!0));continue}const o=l[t];o.hasFinished||(null!=(null==(w=e.function)?void 0:w.arguments)&&(o.function.arguments+=null!=($=null==(k=e.function)?void 0:k.arguments)?$:""),n.enqueue({type:"tool-input-delta",id:o.id,delta:null!=(E=e.function.arguments)?E:""}),null!=(null==(S=o.function)?void 0:S.name)&&null!=(null==(T=o.function)?void 0:T.arguments)&&(0,a.v0)(o.function.arguments)&&(n.enqueue({type:"tool-input-end",id:o.id}),n.enqueue({type:"tool-call",toolCallId:null!=(A=o.id)?A:(0,a.$C)(),toolName:o.function.name,input:o.function.arguments}),o.hasFinished=!0))}if(null!=j.annotations)for(const e of j.annotations)n.enqueue({type:"source",sourceType:"url",id:(0,a.$C)(),url:e.url_citation.url,title:e.url_citation.title})},flush(e){v&&e.enqueue({type:"text-end",id:"0"}),e.enqueue({type:"finish",finishReason:h,usage:p(c),...null!=y?{providerMetadata:y}:{}})}})),request:{body:o},response:{headers:s}}}};function y(e){var t,n,a,r;if(null==e)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};const o=null!=(t=e.prompt_tokens)?t:0,s=null!=(n=e.completion_tokens)?n:0;return{inputTokens:{total:null!=(a=e.prompt_tokens)?a:void 0,noCache:o,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:null!=(r=e.completion_tokens)?r:void 0,text:s,reasoning:void 0},raw:e}}function _({id:e,model:t,created:n}){return{id:null!=e?e:void 0,modelId:null!=t?t:void 0,timestamp:null!=n?new Date(1e3*n):void 0}}function b(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"unknown"}}var x=(0,a.ID)((()=>(0,a.jN)(o.Ik({id:o.Yj().nullish(),created:o.ai().nullish(),model:o.Yj().nullish(),choices:o.YO(o.Ik({text:o.Yj(),finish_reason:o.Yj(),logprobs:o.Ik({tokens:o.YO(o.Yj()),token_logprobs:o.YO(o.ai()),top_logprobs:o.YO(o.g1(o.Yj(),o.ai())).nullish()}).nullish()})),usage:o.Ik({prompt_tokens:o.ai(),completion_tokens:o.ai(),total_tokens:o.ai()}).nullish()})))),I=(0,a.ID)((()=>(0,a.jN)(o.KC([o.Ik({id:o.Yj().nullish(),created:o.ai().nullish(),model:o.Yj().nullish(),choices:o.YO(o.Ik({text:o.Yj(),finish_reason:o.Yj().nullish(),index:o.ai(),logprobs:o.Ik({tokens:o.YO(o.Yj()),token_logprobs:o.YO(o.ai()),top_logprobs:o.YO(o.g1(o.Yj(),o.ai())).nullish()}).nullish()})),usage:o.Ik({prompt_tokens:o.ai(),completion_tokens:o.ai(),total_tokens:o.ai()}).nullish()}),l])))),w=(0,a.ID)((()=>(0,a.jN)(o.Ik({echo:o.zM().optional(),logitBias:o.g1(o.Yj(),o.ai()).optional(),suffix:o.Yj().optional(),user:o.Yj().optional(),logprobs:o.KC([o.zM(),o.ai()]).optional()})))),k=class{constructor(e,t){this.specificationVersion="v3",this.supportedUrls={},this.modelId=e,this.config=t}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:o,topK:s,frequencyPenalty:i,presencePenalty:l,stopSequences:u,responseFormat:c,tools:p,toolChoice:d,seed:m,providerOptions:h}){const f=[],g={...await(0,a.xI)({provider:"openai",providerOptions:h,schema:w}),...await(0,a.xI)({provider:this.providerOptionsName,providerOptions:h,schema:w})};null!=s&&f.push({type:"unsupported",feature:"topK"}),(null==p?void 0:p.length)&&f.push({type:"unsupported",feature:"tools"}),null!=d&&f.push({type:"unsupported",feature:"toolChoice"}),null!=c&&"text"!==c.type&&f.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});const{prompt:v,stopSequences:y}=function({prompt:e,user:t="user",assistant:n="assistant"}){let a="";"system"===e[0].role&&(a+=`${e[0].content}\n\n`,e=e.slice(1));for(const{role:o,content:s}of e)switch(o){case"system":throw new r.M3({message:"Unexpected system message in prompt: ${content}",prompt:e});case"user":a+=`${t}:\n${s.map((e=>{if("text"===e.type)return e.text})).filter(Boolean).join("")}\n\n`;break;case"assistant":a+=`${n}:\n${s.map((e=>{switch(e.type){case"text":return e.text;case"tool-call":throw new r.b8({functionality:"tool-call messages"})}})).join("")}\n\n`;break;case"tool":throw new r.b8({functionality:"tool messages"});default:throw new Error(`Unsupported role: ${o}`)}return a+=`${n}:\n`,{prompt:a,stopSequences:[`\n${t}:`]}}({prompt:e}),_=[...null!=y?y:[],...null!=u?u:[]];return{args:{model:this.modelId,echo:g.echo,logit_bias:g.logitBias,logprobs:!0===(null==g?void 0:g.logprobs)?0:!1===(null==g?void 0:g.logprobs)||null==g?void 0:g.logprobs,suffix:g.suffix,user:g.user,max_tokens:t,temperature:n,top_p:o,frequency_penalty:i,presence_penalty:l,seed:m,prompt:v,stop:_.length>0?_:void 0},warnings:f}}async doGenerate(e){const{args:t,warnings:n}=await this.getArgs(e),{responseHeaders:r,value:o,rawValue:s}=await(0,a.GU)({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),e.headers),body:t,failedResponseHandler:u,successfulResponseHandler:(0,a.cV)(x),abortSignal:e.abortSignal,fetch:this.config.fetch}),i=o.choices[0],l={openai:{}};return null!=i.logprobs&&(l.openai.logprobs=i.logprobs),{content:[{type:"text",text:i.text}],usage:y(o.usage),finishReason:b(i.finish_reason),request:{body:t},response:{..._(o),headers:r,body:s},providerMetadata:l,warnings:n}}async doStream(e){const{args:t,warnings:n}=await this.getArgs(e),r={...t,stream:!0,stream_options:{include_usage:!0}},{responseHeaders:o,value:s}=await(0,a.GU)({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),e.headers),body:r,failedResponseHandler:u,successfulResponseHandler:(0,a.Ds)(I),abortSignal:e.abortSignal,fetch:this.config.fetch});let i="unknown";const l={openai:{}};let c,p=!0;return{stream:s.pipeThrough(new TransformStream({start(e){e.enqueue({type:"stream-start",warnings:n})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:"raw",rawValue:t.rawValue}),!t.success)return i="error",void n.enqueue({type:"error",error:t.error});const a=t.value;if("error"in a)return i="error",void n.enqueue({type:"error",error:a.error});p&&(p=!1,n.enqueue({type:"response-metadata",..._(a)}),n.enqueue({type:"text-start",id:"0"})),null!=a.usage&&(c=a.usage);const r=a.choices[0];null!=(null==r?void 0:r.finish_reason)&&(i=b(r.finish_reason)),null!=(null==r?void 0:r.logprobs)&&(l.openai.logprobs=r.logprobs),null!=(null==r?void 0:r.text)&&r.text.length>0&&n.enqueue({type:"text-delta",id:"0",delta:r.text})},flush(e){p||e.enqueue({type:"text-end",id:"0"}),e.enqueue({type:"finish",finishReason:i,providerMetadata:l,usage:y(c)})}})),request:{body:r},response:{headers:o}}}},$=(0,a.ID)((()=>(0,a.jN)(o.Ik({dimensions:o.ai().optional(),user:o.Yj().optional()})))),E=(0,a.ID)((()=>(0,a.jN)(o.Ik({data:o.YO(o.Ik({embedding:o.YO(o.ai())})),usage:o.Ik({prompt_tokens:o.ai()}).nullish()})))),S=class{constructor(e,t){this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=e,this.config=t}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:o}){var s;if(e.length>this.maxEmbeddingsPerCall)throw new r.Ch({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:e});const i=null!=(s=await(0,a.xI)({provider:"openai",providerOptions:o,schema:$}))?s:{},{responseHeaders:l,value:c,rawValue:p}=await(0,a.GU)({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),t),body:{model:this.modelId,input:e,encoding_format:"float",dimensions:i.dimensions,user:i.user},failedResponseHandler:u,successfulResponseHandler:(0,a.cV)(E),abortSignal:n,fetch:this.config.fetch});return{warnings:[],embeddings:c.data.map((e=>e.embedding)),usage:c.usage?{tokens:c.usage.prompt_tokens}:void 0,response:{headers:l,body:p}}}},T=(0,a.ID)((()=>(0,a.jN)(o.Ik({created:o.ai().nullish(),data:o.YO(o.Ik({b64_json:o.Yj(),revised_prompt:o.Yj().nullish()})),background:o.Yj().nullish(),output_format:o.Yj().nullish(),size:o.Yj().nullish(),quality:o.Yj().nullish(),usage:o.Ik({input_tokens:o.ai().nullish(),output_tokens:o.ai().nullish(),total_tokens:o.ai().nullish(),input_tokens_details:o.Ik({image_tokens:o.ai().nullish(),text_tokens:o.ai().nullish()}).nullish()}).nullish()})))),A={"dall-e-3":1,"dall-e-2":10,"gpt-image-1":10,"gpt-image-1-mini":10},N=new Set(["gpt-image-1","gpt-image-1-mini"]),O=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3"}get maxImagesPerCall(){var e;return null!=(e=A[this.modelId])?e:1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:n,aspectRatio:r,seed:o,providerOptions:s,headers:i,abortSignal:l}){var c,p,d,m,h,f,g;const v=[];null!=r&&v.push({type:"unsupported",feature:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."}),null!=o&&v.push({type:"unsupported",feature:"seed"});const y=null!=(d=null==(p=null==(c=this.config._internal)?void 0:c.currentDate)?void 0:p.call(c))?d:new Date,{value:_,responseHeaders:b}=await(0,a.GU)({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),i),body:{model:this.modelId,prompt:e,n:t,size:n,...null!=(m=s.openai)?m:{},...N.has(this.modelId)?{}:{response_format:"b64_json"}},failedResponseHandler:u,successfulResponseHandler:(0,a.cV)(T),abortSignal:l,fetch:this.config.fetch});return{images:_.data.map((e=>e.b64_json)),warnings:v,usage:null!=_.usage?{inputTokens:null!=(h=_.usage.input_tokens)?h:void 0,outputTokens:null!=(f=_.usage.output_tokens)?f:void 0,totalTokens:null!=(g=_.usage.total_tokens)?g:void 0}:void 0,response:{timestamp:y,modelId:this.modelId,headers:b},providerMetadata:{openai:{images:_.data.map((e=>{var t,n,a,r,o;return{...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:null!=(t=_.created)?t:void 0,size:null!=(n=_.size)?n:void 0,quality:null!=(a=_.quality)?a:void 0,background:null!=(r=_.background)?r:void 0,outputFormat:null!=(o=_.output_format)?o:void 0}}))}}}}},j=(0,a.ID)((()=>(0,a.jN)(o.Ik({callId:o.Yj(),operation:o.gM("type",[o.Ik({type:o.eu("create_file"),path:o.Yj(),diff:o.Yj()}),o.Ik({type:o.eu("delete_file"),path:o.Yj()}),o.Ik({type:o.eu("update_file"),path:o.Yj(),diff:o.Yj()})])})))),C=(0,a.ID)((()=>(0,a.jN)(o.Ik({status:o.k5(["completed","failed"]),output:o.Yj().optional()})))),R=((0,a.ID)((()=>(0,a.jN)(o.Ik({})))),(0,a.wA)({id:"openai.apply_patch",inputSchema:j,outputSchema:C})),M=(0,a.ID)((()=>(0,a.jN)(o.Ik({code:o.Yj().nullish(),containerId:o.Yj()})))),P=(0,a.ID)((()=>(0,a.jN)(o.Ik({outputs:o.YO(o.gM("type",[o.Ik({type:o.eu("logs"),logs:o.Yj()}),o.Ik({type:o.eu("image"),url:o.Yj()})])).nullish()})))),Y=(0,a.ID)((()=>(0,a.jN)(o.Ik({container:o.KC([o.Yj(),o.Ik({fileIds:o.YO(o.Yj()).optional()})]).optional()})))),L=(0,a.wA)({id:"openai.code_interpreter",inputSchema:M,outputSchema:P}),D=o.Ik({key:o.Yj(),type:o.k5(["eq","ne","gt","gte","lt","lte","in","nin"]),value:o.KC([o.Yj(),o.ai(),o.zM(),o.YO(o.Yj())])}),z=o.Ik({type:o.k5(["and","or"]),filters:o.YO(o.KC([D,o.RZ((()=>z))]))}),F=(0,a.ID)((()=>(0,a.jN)(o.Ik({vectorStoreIds:o.YO(o.Yj()),maxNumResults:o.ai().optional(),ranking:o.Ik({ranker:o.Yj().optional(),scoreThreshold:o.ai().optional()}).optional(),filters:o.KC([D,z]).optional()})))),q=(0,a.ID)((()=>(0,a.jN)(o.Ik({queries:o.YO(o.Yj()),results:o.YO(o.Ik({attributes:o.g1(o.Yj(),o.L5()),fileId:o.Yj(),filename:o.Yj(),score:o.ai(),text:o.Yj()})).nullable()})))),Z=(0,a.wA)({id:"openai.file_search",inputSchema:o.Ik({}),outputSchema:q}),U=(0,a.ID)((()=>(0,a.jN)(o.Ik({background:o.k5(["auto","opaque","transparent"]).optional(),inputFidelity:o.k5(["low","high"]).optional(),inputImageMask:o.Ik({fileId:o.Yj().optional(),imageUrl:o.Yj().optional()}).optional(),model:o.Yj().optional(),moderation:o.k5(["auto"]).optional(),outputCompression:o.ai().int().min(0).max(100).optional(),outputFormat:o.k5(["png","jpeg","webp"]).optional(),partialImages:o.ai().int().min(0).max(3).optional(),quality:o.k5(["auto","low","medium","high"]).optional(),size:o.k5(["1024x1024","1024x1536","1536x1024","auto"]).optional()}).strict()))),V=(0,a.ID)((()=>(0,a.jN)(o.Ik({})))),B=(0,a.ID)((()=>(0,a.jN)(o.Ik({result:o.Yj()})))),W=(0,a.wA)({id:"openai.image_generation",inputSchema:V,outputSchema:B}),G=(0,a.ID)((()=>(0,a.jN)(o.Ik({action:o.Ik({type:o.eu("exec"),command:o.YO(o.Yj()),timeoutMs:o.ai().optional(),user:o.Yj().optional(),workingDirectory:o.Yj().optional(),env:o.g1(o.Yj(),o.Yj()).optional()})})))),K=(0,a.ID)((()=>(0,a.jN)(o.Ik({output:o.Yj()})))),H=(0,a.wA)({id:"openai.local_shell",inputSchema:G,outputSchema:K}),J=(0,a.ID)((()=>(0,a.jN)(o.Ik({action:o.Ik({commands:o.YO(o.Yj()),timeoutMs:o.ai().optional(),maxOutputLength:o.ai().optional()})})))),X=(0,a.ID)((()=>(0,a.jN)(o.Ik({output:o.YO(o.Ik({stdout:o.Yj(),stderr:o.Yj(),outcome:o.gM("type",[o.Ik({type:o.eu("timeout")}),o.Ik({type:o.eu("exit"),exitCode:o.ai()})])}))})))),Q=(0,a.wA)({id:"openai.shell",inputSchema:J,outputSchema:X}),ee=(0,a.ID)((()=>(0,a.jN)(o.Ik({externalWebAccess:o.zM().optional(),filters:o.Ik({allowedDomains:o.YO(o.Yj()).optional()}).optional(),searchContextSize:o.k5(["low","medium","high"]).optional(),userLocation:o.Ik({type:o.eu("approximate"),country:o.Yj().optional(),city:o.Yj().optional(),region:o.Yj().optional(),timezone:o.Yj().optional()}).optional()})))),te=(0,a.ID)((()=>(0,a.jN)(o.Ik({})))),ne=(0,a.ID)((()=>(0,a.jN)(o.Ik({action:o.gM("type",[o.Ik({type:o.eu("search"),query:o.Yj().optional()}),o.Ik({type:o.eu("openPage"),url:o.Yj().nullish()}),o.Ik({type:o.eu("findInPage"),url:o.Yj().nullish(),pattern:o.Yj().nullish()})]),sources:o.YO(o.gM("type",[o.Ik({type:o.eu("url"),url:o.Yj()}),o.Ik({type:o.eu("api"),name:o.Yj()})])).optional()})))),ae=(0,a.wA)({id:"openai.web_search",inputSchema:te,outputSchema:ne}),re=(0,a.ID)((()=>(0,a.jN)(o.Ik({searchContextSize:o.k5(["low","medium","high"]).optional(),userLocation:o.Ik({type:o.eu("approximate"),country:o.Yj().optional(),city:o.Yj().optional(),region:o.Yj().optional(),timezone:o.Yj().optional()}).optional()})))),oe=(0,a.ID)((()=>(0,a.jN)(o.Ik({})))),se=(0,a.ID)((()=>(0,a.jN)(o.Ik({action:o.gM("type",[o.Ik({type:o.eu("search"),query:o.Yj().optional()}),o.Ik({type:o.eu("openPage"),url:o.Yj().nullish()}),o.Ik({type:o.eu("findInPage"),url:o.Yj().nullish(),pattern:o.Yj().nullish()})])})))),ie=(0,a.wA)({id:"openai.web_search_preview",inputSchema:oe,outputSchema:se}),le=o.RZ((()=>o.KC([o.Yj(),o.ai(),o.zM(),o.ch(),o.YO(le),o.g1(o.Yj(),le)]))),ue=(0,a.ID)((()=>(0,a.jN)(o.Ik({serverLabel:o.Yj(),allowedTools:o.KC([o.YO(o.Yj()),o.Ik({readOnly:o.zM().optional(),toolNames:o.YO(o.Yj()).optional()})]).optional(),authorization:o.Yj().optional(),connectorId:o.Yj().optional(),headers:o.g1(o.Yj(),o.Yj()).optional(),serverDescription:o.Yj().optional(),serverUrl:o.Yj().optional()}).refine((e=>null!=e.serverUrl||null!=e.connectorId),"One of serverUrl or connectorId must be provided.")))),ce=(0,a.ID)((()=>(0,a.jN)(o.Ik({})))),pe=(0,a.ID)((()=>(0,a.jN)(o.gM("type",[o.Ik({type:o.eu("call"),serverLabel:o.Yj(),name:o.Yj(),arguments:o.Yj(),output:o.Yj().nullable().optional(),error:o.KC([o.Yj(),le]).optional()}),o.Ik({type:o.eu("listTools"),serverLabel:o.Yj(),tools:o.YO(o.Ik({name:o.Yj(),description:o.Yj().optional(),inputSchema:le,annotations:o.g1(o.Yj(),le).optional()})),error:o.KC([o.Yj(),le]).optional()}),o.Ik({type:o.eu("approvalRequest"),serverLabel:o.Yj(),name:o.Yj(),arguments:o.Yj(),approvalRequestId:o.Yj()})])))),de=(0,a.wA)({id:"openai.mcp",inputSchema:ce,outputSchema:pe}),me={applyPatch:R,codeInterpreter:(e={})=>L(e),fileSearch:Z,imageGeneration:(e={})=>W(e),localShell:H,shell:Q,webSearchPreview:ie,webSearch:(e={})=>ae(e),mcp:e=>de(e)};function he(e){var t,n,a,r;if(null==e)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};const o=e.input_tokens,s=e.output_tokens,i=null!=(n=null==(t=e.input_tokens_details)?void 0:t.cached_tokens)?n:0,l=null!=(r=null==(a=e.output_tokens_details)?void 0:a.reasoning_tokens)?r:0;return{inputTokens:{total:o,noCache:o-i,cacheRead:i,cacheWrite:void 0},outputTokens:{total:s,text:s-l,reasoning:l},raw:e}}function fe(e,t){return!!t&&t.some((t=>e.startsWith(t)))}var ge=o.Ik({itemId:o.Yj().nullish(),reasoningEncryptedContent:o.Yj().nullish()});function ve({finishReason:e,hasFunctionCall:t}){switch(e){case void 0:case null:return t?"tool-calls":"stop";case"max_output_tokens":return"length";case"content_filter":return"content-filter";default:return t?"tool-calls":"unknown"}}var ye=(0,a.ID)((()=>(0,a.jN)(o.KC([o.Ik({type:o.eu("response.output_text.delta"),item_id:o.Yj(),delta:o.Yj(),logprobs:o.YO(o.Ik({token:o.Yj(),logprob:o.ai(),top_logprobs:o.YO(o.Ik({token:o.Yj(),logprob:o.ai()}))})).nullish()}),o.Ik({type:o.k5(["response.completed","response.incomplete"]),response:o.Ik({incomplete_details:o.Ik({reason:o.Yj()}).nullish(),usage:o.Ik({input_tokens:o.ai(),input_tokens_details:o.Ik({cached_tokens:o.ai().nullish()}).nullish(),output_tokens:o.ai(),output_tokens_details:o.Ik({reasoning_tokens:o.ai().nullish()}).nullish()}),service_tier:o.Yj().nullish()})}),o.Ik({type:o.eu("response.created"),response:o.Ik({id:o.Yj(),created_at:o.ai(),model:o.Yj(),service_tier:o.Yj().nullish()})}),o.Ik({type:o.eu("response.output_item.added"),output_index:o.ai(),item:o.gM("type",[o.Ik({type:o.eu("message"),id:o.Yj()}),o.Ik({type:o.eu("reasoning"),id:o.Yj(),encrypted_content:o.Yj().nullish()}),o.Ik({type:o.eu("function_call"),id:o.Yj(),call_id:o.Yj(),name:o.Yj(),arguments:o.Yj()}),o.Ik({type:o.eu("web_search_call"),id:o.Yj(),status:o.Yj()}),o.Ik({type:o.eu("computer_call"),id:o.Yj(),status:o.Yj()}),o.Ik({type:o.eu("file_search_call"),id:o.Yj()}),o.Ik({type:o.eu("image_generation_call"),id:o.Yj()}),o.Ik({type:o.eu("code_interpreter_call"),id:o.Yj(),container_id:o.Yj(),code:o.Yj().nullable(),outputs:o.YO(o.gM("type",[o.Ik({type:o.eu("logs"),logs:o.Yj()}),o.Ik({type:o.eu("image"),url:o.Yj()})])).nullable(),status:o.Yj()}),o.Ik({type:o.eu("mcp_call"),id:o.Yj(),status:o.Yj()}),o.Ik({type:o.eu("mcp_list_tools"),id:o.Yj()}),o.Ik({type:o.eu("mcp_approval_request"),id:o.Yj()}),o.Ik({type:o.eu("apply_patch_call"),id:o.Yj(),call_id:o.Yj(),status:o.k5(["in_progress","completed"]),operation:o.gM("type",[o.Ik({type:o.eu("create_file"),path:o.Yj(),diff:o.Yj()}),o.Ik({type:o.eu("delete_file"),path:o.Yj()}),o.Ik({type:o.eu("update_file"),path:o.Yj(),diff:o.Yj()})])}),o.Ik({type:o.eu("shell_call"),id:o.Yj(),call_id:o.Yj(),status:o.k5(["in_progress","completed","incomplete"]),action:o.Ik({commands:o.YO(o.Yj())})})])}),o.Ik({type:o.eu("response.output_item.done"),output_index:o.ai(),item:o.gM("type",[o.Ik({type:o.eu("message"),id:o.Yj()}),o.Ik({type:o.eu("reasoning"),id:o.Yj(),encrypted_content:o.Yj().nullish()}),o.Ik({type:o.eu("function_call"),id:o.Yj(),call_id:o.Yj(),name:o.Yj(),arguments:o.Yj(),status:o.eu("completed")}),o.Ik({type:o.eu("code_interpreter_call"),id:o.Yj(),code:o.Yj().nullable(),container_id:o.Yj(),outputs:o.YO(o.gM("type",[o.Ik({type:o.eu("logs"),logs:o.Yj()}),o.Ik({type:o.eu("image"),url:o.Yj()})])).nullable()}),o.Ik({type:o.eu("image_generation_call"),id:o.Yj(),result:o.Yj()}),o.Ik({type:o.eu("web_search_call"),id:o.Yj(),status:o.Yj(),action:o.gM("type",[o.Ik({type:o.eu("search"),query:o.Yj().nullish(),sources:o.YO(o.gM("type",[o.Ik({type:o.eu("url"),url:o.Yj()}),o.Ik({type:o.eu("api"),name:o.Yj()})])).nullish()}),o.Ik({type:o.eu("open_page"),url:o.Yj().nullish()}),o.Ik({type:o.eu("find_in_page"),url:o.Yj().nullish(),pattern:o.Yj().nullish()})])}),o.Ik({type:o.eu("file_search_call"),id:o.Yj(),queries:o.YO(o.Yj()),results:o.YO(o.Ik({attributes:o.g1(o.Yj(),o.KC([o.Yj(),o.ai(),o.zM()])),file_id:o.Yj(),filename:o.Yj(),score:o.ai(),text:o.Yj()})).nullish()}),o.Ik({type:o.eu("local_shell_call"),id:o.Yj(),call_id:o.Yj(),action:o.Ik({type:o.eu("exec"),command:o.YO(o.Yj()),timeout_ms:o.ai().optional(),user:o.Yj().optional(),working_directory:o.Yj().optional(),env:o.g1(o.Yj(),o.Yj()).optional()})}),o.Ik({type:o.eu("computer_call"),id:o.Yj(),status:o.eu("completed")}),o.Ik({type:o.eu("mcp_call"),id:o.Yj(),status:o.Yj(),arguments:o.Yj(),name:o.Yj(),server_label:o.Yj(),output:o.Yj().nullish(),error:o.KC([o.Yj(),o.Ik({type:o.Yj().optional(),code:o.KC([o.ai(),o.Yj()]).optional(),message:o.Yj().optional()}).loose()]).nullish()}),o.Ik({type:o.eu("mcp_list_tools"),id:o.Yj(),server_label:o.Yj(),tools:o.YO(o.Ik({name:o.Yj(),description:o.Yj().optional(),input_schema:o.bz(),annotations:o.g1(o.Yj(),o.L5()).optional()})),error:o.KC([o.Yj(),o.Ik({type:o.Yj().optional(),code:o.KC([o.ai(),o.Yj()]).optional(),message:o.Yj().optional()}).loose()]).optional()}),o.Ik({type:o.eu("mcp_approval_request"),id:o.Yj(),server_label:o.Yj(),name:o.Yj(),arguments:o.Yj(),approval_request_id:o.Yj()}),o.Ik({type:o.eu("apply_patch_call"),id:o.Yj(),call_id:o.Yj(),status:o.k5(["in_progress","completed"]),operation:o.gM("type",[o.Ik({type:o.eu("create_file"),path:o.Yj(),diff:o.Yj()}),o.Ik({type:o.eu("delete_file"),path:o.Yj()}),o.Ik({type:o.eu("update_file"),path:o.Yj(),diff:o.Yj()})])}),o.Ik({type:o.eu("shell_call"),id:o.Yj(),call_id:o.Yj(),status:o.k5(["in_progress","completed","incomplete"]),action:o.Ik({commands:o.YO(o.Yj())})})])}),o.Ik({type:o.eu("response.function_call_arguments.delta"),item_id:o.Yj(),output_index:o.ai(),delta:o.Yj()}),o.Ik({type:o.eu("response.image_generation_call.partial_image"),item_id:o.Yj(),output_index:o.ai(),partial_image_b64:o.Yj()}),o.Ik({type:o.eu("response.code_interpreter_call_code.delta"),item_id:o.Yj(),output_index:o.ai(),delta:o.Yj()}),o.Ik({type:o.eu("response.code_interpreter_call_code.done"),item_id:o.Yj(),output_index:o.ai(),code:o.Yj()}),o.Ik({type:o.eu("response.output_text.annotation.added"),annotation:o.gM("type",[o.Ik({type:o.eu("url_citation"),start_index:o.ai(),end_index:o.ai(),url:o.Yj(),title:o.Yj()}),o.Ik({type:o.eu("file_citation"),file_id:o.Yj(),filename:o.Yj().nullish(),index:o.ai().nullish(),start_index:o.ai().nullish(),end_index:o.ai().nullish(),quote:o.Yj().nullish()}),o.Ik({type:o.eu("container_file_citation"),container_id:o.Yj(),file_id:o.Yj(),filename:o.Yj().nullish(),start_index:o.ai().nullish(),end_index:o.ai().nullish(),index:o.ai().nullish()}),o.Ik({type:o.eu("file_path"),file_id:o.Yj(),index:o.ai().nullish()})])}),o.Ik({type:o.eu("response.reasoning_summary_part.added"),item_id:o.Yj(),summary_index:o.ai()}),o.Ik({type:o.eu("response.reasoning_summary_text.delta"),item_id:o.Yj(),summary_index:o.ai(),delta:o.Yj()}),o.Ik({type:o.eu("response.reasoning_summary_part.done"),item_id:o.Yj(),summary_index:o.ai()}),o.Ik({type:o.eu("error"),sequence_number:o.ai(),error:o.Ik({type:o.Yj(),code:o.Yj(),message:o.Yj(),param:o.Yj().nullish()})}),o.Ik({type:o.Yj()}).loose().transform((e=>({type:"unknown_chunk",message:e.type})))])))),_e=(0,a.ID)((()=>(0,a.jN)(o.Ik({id:o.Yj().optional(),created_at:o.ai().optional(),error:o.Ik({message:o.Yj(),type:o.Yj(),param:o.Yj().nullish(),code:o.Yj()}).nullish(),model:o.Yj().optional(),output:o.YO(o.gM("type",[o.Ik({type:o.eu("message"),role:o.eu("assistant"),id:o.Yj(),content:o.YO(o.Ik({type:o.eu("output_text"),text:o.Yj(),logprobs:o.YO(o.Ik({token:o.Yj(),logprob:o.ai(),top_logprobs:o.YO(o.Ik({token:o.Yj(),logprob:o.ai()}))})).nullish(),annotations:o.YO(o.gM("type",[o.Ik({type:o.eu("url_citation"),start_index:o.ai(),end_index:o.ai(),url:o.Yj(),title:o.Yj()}),o.Ik({type:o.eu("file_citation"),file_id:o.Yj(),filename:o.Yj().nullish(),index:o.ai().nullish(),start_index:o.ai().nullish(),end_index:o.ai().nullish(),quote:o.Yj().nullish()}),o.Ik({type:o.eu("container_file_citation"),container_id:o.Yj(),file_id:o.Yj(),filename:o.Yj().nullish(),start_index:o.ai().nullish(),end_index:o.ai().nullish(),index:o.ai().nullish()}),o.Ik({type:o.eu("file_path"),file_id:o.Yj(),index:o.ai().nullish()})]))}))}),o.Ik({type:o.eu("web_search_call"),id:o.Yj(),status:o.Yj(),action:o.gM("type",[o.Ik({type:o.eu("search"),query:o.Yj().nullish(),sources:o.YO(o.gM("type",[o.Ik({type:o.eu("url"),url:o.Yj()}),o.Ik({type:o.eu("api"),name:o.Yj()})])).nullish()}),o.Ik({type:o.eu("open_page"),url:o.Yj().nullish()}),o.Ik({type:o.eu("find_in_page"),url:o.Yj().nullish(),pattern:o.Yj().nullish()})])}),o.Ik({type:o.eu("file_search_call"),id:o.Yj(),queries:o.YO(o.Yj()),results:o.YO(o.Ik({attributes:o.g1(o.Yj(),o.KC([o.Yj(),o.ai(),o.zM()])),file_id:o.Yj(),filename:o.Yj(),score:o.ai(),text:o.Yj()})).nullish()}),o.Ik({type:o.eu("code_interpreter_call"),id:o.Yj(),code:o.Yj().nullable(),container_id:o.Yj(),outputs:o.YO(o.gM("type",[o.Ik({type:o.eu("logs"),logs:o.Yj()}),o.Ik({type:o.eu("image"),url:o.Yj()})])).nullable()}),o.Ik({type:o.eu("image_generation_call"),id:o.Yj(),result:o.Yj()}),o.Ik({type:o.eu("local_shell_call"),id:o.Yj(),call_id:o.Yj(),action:o.Ik({type:o.eu("exec"),command:o.YO(o.Yj()),timeout_ms:o.ai().optional(),user:o.Yj().optional(),working_directory:o.Yj().optional(),env:o.g1(o.Yj(),o.Yj()).optional()})}),o.Ik({type:o.eu("function_call"),call_id:o.Yj(),name:o.Yj(),arguments:o.Yj(),id:o.Yj()}),o.Ik({type:o.eu("computer_call"),id:o.Yj(),status:o.Yj().optional()}),o.Ik({type:o.eu("reasoning"),id:o.Yj(),encrypted_content:o.Yj().nullish(),summary:o.YO(o.Ik({type:o.eu("summary_text"),text:o.Yj()}))}),o.Ik({type:o.eu("mcp_call"),id:o.Yj(),status:o.Yj(),arguments:o.Yj(),name:o.Yj(),server_label:o.Yj(),output:o.Yj().nullish(),error:o.KC([o.Yj(),o.Ik({type:o.Yj().optional(),code:o.KC([o.ai(),o.Yj()]).optional(),message:o.Yj().optional()}).loose()]).nullish()}),o.Ik({type:o.eu("mcp_list_tools"),id:o.Yj(),server_label:o.Yj(),tools:o.YO(o.Ik({name:o.Yj(),description:o.Yj().optional(),input_schema:o.bz(),annotations:o.g1(o.Yj(),o.L5()).optional()})),error:o.KC([o.Yj(),o.Ik({type:o.Yj().optional(),code:o.KC([o.ai(),o.Yj()]).optional(),message:o.Yj().optional()}).loose()]).optional()}),o.Ik({type:o.eu("mcp_approval_request"),id:o.Yj(),server_label:o.Yj(),name:o.Yj(),arguments:o.Yj(),approval_request_id:o.Yj()}),o.Ik({type:o.eu("apply_patch_call"),id:o.Yj(),call_id:o.Yj(),status:o.k5(["in_progress","completed"]),operation:o.gM("type",[o.Ik({type:o.eu("create_file"),path:o.Yj(),diff:o.Yj()}),o.Ik({type:o.eu("delete_file"),path:o.Yj()}),o.Ik({type:o.eu("update_file"),path:o.Yj(),diff:o.Yj()})])}),o.Ik({type:o.eu("shell_call"),id:o.Yj(),call_id:o.Yj(),status:o.k5(["in_progress","completed","incomplete"]),action:o.Ik({commands:o.YO(o.Yj())})})])).optional(),service_tier:o.Yj().nullish(),incomplete_details:o.Ik({reason:o.Yj()}).nullish(),usage:o.Ik({input_tokens:o.ai(),input_tokens_details:o.Ik({cached_tokens:o.ai().nullish()}).nullish(),output_tokens:o.ai(),output_tokens_details:o.Ik({reasoning_tokens:o.ai().nullish()}).nullish()}).optional()})))),be=(0,a.ID)((()=>(0,a.jN)(o.Ik({conversation:o.Yj().nullish(),include:o.YO(o.k5(["reasoning.encrypted_content","file_search_call.results","message.output_text.logprobs"])).nullish(),instructions:o.Yj().nullish(),logprobs:o.KC([o.zM(),o.ai().min(1).max(20)]).optional(),maxToolCalls:o.ai().nullish(),metadata:o.bz().nullish(),parallelToolCalls:o.zM().nullish(),previousResponseId:o.Yj().nullish(),promptCacheKey:o.Yj().nullish(),promptCacheRetention:o.k5(["in_memory","24h"]).nullish(),reasoningEffort:o.Yj().nullish(),reasoningSummary:o.Yj().nullish(),safetyIdentifier:o.Yj().nullish(),serviceTier:o.k5(["auto","flex","priority","default"]).nullish(),store:o.zM().nullish(),strictJsonSchema:o.zM().nullish(),textVerbosity:o.k5(["low","medium","high"]).nullish(),truncation:o.k5(["auto","disabled"]).nullish(),user:o.Yj().nullish()})))),xe=class{constructor(e,t){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}get provider(){return this.config.provider}async getArgs({maxOutputTokens:e,temperature:t,stopSequences:n,topP:o,topK:s,presencePenalty:l,frequencyPenalty:u,seed:p,prompt:d,providerOptions:m,tools:h,toolChoice:f,responseFormat:g}){var v,y,_,b;const x=[],I=c(this.modelId);null!=s&&x.push({type:"unsupported",feature:"topK"}),null!=p&&x.push({type:"unsupported",feature:"seed"}),null!=l&&x.push({type:"unsupported",feature:"presencePenalty"}),null!=u&&x.push({type:"unsupported",feature:"frequencyPenalty"}),null!=n&&x.push({type:"unsupported",feature:"stopSequences"});const w=await(0,a.xI)({provider:"openai",providerOptions:m,schema:be});(null==w?void 0:w.conversation)&&(null==w?void 0:w.previousResponseId)&&x.push({type:"unsupported",feature:"conversation",details:"conversation and previousResponseId cannot be used together"});const k=(0,a.CR)({tools:h,providerToolNames:{"openai.code_interpreter":"code_interpreter","openai.file_search":"file_search","openai.image_generation":"image_generation","openai.local_shell":"local_shell","openai.shell":"shell","openai.web_search":"web_search","openai.web_search_preview":"web_search_preview","openai.mcp":"mcp","openai.apply_patch":"apply_patch"}}),{input:$,warnings:E}=await async function({prompt:e,toolNameMapping:t,systemMessageMode:n,fileIdPrefixes:o,store:s,hasLocalShellTool:l=!1,hasShellTool:u=!1,hasApplyPatchTool:c=!1}){var p,d,m,h,f;const g=[],v=[];for(const{role:y,content:_}of e)switch(y){case"system":switch(n){case"system":g.push({role:"system",content:_});break;case"developer":g.push({role:"developer",content:_});break;case"remove":v.push({type:"other",message:"system messages are removed for this model"});break;default:throw new Error(`Unsupported system message mode: ${n}`)}break;case"user":g.push({role:"user",content:_.map(((e,t)=>{var n,s,l;switch(e.type){case"text":return{type:"input_text",text:e.text};case"file":if(e.mediaType.startsWith("image/")){const t="image/*"===e.mediaType?"image/jpeg":e.mediaType;return{type:"input_image",...e.data instanceof i?{image_url:e.data.toString()}:"string"==typeof e.data&&fe(e.data,o)?{file_id:e.data}:{image_url:`data:${t};base64,${(0,a.ej)(e.data)}`},detail:null==(s=null==(n=e.providerOptions)?void 0:n.openai)?void 0:s.imageDetail}}if("application/pdf"===e.mediaType)return e.data instanceof i?{type:"input_file",file_url:e.data.toString()}:{type:"input_file",..."string"==typeof e.data&&fe(e.data,o)?{file_id:e.data}:{filename:null!=(l=e.filename)?l:`part-${t}.pdf`,file_data:`data:application/pdf;base64,${(0,a.ej)(e.data)}`}};throw new r.b8({functionality:`file part media type ${e.mediaType}`})}}))});break;case"assistant":{const e={};for(const n of _)switch(n.type){case"text":{const e=null==(d=null==(p=n.providerOptions)?void 0:p.openai)?void 0:d.itemId;if(s&&null!=e){g.push({type:"item_reference",id:e});break}g.push({role:"assistant",content:[{type:"output_text",text:n.text}],id:e});break}case"tool-call":{if(n.providerExecuted)break;const e=null==(h=null==(m=n.providerOptions)?void 0:m.openai)?void 0:h.itemId;if(s&&null!=e){g.push({type:"item_reference",id:e});break}const r=t.toProviderToolName(n.toolName);if(l&&"local_shell"===r){const t=await(0,a.k5)({value:n.input,schema:G});g.push({type:"local_shell_call",call_id:n.toolCallId,id:e,action:{type:"exec",command:t.action.command,timeout_ms:t.action.timeoutMs,user:t.action.user,working_directory:t.action.workingDirectory,env:t.action.env}});break}if(u&&"shell"===r){const t=await(0,a.k5)({value:n.input,schema:J});g.push({type:"shell_call",call_id:n.toolCallId,id:e,status:"completed",action:{commands:t.action.commands,timeout_ms:t.action.timeoutMs,max_output_length:t.action.maxOutputLength}});break}g.push({type:"function_call",call_id:n.toolCallId,name:r,arguments:JSON.stringify(n.input),id:e});break}case"tool-result":s?g.push({type:"item_reference",id:n.toolCallId}):v.push({type:"other",message:`Results for OpenAI tool ${n.toolName} are not sent to the API when store is false`});break;case"reasoning":{const t=await(0,a.xI)({provider:"openai",providerOptions:n.providerOptions,schema:ge}),r=null==t?void 0:t.itemId;if(null!=r){const a=e[r];if(s)void 0===a&&(g.push({type:"item_reference",id:r}),e[r]={type:"reasoning",id:r,summary:[]});else{const o=[];n.text.length>0?o.push({type:"summary_text",text:n.text}):void 0!==a&&v.push({type:"other",message:`Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(n)}.`}),void 0===a?(e[r]={type:"reasoning",id:r,encrypted_content:null==t?void 0:t.reasoningEncryptedContent,summary:o},g.push(e[r])):(a.summary.push(...o),null!=(null==t?void 0:t.reasoningEncryptedContent)&&(a.encrypted_content=t.reasoningEncryptedContent))}}else v.push({type:"other",message:`Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(n)}.`});break}}break}case"tool":for(const e of _){const n=e.output,r=t.toProviderToolName(e.toolName);if(l&&"local_shell"===r&&"json"===n.type){const t=await(0,a.k5)({value:n.value,schema:K});g.push({type:"local_shell_call_output",call_id:e.toolCallId,output:t.output});break}if(u&&"shell"===r&&"json"===n.type){const t=await(0,a.k5)({value:n.value,schema:X});g.push({type:"shell_call_output",call_id:e.toolCallId,output:t.output.map((e=>({stdout:e.stdout,stderr:e.stderr,outcome:"timeout"===e.outcome.type?{type:"timeout"}:{type:"exit",exit_code:e.outcome.exitCode}})))});break}if(c&&"apply_patch"===e.toolName&&"json"===n.type){const t=await(0,a.k5)({value:n.value,schema:C});g.push({type:"apply_patch_call_output",call_id:e.toolCallId,status:t.status,output:t.output});break}let o;switch(n.type){case"text":case"error-text":o=n.value;break;case"execution-denied":o=null!=(f=n.reason)?f:"Tool execution denied.";break;case"json":case"error-json":o=JSON.stringify(n.value);break;case"content":o=n.value.map((e=>{var t;switch(e.type){case"text":return{type:"input_text",text:e.text};case"image-data":return{type:"input_image",image_url:`data:${e.mediaType};base64,${e.data}`};case"file-data":return{type:"input_file",filename:null!=(t=e.filename)?t:"data",file_data:`data:${e.mediaType};base64,${e.data}`};default:return void v.push({type:"other",message:`unsupported tool content part type: ${e.type}`})}})).filter(a.R)}g.push({type:"function_call_output",call_id:e.toolCallId,output:o})}break;default:throw new Error(`Unsupported role: ${y}`)}return{input:g,warnings:v}}({prompt:d,toolNameMapping:k,systemMessageMode:I.systemMessageMode,fileIdPrefixes:this.config.fileIdPrefixes,store:null==(v=null==w?void 0:w.store)||v,hasLocalShellTool:N("openai.local_shell"),hasShellTool:N("openai.shell"),hasApplyPatchTool:N("openai.apply_patch")});x.push(...E);const S=null==(y=null==w?void 0:w.strictJsonSchema)||y;let T=null==w?void 0:w.include;function A(e){null==T?T=[e]:T.includes(e)||(T=[...T,e])}function N(e){return null!=(null==h?void 0:h.find((t=>"provider"===t.type&&t.id===e)))}const O="number"==typeof(null==w?void 0:w.logprobs)?null==w?void 0:w.logprobs:!0===(null==w?void 0:w.logprobs)?20:void 0;O&&A("message.output_text.logprobs");const j=null==(_=null==h?void 0:h.find((e=>"provider"===e.type&&("openai.web_search"===e.id||"openai.web_search_preview"===e.id))))?void 0:_.name;j&&A("web_search_call.action.sources"),N("openai.code_interpreter")&&A("code_interpreter_call.outputs");const R=null==w?void 0:w.store;!1===R&&I.isReasoningModel&&A("reasoning.encrypted_content");const M={model:this.modelId,input:$,temperature:t,top_p:o,max_output_tokens:e,...("json"===(null==g?void 0:g.type)||(null==w?void 0:w.textVerbosity))&&{text:{..."json"===(null==g?void 0:g.type)&&{format:null!=g.schema?{type:"json_schema",strict:S,name:null!=(b=g.name)?b:"response",description:g.description,schema:g.schema}:{type:"json_object"}},...(null==w?void 0:w.textVerbosity)&&{verbosity:w.textVerbosity}}},conversation:null==w?void 0:w.conversation,max_tool_calls:null==w?void 0:w.maxToolCalls,metadata:null==w?void 0:w.metadata,parallel_tool_calls:null==w?void 0:w.parallelToolCalls,previous_response_id:null==w?void 0:w.previousResponseId,store:R,user:null==w?void 0:w.user,instructions:null==w?void 0:w.instructions,service_tier:null==w?void 0:w.serviceTier,include:T,prompt_cache_key:null==w?void 0:w.promptCacheKey,prompt_cache_retention:null==w?void 0:w.promptCacheRetention,safety_identifier:null==w?void 0:w.safetyIdentifier,top_logprobs:O,truncation:null==w?void 0:w.truncation,...I.isReasoningModel&&(null!=(null==w?void 0:w.reasoningEffort)||null!=(null==w?void 0:w.reasoningSummary))&&{reasoning:{...null!=(null==w?void 0:w.reasoningEffort)&&{effort:w.reasoningEffort},...null!=(null==w?void 0:w.reasoningSummary)&&{summary:w.reasoningSummary}}}};I.isReasoningModel?"none"===(null==w?void 0:w.reasoningEffort)&&I.supportsNonReasoningParameters||(null!=M.temperature&&(M.temperature=void 0,x.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for reasoning models"})),null!=M.top_p&&(M.top_p=void 0,x.push({type:"unsupported",feature:"topP",details:"topP is not supported for reasoning models"}))):(null!=(null==w?void 0:w.reasoningEffort)&&x.push({type:"unsupported",feature:"reasoningEffort",details:"reasoningEffort is not supported for non-reasoning models"}),null!=(null==w?void 0:w.reasoningSummary)&&x.push({type:"unsupported",feature:"reasoningSummary",details:"reasoningSummary is not supported for non-reasoning models"})),"flex"!==(null==w?void 0:w.serviceTier)||I.supportsFlexProcessing||(x.push({type:"unsupported",feature:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),delete M.service_tier),"priority"!==(null==w?void 0:w.serviceTier)||I.supportsPriorityProcessing||(x.push({type:"unsupported",feature:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),delete M.service_tier);const{tools:P,toolChoice:L,toolWarnings:D}=await async function({tools:e,toolChoice:t}){const n=[];if(null==(e=(null==e?void 0:e.length)?e:void 0))return{tools:void 0,toolChoice:void 0,toolWarnings:n};const o=[];for(const t of e)switch(t.type){case"function":o.push({type:"function",name:t.name,description:t.description,parameters:t.inputSchema,...null!=t.strict?{strict:t.strict}:{}});break;case"provider":switch(t.id){case"openai.file_search":{const e=await(0,a.k5)({value:t.args,schema:F});o.push({type:"file_search",vector_store_ids:e.vectorStoreIds,max_num_results:e.maxNumResults,ranking_options:e.ranking?{ranker:e.ranking.ranker,score_threshold:e.ranking.scoreThreshold}:void 0,filters:e.filters});break}case"openai.local_shell":o.push({type:"local_shell"});break;case"openai.shell":o.push({type:"shell"});break;case"openai.apply_patch":o.push({type:"apply_patch"});break;case"openai.web_search_preview":{const e=await(0,a.k5)({value:t.args,schema:re});o.push({type:"web_search_preview",search_context_size:e.searchContextSize,user_location:e.userLocation});break}case"openai.web_search":{const e=await(0,a.k5)({value:t.args,schema:ee});o.push({type:"web_search",filters:null!=e.filters?{allowed_domains:e.filters.allowedDomains}:void 0,external_web_access:e.externalWebAccess,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case"openai.code_interpreter":{const e=await(0,a.k5)({value:t.args,schema:Y});o.push({type:"code_interpreter",container:null==e.container?{type:"auto",file_ids:void 0}:"string"==typeof e.container?e.container:{type:"auto",file_ids:e.container.fileIds}});break}case"openai.image_generation":{const e=await(0,a.k5)({value:t.args,schema:U});o.push({type:"image_generation",background:e.background,input_fidelity:e.inputFidelity,input_image_mask:e.inputImageMask?{file_id:e.inputImageMask.fileId,image_url:e.inputImageMask.imageUrl}:void 0,model:e.model,moderation:e.moderation,partial_images:e.partialImages,quality:e.quality,output_compression:e.outputCompression,output_format:e.outputFormat,size:e.size});break}case"openai.mcp":{const e=await(0,a.k5)({value:t.args,schema:ue});o.push({type:"mcp",server_label:e.serverLabel,allowed_tools:Array.isArray(e.allowedTools)?e.allowedTools:e.allowedTools?{read_only:e.allowedTools.readOnly,tool_names:e.allowedTools.toolNames}:void 0,authorization:e.authorization,connector_id:e.connectorId,headers:e.headers,require_approval:"never",server_description:e.serverDescription,server_url:e.serverUrl});break}}break;default:n.push({type:"unsupported",feature:`function tool ${t}`})}if(null==t)return{tools:o,toolChoice:void 0,toolWarnings:n};const s=t.type;switch(s){case"auto":case"none":case"required":return{tools:o,toolChoice:s,toolWarnings:n};case"tool":return{tools:o,toolChoice:"code_interpreter"===t.toolName||"file_search"===t.toolName||"image_generation"===t.toolName||"web_search_preview"===t.toolName||"web_search"===t.toolName||"mcp"===t.toolName||"apply_patch"===t.toolName?{type:t.toolName}:{type:"function",name:t.toolName},toolWarnings:n};default:{const e=s;throw new r.b8({functionality:`tool choice type: ${e}`})}}}({tools:h,toolChoice:f});return{webSearchToolName:j,args:{...M,tools:P,tool_choice:L},warnings:[...x,...D],store:R,toolNameMapping:k}}async doGenerate(e){var t,n,o,s,i,l,c,p,d,m,h,f,g,v,y,_,b,x,I,w,k,$,E,S;const{args:T,warnings:A,webSearchToolName:N,toolNameMapping:O}=await this.getArgs(e),j=this.config.url({path:"/responses",modelId:this.modelId}),C=this.config.provider.replace(".responses",""),{responseHeaders:R,value:M,rawValue:P}=await(0,a.GU)({url:j,headers:(0,a.m2)(this.config.headers(),e.headers),body:T,failedResponseHandler:u,successfulResponseHandler:(0,a.cV)(_e),abortSignal:e.abortSignal,fetch:this.config.fetch});if(M.error)throw new r.hL({message:M.error.message,url:j,requestBodyValues:T,statusCode:400,responseHeaders:R,responseBody:P,isRetryable:!1});const Y=[],L=[];let D=!1;for(const r of M.output)switch(r.type){case"reasoning":0===r.summary.length&&r.summary.push({type:"summary_text",text:""});for(const e of r.summary)Y.push({type:"reasoning",text:e.text,providerMetadata:{[C]:{itemId:r.id,reasoningEncryptedContent:null!=(t=r.encrypted_content)?t:null}}});break;case"image_generation_call":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName("image_generation"),input:"{}",providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName("image_generation"),result:{result:r.result}});break;case"local_shell_call":Y.push({type:"tool-call",toolCallId:r.call_id,toolName:O.toCustomToolName("local_shell"),input:JSON.stringify({action:r.action}),providerMetadata:{[C]:{itemId:r.id}}});break;case"shell_call":Y.push({type:"tool-call",toolCallId:r.call_id,toolName:O.toCustomToolName("shell"),input:JSON.stringify({action:{commands:r.action.commands}}),providerMetadata:{[C]:{itemId:r.id}}});break;case"message":for(const t of r.content){(null==(o=null==(n=e.providerOptions)?void 0:n.openai)?void 0:o.logprobs)&&t.logprobs&&L.push(t.logprobs);const u={itemId:r.id,...t.annotations.length>0&&{annotations:t.annotations}};Y.push({type:"text",text:t.text,providerMetadata:{[C]:u}});for(const e of t.annotations)"url_citation"===e.type?Y.push({type:"source",sourceType:"url",id:null!=(l=null==(i=(s=this.config).generateId)?void 0:i.call(s))?l:(0,a.$C)(),url:e.url,title:e.title}):"file_citation"===e.type?Y.push({type:"source",sourceType:"document",id:null!=(d=null==(p=(c=this.config).generateId)?void 0:p.call(c))?d:(0,a.$C)(),mediaType:"text/plain",title:null!=(h=null!=(m=e.quote)?m:e.filename)?h:"Document",filename:null!=(f=e.filename)?f:e.file_id,...e.file_id?{providerMetadata:{[C]:{fileId:e.file_id}}}:{}}):"container_file_citation"===e.type?Y.push({type:"source",sourceType:"document",id:null!=(y=null==(v=(g=this.config).generateId)?void 0:v.call(g))?y:(0,a.$C)(),mediaType:"text/plain",title:null!=(b=null!=(_=e.filename)?_:e.file_id)?b:"Document",filename:null!=(x=e.filename)?x:e.file_id,providerMetadata:{[C]:{fileId:e.file_id,containerId:e.container_id,...null!=e.index?{index:e.index}:{}}}}):"file_path"===e.type&&Y.push({type:"source",sourceType:"document",id:null!=(k=null==(w=(I=this.config).generateId)?void 0:w.call(I))?k:(0,a.$C)(),mediaType:"application/octet-stream",title:e.file_id,filename:e.file_id,providerMetadata:{[C]:{fileId:e.file_id,...null!=e.index?{index:e.index}:{}}}})}break;case"function_call":D=!0,Y.push({type:"tool-call",toolCallId:r.call_id,toolName:r.name,input:r.arguments,providerMetadata:{[C]:{itemId:r.id}}});break;case"web_search_call":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName(null!=N?N:"web_search"),input:JSON.stringify({}),providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName(null!=N?N:"web_search"),result:we(r.action)});break;case"mcp_call":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName("mcp"),input:JSON.stringify({}),providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName("mcp"),result:{type:"call",serverLabel:r.server_label,name:r.name,arguments:r.arguments,...null!=r.output?{output:r.output}:{},...null!=r.error?{error:r.error}:{}}});break;case"mcp_list_tools":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName("mcp"),input:JSON.stringify({}),providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName("mcp"),result:{type:"listTools",serverLabel:r.server_label,tools:r.tools.map((e=>{var t,n;return{name:e.name,description:null!=(t=e.description)?t:void 0,inputSchema:e.input_schema,annotations:null!=(n=e.annotations)?n:void 0}})),...null!=r.error?{error:r.error}:{}}});break;case"mcp_approval_request":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName("mcp"),input:JSON.stringify({}),providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName("mcp"),result:{type:"approvalRequest",serverLabel:r.server_label,name:r.name,arguments:r.arguments,approvalRequestId:r.approval_request_id}});break;case"computer_call":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName("computer_use"),input:"",providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName("computer_use"),result:{type:"computer_use_tool_result",status:r.status||"completed"}});break;case"file_search_call":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName("file_search"),input:"{}",providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName("file_search"),result:{queries:r.queries,results:null!=(E=null==($=r.results)?void 0:$.map((e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))))?E:null}});break;case"code_interpreter_call":Y.push({type:"tool-call",toolCallId:r.id,toolName:O.toCustomToolName("code_interpreter"),input:JSON.stringify({code:r.code,containerId:r.container_id}),providerExecuted:!0}),Y.push({type:"tool-result",toolCallId:r.id,toolName:O.toCustomToolName("code_interpreter"),result:{outputs:r.outputs}});break;case"apply_patch_call":Y.push({type:"tool-call",toolCallId:r.call_id,toolName:O.toCustomToolName("apply_patch"),input:JSON.stringify({callId:r.call_id,operation:r.operation}),providerMetadata:{[C]:{itemId:r.id}}})}const z={[C]:{responseId:M.id}};L.length>0&&(z[C].logprobs=L),"string"==typeof M.service_tier&&(z[C].serviceTier=M.service_tier);const F=M.usage;return{content:Y,finishReason:ve({finishReason:null==(S=M.incomplete_details)?void 0:S.reason,hasFunctionCall:D}),usage:he(F),request:{body:T},response:{id:M.id,timestamp:new Date(1e3*M.created_at),modelId:M.model,headers:R,body:P},providerMetadata:z,warnings:A}}async doStream(e){const{args:t,warnings:n,webSearchToolName:r,toolNameMapping:o,store:s}=await this.getArgs(e),{responseHeaders:i,value:l}=await(0,a.GU)({url:this.config.url({path:"/responses",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),e.headers),body:{...t,stream:!0},failedResponseHandler:u,successfulResponseHandler:(0,a.Ds)(ye),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=this,p=this.config.provider.replace(".responses","");let d,m="unknown";const h=[];let f=null;const g={},v=[];let y=!1;const _={};let b;return{stream:l.pipeThrough(new TransformStream({start(e){e.enqueue({type:"stream-start",warnings:n})},transform(t,n){var i,l,u,x,I,w,k,$,E,S,T,A,N,O,j,C,R,M,P,Y,L,D,z,F,q,Z,U;if(e.includeRawChunks&&n.enqueue({type:"raw",rawValue:t.rawValue}),!t.success)return m="error",void n.enqueue({type:"error",error:t.error});const V=t.value;if(Ie(V))"function_call"===V.item.type?(g[V.output_index]={toolName:V.item.name,toolCallId:V.item.call_id},n.enqueue({type:"tool-input-start",id:V.item.call_id,toolName:V.item.name})):"web_search_call"===V.item.type?(g[V.output_index]={toolName:o.toCustomToolName(null!=r?r:"web_search"),toolCallId:V.item.id},n.enqueue({type:"tool-input-start",id:V.item.id,toolName:o.toCustomToolName(null!=r?r:"web_search"),providerExecuted:!0}),n.enqueue({type:"tool-input-end",id:V.item.id}),n.enqueue({type:"tool-call",toolCallId:V.item.id,toolName:o.toCustomToolName(null!=r?r:"web_search"),input:JSON.stringify({}),providerExecuted:!0})):"computer_call"===V.item.type?(g[V.output_index]={toolName:o.toCustomToolName("computer_use"),toolCallId:V.item.id},n.enqueue({type:"tool-input-start",id:V.item.id,toolName:o.toCustomToolName("computer_use"),providerExecuted:!0})):"code_interpreter_call"===V.item.type?(g[V.output_index]={toolName:o.toCustomToolName("code_interpreter"),toolCallId:V.item.id,codeInterpreter:{containerId:V.item.container_id}},n.enqueue({type:"tool-input-start",id:V.item.id,toolName:o.toCustomToolName("code_interpreter"),providerExecuted:!0}),n.enqueue({type:"tool-input-delta",id:V.item.id,delta:`{"containerId":"${V.item.container_id}","code":"`})):"file_search_call"===V.item.type?n.enqueue({type:"tool-call",toolCallId:V.item.id,toolName:o.toCustomToolName("file_search"),input:"{}",providerExecuted:!0}):"image_generation_call"===V.item.type?n.enqueue({type:"tool-call",toolCallId:V.item.id,toolName:o.toCustomToolName("image_generation"),input:"{}",providerExecuted:!0}):"mcp_call"===V.item.type||"mcp_list_tools"===V.item.type||"mcp_approval_request"===V.item.type?n.enqueue({type:"tool-call",toolCallId:V.item.id,toolName:o.toCustomToolName("mcp"),input:"{}",providerExecuted:!0}):"apply_patch_call"===V.item.type?(g[V.output_index]={toolName:o.toCustomToolName("apply_patch"),toolCallId:V.item.call_id},"completed"===V.item.status&&n.enqueue({type:"tool-call",toolCallId:V.item.call_id,toolName:o.toCustomToolName("apply_patch"),input:JSON.stringify({callId:V.item.call_id,operation:V.item.operation}),providerMetadata:{[p]:{itemId:V.item.id}}})):"shell_call"===V.item.type?g[V.output_index]={toolName:o.toCustomToolName("shell"),toolCallId:V.item.call_id}:"message"===V.item.type?(v.splice(0,v.length),n.enqueue({type:"text-start",id:V.item.id,providerMetadata:{[p]:{itemId:V.item.id}}})):Ie(V)&&"reasoning"===V.item.type&&(_[V.item.id]={encryptedContent:V.item.encrypted_content,summaryParts:{0:"active"}},n.enqueue({type:"reasoning-start",id:`${V.item.id}:0`,providerMetadata:{[p]:{itemId:V.item.id,reasoningEncryptedContent:null!=(i=V.item.encrypted_content)?i:null}}}));else if(function(e){return"response.output_item.done"===e.type}(V)){if("message"===V.item.type)n.enqueue({type:"text-end",id:V.item.id,providerMetadata:{[p]:{itemId:V.item.id,...v.length>0&&{annotations:v}}}});else if("function_call"===V.item.type)g[V.output_index]=void 0,y=!0,n.enqueue({type:"tool-input-end",id:V.item.call_id}),n.enqueue({type:"tool-call",toolCallId:V.item.call_id,toolName:V.item.name,input:V.item.arguments,providerMetadata:{[p]:{itemId:V.item.id}}});else if("web_search_call"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName(null!=r?r:"web_search"),result:we(V.item.action)});else if("computer_call"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-input-end",id:V.item.id}),n.enqueue({type:"tool-call",toolCallId:V.item.id,toolName:o.toCustomToolName("computer_use"),input:"",providerExecuted:!0}),n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName("computer_use"),result:{type:"computer_use_tool_result",status:V.item.status||"completed"}});else if("file_search_call"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName("file_search"),result:{queries:V.item.queries,results:null!=(u=null==(l=V.item.results)?void 0:l.map((e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))))?u:null}});else if("code_interpreter_call"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName("code_interpreter"),result:{outputs:V.item.outputs}});else if("image_generation_call"===V.item.type)n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName("image_generation"),result:{result:V.item.result}});else if("mcp_call"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName("mcp"),result:{type:"call",serverLabel:V.item.server_label,name:V.item.name,arguments:V.item.arguments,...null!=V.item.output?{output:V.item.output}:{},...null!=V.item.error?{error:V.item.error}:{}}});else if("mcp_list_tools"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName("mcp"),result:{type:"listTools",serverLabel:V.item.server_label,tools:V.item.tools.map((e=>{var t,n;return{name:e.name,description:null!=(t=e.description)?t:void 0,inputSchema:e.input_schema,annotations:null!=(n=e.annotations)?n:void 0}})),...null!=V.item.error?{error:V.item.error}:{}}});else if("apply_patch_call"===V.item.type)g[V.output_index]=void 0,"completed"===V.item.status&&n.enqueue({type:"tool-call",toolCallId:V.item.call_id,toolName:o.toCustomToolName("apply_patch"),input:JSON.stringify({callId:V.item.call_id,operation:V.item.operation}),providerMetadata:{[p]:{itemId:V.item.id}}});else if("mcp_approval_request"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-result",toolCallId:V.item.id,toolName:o.toCustomToolName("mcp"),result:{type:"approvalRequest",serverLabel:V.item.server_label,name:V.item.name,arguments:V.item.arguments,approvalRequestId:V.item.approval_request_id}});else if("local_shell_call"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-call",toolCallId:V.item.call_id,toolName:o.toCustomToolName("local_shell"),input:JSON.stringify({action:{type:"exec",command:V.item.action.command,timeoutMs:V.item.action.timeout_ms,user:V.item.action.user,workingDirectory:V.item.action.working_directory,env:V.item.action.env}}),providerMetadata:{[p]:{itemId:V.item.id}}});else if("shell_call"===V.item.type)g[V.output_index]=void 0,n.enqueue({type:"tool-call",toolCallId:V.item.call_id,toolName:o.toCustomToolName("shell"),input:JSON.stringify({action:{commands:V.item.action.commands}}),providerMetadata:{[p]:{itemId:V.item.id}}});else if("reasoning"===V.item.type){const e=_[V.item.id],t=Object.entries(e.summaryParts).filter((([e,t])=>"active"===t||"can-conclude"===t)).map((([e])=>e));for(const e of t)n.enqueue({type:"reasoning-end",id:`${V.item.id}:${e}`,providerMetadata:{[p]:{itemId:V.item.id,reasoningEncryptedContent:null!=(x=V.item.encrypted_content)?x:null}}});delete _[V.item.id]}}else if(function(e){return"response.function_call_arguments.delta"===e.type}(V)){const e=g[V.output_index];null!=e&&n.enqueue({type:"tool-input-delta",id:e.toolCallId,delta:V.delta})}else if(function(e){return"response.image_generation_call.partial_image"===e.type}(V))n.enqueue({type:"tool-result",toolCallId:V.item_id,toolName:o.toCustomToolName("image_generation"),result:{result:V.partial_image_b64},preliminary:!0});else if(function(e){return"response.code_interpreter_call_code.delta"===e.type}(V)){const e=g[V.output_index];null!=e&&n.enqueue({type:"tool-input-delta",id:e.toolCallId,delta:JSON.stringify(V.delta).slice(1,-1)})}else if(function(e){return"response.code_interpreter_call_code.done"===e.type}(V)){const e=g[V.output_index];null!=e&&(n.enqueue({type:"tool-input-delta",id:e.toolCallId,delta:'"}'}),n.enqueue({type:"tool-input-end",id:e.toolCallId}),n.enqueue({type:"tool-call",toolCallId:e.toolCallId,toolName:o.toCustomToolName("code_interpreter"),input:JSON.stringify({code:V.code,containerId:e.codeInterpreter.containerId}),providerExecuted:!0}))}else if(function(e){return"response.created"===e.type}(V))f=V.response.id,n.enqueue({type:"response-metadata",id:V.response.id,timestamp:new Date(1e3*V.response.created_at),modelId:V.response.model});else if(function(e){return"response.output_text.delta"===e.type}(V))n.enqueue({type:"text-delta",id:V.item_id,delta:V.delta}),(null==(w=null==(I=e.providerOptions)?void 0:I.openai)?void 0:w.logprobs)&&V.logprobs&&h.push(V.logprobs);else if("response.reasoning_summary_part.added"===V.type){if(V.summary_index>0){const e=_[V.item_id];e.summaryParts[V.summary_index]="active";for(const t of Object.keys(e.summaryParts))"can-conclude"===e.summaryParts[t]&&(n.enqueue({type:"reasoning-end",id:`${V.item_id}:${t}`,providerMetadata:{[p]:{itemId:V.item_id}}}),e.summaryParts[t]="concluded");n.enqueue({type:"reasoning-start",id:`${V.item_id}:${V.summary_index}`,providerMetadata:{[p]:{itemId:V.item_id,reasoningEncryptedContent:null!=($=null==(k=_[V.item_id])?void 0:k.encryptedContent)?$:null}}})}}else"response.reasoning_summary_text.delta"===V.type?n.enqueue({type:"reasoning-delta",id:`${V.item_id}:${V.summary_index}`,delta:V.delta,providerMetadata:{[p]:{itemId:V.item_id}}}):"response.reasoning_summary_part.done"===V.type?s?(n.enqueue({type:"reasoning-end",id:`${V.item_id}:${V.summary_index}`,providerMetadata:{[p]:{itemId:V.item_id}}}),_[V.item_id].summaryParts[V.summary_index]="concluded"):_[V.item_id].summaryParts[V.summary_index]="can-conclude":function(e){return"response.completed"===e.type||"response.incomplete"===e.type}(V)?(m=ve({finishReason:null==(E=V.response.incomplete_details)?void 0:E.reason,hasFunctionCall:y}),d=V.response.usage,"string"==typeof V.response.service_tier&&(b=V.response.service_tier)):function(e){return"response.output_text.annotation.added"===e.type}(V)?(v.push(V.annotation),"url_citation"===V.annotation.type?n.enqueue({type:"source",sourceType:"url",id:null!=(A=null==(T=(S=c.config).generateId)?void 0:T.call(S))?A:(0,a.$C)(),url:V.annotation.url,title:V.annotation.title}):"file_citation"===V.annotation.type?n.enqueue({type:"source",sourceType:"document",id:null!=(j=null==(O=(N=c.config).generateId)?void 0:O.call(N))?j:(0,a.$C)(),mediaType:"text/plain",title:null!=(R=null!=(C=V.annotation.quote)?C:V.annotation.filename)?R:"Document",filename:null!=(M=V.annotation.filename)?M:V.annotation.file_id,...V.annotation.file_id?{providerMetadata:{[p]:{fileId:V.annotation.file_id}}}:{}}):"container_file_citation"===V.annotation.type?n.enqueue({type:"source",sourceType:"document",id:null!=(L=null==(Y=(P=c.config).generateId)?void 0:Y.call(P))?L:(0,a.$C)(),mediaType:"text/plain",title:null!=(z=null!=(D=V.annotation.filename)?D:V.annotation.file_id)?z:"Document",filename:null!=(F=V.annotation.filename)?F:V.annotation.file_id,providerMetadata:{[p]:{fileId:V.annotation.file_id,containerId:V.annotation.container_id,...null!=V.annotation.index?{index:V.annotation.index}:{}}}}):"file_path"===V.annotation.type&&n.enqueue({type:"source",sourceType:"document",id:null!=(U=null==(Z=(q=c.config).generateId)?void 0:Z.call(q))?U:(0,a.$C)(),mediaType:"application/octet-stream",title:V.annotation.file_id,filename:V.annotation.file_id,providerMetadata:{[p]:{fileId:V.annotation.file_id,...null!=V.annotation.index?{index:V.annotation.index}:{}}}})):function(e){return"error"===e.type}(V)&&n.enqueue({type:"error",error:V})},flush(e){const t={[p]:{responseId:f}};h.length>0&&(t[p].logprobs=h),void 0!==b&&(t[p].serviceTier=b),e.enqueue({type:"finish",finishReason:m,usage:he(d),providerMetadata:t})}})),request:{body:t},response:{headers:i}}}};function Ie(e){return"response.output_item.added"===e.type}function we(e){var t;switch(e.type){case"search":return{action:{type:"search",query:null!=(t=e.query)?t:void 0},...null!=e.sources&&{sources:e.sources}};case"open_page":return{action:{type:"openPage",url:e.url}};case"find_in_page":return{action:{type:"findInPage",url:e.url,pattern:e.pattern}}}}var ke=(0,a.ID)((()=>(0,a.jN)(o.Ik({instructions:o.Yj().nullish(),speed:o.ai().min(.25).max(4).default(1).nullish()})))),$e=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3"}get provider(){return this.config.provider}async getArgs({text:e,voice:t="alloy",outputFormat:n="mp3",speed:r,instructions:o,language:s,providerOptions:i}){const l=[],u=await(0,a.xI)({provider:"openai",providerOptions:i,schema:ke}),c={model:this.modelId,input:e,voice:t,response_format:"mp3",speed:r,instructions:o};if(n&&(["mp3","opus","aac","flac","wav","pcm"].includes(n)?c.response_format=n:l.push({type:"unsupported",feature:"outputFormat",details:`Unsupported output format: ${n}. Using mp3 instead.`})),u){const e={};for(const t in e){const n=e[t];void 0!==n&&(c[t]=n)}}return s&&l.push({type:"unsupported",feature:"language",details:`OpenAI speech models do not support language selection. Language parameter "${s}" was ignored.`}),{requestBody:c,warnings:l}}async doGenerate(e){var t,n,r;const o=null!=(r=null==(n=null==(t=this.config._internal)?void 0:t.currentDate)?void 0:n.call(t))?r:new Date,{requestBody:s,warnings:i}=await this.getArgs(e),{value:l,responseHeaders:c,rawValue:p}=await(0,a.GU)({url:this.config.url({path:"/audio/speech",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),e.headers),body:s,failedResponseHandler:u,successfulResponseHandler:(0,a.HD)(),abortSignal:e.abortSignal,fetch:this.config.fetch});return{audio:l,warnings:i,request:{body:JSON.stringify(s)},response:{timestamp:o,modelId:this.modelId,headers:c,body:p}}}},Ee=(0,a.ID)((()=>(0,a.jN)(o.Ik({text:o.Yj(),language:o.Yj().nullish(),duration:o.ai().nullish(),words:o.YO(o.Ik({word:o.Yj(),start:o.ai(),end:o.ai()})).nullish(),segments:o.YO(o.Ik({id:o.ai(),seek:o.ai(),start:o.ai(),end:o.ai(),text:o.Yj(),tokens:o.YO(o.ai()),temperature:o.ai(),avg_logprob:o.ai(),compression_ratio:o.ai(),no_speech_prob:o.ai()})).nullish()})))),Se=(0,a.ID)((()=>(0,a.jN)(o.Ik({include:o.YO(o.Yj()).optional(),language:o.Yj().optional(),prompt:o.Yj().optional(),temperature:o.ai().min(0).max(1).default(0).optional(),timestampGranularities:o.YO(o.k5(["word","segment"])).default(["segment"]).optional()})))),Te={afrikaans:"af",arabic:"ar",armenian:"hy",azerbaijani:"az",belarusian:"be",bosnian:"bs",bulgarian:"bg",catalan:"ca",chinese:"zh",croatian:"hr",czech:"cs",danish:"da",dutch:"nl",english:"en",estonian:"et",finnish:"fi",french:"fr",galician:"gl",german:"de",greek:"el",hebrew:"he",hindi:"hi",hungarian:"hu",icelandic:"is",indonesian:"id",italian:"it",japanese:"ja",kannada:"kn",kazakh:"kk",korean:"ko",latvian:"lv",lithuanian:"lt",macedonian:"mk",malay:"ms",marathi:"mr",maori:"mi",nepali:"ne",norwegian:"no",persian:"fa",polish:"pl",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"sr",slovak:"sk",slovenian:"sl",spanish:"es",swahili:"sw",swedish:"sv",tagalog:"tl",tamil:"ta",thai:"th",turkish:"tr",ukrainian:"uk",urdu:"ur",vietnamese:"vi",welsh:"cy"},Ae=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3"}get provider(){return this.config.provider}async getArgs({audio:e,mediaType:t,providerOptions:n}){const r=await(0,a.xI)({provider:"openai",providerOptions:n,schema:Se}),o=new FormData,s=e instanceof Uint8Array?new Blob([e]):new Blob([(0,a.Z9)(e)]);o.append("model",this.modelId);const i=(0,a.HQ)(t);if(o.append("file",new File([s],"audio",{type:t}),`audio.${i}`),r){const e={include:r.include,language:r.language,prompt:r.prompt,response_format:["gpt-4o-transcribe","gpt-4o-mini-transcribe"].includes(this.modelId)?"json":"verbose_json",temperature:r.temperature,timestamp_granularities:r.timestampGranularities};for(const[t,n]of Object.entries(e))if(null!=n)if(Array.isArray(n))for(const e of n)o.append(`${t}[]`,String(e));else o.append(t,String(n))}return{formData:o,warnings:[]}}async doGenerate(e){var t,n,r,o,s,i,l,c;const p=null!=(r=null==(n=null==(t=this.config._internal)?void 0:t.currentDate)?void 0:n.call(t))?r:new Date,{formData:d,warnings:m}=await this.getArgs(e),{value:h,responseHeaders:f,rawValue:g}=await(0,a.S)({url:this.config.url({path:"/audio/transcriptions",modelId:this.modelId}),headers:(0,a.m2)(this.config.headers(),e.headers),formData:d,failedResponseHandler:u,successfulResponseHandler:(0,a.cV)(Ee),abortSignal:e.abortSignal,fetch:this.config.fetch}),v=null!=h.language&&h.language in Te?Te[h.language]:void 0;return{text:h.text,segments:null!=(l=null!=(i=null==(o=h.segments)?void 0:o.map((e=>({text:e.text,startSecond:e.start,endSecond:e.end}))))?i:null==(s=h.words)?void 0:s.map((e=>({text:e.word,startSecond:e.start,endSecond:e.end}))))?l:[],language:v,durationInSeconds:null!=(c=h.duration)?c:void 0,warnings:m,response:{timestamp:p,modelId:this.modelId,headers:f,body:g}}}},Ne="3.0.0-beta.96";function Oe(e={}){var t,n;const r=null!=(t=(0,a.ae)((0,a.x3)({settingValue:e.baseURL,environmentVariableName:"OPENAI_BASE_URL"})))?t:"https://api.openai.com/v1",o=null!=(n=e.name)?n:"openai",s=()=>(0,a.WZ)({Authorization:`Bearer ${(0,a.WL)({apiKey:e.apiKey,environmentVariableName:"OPENAI_API_KEY",description:"OpenAI"})}`,"OpenAI-Organization":e.organization,"OpenAI-Project":e.project,...e.headers},`ai-sdk/openai/${Ne}`),i=t=>new S(t,{provider:`${o}.embedding`,url:({path:e})=>`${r}${e}`,headers:s,fetch:e.fetch}),l=t=>new O(t,{provider:`${o}.image`,url:({path:e})=>`${r}${e}`,headers:s,fetch:e.fetch}),u=t=>new Ae(t,{provider:`${o}.transcription`,url:({path:e})=>`${r}${e}`,headers:s,fetch:e.fetch}),c=t=>new $e(t,{provider:`${o}.speech`,url:({path:e})=>`${r}${e}`,headers:s,fetch:e.fetch}),p=e=>{if(new.target)throw new Error("The OpenAI model function cannot be called with the new keyword.");return d(e)},d=t=>new xe(t,{provider:`${o}.responses`,url:({path:e})=>`${r}${e}`,headers:s,fetch:e.fetch,fileIdPrefixes:["file-"]}),m=function(e){return p(e)};return m.specificationVersion="v3",m.languageModel=p,m.chat=t=>new v(t,{provider:`${o}.chat`,url:({path:e})=>`${r}${e}`,headers:s,fetch:e.fetch}),m.completion=t=>new k(t,{provider:`${o}.completion`,url:({path:e})=>`${r}${e}`,headers:s,fetch:e.fetch}),m.responses=d,m.embedding=i,m.embeddingModel=i,m.image=l,m.imageModel=l,m.transcription=u,m.transcriptionModel=u,m.speech=c,m.speechModel=c,m.tools=me,m}Oe()},65789:(e,t,n)=>{const a=n(98855);e.exports=(e,t)=>{const n=a(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},67105:(e,t,n)=>{const a=Symbol("SemVer ANY");class r{static get ANY(){return a}constructor(e,t){if(t=o(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===a?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?s[i.COMPARATORLOOSE]:s[i.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new c(n[2],this.options.loose):this.semver=a}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===a||e===a)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new p(e.value,t).test(this.value):""===e.operator?""===e.value||new p(this.value,t).test(e.semver):!((t=o(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=r;const o=n(40594),{safeRe:s,t:i}=n(36165),l=n(5544),u=n(95869),c=n(88825),p=n(20360)},67274:e=>{const t=/^[0-9]+$/,n=(e,n)=>{const a=t.test(e),r=t.test(n);return a&&r&&(e=+e,n=+n),e===n?0:a&&!r?-1:r&&!a?1:e<n?-1:1};e.exports={compareIdentifiers:n,rcompareIdentifiers:(e,t)=>n(t,e)}},69316:(e,t,n)=>{var a=n(99174),r=n(4414),o=n(11710),s=n(18184),i=n(57116),l=Object.prototype.hasOwnProperty,u=1,c=2,p=3,d=4,m=1,h=2,f=3,g=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,v=/[\x85\u2028\u2029]/,y=/[,\[\]\{\}]/,_=/^(?:!|!!|![a-z\-]+!)$/i,b=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function x(e){return Object.prototype.toString.call(e)}function I(e){return 10===e||13===e}function w(e){return 9===e||32===e}function k(e){return 9===e||32===e||10===e||13===e}function $(e){return 44===e||91===e||93===e||123===e||125===e}function E(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function S(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function T(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var A=new Array(256),N=new Array(256),O=0;O<256;O++)A[O]=S(O)?1:0,N[O]=S(O);function j(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||i,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function C(e,t){return new r(t,new o(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function R(e,t){throw C(e,t)}function M(e,t){e.onWarning&&e.onWarning.call(null,C(e,t))}var P={YAML:function(e,t,n){var a,r,o;null!==e.version&&R(e,"duplication of %YAML directive"),1!==n.length&&R(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&R(e,"ill-formed argument of the YAML directive"),r=parseInt(a[1],10),o=parseInt(a[2],10),1!==r&&R(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&M(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,r;2!==n.length&&R(e,"TAG directive accepts exactly two arguments"),a=n[0],r=n[1],_.test(a)||R(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,a)&&R(e,'there is a previously declared suffix for "'+a+'" tag handle'),b.test(r)||R(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[a]=r}};function Y(e,t,n,a){var r,o,s,i;if(t<n){if(i=e.input.slice(t,n),a)for(r=0,o=i.length;r<o;r+=1)9===(s=i.charCodeAt(r))||32<=s&&s<=1114111||R(e,"expected valid JSON character");else g.test(i)&&R(e,"the stream contains non-printable characters");e.result+=i}}function L(e,t,n,r){var o,s,i,u;for(a.isObject(n)||R(e,"cannot merge mappings; the provided source object is unacceptable"),i=0,u=(o=Object.keys(n)).length;i<u;i+=1)s=o[i],l.call(t,s)||(t[s]=n[s],r[s]=!0)}function D(e,t,n,a,r,o,s,i){var u,c;if(Array.isArray(r))for(u=0,c=(r=Array.prototype.slice.call(r)).length;u<c;u+=1)Array.isArray(r[u])&&R(e,"nested arrays are not supported inside keys"),"object"==typeof r&&"[object Object]"===x(r[u])&&(r[u]="[object Object]");if("object"==typeof r&&"[object Object]"===x(r)&&(r="[object Object]"),r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===a)if(Array.isArray(o))for(u=0,c=o.length;u<c;u+=1)L(e,t,o[u],n);else L(e,t,o,n);else e.json||l.call(n,r)||!l.call(t,r)||(e.line=s||e.line,e.position=i||e.position,R(e,"duplicated mapping key")),t[r]=o,delete n[r];return t}function z(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):R(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function F(e,t,n){for(var a=0,r=e.input.charCodeAt(e.position);0!==r;){for(;w(r);)r=e.input.charCodeAt(++e.position);if(t&&35===r)do{r=e.input.charCodeAt(++e.position)}while(10!==r&&13!==r&&0!==r);if(!I(r))break;for(z(e),r=e.input.charCodeAt(e.position),a++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==a&&e.lineIndent<n&&M(e,"deficient indentation"),a}function q(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!k(t)))}function Z(e,t){1===t?e.result+=" ":t>1&&(e.result+=a.repeat("\n",t-1))}function U(e,t){var n,a,r=e.tag,o=e.anchor,s=[],i=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=s),a=e.input.charCodeAt(e.position);0!==a&&45===a&&k(e.input.charCodeAt(e.position+1));)if(i=!0,e.position++,F(e,!0,-1)&&e.lineIndent<=t)s.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,W(e,t,p,!1,!0),s.push(e.result),F(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)R(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!i&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=s,!0)}function V(e){var t,n,a,r,o=!1,s=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&R(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(s=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&62!==r);e.position<e.length?(a=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):R(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!k(r);)33===r&&(s?R(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),_.test(n)||R(e,"named tag handle cannot contain such characters"),s=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),y.test(a)&&R(e,"tag suffix cannot contain flow indicator characters")}return a&&!b.test(a)&&R(e,"tag name cannot contain such characters: "+a),o?e.tag=a:l.call(e.tagMap,n)?e.tag=e.tagMap[n]+a:"!"===n?e.tag="!"+a:"!!"===n?e.tag="tag:yaml.org,2002:"+a:R(e,'undeclared tag handle "'+n+'"'),!0}function B(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&R(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!k(n)&&!$(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&R(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function W(e,t,n,r,o){var s,i,g,v,y,_,b,x,S=1,O=!1,j=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=i=g=d===n||p===n,r&&F(e,!0,-1)&&(O=!0,e.lineIndent>t?S=1:e.lineIndent===t?S=0:e.lineIndent<t&&(S=-1)),1===S)for(;V(e)||B(e);)F(e,!0,-1)?(O=!0,g=s,e.lineIndent>t?S=1:e.lineIndent===t?S=0:e.lineIndent<t&&(S=-1)):g=!1;if(g&&(g=O||o),1!==S&&d!==n||(b=u===n||c===n?t:t+1,x=e.position-e.lineStart,1===S?g&&(U(e,x)||function(e,t,n){var a,r,o,s,i,l=e.tag,u=e.anchor,p={},m={},h=null,f=null,g=null,v=!1,y=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=p),i=e.input.charCodeAt(e.position);0!==i;){if(a=e.input.charCodeAt(e.position+1),o=e.line,s=e.position,63!==i&&58!==i||!k(a)){if(!W(e,n,c,!1,!0))break;if(e.line===o){for(i=e.input.charCodeAt(e.position);w(i);)i=e.input.charCodeAt(++e.position);if(58===i)k(i=e.input.charCodeAt(++e.position))||R(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(D(e,p,m,h,f,null),h=f=g=null),y=!0,v=!1,r=!1,h=e.tag,f=e.result;else{if(!y)return e.tag=l,e.anchor=u,!0;R(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=l,e.anchor=u,!0;R(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===i?(v&&(D(e,p,m,h,f,null),h=f=g=null),y=!0,v=!0,r=!0):v?(v=!1,r=!0):R(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,i=a;if((e.line===o||e.lineIndent>t)&&(W(e,t,d,!0,r)&&(v?f=e.result:g=e.result),v||(D(e,p,m,h,f,g,o,s),h=f=g=null),F(e,!0,-1),i=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==i)R(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&D(e,p,m,h,f,null),y&&(e.tag=l,e.anchor=u,e.kind="mapping",e.result=p),y}(e,x,b))||function(e,t){var n,a,r,o,s,i,l,c,p,d,m=!0,h=e.tag,f=e.anchor,g={};if(91===(d=e.input.charCodeAt(e.position)))r=93,i=!1,a=[];else{if(123!==d)return!1;r=125,i=!0,a={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),d=e.input.charCodeAt(++e.position);0!==d;){if(F(e,!0,t),(d=e.input.charCodeAt(e.position))===r)return e.position++,e.tag=h,e.anchor=f,e.kind=i?"mapping":"sequence",e.result=a,!0;m||R(e,"missed comma between flow collection entries"),p=null,o=s=!1,63===d&&k(e.input.charCodeAt(e.position+1))&&(o=s=!0,e.position++,F(e,!0,t)),n=e.line,W(e,t,u,!1,!0),c=e.tag,l=e.result,F(e,!0,t),d=e.input.charCodeAt(e.position),!s&&e.line!==n||58!==d||(o=!0,d=e.input.charCodeAt(++e.position),F(e,!0,t),W(e,t,u,!1,!0),p=e.result),i?D(e,a,g,c,l,p):o?a.push(D(e,null,g,c,l,p)):a.push(l),F(e,!0,t),44===(d=e.input.charCodeAt(e.position))?(m=!0,d=e.input.charCodeAt(++e.position)):m=!1}R(e,"unexpected end of the stream within a flow collection")}(e,b)?j=!0:(i&&function(e,t){var n,r,o,s,i,l=m,u=!1,c=!1,p=t,d=0,g=!1;if(124===(s=e.input.charCodeAt(e.position)))r=!1;else{if(62!==s)return!1;r=!0}for(e.kind="scalar",e.result="";0!==s;)if(43===(s=e.input.charCodeAt(++e.position))||45===s)m===l?l=43===s?f:h:R(e,"repeat of a chomping mode identifier");else{if(!((o=48<=(i=s)&&i<=57?i-48:-1)>=0))break;0===o?R(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?R(e,"repeat of an indentation width identifier"):(p=t+o-1,c=!0)}if(w(s)){do{s=e.input.charCodeAt(++e.position)}while(w(s));if(35===s)do{s=e.input.charCodeAt(++e.position)}while(!I(s)&&0!==s)}for(;0!==s;){for(z(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!c||e.lineIndent<p)&&32===s;)e.lineIndent++,s=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>p&&(p=e.lineIndent),I(s))d++;else{if(e.lineIndent<p){l===f?e.result+=a.repeat("\n",u?1+d:d):l===m&&u&&(e.result+="\n");break}for(r?w(s)?(g=!0,e.result+=a.repeat("\n",u?1+d:d)):g?(g=!1,e.result+=a.repeat("\n",d+1)):0===d?u&&(e.result+=" "):e.result+=a.repeat("\n",d):e.result+=a.repeat("\n",u?1+d:d),u=!0,c=!0,d=0,n=e.position;!I(s)&&0!==s;)s=e.input.charCodeAt(++e.position);Y(e,n,e.position,!1)}}return!0}(e,b)||function(e,t){var n,a,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,a=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(Y(e,a,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;a=e.position,e.position++,r=e.position}else I(n)?(Y(e,a,r,!0),Z(e,F(e,!1,t)),a=r=e.position):e.position===e.lineStart&&q(e)?R(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);R(e,"unexpected end of the stream within a single quoted scalar")}(e,b)||function(e,t){var n,a,r,o,s,i,l;if(34!==(i=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=a=e.position;0!==(i=e.input.charCodeAt(e.position));){if(34===i)return Y(e,n,e.position,!0),e.position++,!0;if(92===i){if(Y(e,n,e.position,!0),I(i=e.input.charCodeAt(++e.position)))F(e,!1,t);else if(i<256&&A[i])e.result+=N[i],e.position++;else if((s=120===(l=i)?2:117===l?4:85===l?8:0)>0){for(r=s,o=0;r>0;r--)(s=E(i=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+s:R(e,"expected hexadecimal character");e.result+=T(o),e.position++}else R(e,"unknown escape sequence");n=a=e.position}else I(i)?(Y(e,n,a,!0),Z(e,F(e,!1,t)),n=a=e.position):e.position===e.lineStart&&q(e)?R(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}R(e,"unexpected end of the stream within a double quoted scalar")}(e,b)?j=!0:function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!k(a)&&!$(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&R(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),l.call(e.anchorMap,n)||R(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],F(e,!0,-1),!0}(e)?(j=!0,null===e.tag&&null===e.anchor||R(e,"alias node should not have any properties")):function(e,t,n){var a,r,o,s,i,l,u,c,p=e.kind,d=e.result;if(k(c=e.input.charCodeAt(e.position))||$(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(k(a=e.input.charCodeAt(e.position+1))||n&&$(a)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,s=!1;0!==c;){if(58===c){if(k(a=e.input.charCodeAt(e.position+1))||n&&$(a))break}else if(35===c){if(k(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&q(e)||n&&$(c))break;if(I(c)){if(i=e.line,l=e.lineStart,u=e.lineIndent,F(e,!1,-1),e.lineIndent>=t){s=!0,c=e.input.charCodeAt(e.position);continue}e.position=o,e.line=i,e.lineStart=l,e.lineIndent=u;break}}s&&(Y(e,r,o,!1),Z(e,e.line-i),r=o=e.position,s=!1),w(c)||(o=e.position+1),c=e.input.charCodeAt(++e.position)}return Y(e,r,o,!1),!!e.result||(e.kind=p,e.result=d,!1)}(e,b,u===n)&&(j=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===S&&(j=g&&U(e,x))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&R(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),v=0,y=e.implicitTypes.length;v<y;v+=1)if((_=e.implicitTypes[v]).resolve(e.result)){e.result=_.construct(e.result),e.tag=_.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else l.call(e.typeMap[e.kind||"fallback"],e.tag)?(_=e.typeMap[e.kind||"fallback"][e.tag],null!==e.result&&_.kind!==e.kind&&R(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+_.kind+'", not "'+e.kind+'"'),_.resolve(e.result)?(e.result=_.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):R(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):R(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||j}function G(e){var t,n,a,r,o=e.position,s=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(r=e.input.charCodeAt(e.position))&&(F(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(s=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!k(r);)r=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&R(e,"directive name must not be less than one character in length");0!==r;){for(;w(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!I(r));break}if(I(r))break;for(t=e.position;0!==r&&!k(r);)r=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==r&&z(e),l.call(P,n)?P[n](e,n,a):M(e,'unknown document directive "'+n+'"')}F(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,F(e,!0,-1)):s&&R(e,"directives end mark is expected"),W(e,e.lineIndent-1,d,!1,!0),F(e,!0,-1),e.checkLineBreaks&&v.test(e.input.slice(o,e.position))&&M(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&q(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,F(e,!0,-1)):e.position<e.length-1&&R(e,"end of the stream or a document separator is expected")}function K(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new j(e,t),a=e.indexOf("\0");for(-1!==a&&(n.position=a,R(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)G(n);return n.documents}function H(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var a=K(e,n);if("function"!=typeof t)return a;for(var r=0,o=a.length;r<o;r+=1)t(a[r])}function J(e,t){var n=K(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new r("expected a single document in the stream, but found more")}}e.exports.loadAll=H,e.exports.load=J,e.exports.safeLoadAll=function(e,t,n){return"object"==typeof t&&null!==t&&void 0===n&&(n=t,t=null),H(e,t,a.extend({schema:s},n))},e.exports.safeLoad=function(e,t){return J(e,a.extend({schema:s},t))}},71295:(e,t,n)=>{n.d(t,{DG:()=>g,E6:()=>x,J:()=>b,J_:()=>u,Jk:()=>c,KH:()=>p,Kk:()=>m,NI:()=>v,QP:()=>s,RM:()=>h,Tt:()=>_,Yk:()=>d,kH:()=>y,ql:()=>f,sm:()=>l,v$:()=>I});var a=n(49189),r=n(7263),o=n(72510);const s=a.xI("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),i={number:"number",bigint:"bigint",object:"date"},l=a.xI("$ZodCheckLessThan",((e,t)=>{s.init(e,t);const n=i[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,a=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),u=a.xI("$ZodCheckGreaterThan",((e,t)=>{s.init(e,t);const n=i[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,a=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),c=a.xI("$ZodCheckMultipleOf",((e,t)=>{s.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===o.LG(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),p=a.xI("$ZodCheckNumberFormat",((e,t)=>{s.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),a=n?"int":"number",[i,l]=o.zH[t.format];e._zod.onattach.push((e=>{const a=e._zod.bag;a.format=t.format,a.minimum=i,a.maximum=l,n&&(a.pattern=r.nd)})),e._zod.check=r=>{const o=r.value;if(n){if(!Number.isInteger(o))return void r.issues.push({expected:a,format:t.format,code:"invalid_type",input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?r.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):r.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}))}o<i&&r.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),o>l&&r.issues.push({origin:"number",input:o,code:"too_big",maximum:l,inst:e})}})),d=a.xI("$ZodCheckMaxLength",((e,t)=>{var n;s.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!o.cl(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const a=n.value;if(a.length<=t.maximum)return;const r=o.Rc(a);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}})),m=a.xI("$ZodCheckMinLength",((e,t)=>{var n;s.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!o.cl(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const a=n.value;if(a.length>=t.minimum)return;const r=o.Rc(a);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}})),h=a.xI("$ZodCheckLengthEquals",((e,t)=>{var n;s.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!o.cl(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const a=n.value,r=a.length;if(r===t.length)return;const s=o.Rc(a),i=r>t.length;n.issues.push({origin:s,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),f=a.xI("$ZodCheckStringFormat",((e,t)=>{var n,a;s.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})})),g=a.xI("$ZodCheckRegex",((e,t)=>{f.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),v=a.xI("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=r.AC),f.init(e,t)})),y=a.xI("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=r.Zv),f.init(e,t)})),_=a.xI("$ZodCheckIncludes",((e,t)=>{s.init(e,t);const n=o.$f(t.includes),a=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),b=a.xI("$ZodCheckStartsWith",((e,t)=>{s.init(e,t);const n=new RegExp(`^${o.$f(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),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})}})),x=a.xI("$ZodCheckEndsWith",((e,t)=>{s.init(e,t);const n=new RegExp(`.*${o.$f(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),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})}})),I=a.xI("$ZodCheckOverwrite",((e,t)=>{s.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}))},71851:(e,t,n)=>{const a=n(25583);e.exports=(e,t,n)=>a(e,t,n)<=0},72510:(e,t,n)=>{function a(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}function r(e,t){return"bigint"==typeof t?t.toString():t}function o(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function s(e){return null==e}function i(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function l(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}function u(e,t,n){Object.defineProperty(e,t,{get(){{const a=n();return e[t]=a,a}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function c(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(e){return JSON.stringify(e)}n.d(t,{$f:()=>v,A2:()=>_,Gv:()=>m,LG:()=>l,NM:()=>b,OH:()=>E,PO:()=>o,QH:()=>T,Qd:()=>f,Rc:()=>j,UQ:()=>p,Up:()=>I,Vy:()=>c,X$:()=>k,cJ:()=>w,cl:()=>s,gJ:()=>u,gx:()=>d,h1:()=>$,hI:()=>h,iR:()=>O,k8:()=>r,lQ:()=>A,mw:()=>S,o8:()=>y,p6:()=>i,qQ:()=>g,sn:()=>C,w5:()=>a,zH:()=>x});const d=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function m(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const h=o((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function f(e){if(!1===m(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==m(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}const g=new Set(["string","number","symbol"]);function v(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y(e,t,n){const a=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(a._zod.parent=e),a}function _(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function b(e){return Object.keys(e).filter((t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout))}new Set(["string","number","bigint","boolean","symbol","undefined"]);const x={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 I(e,t){const n={},a=e._zod.def;for(const e in t){if(!(e in a.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=a.shape[e])}return y(e,{...e._zod.def,shape:n,checks:[]})}function w(e,t){const n={...e._zod.def.shape},a=e._zod.def;for(const e in t){if(!(e in a.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return y(e,{...e._zod.def,shape:n,checks:[]})}function k(e,t){if(!f(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return c(this,"shape",n),n},checks:[]};return y(e,n)}function $(e,t){return y(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return c(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function E(e,t,n){const a=t._zod.def.shape,r={...a};if(n)for(const t in n){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=e?new e({type:"optional",innerType:a[t]}):a[t])}else for(const t in a)r[t]=e?new e({type:"optional",innerType:a[t]}):a[t];return y(t,{...t._zod.def,shape:r,checks:[]})}function S(e,t,n){const a=t._zod.def.shape,r={...a};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new e({type:"nonoptional",innerType:a[t]}))}else for(const t in a)r[t]=new e({type:"nonoptional",innerType:a[t]});return y(t,{...t._zod.def,shape:r,checks:[]})}function T(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function A(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function N(e){return"string"==typeof e?e:e?.message}function O(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const r=N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(n.customError?.(e))??N(n.localeError?.(e))??"Invalid input";a.message=r}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function j(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function C(...e){const[t,n,a]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:a}:{...t}}},72849:(e,t,n)=>{const a=n(20360);e.exports=(e,t,n)=>{try{t=new a(t,n)}catch(e){return!1}return t.test(e)}},75459:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},75982:(e,t,n)=>{const a=n(36165),r=n(64136),o=n(88825),s=n(67274),i=n(98855),l=n(46526),u=n(65789),c=n(47384),p=n(4113),d=n(12169),m=n(9357),h=n(29478),f=n(160),g=n(25583),v=n(24975),y=n(98736),_=n(56206),b=n(9982),x=n(81521),I=n(51269),w=n(18082),k=n(26620),$=n(32056),E=n(54838),S=n(71851),T=n(5544),A=n(52539),N=n(67105),O=n(20360),j=n(72849),C=n(47544),R=n(79779),M=n(38185),P=n(23252),Y=n(78767),L=n(87866),D=n(22038),z=n(4827),F=n(27995),q=n(88834),Z=n(99571);e.exports={parse:i,valid:l,clean:u,inc:c,diff:p,major:d,minor:m,patch:h,prerelease:f,compare:g,rcompare:v,compareLoose:y,compareBuild:_,sort:b,rsort:x,gt:I,lt:w,eq:k,neq:$,gte:E,lte:S,cmp:T,coerce:A,Comparator:N,Range:O,satisfies:j,toComparators:C,maxSatisfying:R,minSatisfying:M,minVersion:P,validRange:Y,outside:L,gtr:D,ltr:z,intersects:F,simplifyRange:q,subset:Z,SemVer:o,re:a.re,src:a.src,tokens:a.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers}},76462:(e,t,n)=>{var a=n(99174),r=n(4414),o=n(57116),s=n(18184),i=Object.prototype.toString,l=Object.prototype.hasOwnProperty,u=9,c=10,p=13,d=32,m=33,h=34,f=35,g=37,v=38,y=39,_=42,b=44,x=45,I=58,w=61,k=62,$=63,E=64,S=91,T=93,A=96,N=123,O=124,j=125,C={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},R=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function M(e){var t,n,o;if(t=e.toString(16).toUpperCase(),e<=255)n="x",o=2;else if(e<=65535)n="u",o=4;else{if(!(e<=4294967295))throw new r("code point within a string may not be greater than 0xFFFFFFFF");n="U",o=8}return"\\"+n+a.repeat("0",o-t.length)+t}function P(e){this.schema=e.schema||o,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=a.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,a,r,o,s,i,u;if(null===t)return{};for(n={},r=0,o=(a=Object.keys(t)).length;r<o;r+=1)s=a[r],i=String(t[s]),"!!"===s.slice(0,2)&&(s="tag:yaml.org,2002:"+s.slice(2)),(u=e.compiledTypeMap.fallback[s])&&l.call(u.styleAliases,i)&&(i=u.styleAliases[i]),n[s]=i;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Y(e,t){for(var n,r=a.repeat(" ",t),o=0,s=-1,i="",l=e.length;o<l;)-1===(s=e.indexOf("\n",o))?(n=e.slice(o),o=l):(n=e.slice(o,s+1),o=s+1),n.length&&"\n"!==n&&(i+=r),i+=n;return i}function L(e,t){return"\n"+a.repeat(" ",e.indent*t)}function D(e){return e===d||e===u}function z(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&65279!==e||65536<=e&&e<=1114111}function F(e,t){return z(e)&&65279!==e&&e!==b&&e!==S&&e!==T&&e!==N&&e!==j&&e!==I&&(e!==f||t&&function(e){return z(e)&&!D(e)&&65279!==e&&e!==p&&e!==c}(t))}function q(e){return/^\n* /.test(e)}var Z=1,U=2,V=3,B=4,W=5;function G(e,t,n,a){e.dump=function(){if(0===t.length)return"''";if(!e.noCompatMode&&-1!==R.indexOf(t))return"'"+t+"'";var o=e.indent*Math.max(1,n),s=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),i=a||e.flowLevel>-1&&n>=e.flowLevel;switch(function(e,t,n,a,r){var o,s,i,l,u=!1,p=!1,d=-1!==a,C=-1,R=z(l=e.charCodeAt(0))&&65279!==l&&!D(l)&&l!==x&&l!==$&&l!==I&&l!==b&&l!==S&&l!==T&&l!==N&&l!==j&&l!==f&&l!==v&&l!==_&&l!==m&&l!==O&&l!==w&&l!==k&&l!==y&&l!==h&&l!==g&&l!==E&&l!==A&&!D(e.charCodeAt(e.length-1));if(t)for(o=0;o<e.length;o++){if(!z(s=e.charCodeAt(o)))return W;i=o>0?e.charCodeAt(o-1):null,R=R&&F(s,i)}else{for(o=0;o<e.length;o++){if((s=e.charCodeAt(o))===c)u=!0,d&&(p=p||o-C-1>a&&" "!==e[C+1],C=o);else if(!z(s))return W;i=o>0?e.charCodeAt(o-1):null,R=R&&F(s,i)}p=p||d&&o-C-1>a&&" "!==e[C+1]}return u||p?n>9&&q(e)?W:p?B:V:R&&!r(e)?Z:U}(t,i,e.indent,s,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n<a;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(e,t)}))){case Z:return t;case U:return"'"+t.replace(/'/g,"''")+"'";case V:return"|"+K(t,e.indent)+H(Y(t,o));case B:return">"+K(t,e.indent)+H(Y(function(e,t){for(var n,a,r,o=/(\n+)([^\n]*)/g,s=(r=-1!==(r=e.indexOf("\n"))?r:e.length,o.lastIndex=r,J(e.slice(0,r),t)),i="\n"===e[0]||" "===e[0];a=o.exec(e);){var l=a[1],u=a[2];n=" "===u[0],s+=l+(i||n||""===u?"":"\n")+J(u,t),i=n}return s}(t,s),o));case W:return'"'+function(e){for(var t,n,a,r="",o=0;o<e.length;o++)(t=e.charCodeAt(o))>=55296&&t<=56319&&(n=e.charCodeAt(o+1))>=56320&&n<=57343?(r+=M(1024*(t-55296)+n-56320+65536),o++):r+=!(a=C[t])&&z(t)?e[o]:a||M(t);return r}(t)+'"';default:throw new r("impossible error: invalid scalar style")}}()}function K(e,t){var n=q(e)?String(t):"",a="\n"===e[e.length-1];return n+(!a||"\n"!==e[e.length-2]&&"\n"!==e?a?"":"-":"+")+"\n"}function H(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function J(e,t){if(""===e||" "===e[0])return e;for(var n,a,r=/ [^ ]/g,o=0,s=0,i=0,l="";n=r.exec(e);)(i=n.index)-o>t&&(a=s>o?s:i,l+="\n"+e.slice(o,a),o=a+1),s=i;return l+="\n",e.length-o>t&&s>o?l+=e.slice(o,s)+"\n"+e.slice(s+1):l+=e.slice(o),l.slice(1)}function X(e,t,n){var a,o,s,u,c,p;for(s=0,u=(o=n?e.explicitTypes:e.implicitTypes).length;s<u;s+=1)if(((c=o[s]).instanceOf||c.predicate)&&(!c.instanceOf||"object"==typeof t&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(e.tag=n?c.tag:"?",c.represent){if(p=e.styleMap[c.tag]||c.defaultStyle,"[object Function]"===i.call(c.represent))a=c.represent(t,p);else{if(!l.call(c.represent,p))throw new r("!<"+c.tag+'> tag resolver accepts not "'+p+'" style');a=c.represent[p](t,p)}e.dump=a}return!0}return!1}function Q(e,t,n,a,o,s){e.tag=null,e.dump=n,X(e,n,!1)||X(e,n,!0);var l=i.call(e.dump);a&&(a=e.flowLevel<0||e.flowLevel>t);var u,p,d="[object Object]"===l||"[object Array]"===l;if(d&&(p=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||p||2!==e.indent&&t>0)&&(o=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)a&&0!==Object.keys(e.dump).length?(function(e,t,n,a){var o,s,i,l,u,p,d="",m=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new r("sortKeys must be a boolean or a function");for(o=0,s=h.length;o<s;o+=1)p="",a&&0===o||(p+=L(e,t)),l=n[i=h[o]],Q(e,t+1,i,!0,!0,!0)&&((u=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&c===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=L(e,t)),Q(e,t+1,l,!0,u)&&(e.dump&&c===e.dump.charCodeAt(0)?p+=":":p+=": ",d+=p+=e.dump));e.tag=m,e.dump=d||"{}"}(e,t,e.dump,o),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var a,r,o,s,i,l="",u=e.tag,c=Object.keys(n);for(a=0,r=c.length;a<r;a+=1)i="",0!==a&&(i+=", "),e.condenseFlow&&(i+='"'),s=n[o=c[a]],Q(e,t,o,!1,!1)&&(e.dump.length>1024&&(i+="? "),i+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Q(e,t,s,!1,!1)&&(l+=i+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var m=e.noArrayIndent&&t>0?t-1:t;a&&0!==e.dump.length?(function(e,t,n,a){var r,o,s="",i=e.tag;for(r=0,o=n.length;r<o;r+=1)Q(e,t+1,n[r],!0,!0)&&(a&&0===r||(s+=L(e,t)),e.dump&&c===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}(e,m,e.dump,o),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,n){var a,r,o="",s=e.tag;for(a=0,r=n.length;a<r;a+=1)Q(e,t,n[a],!1,!1)&&(0!==a&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=s,e.dump="["+o+"]"}(e,m,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump))}else{if("[object String]"!==l){if(e.skipInvalid)return!1;throw new r("unacceptable kind of an object to dump "+l)}"?"!==e.tag&&G(e,e.dump,t,s)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function ee(e,t){var n,a,r=[],o=[];for(te(e,r,o),n=0,a=o.length;n<a;n+=1)t.duplicates.push(r[o[n]]);t.usedDuplicates=new Array(a)}function te(e,t,n){var a,r,o;if(null!==e&&"object"==typeof e)if(-1!==(r=t.indexOf(e)))-1===n.indexOf(r)&&n.push(r);else if(t.push(e),Array.isArray(e))for(r=0,o=e.length;r<o;r+=1)te(e[r],t,n);else for(r=0,o=(a=Object.keys(e)).length;r<o;r+=1)te(e[a[r]],t,n)}function ne(e,t){var n=new P(t=t||{});return n.noRefs||ee(e,n),Q(n,0,e,!0,!0)?n.dump+"\n":""}e.exports.dump=ne,e.exports.safeDump=function(e,t){return ne(e,a.extend({schema:s},t))}},78316:(e,t,n)=>{var a=n(40811),r=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new a("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==r.exec(e)||null!==o.exec(e))},construct:function(e){var t,n,a,s,i,l,u,c,p=0,d=null;if(null===(t=r.exec(e))&&(t=o.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,a,s));if(i=+t[4],l=+t[5],u=+t[6],t[7]){for(p=t[7].slice(0,3);p.length<3;)p+="0";p=+p}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,s,i,l,u,p)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},78767:(e,t,n)=>{const a=n(20360);e.exports=(e,t)=>{try{return new a(e,t).range||"*"}catch(e){return null}}},79223:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ANY_NAMESPACE=t.ANY_COLLECTION_NAMESPACE=t.TIME_SERIES=t.VIEW=t.COLLECTION=t.DATABASE=void 0,t.DATABASE="db";const n="coll";t.COLLECTION=n;const a="view";t.VIEW=a;const r="timeseries";t.TIME_SERIES=r;const o=[n,a,r];t.ANY_COLLECTION_NAMESPACE=o;const s=["db",...o];t.ANY_NAMESPACE=s},79779:(e,t,n)=>{const a=n(88825),r=n(20360);e.exports=(e,t,n)=>{let o=null,s=null,i=null;try{i=new r(t,n)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(o&&-1!==s.compare(e)||(o=e,s=new a(o,n)))})),o}},79984:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.REQUIRED_AS_FIRST_STAGE=t.FULL_SCAN_STAGES=t.OUT_STAGES=t.STAGE_OPERATOR_NAMES=t.STAGE_OPERATORS=void 0;const a=n(92133),r=n(79223),o=[{name:"$addFields",value:"$addFields",label:"$addFields",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Adds new field(s) to a document with a computed value, or reassigns an existing field(s) with a computed value.",comment:"/**\n * newField: The new field name.\n * expression: The new field expression.\n */\n",snippet:"{\n ${1:newField}: ${2:expression}, ${3:...}\n}"},{name:"$bucket",value:"$bucket",label:"$bucket",outputStage:!1,fullScan:!0,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Categorizes incoming documents into groups, called buckets, based on specified boundaries.",comment:"/**\n * groupBy: The expression to group by.\n * boundaries: An array of the lower boundaries for each bucket.\n * default: The bucket name for documents that do not fall within the specified boundaries\n * output: {\n * outputN: Optional. The output object may contain a single or numerous field names used to accumulate values per bucket.\n * }\n */\n",snippet:"{\n groupBy: ${1:expression},\n boundaries: [ ${2:lowerbound}, ${3:...} ],\n default: ${4:literal},\n output: {\n ${5:outputN}: { ${6:accumulator} }, ${7:...}\n }\n}"},{name:"$bucketAuto",value:"$bucketAuto",label:"$bucketAuto",outputStage:!1,fullScan:!0,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Automatically categorizes documents into a specified number of buckets, attempting even distribution if possible.",comment:"/**\n * groupBy: The expression to group by.\n * buckets: The desired number of buckets\n * output: {\n * outputN: Optional. The output object may contain a single or numerous field names used to accumulate values per bucket.\n * }\n * granularity: Optional number series\n */\n",snippet:"{\n groupBy: ${1:expression},\n buckets: ${2:number},\n output: {\n ${3:outputN}: ${4:accumulator}, ${5:...}\n },\n granularity: '${6:string}'\n}"},{name:"$changeStream",value:"$changeStream",label:"$changeStream",outputStage:!1,fullScan:!1,firstStage:!0,score:1,env:[a.ATLAS,a.ON_PREM],meta:"stage",version:"4.2.0",apiVersions:[1],namespaces:[r.DATABASE],description:"Returns a Change Stream cursor for the collection.",comment:"/**\n * allChangesForCluster: Optional boolean to include all changes in the cluster.\n * fullDocument: Optional value to request a copy of full document when modified by update operations (Introduced in 6.0).\n * fullDocumentBeforeChange: Value to configure whether to return a full document before the change or not.\n * resumeAfter: Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields.\n * showExpandedEvents: Specifies whether to include additional change events, such as such as DDL and index operations (Introduced in 6.0).\n * startAfter: Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields.\n * startAtOperationTime: Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields.\n */\n",snippet:"{\n allChangesForCluster: ${1:boolean},\n fullDocument: '${2:string}',\n fullDocumentBeforeChange: '${3:string}',\n resumeAfter: ${4:resumeToken},\n showExpandedEvents: ${5:boolean},\n startAfter: ${6:resumeToken},\n startAtOperationTime: ${7:time},\n}"},{name:"$collStats",value:"$collStats",label:"$collStats",outputStage:!1,fullScan:!1,firstStage:!0,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[],namespaces:[...r.ANY_COLLECTION_NAMESPACE],description:"Returns statistics regarding a collection or view.",comment:"/**\n * histograms: Optional latency histograms.\n * storageStats: Optional storage stats.\n */\n",snippet:"{\n latencyStats: {\n histograms: ${1:boolean}\n },\n storageStats: {${2:}},\n}"},{name:"$count",value:"$count",label:"$count",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Returns a count of the number of documents at this stage of the aggregation pipeline.",comment:"/**\n * Provide the field name for the count.\n */\n",snippet:"'${1:string}'"},{name:"$currentOp",value:"$currentOp",label:"$currentOp",outputStage:!1,fullScan:!1,firstStage:!0,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.6.0",apiVersions:[1],namespaces:[r.DATABASE],description:"Returns a cursor over information on active and/or dormant operations for the MongoDB deployment as well as inactive sessions that are holding locks as part of a transaction.",comment:"/**\n * allUsers: Optional boolean value to specify whether to return operations for all users or not.\n * idleConnections: Optional boolean value to specify whether to return all operations including idle connections or not.\n * idleCursors: Optional boolean value to specify whether to report on cursors that are idle or not.\n * idleSessions: Optional boolean value to specify whether to report on dormant sessions or not.\n * localOps: Optional boolean value to specify whether to report on operations running locally on targetted mongos or not.\n * backtrace: Optional boolean value to specify whether callstack information is returned as part of the waitingForLatch output field.\n */\n",snippet:"{\n allUsers: ${1:false},\n idleConnections: ${2:false},\n idleCursors: ${3:false},\n idleSessions: ${4:true},\n localOps: ${5:false},\n backtrace: ${6:false},\n}"},{name:"$densify",value:"$densify",label:"$densify",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"5.1.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Creates new documents to eliminate the gaps in the time or numeric domain at the required granularity level.",comment:"/**\n * field: The required field to densify.\n * partitionByFields: The set of fields that acts as a compound key to define each partition.\n * range: {\n * step: The amount to increment the field value in each document.\n * unit: If specified field must evaluate to a date for every document in the collection, otherwise must evaluate to a numeric.\n * bounds: A string or array of numeric/date bounds, corresponding to the type of the field.\n * }\n */\n",snippet:"{\n field: ${1:string},\n partitionByFields: [${2:string}, ${3:string}, ...],\n range: {\n step: ${4:number},\n unit: ${5:string},\n bounds: [${6:lowerbound}, ${7:upperbound}, ...]\n }\n}"},{name:"$documents",value:"$documents",label:"$documents",outputStage:!1,fullScan:!1,firstStage:!0,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"4.4.9",apiVersions:[1],namespaces:[r.DATABASE],description:"Returns literal documents from input values.",comment:"/**\n * expression: Any valid expression.\n */\n",snippet:"{\n ${1:expression}\n}"},{name:"$facet",value:"$facet",label:"$facet",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Allows for multiple parellel aggregations to be specified.",comment:"/**\n * outputFieldN: The first output field.\n * stageN: The first aggregation stage.\n */\n",snippet:"{\n ${1:outputFieldN}: [ ${2:stageN}, ${3:...} ]\n}"},{name:"$fill",value:"$fill",label:"$fill",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"5.3.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Populates null and missing field values within documents.",comment:'/**\n * sortBy: Syntax is the same as $sort, required if "method" is used in at least one output spec otherwise optional\n * partitionBy: Optional, default is a single partition. Specification is the same as _id in $group (same as partitionBy in window functions).\n * partitionByFields: Optional, set of fields that acts as a compound key to define each partition.\n * output - Required, object for each field to fill in. For a single field, can be a single object.\n * output.<field> - A field to be filled with value, if missing or null in the current document.\n */\n',snippet:"{\n sortBy: ${1:sortSpec},\n partitionBy: ${2:expression},\n partitionByFields: [${3:string}, ${4:string}, ...],\n output: {\n field1: {value: ${5:expression}},\n field2: {method: ${6:string}},\n ...\n }\n}"},{name:"$geoNear",value:"$geoNear",label:"$geoNear",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Returns documents based on proximity to a geospatial point.",comment:"/**\n * near: The point to search near.\n * distanceField: The calculated distance.\n * maxDistance: The maximum distance, in meters, documents can be before being excluded from results.\n * query: Limits results that match the query\n * includeLocs: Optional. Labels and includes the point used to match the document.\n * num: Optional. The maximum number of documents to return.\n * spherical: Defaults to false. Specifies whether to use spherical geometry.\n */\n",snippet:"{\n near: { type: 'Point', coordinates: [ ${1:number}, ${2:number} ] },\n distanceField: '${3:string}',\n maxDistance: ${4:number},\n query: {${5}},\n includeLocs: '${6}',\n num: ${7:number},\n spherical: ${8:boolean}\n}"},{name:"$graphLookup",value:"$graphLookup",label:"$graphLookup",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Performs a recursive search on a collection.",comment:"/**\n * from: The target collection.\n * startWith: Expression to start.\n * connectFromField: Field to connect.\n * connectToField: Field to connect to.\n * as: Name of the array field.\n * maxDepth: Optional max recursion depth.\n * depthField: Optional Name of the depth field.\n * restrictSearchWithMatch: Optional query.\n */\n",snippet:"{\n from: '${1:string}',\n startWith: ${2:expression},\n connectFromField: '${3:string}',\n connectToField: '${4:string}',\n as: '${5:string}',\n maxDepth: ${6:number},\n depthField: '${7:string}',\n restrictSearchWithMatch: {${8}}\n}"},{name:"$group",value:"$group",label:"$group",outputStage:!1,fullScan:!0,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Groups documents by a specified expression.",comment:"/**\n * _id: The id of the group.\n * fieldN: The first field name.\n */\n",snippet:"{\n _id: ${1:expression},\n ${2:fieldN}: {\n ${3:accumulatorN}: ${4:expressionN}\n }\n}"},{name:"$indexStats",value:"$indexStats",label:"$indexStats",outputStage:!1,fullScan:!1,firstStage:!0,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.2.0",apiVersions:[],namespaces:[...r.ANY_NAMESPACE],description:"Returns statistics regarding the use of each index for the collection.",comment:"/**\n * No parameters.\n */\n",snippet:"{}"},{name:"$limit",value:"$limit",label:"$limit",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Limits the number of documents that flow into subsequent stages.",comment:"/**\n * Provide the number of documents to limit.\n */\n",snippet:"${1:number}"},{name:"$listLocalSessions",value:"$listLocalSessions",label:"$listLocalSessions",outputStage:!1,fullScan:!1,firstStage:!0,score:1,env:[a.ATLAS,a.ON_PREM],meta:"stage",version:"3.6.0",apiVersions:[1],namespaces:[r.DATABASE],description:"Lists the sessions cached in memory by the mongod or mongos instance.",comment:"/**\n * users: Optional list of users for which local sessions need to be returned.\n * allUsers: Optional boolean value to specify whether to return local sessions for all users or not.\n */\n",snippet:"{\n allUsers: ${1:false},\n users: [\n { user: '${2:string}', db: '${3:string}' }\n ]\n}"},{name:"$lookup",value:"$lookup",label:"$lookup",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Performs a join between two collections.",comment:"/**\n * from: The target collection.\n * localField: The local join field.\n * foreignField: The target join field.\n * as: The name for the results.\n * pipeline: Optional pipeline to run on the foreign collection.\n * let: Optional variables to use in the pipeline field stages.\n */\n",snippet:"{\n from: ${1:collection},\n localField: ${2:field},\n foreignField: ${3:field},\n as: ${4:result}\n}"},{name:"$match",value:"$match",label:"$match",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Filters the document stream to allow only matching documents to pass through to subsequent stages.",comment:"/**\n * query: The query in MQL.\n */\n",snippet:"{\n ${1:query}\n}"},{name:"$merge",value:"$merge",label:"$merge",outputStage:!0,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ON_PREM],meta:"stage",version:"4.1.11",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Merges the resulting documents into a collection, optionally overriding existing documents.",comment:"/**\n * into: The target collection.\n * on: Fields to identify.\n * let: Defined variables.\n * whenMatched: Action for matching docs.\n * whenNotMatched: Action for non-matching docs.\n */\n",snippet:"{\n into: '${1:string}',\n on: '${2:string}',\n let: '${3:specification(s)}',\n whenMatched: '${4:string}',\n whenNotMatched: '${5:string}'\n}"},{name:"$merge",value:"$merge",label:"$merge",outputStage:!0,fullScan:!1,firstStage:!1,score:1,env:[a.ADL],meta:"stage",version:"4.0.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Merges the resulting documents into a collection, optionally overriding existing documents.",comment:"/**\n * atlas: Location to write the documents from the aggregation pipeline.\n * on: Fields to identify.\n * let: Defined variables.\n * whenMatched: Action for matching docs.\n * whenNotMatched: Action for non-matching docs.\n */\n",snippet:"{\n into: {\n atlas: {\n clusterName: '${1:atlasClusterName}',\n db: '${2:database}',\n coll: '${3:collection}',\n projectId: '${4:optionalAtlasProjectId}'\n }\n },\n on: '${5:identifier}',\n let: { ${6:specification(s)} },\n whenMatched: '${7:string}',\n whenNotMatched: '${8:string}'\n}"},{name:"$out",value:"$out",label:"$out",outputStage:!0,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Writes the result of a pipeline to a new or existing collection.",comment:"/**\n * Provide the name of the output database and collection.\n */\n",snippet:"{\n db: '${1:string}',\n coll: '${2:string}',\n /*\n timeseries: {\n timeField: '${3:field}',\n bucketMaxSpanSeconds: '${4:number}',\n granularity: '${5:granularity}'\n }\n */\n}"},{name:"$out",value:"$out",label:"$out",outputStage:!0,fullScan:!1,firstStage:!1,score:1,env:[a.ADL],meta:"stage",version:"4.0.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Writes the result of a pipeline to an Atlas cluster, S3 bucket, or Azure Blob Storage.",comment:"/**\n * Use any one of the following:\n * s3: Parameters to save the data to S3.\n * atlas: Parameters to save the data to Atlas. Example:\n * {\n * atlas: {\n * db: 'string',\n * coll: 'string',\n * projectId: 'string',\n * clusterName: 'string'\n * }\n * },\n * azure: Parameters to save the data to Azure. Example:\n * {\n * azure: {\n * serviceURL: 'string',\n * containerName: 'string',\n * region: 'string,\n * filename: 'string',\n * format: {\n * name: 'string',\n * maxFileSize: 'string',\n * maxRowGroupSize: 'string',\n * columnCompression: 'string'\n * },\n * errorMode: 'string'\n * }\n * }\n */\n",snippet:"{\n s3: {\n bucket: '${1:string}',\n region: '${2:string}',\n filename: '${3:string}',\n format: {\n name: '${4:string}',\n maxFileSize: '${5:bytes}',\n maxRowGroupSize: '${6:string}',\n columnCompression: '${7:string}'\n },\n errorMode: '${8:string}'\n }\n}"},{name:"$project",value:"$project",label:"$project",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Adds new field(s) to a document with a computed value, or reassigns an existing field(s) with a computed value. Unlike $addFields, $project can also remove fields.",comment:"/**\n * specifications: The fields to\n * include or exclude.\n */\n",snippet:"{\n ${1:specification(s)}\n}"},{name:"$rankFusion",value:"$rankFusion",label:"$rankFusion",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS],meta:"stage",version:"8.0.14",apiVersions:[],namespaces:[r.COLLECTION],description:"Combines multiple pipelines using reciprocal rank fusion to create hybrid search results.",comment:'/**\n * input.pipelines: Required. Map from name to input pipeline. Each pipeline must be a Ranked Selection Pipeline operating on the same collection. Minimum of one pipeline.\n * combination.weights: Optional. Map from pipeline name to numbers (non-negative). If unspecified, default weight is 1 for each pipeline.\n * scoreDetails: Optional. Default false. Set to true to include detailed scoring information in {$meta: "scoreDetails"} for debugging and tuning.\n */\n',snippet:"{\n input: {\n pipelines: {\n ${1:searchPipeline}: [\n {$search: {${2:searchStage}}},\n {$limit: ${3:limit}}\n ],\n ${4:vectorPipeline}: [\n {$vectorSearch: {${5:vectorSearchStage}}}\n ]\n }\n },\n combination: {\n weights: {\n ${6:searchPipeline}: ${7:number},\n ${8:vectorPipeline}: ${9:number}\n }\n },\n scoreDetails: ${10:false}\n}"},{name:"$redact",value:"$redact",label:"$redact",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.6.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Restricts the content for each document based on information stored in the documents themselves",comment:"/**\n * expression: Any valid expression that\n * evaluates to $$DESCEND, $$PRUNE, or $$KEEP.\n */\n",snippet:"{\n ${1:expression}\n}"},{name:"$replaceRoot",value:"$replaceRoot",label:"$replaceRoot",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Replaces a document with the specified embedded document.",comment:"/**\n * replacementDocument: A document or string.\n */\n",snippet:"{\n newRoot: ${1:replacementDocument}\n}"},{name:"$replaceWith",value:"$replaceWith",label:"$replaceWith",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"4.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Replaces a document with the specified embedded document.",comment:"/**\n * replacementDocument: A document or string.\n */\n",snippet:"{\n newWith: ${1:replacementDocument}\n}"},{name:"$sample",value:"$sample",label:"$sample",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.2.0",apiVersions:[1],namespaces:[...r.ANY_COLLECTION_NAMESPACE],description:"Randomly selects the specified number of documents from its input.",comment:"/**\n * size: The number of documents to sample.\n */\n",snippet:"{\n size: ${1:number}\n}"},{name:"$scoreFusion",value:"$scoreFusion",label:"$scoreFusion",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS],meta:"stage",version:"8.2.0",apiVersions:[],namespaces:[r.COLLECTION],description:"Combines multiple pipelines using relative score fusion to create hybrid search results.",comment:"/**\n * input.pipelines: Required. Map from name to input pipeline. Each pipeline must be operating on the same collection. Minimum of one pipeline.\n * input.normalization: Required. Normalizes the score to the range 0 to 1 before combining the results. Value can be none, sigmoid or minMaxScaler.\n * combination.weights: Optional. Map from pipeline name to numbers (non-negative). If unspecified, default weight is 1 for each pipeline.\n * combination.method: Optional. Specifies method for combining scores. Value can be avg or expression. Default is avg.\n * combination.expression: Optional. This is the custom expression that is used when combination.method is set to expression.\n * scoreDetails: Optional. Default false. Set to true to include detailed scoring information.\n */\n",snippet:"{\n input: {\n pipelines: {\n ${1:searchPipeline}: [\n {$search: {${2:searchStage}}},\n {$limit: ${3:limit}}\n ],\n ${4:vectorPipeline}: [\n {$vectorSearch: {${5:vectorSearchStage}}}\n ]\n },\n normalization: '${6:none|sigmoid|minMaxScaler}'\n },\n combination: {\n weights: {\n ${7:searchPipeline}: ${8:number},\n ${9:vectorPipeline}: ${10:number}\n },\n method: '${11:avg|expression}',\n expression: '${12:expression}'\n },\n scoreDetails: ${13:false}\n}"},{name:"$search",value:"$search",label:"$search",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS],meta:"stage",version:"4.1.11",apiVersions:[],namespaces:[r.COLLECTION,r.VIEW],description:"Performs a full-text search on the specified field(s).",comment:"/**\n * index: The name of the Search index.\n * text: Analyzed search, with required fields of query and path, the analyzed field(s) to search. Use matchCriteria to match 'any' or 'all' query terms.\n * compound: Combines ops.\n * span: Find in text field regions.\n * exists: Test for presence of a field.\n * near: Find near number or date.\n * range: Find in numeric or date range.\n */\n",snippet:"{\n index: '${1:string}',\n text: {\n query: '${2:string}',\n path: '${3:string}',\n matchCriteria: '${4:any}',\n }\n}"},{name:"$searchMeta",value:"$searchMeta",label:"$searchMeta",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS],meta:"stage",version:"4.4.9",apiVersions:[],namespaces:[r.COLLECTION,r.VIEW],description:"Performs a full-text search on the specified field(s) and gets back only the generated search meta data from a query.",comment:"/**\n * index: The name of the Search index.\n * count: The count of the results.\n * facet: {\n * operator: Analyzed search, with required fields of query and path, can either be replaced with the name of a valid operator.\n * facets: {\n * stringFacet: Narrows search results based on unique string values, with required fields of type and path.\n * numberFacet: Narrows search results by breaking them up into separate ranges of numbers, with required fields of type, path, and boundaries.\n * dateFacet: Narrows search results by breaking them up into separate ranges of dates, with required fields of type, path, and boundaries.\n * }\n * }\n */\n",snippet:"{\n index: ${1:string},\n facet: {\n operator: {\n text: {\n query: ${2:string},\n path: ${3:string}\n }\n },\n facets: {\n ${4:stringFacet}: {\n type: ${5:string},\n path: ${6:string},\n numBuckets: ${7:integer}\n },\n numberFacet: {\n type: 'number',\n path: ${8:string},\n boundaries: [${9:lowerbound}, ${10:upperbound}, ...],\n default: ${11:string}\n }\n }\n }\n}"},{name:"$set",value:"$set",label:"$set",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"4.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Adds new fields to documents. $set outputs documents that contain all existing fields from the input documents and newly added fields.",comment:"/**\n * field: The field name\n * expression: The expression.\n */\n",snippet:"{\n ${1:field}: ${2:expression}\n}"},{name:"$setWindowFields",value:"$setWindowFields",label:"$setWindowFields",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"5.0.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Capable of partitioning incoming data, and can apply one or more functions to defined windows within each partition.",comment:"/**\n * partitionBy: partitioning of data.\n * sortBy: fields to sort by.\n * output: {\n * path: {\n * function: The window function to compute over the given window.\n * window: {\n * documents: A number of documents before and after the current document.\n * range: A range of possible values around the value in the current document's sortBy field.\n * unit: Specifies the units for the window bounds.\n * }\n * }\n * }\n */\n",snippet:"{\n partitionBy: ${1:expression},\n sortBy: ${2:sortSpec},\n output: {\n ${3:path}: {\n ${4:function}: ${5:functionArgs},\n window: {\n documents: [${6:lowerbound}, ${7:upperbound}],\n range: [${8:lowerbound}, ${9:upperbound}],\n unit: ${10:string}\n }\n },\n ${11:path2}: ...\n }\n}"},{name:"$skip",value:"$skip",label:"$skip",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Skips a specified number of documents before advancing to the next stage.",comment:"/**\n * Provide the number of documents to skip.\n */\n",snippet:"${1:number}"},{name:"$sort",value:"$sort",label:"$sort",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Reorders the document stream by a specified sort key and direction.",comment:"/**\n * Provide any number of field/order pairs.\n */\n",snippet:"{\n ${1:field1}: ${2:sortOrder}\n}"},{name:"$sortByCount",value:"$sortByCount",label:"$sortByCount",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"3.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group.",comment:"/**\n * expression: Grouping expression or string.\n */\n",snippet:"{\n ${1:expression}\n}"},{name:"$unionWith",value:"$unionWith",label:"$unionWith",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"4.4.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Perform a union with a pipeline on another collection.",comment:"/**\n * coll: The collection name.\n * pipeline: The pipeline on the other collection.\n */\n",snippet:"{\n coll: '${1:coll}',\n pipeline: [${2:pipeline}]\n}"},{name:"$unset",value:"$unset",label:"$unset",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"4.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Excludes fields from the result document.",comment:"/**\n * Provide the field name to exclude.\n * To exclude multiple fields, pass the field names in an array.\n */\n",snippet:"'${1:string}'"},{name:"$unwind",value:"$unwind",label:"$unwind",outputStage:!1,fullScan:!1,firstStage:!1,score:1,env:[a.ATLAS,a.ADL,a.ON_PREM],meta:"stage",version:"2.2.0",apiVersions:[1],namespaces:[...r.ANY_NAMESPACE],description:"Outputs a new document for each element in a specified array. ",comment:"/**\n * path: Path to the array field.\n * includeArrayIndex: Optional name for index.\n * preserveNullAndEmptyArrays: Optional\n * toggle to unwind null and empty values.\n */\n",snippet:"{\n path: ${1:path},\n includeArrayIndex: '${2:string}',\n preserveNullAndEmptyArrays: ${3:boolean}\n}"},{name:"$vectorSearch",value:"$vectorSearch",label:"$vectorSearch",outputStage:!1,fullScan:!1,firstStage:!0,score:1,env:[a.ATLAS],meta:"stage",version:">=6.0.10 <7.0.0 || >=7.0.2",apiVersions:[],namespaces:[r.COLLECTION,r.VIEW],description:"Performs a kNN search on embeddings in the specified field(s)",comment:"/**\n * queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector dimensions specified in the index for the field. (Required)\n * path: The field to search. (Required)\n * numCandidates: Number of nearest neighbors to use during the search. You can specify a number higher than the number of documents to return (`limit`) to increase accuracy. (Required)\n * index: Name of the Atlas Search index to use. (Required)\n * limit: Number (of type `int` only) of documents to return in the results. (Required)\n * filter: Any MongoDB Query Language (MQL) match expression that compares an indexed field with a boolean, number (not decimals), or string to use as a prefilter. (Optional)\n * exact: Choose between false for ANN (Approximate Nearest Neighbor) and true for ENN (Exact Nearest Neighbor). Defaults to false. (Optional)\n */\n",snippet:"{\n queryVector: [${1:dimension1}, ${2:dimension2}, ...],\n path: ${3:string},\n numCandidates: ${4:numCandidates},\n index: ${5:string},\n limit: ${6:limit},\n filter: {${7:expression}},\n exact: ${8:boolean}\n}"}];t.STAGE_OPERATORS=o;const s=o.map((e=>e.name));t.STAGE_OPERATOR_NAMES=s;const i=o.filter((e=>e.outputStage));t.OUT_STAGES=i;const l=o.filter((e=>e.fullScan));t.FULL_SCAN_STAGES=l;const u=o.filter((e=>e.firstStage));t.REQUIRED_AS_FIRST_STAGE=u},81521:(e,t,n)=>{const a=n(56206);e.exports=(e,t)=>e.sort(((e,n)=>a(n,e,t)))},81602:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},84527:(e,t,n)=>{n.d(t,{Od:()=>l,Rb:()=>i,Tj:()=>s,bp:()=>p,wG:()=>c,xL:()=>u});var a=n(49189),r=n(99629),o=n(72510);const s=e=>(t,n,r,s)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},l=t._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw new a.GT;if(l.issues.length){const t=new(s?.Err??e)(l.issues.map((e=>o.iR(e,i,a.$W()))));throw o.gx(t,s?.callee),t}return l.value},i=(r.Kd,e=>async(t,n,r,s)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},i);if(l instanceof Promise&&(l=await l),l.issues.length){const t=new(s?.Err??e)(l.issues.map((e=>o.iR(e,i,a.$W()))));throw o.gx(t,s?.callee),t}return l.value}),l=(r.Kd,e=>(t,n,s)=>{const i=s?{...s,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw new a.GT;return l.issues.length?{success:!1,error:new(e??r.a$)(l.issues.map((e=>o.iR(e,i,a.$W()))))}:{success:!0,data:l.value}}),u=l(r.Kd),c=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map((e=>o.iR(e,s,a.$W()))))}:{success:!0,data:i.value}},p=c(r.Kd)},85070:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EXPRESSION_OPERATORS=void 0,t.EXPRESSION_OPERATORS=[{name:"$abs",value:"$abs",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$accumulator",value:"$accumulator",score:1,meta:"expr:arith",version:"4.4.0"},{name:"$add",value:"$add",score:1,meta:"expr:arith",version:"2.2.0"},{name:"$allElementsTrue",value:"$allElementsTrue",score:1,meta:"expr:set",version:"2.6.0"},{name:"$and",value:"$and",score:1,meta:"expr:bool",version:"2.2.0"},{name:"$anyElementTrue",value:"$anyElementTrue",score:1,meta:"expr:set",version:"2.6.0"},{name:"$arrayElemAt",value:"$arrayElemAt",score:1,meta:"expr:array",version:"3.2.0"},{name:"$arrayToObject",value:"$arrayToObject",score:1,meta:"expr:array",version:"3.4.4"},{name:"$binarySize",value:"$binarySize",score:1,meta:"expr:obj",version:"4.4.0"},{name:"$bsonSize",value:"$bsonSize",score:1,meta:"expr:obj",version:"4.4.0"},{name:"$ceil",value:"$ceil",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$cmp",value:"$cmp",score:1,meta:"expr:comp",version:"2.2.0"},{name:"$concat",value:"$concat",score:1,meta:"expr:string",version:"2.4.0"},{name:"$concatArrays",value:"$concatArrays",score:1,meta:"expr:array",version:"3.2.0"},{name:"$cond",value:"$cond",score:1,meta:"expr:cond",version:"2.6.0"},{name:"$dateAdd",value:"$dateAdd",score:1,meta:"expr:date",version:"5.0.0"},{name:"$dateDiff",value:"$dateDiff",score:1,meta:"expr:date",version:"5.0.0"},{name:"$dateFromParts",value:"$dateFromParts",score:1,meta:"expr:date",version:"3.6.0"},{name:"$dateFromString",value:"$dateFromString",score:1,meta:"expr:date",version:"3.6.0"},{name:"$dateSubtract",value:"$dateSubtract",score:1,meta:"expr:date",version:"5.0.0"},{name:"$dateToParts",value:"$dateToParts",score:1,meta:"expr:date",version:"3.6.0"},{name:"$dateToString",value:"$dateToString",score:1,meta:"expr:date",version:"3.6.0"},{name:"$dateTrunc",value:"$dateTrunc",score:1,meta:"expr:date",version:"5.0.0"},{name:"$dayOfMonth",value:"$dayOfMonth",score:1,meta:"expr:date",version:"2.2.0"},{name:"$dayOfWeek",value:"$dayOfWeek",score:1,meta:"expr:date",version:"2.2.0"},{name:"$dayOfYear",value:"$dayOfYear",score:1,meta:"expr:date",version:"2.2.0"},{name:"$dateToString",value:"$dateToString",score:1,meta:"expr:date",version:"3.0.0"},{name:"$divide",value:"$divide",score:1,meta:"expr:arith",version:"2.2.0"},{name:"$eq",value:"$eq",score:1,meta:"expr:comp",version:"2.2.0"},{name:"$exp",value:"$exp",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$filter",value:"$filter",score:1,meta:"expr:array",version:"3.2.0"},{name:"$first",value:"$first",score:1,meta:"expr:array",version:"4.4.0"},{name:"$floor",value:"$floor",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$function",value:"$function",score:1,meta:"expr:arith",version:"4.4.0"},{name:"$getField",value:"$getField",score:1,meta:"expr:get",version:"5.0.0"},{name:"$gt",value:"$gt",score:1,meta:"expr:comp",version:"2.2.0"},{name:"$gte",value:"$gte",score:1,meta:"expr:comp",version:"2.2.0"},{name:"$hour",value:"$hour",score:1,meta:"expr:date",version:"2.2.0"},{name:"$ifNull",value:"$ifNull",score:1,meta:"expr:cond",version:"2.2.0"},{name:"$in",value:"$in",score:1,meta:"expr:array",version:"3.4.0"},{name:"$indexOfArray",value:"$indexOfArray",score:1,meta:"expr:array",version:"3.4.0"},{name:"$indexOfBytes",value:"$indexOfBytes",score:1,meta:"expr:string",version:"3.4.0"},{name:"$indexOfCP",value:"$indexOfCP",score:1,meta:"expr:string",version:"3.4.0"},{name:"$isArray",value:"$isArray",score:1,meta:"expr:array",version:"3.2.0"},{name:"$isNumber",value:"$isNumber",score:1,meta:"expr:arith",version:"4.4.0"},{name:"$isoDayOfWeek",value:"$isoDayOfWeek",score:1,meta:"expr:date",version:"3.4.0"},{name:"$isoWeek",value:"$isoWeek",score:1,meta:"expr:date",version:"3.4.0"},{name:"$isoWeekYear",value:"$isoWeekYear",score:1,meta:"expr:date",version:"3.4.0"},{name:"$last",value:"$last",score:1,meta:"expr:array",version:"4.4.0"},{name:"$let",value:"$let",score:1,meta:"expr:var",version:"2.6.0"},{name:"$literal",value:"$literal",score:1,meta:"expr:literal",version:"2.6.0"},{name:"$lt",value:"$lt",score:1,meta:"expr:comp",version:"2.2.0"},{name:"$lt",value:"$lte",score:1,meta:"expr:comp",version:"2.2.0"},{name:"$ln",value:"$ln",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$log",value:"$log",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$log10",value:"$log10",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$map",value:"$map",score:1,meta:"expr:array",version:"2.6.0"},{name:"$mergeObjects",value:"$mergeObjects",score:1,meta:"expr:obj",version:"3.6.0"},{name:"$meta",value:"$meta",score:1,meta:"expr:text",version:"2.6.0"},{name:"$millisecond",value:"$millisecond",score:1,meta:"expr:date",version:"2.4.0"},{name:"$minute",value:"$minute",score:1,meta:"expr:date",version:"2.2.0"},{name:"$mod",value:"$mod",score:1,meta:"expr:arith",version:"2.2.0"},{name:"$month",value:"$month",score:1,meta:"expr:date",version:"2.2.0"},{name:"$multiply",value:"$multiply",score:1,meta:"expr:arith",version:"2.2.0"},{name:"$new",value:"$new",score:1,meta:"expr:comp",version:"2.2.0"},{name:"$not",value:"$not",score:1,meta:"expr:bool",version:"2.2.0"},{name:"$objectToArray",value:"$objectToArray",score:1,meta:"expr:array",version:"3.4.4"},{name:"$or",value:"$or",score:1,meta:"expr:bool",version:"2.2.0"},{name:"$pow",value:"$pow",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$range",value:"$range",score:1,meta:"expr:array",version:"3.4.0"},{name:"$reduce",value:"$reduce",score:1,meta:"expr:array",version:"3.4.0"},{name:"$regexFind",value:"$regexFind",score:1,meta:"expr:regex",version:"4.1.11"},{name:"$regexFindAll",value:"$regexFindAll",score:1,meta:"expr:regex",version:"4.1.11"},{name:"$regexMatch",value:"$regexMatch",score:1,meta:"expr:regex",version:"4.1.11"},{name:"$replaceAll",value:"$replaceAll",score:1,meta:"expr:string",version:"4.4.0"},{name:"$replaceOne",value:"$replaceOne",score:1,meta:"expr:string",version:"4.4.0"},{name:"$reverseArray",value:"$reverseArray",score:1,meta:"expr:array",version:"3.4.0"},{name:"$second",value:"$second",score:1,meta:"expr:date",version:"2.2.0"},{name:"$setDifference",value:"$setDifference",score:1,meta:"expr:set",version:"2.6.0"},{name:"$setEquals",value:"$setEquals",score:1,meta:"expr:set",version:"2.6.0"},{name:"$setIntersection",value:"$setIntersection",score:1,meta:"expr:set",version:"2.6.0"},{name:"$setIsSubset",value:"$setIsSubset",score:1,meta:"expr:set",version:"2.6.0"},{name:"$setUnion",value:"$setUnion",score:1,meta:"expr:set",version:"2.6.0"},{name:"$similarityCosine",value:"$similarityCosine",score:1,meta:"expr:arith",version:"8.2.0"},{name:"$similarityDotProduct",value:"$similarityDotProduct",score:1,meta:"expr:arith",version:"8.2.0"},{name:"$similarityEuclidean",value:"$similarityEuclidean",score:1,meta:"expr:arith",version:"8.2.0"},{name:"$size",value:"$size",score:1,meta:"expr:array",version:"2.6.0"},{name:"$slice",value:"$slice",score:1,meta:"expr:array",version:"3.2.0"},{name:"$sortArray",value:"$sortArray",score:1,meta:"expr:array",version:"5.2.0"},{name:"$split",value:"$split",score:1,meta:"expr:string",version:"3.4.0"},{name:"$sqrt",value:"$sqrt",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$strcasecmp",value:"$strcasecmp",score:1,meta:"expr:string",version:"2.2.0"},{name:"$strLenBytes",value:"$strLenBytes",score:1,meta:"expr:string",version:"3.4.0"},{name:"$strLenCP",value:"$strLenCP",score:1,meta:"expr:string",version:"3.4.0"},{name:"$substr",value:"$substr",score:1,meta:"expr:string",version:"2.2.0",deprecated:"3.4.0",replacement:"$substrBytes"},{name:"$substrBytes",value:"$substrBytes",score:1,meta:"expr:string",version:"3.4.0"},{name:"$substrCP",value:"$substrCP",score:1,meta:"expr:string",version:"3.4.0"},{name:"$subtract",value:"$subtract",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$switch",value:"$switch",score:1,meta:"expr:cond",version:"3.4.0"},{name:"$toHashedIndexKey",value:"$toHashedIndexKey",score:1,meta:"expr:arith",version:"4.2.24"},{name:"$toLower",value:"$toLower",score:1,meta:"expr:string",version:"2.2.0"},{name:"$toUpper",value:"$toUpper",score:1,meta:"expr:string",version:"2.2.0"},{name:"$tsSecond",value:"$tsSecond",score:1,meta:"expr:date",version:"5.1.0"},{name:"$tsIncrement",value:"$tsIncrement",score:1,meta:"expr:date",version:"5.1.0"},{name:"$trunc",value:"$trunc",score:1,meta:"expr:arith",version:"3.2.0"},{name:"$type",value:"$type",score:1,meta:"expr:type",version:"3.4.0"},{name:"$week",value:"$week",score:1,meta:"expr:date",version:"2.2.0"},{name:"$year",value:"$year",score:1,meta:"expr:date",version:"2.2.0"},{name:"$zip",value:"$zip",score:1,meta:"expr:array",version:"3.4.0"},{name:"$bitAnd",value:"$bitAnd",score:1,meta:"expr:bit",version:"7.0.0"},{name:"$bitOr",value:"$bitOr",score:1,meta:"expr:bit",version:"7.0.0"},{name:"$bitXor",value:"$bitXor",score:1,meta:"expr:bit",version:"7.0.0"},{name:"$bitNot",value:"$bitNot",score:1,meta:"expr:bit",version:"7.0.0"}]},87494:e=>{const t=function(e){return e=e.toString(),this instanceof t?(this.ns=e,this.dotIndex=e.indexOf("."),-1===this.dotIndex?(this.database=e,this.collection=""):(this.database=e.slice(0,this.dotIndex),this.collection=e.slice(this.dotIndex+1)),this.system=/^(?:system(?!\.profile$).*|enxcol_)\./.test(this.collection),this.oplog=/local\.oplog\.(\$main|rs)/.test(e),this.command="$cmd"===this.collection||0===this.collection.indexOf("$cmd.sys"),this.special=this.oplog||this.command||this.system||"config"===this.database||/^__mdb_internal_\w/.test(this.database),this.specialish=this.special||["local","admin"].indexOf(this.database)>-1,this.normal=this.oplog||-1===this.ns.indexOf("$"),this.validDatabaseName=new RegExp('^[^\\\\/". ]*$').test(this.database)&&this.database.length<=t.MAX_DATABASE_NAME_LENGTH,this.validCollectionName=this.collection.length>0&&(this.oplog||/^[^\0$]*$/.test(this.collection)),this.databaseHash=7,this.ns.split("").every(((e,t)=>"."!==e&&(this.databaseHash+=11*this.ns.charCodeAt(t),this.databaseHash*=3,!0))),this):new t(e)};t.prototype.database="",t.prototype.databaseHash=0,t.prototype.collection="",t.prototype.command=!1,t.prototype.special=!1,t.prototype.system=!1,t.prototype.oplog=!1,t.prototype.normal=!1,t.prototype.specialish=!1,t.prototype.isCommand=function(){return this.command},t.prototype.isSpecial=function(){return this.special},t.prototype.isSystem=function(){return this.system},t.prototype.isNormal=function(){return this.normal},t.prototype.isOplog=function(){return this.oplog},t.prototype.isConf=function(){},t.prototype.toString=function(){return this.ns},t.MAX_DATABASE_NAME_LENGTH=128,t.sort=function(e){return e.sort((function(e,n){return new t(e).specialish&&new t(n).specialish?0:new t(e).specialish&&!new t(n).specialish?1:!new t(e).specialish&&new t(n).specialish?-1:e>n?1:-1})),e},e.exports=t},87866:(e,t,n)=>{const a=n(88825),r=n(67105),{ANY:o}=r,s=n(20360),i=n(72849),l=n(51269),u=n(18082),c=n(71851),p=n(54838);e.exports=(e,t,n,d)=>{let m,h,f,g,v;switch(e=new a(e,d),t=new s(t,d),n){case">":m=l,h=c,f=u,g=">",v=">=";break;case"<":m=u,h=p,f=l,g="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(e,t,d))return!1;for(let n=0;n<t.set.length;++n){const a=t.set[n];let s=null,i=null;if(a.forEach((e=>{e.semver===o&&(e=new r(">=0.0.0")),s=s||e,i=i||e,m(e.semver,s.semver,d)?s=e:f(e.semver,i.semver,d)&&(i=e)})),s.operator===g||s.operator===v)return!1;if((!i.operator||i.operator===g)&&h(e,i.semver))return!1;if(i.operator===v&&f(e,i.semver))return!1}return!0}},88825:(e,t,n)=>{const a=n(95869),{MAX_LENGTH:r,MAX_SAFE_INTEGER:o}=n(64136),{safeRe:s,t:i}=n(36165),l=n(40594),{compareIdentifiers:u}=n(67274);class c{constructor(e,t){if(t=l(t),e instanceof c){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>r)throw new TypeError(`version is longer than ${r} characters`);a("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?s[i.LOOSE]:s[i.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<o)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(a("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof c||(e=new c(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],r=e.prerelease[t];if(a("prerelease compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return u(n,r)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{const n=this.build[t],r=e.build[t];if(a("build compare",t,n,r),void 0===n&&void 0===r)return 0;if(void 0===r)return 1;if(void 0===n)return-1;if(n!==r)return u(n,r)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?s[i.PRERELEASELOOSE]:s[i.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let a=this.prerelease.length;for(;--a>=0;)"number"==typeof this.prerelease[a]&&(this.prerelease[a]++,a=-2);if(-1===a){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let a=[t,e];!1===n&&(a=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},88834:(e,t,n)=>{const a=n(72849),r=n(25583);e.exports=(e,t,n)=>{const o=[];let s=null,i=null;const l=e.sort(((e,t)=>r(e,t,n)));for(const e of l)a(e,t,n)?(i=e,s||(s=e)):(i&&o.push([s,i]),i=null,s=null);s&&o.push([s,null]);const u=[];for(const[e,t]of o)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const c=u.join(" || "),p="string"==typeof t.raw?t.raw:String(t);return c.length<p.length?c:t}},89295:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},91714:(e,t,n)=>{var a=n(54420);e.exports=new a({explicit:[n(75459),n(98727),n(1726)]})},92133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ENVS=t.ON_PREM=t.ADL=t.ATLAS=void 0;const n="atlas";t.ATLAS=n,t.ADL="adl";const a="on-prem";t.ON_PREM=a;const r=[n,"adl",a];t.ENVS=r},93575:(e,t,n)=>{n.d(t,{vl:()=>ta,ut:()=>Hn,gM:()=>Gn});var a,r,o,s,i,l,u,c,p,d,m,h,f,g,v=n(7774),y=n(12240),_=n(94893),b=n(39889),x=n(9606).URL,I=n(67787).Buffer,w=Symbol.for("vercel.ai.gateway.error"),k=class e extends(r=Error,a=w,r){constructor({message:e,statusCode:t=500,cause:n}){super(e),this[a]=!0,this.statusCode=t,this.cause=n}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return"object"==typeof e&&null!==e&&w in e&&!0===e[w]}},$="GatewayAuthenticationError",E=`vercel.ai.gateway.error.${$}`,S=Symbol.for(E),T=class e extends(s=k,o=S,s){constructor({message:e="Authentication failed",statusCode:t=401,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[o]=!0,this.name=$,this.type="authentication_error"}static isInstance(e){return k.hasMarker(e)&&S in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:a="Authentication failed",statusCode:r=401,cause:o}){let s;return s=t?"AI Gateway authentication failed: Invalid API key.\n\nCreate a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys\n\nProvide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.":n?"AI Gateway authentication failed: Invalid OIDC token.\n\nRun 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.\n\nAlternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys":"AI Gateway authentication failed: No authentication provided.\n\nOption 1 - API key:\nCreate an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys\nProvide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.\n\nOption 2 - OIDC token:\nRun 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.",new e({message:s,statusCode:r,cause:o})}},A="GatewayInvalidRequestError",N=`vercel.ai.gateway.error.${A}`,O=Symbol.for(N),j=class extends(l=k,i=O,l){constructor({message:e="Invalid request",statusCode:t=400,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[i]=!0,this.name=A,this.type="invalid_request_error"}static isInstance(e){return k.hasMarker(e)&&O in e}},C="GatewayRateLimitError",R=`vercel.ai.gateway.error.${C}`,M=Symbol.for(R),P=class extends(c=k,u=M,c){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[u]=!0,this.name=C,this.type="rate_limit_exceeded"}static isInstance(e){return k.hasMarker(e)&&M in e}},Y="GatewayModelNotFoundError",L=`vercel.ai.gateway.error.${Y}`,D=Symbol.for(L),z=(0,v.ID)((()=>(0,v.jN)(_.Ik({modelId:_.Yj()})))),F=class extends(d=k,p=D,d){constructor({message:e="Model not found",statusCode:t=404,modelId:n,cause:a}={}){super({message:e,statusCode:t,cause:a}),this[p]=!0,this.name=Y,this.type="model_not_found",this.modelId=n}static isInstance(e){return k.hasMarker(e)&&D in e}},q="GatewayInternalServerError",Z=`vercel.ai.gateway.error.${q}`,U=Symbol.for(Z),V=class extends(h=k,m=U,h){constructor({message:e="Internal server error",statusCode:t=500,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[m]=!0,this.name=q,this.type="internal_server_error"}static isInstance(e){return k.hasMarker(e)&&U in e}},B="GatewayResponseError",W=`vercel.ai.gateway.error.${B}`,G=Symbol.for(W),K=class extends(g=k,f=G,g){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:n,validationError:a,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[f]=!0,this.name=B,this.type="response_error",this.response=n,this.validationError=a}static isInstance(e){return k.hasMarker(e)&&G in e}};async function H({response:e,statusCode:t,defaultMessage:n="Gateway request failed",cause:a,authMethod:r}){const o=await(0,v.ZZ)({value:e,schema:J});if(!o.success)return new K({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:o.error,cause:a});const s=o.value,i=s.error.type,l=s.error.message;switch(i){case"authentication_error":return T.createContextualError({apiKeyProvided:"api-key"===r,oidcTokenProvided:"oidc"===r,statusCode:t,cause:a});case"invalid_request_error":return new j({message:l,statusCode:t,cause:a});case"rate_limit_exceeded":return new P({message:l,statusCode:t,cause:a});case"model_not_found":{const e=await(0,v.ZZ)({value:s.error.param,schema:z});return new F({message:l,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:a})}default:return new V({message:l,statusCode:t,cause:a})}}var J=(0,v.ID)((()=>(0,v.jN)(_.Ik({error:_.Ik({message:_.Yj(),type:_.Yj().nullish(),param:_.L5().nullish(),code:_.KC([_.Yj(),_.ai()]).nullish()})}))));function X(e,t){var n;return k.isInstance(e)?e:y.hL.isInstance(e)?H({response:Q(e),statusCode:null!=(n=e.statusCode)?n:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):H({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}function Q(e){if(void 0!==e.data)return e.data;if(null!=e.responseBody)try{return JSON.parse(e.responseBody)}catch(t){return e.responseBody}return{}}var ee="ai-gateway-auth-method";async function te(e){const t=await(0,v.ZZ)({value:e[ee],schema:ne});return t.success?t.value:void 0}var ne=(0,v.ID)((()=>(0,v.jN)(_.KC([_.eu("api-key"),_.eu("oidc")])))),ae=class{constructor(e){this.config=e}async getAvailableModels(){try{const{value:e}=await(0,v.$b)({url:`${this.config.baseURL}/config`,headers:await(0,v.hd)(this.config.headers()),successfulResponseHandler:(0,v.cV)(re),failedResponseHandler:(0,v.sl)({errorSchema:_.bz(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await X(e)}}async getCredits(){try{const e=new x(this.config.baseURL),{value:t}=await(0,v.$b)({url:`${e.origin}/v1/credits`,headers:await(0,v.hd)(this.config.headers()),successfulResponseHandler:(0,v.cV)(oe),failedResponseHandler:(0,v.sl)({errorSchema:_.bz(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await X(e)}}},re=(0,v.ID)((()=>(0,v.jN)(_.Ik({models:_.YO(_.Ik({id:_.Yj(),name:_.Yj(),description:_.Yj().nullish(),pricing:_.Ik({input:_.Yj(),output:_.Yj(),input_cache_read:_.Yj().nullish(),input_cache_write:_.Yj().nullish()}).transform((({input:e,output:t,input_cache_read:n,input_cache_write:a})=>({input:e,output:t,...n?{cachedInputTokens:n}:{},...a?{cacheCreationInputTokens:a}:{}}))).nullish(),specification:_.Ik({specificationVersion:_.eu("v3"),provider:_.Yj(),modelId:_.Yj()}),modelType:_.k5(["language","embedding","image"]).nullish()}))})))),oe=(0,v.ID)((()=>(0,v.jN)(_.Ik({balance:_.Yj(),total_used:_.Yj()}).transform((({balance:e,total_used:t})=>({balance:e,totalUsed:t})))))),se=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){const{abortSignal:t,...n}=e;return{args:this.maybeEncodeFileParts(n),warnings:[]}}async doGenerate(e){const{args:t,warnings:n}=await this.getArgs(e),{abortSignal:a}=e,r=await(0,v.hd)(this.config.headers());try{const{responseHeaders:o,value:s,rawValue:i}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(r,e.headers,this.getModelConfigHeaders(this.modelId,!1),await(0,v.hd)(this.config.o11yHeaders)),body:t,successfulResponseHandler:(0,v.cV)(_.bz()),failedResponseHandler:(0,v.sl)({errorSchema:_.bz(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{...s,request:{body:t},response:{headers:o,body:i},warnings:n}}catch(e){throw await X(e,await te(r))}}async doStream(e){const{args:t,warnings:n}=await this.getArgs(e),{abortSignal:a}=e,r=await(0,v.hd)(this.config.headers());try{const{value:o,responseHeaders:s}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(r,e.headers,this.getModelConfigHeaders(this.modelId,!0),await(0,v.hd)(this.config.o11yHeaders)),body:t,successfulResponseHandler:(0,v.Ds)(_.bz()),failedResponseHandler:(0,v.sl)({errorSchema:_.bz(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{stream:o.pipeThrough(new TransformStream({start(e){n.length>0&&e.enqueue({type:"stream-start",warnings:n})},transform(t,n){if(t.success){const a=t.value;if("raw"===a.type&&!e.includeRawChunks)return;"response-metadata"===a.type&&a.timestamp&&"string"==typeof a.timestamp&&(a.timestamp=new Date(a.timestamp)),n.enqueue(a)}else n.error(t.error)}})),request:{body:t},response:{headers:s}}}catch(e){throw await X(e,await te(r))}}isFilePart(e){return e&&"object"==typeof e&&"type"in e&&"file"===e.type}maybeEncodeFileParts(e){for(const t of e.prompt)for(const e of t.content)if(this.isFilePart(e)){const t=e;if(t.data instanceof Uint8Array){const e=Uint8Array.from(t.data),n=I.from(e).toString("base64");t.data=new x(`data:${t.mediaType||"application/octet-stream"};base64,${n}`)}}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":"2","ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},ie=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:a}){var r;const o=await(0,v.hd)(this.config.headers());try{const{responseHeaders:s,value:i,rawValue:l}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(o,null!=t?t:{},this.getModelConfigHeaders(),await(0,v.hd)(this.config.o11yHeaders)),body:{input:1===e.length?e[0]:e,...a?{providerOptions:a}:{}},successfulResponseHandler:(0,v.cV)(le),failedResponseHandler:(0,v.sl)({errorSchema:_.bz(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{embeddings:i.embeddings,usage:null!=(r=i.usage)?r:void 0,providerMetadata:i.providerMetadata,response:{headers:s,body:l},warnings:[]}}catch(e){throw await X(e,await te(o))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"2","ai-model-id":this.modelId}}},le=(0,v.ID)((()=>(0,v.jN)(_.Ik({embeddings:_.YO(_.YO(_.ai())),usage:_.Ik({tokens:_.ai()}).nullish(),providerMetadata:_.g1(_.Yj(),_.g1(_.Yj(),_.L5())).optional()})))),ue=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:n,aspectRatio:a,seed:r,providerOptions:o,headers:s,abortSignal:i}){var l;const u=await(0,v.hd)(this.config.headers());try{const{responseHeaders:c,value:p,rawValue:d}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(u,null!=s?s:{},this.getModelConfigHeaders(),await(0,v.hd)(this.config.o11yHeaders)),body:{prompt:e,n:t,...n&&{size:n},...a&&{aspectRatio:a},...r&&{seed:r},...o&&{providerOptions:o}},successfulResponseHandler:(0,v.cV)(pe),failedResponseHandler:(0,v.sl)({errorSchema:_.bz(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{images:p.images,warnings:null!=(l=p.warnings)?l:[],providerMetadata:p.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:c}}}catch(e){throw X(e,await te(u))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"2","ai-model-id":this.modelId}}},ce=_.Ik({images:_.YO(_.L5()).optional()}).catchall(_.L5()),pe=_.Ik({images:_.YO(_.Yj()),warnings:_.YO(_.Ik({type:_.eu("other"),message:_.Yj()})).optional(),providerMetadata:_.g1(_.Yj(),ce).optional()}),de=function(e={}){var t,n;let a=null,r=null;const o=null!=(t=e.metadataCacheRefreshMillis)?t:3e5;let s=0;const i=null!=(n=(0,v.ae)(e.baseURL))?n:"https://ai-gateway.vercel.sh/v1/ai",l=async()=>{const t=await async function(e){const t=(0,v.x3)({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(t)return{token:t,authMethod:"api-key"};try{return{token:await(0,b.getVercelOidcToken)(),authMethod:"oidc"}}catch(e){return null}}(e);if(t)return(0,v.WZ)({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":"0.0.1",[ee]:t.authMethod,...e.headers},"ai-sdk/gateway/2.0.0-beta.78");throw T.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401})},u=()=>{const e=(0,v.x3)({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),t=(0,v.x3)({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),n=(0,v.x3)({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{const a=await async function(){var e;return null==(e=(0,b.getContext)().headers)?void 0:e["x-vercel-id"]}();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...a&&{"ai-o11y-request-id":a}}}},c=t=>new se(t,{provider:"gateway",baseURL:i,headers:l,fetch:e.fetch,o11yHeaders:u()}),p=function(e){if(new.target)throw new Error("The Gateway Provider model function cannot be called with the new keyword.");return c(e)};return p.specificationVersion="v3",p.getAvailableModels=async()=>{var t,n,u;const c=null!=(u=null==(n=null==(t=e._internal)?void 0:t.currentDate)?void 0:n.call(t).getTime())?u:Date.now();return(!a||c-s>o)&&(s=c,a=new ae({baseURL:i,headers:l,fetch:e.fetch}).getAvailableModels().then((e=>(r=e,e))).catch((async e=>{throw await X(e,await te(await l()))}))),r?Promise.resolve(r):a},p.getCredits=async()=>new ae({baseURL:i,headers:l,fetch:e.fetch}).getCredits().catch((async e=>{throw await X(e,await te(await l()))})),p.imageModel=t=>new ue(t,{provider:"gateway",baseURL:i,headers:l,fetch:e.fetch,o11yHeaders:u()}),p.languageModel=c,p.embeddingModel=t=>new ie(t,{provider:"gateway",baseURL:i,headers:l,fetch:e.fetch,o11yHeaders:u()}),p}(),me=n(26767),he=n(19917),fe=n(9606).URL,ge=n(65994).e,ve=Object.defineProperty;function ye({warning:e,provider:t,model:n}){const a=`AI SDK Warning (${t} / ${n}):`;switch(e.type){case"unsupported":{let t=`${a} The feature "${e.feature}" is not supported.`;return e.details&&(t+=` ${e.details}`),t}case"compatibility":{let t=`${a} The feature "${e.feature}" is used in a compatibility mode.`;return e.details&&(t+=` ${e.details}`),t}case"other":return`${a} ${e.message}`;default:return`${a} ${JSON.stringify(e,null,2)}`}}var _e,be=!1,xe=e=>{if(0===e.warnings.length)return;const t=globalThis.AI_SDK_LOG_WARNINGS;if(!1!==t)if("function"!=typeof t){be||(be=!0,console.info("AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false."));for(const t of e.warnings)console.warn(ye({warning:t,provider:e.provider,model:e.model}))}else t(e)},Ie="AI_InvalidArgumentError",we=`vercel.ai.error.${Ie}`,ke=Symbol.for(we),$e=class extends y.bD{constructor({parameter:e,value:t,message:n}){super({name:Ie,message:`Invalid argument for parameter ${e}: ${n}`}),this[_e]=!0,this.parameter=e,this.value=t}static isInstance(e){return y.bD.hasMarker(e,we)}};_e=ke;var Ee=Symbol.for("vercel.ai.error.AI_InvalidStreamPartError");y.bD;var Se,Te="AI_InvalidToolInputError",Ae=`vercel.ai.error.${Te}`,Ne=Symbol.for(Ae),Oe=class extends y.bD{constructor({toolInput:e,toolName:t,cause:n,message:a=`Invalid input for tool ${t}: ${(0,y.u1)(n)}`}){super({name:Te,message:a,cause:n}),this[Se]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return y.bD.hasMarker(e,Ae)}};Se=Ne;var je=Symbol.for("vercel.ai.error.AI_NoImageGeneratedError");y.bD;var Ce,Re="AI_NoObjectGeneratedError",Me=`vercel.ai.error.${Re}`,Pe=Symbol.for(Me),Ye=class extends y.bD{constructor({message:e="No object generated.",cause:t,text:n,response:a,usage:r,finishReason:o}){super({name:Re,message:e,cause:t}),this[Ce]=!0,this.text=n,this.response=a,this.usage=r,this.finishReason=o}static isInstance(e){return y.bD.hasMarker(e,Me)}};Ce=Pe;var Le,De="AI_NoOutputGeneratedError",ze=`vercel.ai.error.${De}`,Fe=Symbol.for(ze),qe=class extends y.bD{constructor({message:e="No output generated.",cause:t}={}){super({name:De,message:e,cause:t}),this[Le]=!0}static isInstance(e){return y.bD.hasMarker(e,ze)}};Le=Fe,y.bD;var Ze,Ue="AI_NoSuchToolError",Ve=`vercel.ai.error.${Ue}`,Be=Symbol.for(Ve),We=class extends y.bD{constructor({toolName:e,availableTools:t,message:n=`Model tried to call unavailable tool '${e}'. ${void 0===t?"No tools are available.":`Available tools: ${t.join(", ")}.`}`}){super({name:Ue,message:n}),this[Ze]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return y.bD.hasMarker(e,Ve)}};Ze=Be;var Ge,Ke="AI_ToolCallRepairError",He=`vercel.ai.error.${Ke}`,Je=Symbol.for(He),Xe=class extends y.bD{constructor({cause:e,originalError:t,message:n=`Error repairing tool call: ${(0,y.u1)(e)}`}){super({name:Ke,message:n,cause:e}),this[Ge]=!0,this.originalError=t}static isInstance(e){return y.bD.hasMarker(e,He)}};Ge=Je;var Qe=class extends y.bD{constructor(e){super({name:"AI_UnsupportedModelVersionError",message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},et=Symbol.for("vercel.ai.error.AI_InvalidDataContentError");y.bD;var tt,nt="AI_InvalidMessageRoleError",at=`vercel.ai.error.${nt}`,rt=Symbol.for(at),ot=class extends y.bD{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:nt,message:t}),this[tt]=!0,this.role=e}static isInstance(e){return y.bD.hasMarker(e,at)}};tt=rt;var st,it="AI_MessageConversionError",lt=`vercel.ai.error.${it}`,ut=Symbol.for(lt),ct=class extends y.bD{constructor({originalMessage:e,message:t}){super({name:it,message:t}),this[st]=!0,this.originalMessage=e}static isInstance(e){return y.bD.hasMarker(e,lt)}};st=ut;var pt,dt="AI_DownloadError",mt=`vercel.ai.error.${dt}`,ht=Symbol.for(mt),ft=class extends y.bD{constructor({url:e,statusCode:t,statusText:n,cause:a,message:r=(null==a?`Failed to download ${e}: ${t} ${n}`:`Failed to download ${e}: ${a}`)}){super({name:dt,message:r,cause:a}),this[pt]=!0,this.url=e,this.statusCode=t,this.statusText=n}static isInstance(e){return y.bD.hasMarker(e,mt)}};pt=ht;var gt,vt="AI_RetryError",yt=`vercel.ai.error.${vt}`,_t=Symbol.for(yt),bt=class extends y.bD{constructor({message:e,reason:t,errors:n}){super({name:vt,message:e}),this[gt]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return y.bD.hasMarker(e,yt)}};function xt(e){return"v3"===e.specificationVersion?e:(function({provider:e,modelId:t}){xe({warnings:[{type:"compatibility",feature:"specificationVersion",details:"Using v2 specification compatibility mode. Some features may not be available."}],provider:e,model:t})}({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){switch(t){case"specificationVersion":return"v3";case"doGenerate":return async(...t)=>{const n=await e.doGenerate(...t);return{...n,usage:It(n.usage)}};case"doStream":return async(...t)=>{const n=await e.doStream(...t);return{...n,stream:(a=n.stream,a.pipeThrough(new TransformStream({transform(e,t){"finish"===e.type?t.enqueue({...e,usage:It(e.usage)}):t.enqueue(e)}})))};var a};default:return e[t]}}}))}function It(e){return{inputTokens:{total:e.inputTokens,noCache:void 0,cacheRead:e.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:e.outputTokens,text:void 0,reasoning:e.reasoningTokens}}}function wt(e){if("string"!=typeof e){if("v3"!==e.specificationVersion&&"v2"!==e.specificationVersion){const t=e;throw new Qe({version:t.specificationVersion,provider:t.provider,modelId:t.modelId})}return xt(e)}return(null!=(t=globalThis.AI_SDK_DEFAULT_PROVIDER)?t:de).languageModel(e);var t}gt=_t;var kt=[{mediaType:"image/gif",bytesPrefix:[71,73,70]},{mediaType:"image/png",bytesPrefix:[137,80,78,71]},{mediaType:"image/jpeg",bytesPrefix:[255,216]},{mediaType:"image/webp",bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:"image/bmp",bytesPrefix:[66,77]},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0]},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42]},{mediaType:"image/avif",bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:"image/heic",bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}],$t=e=>{const t="string"==typeof e?(0,v.Z9)(e):e,n=(127&t[6])<<21|(127&t[7])<<14|(127&t[8])<<7|127&t[9];return t.slice(n+10)};var Et="6.0.0-beta.151",St=async({url:e})=>{var t;const n=e.toString();try{const e=await fetch(n,{headers:(0,v.WZ)({},`ai-sdk/${Et}`,(0,v.G1)())});if(!e.ok)throw new ft({url:n,statusCode:e.status,statusText:e.statusText});return{data:new Uint8Array(await e.arrayBuffer()),mediaType:null!=(t=e.headers.get("content-type"))?t:void 0}}catch(e){if(ft.isInstance(e))throw e;throw new ft({url:n,cause:e})}},Tt=(e=St)=>t=>Promise.all(t.map((async t=>t.isUrlSupportedByModel?null:e(t)))),At=_.KC([_.Yj(),_.Nl(Uint8Array),_.Nl(ArrayBuffer),_.Ie((e=>{var t,n;return null!=(n=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&n}),{message:"Must be a Buffer"})]);function Nt(e){if(e instanceof Uint8Array)return{data:e,mediaType:void 0};if(e instanceof ArrayBuffer)return{data:new Uint8Array(e),mediaType:void 0};if("string"==typeof e)try{e=new fe(e)}catch(e){}if(e instanceof fe&&"data:"===e.protocol){const{mediaType:t,base64Content:n}=function(e){try{const[t,n]=e.split(",");return{mediaType:t.split(";")[0].split(":")[1],base64Content:n}}catch(e){return{mediaType:void 0,base64Content:void 0}}}(e.toString());if(null==t||null==n)throw new y.bD({name:"InvalidDataContentError",message:`Invalid data URL format in content ${e.toString()}`});return{data:n,mediaType:t}}return{data:e,mediaType:void 0}}function Ot(e){return void 0===e?[]:Array.isArray(e)?e:[e]}async function jt({prompt:e,supportedUrls:t,download:n=Tt()}){const a=await async function(e,t,n){const a=e.filter((e=>"user"===e.role)).map((e=>e.content)).filter((e=>Array.isArray(e))).flat().filter((e=>"image"===e.type||"file"===e.type)).map((e=>{var t;const n=null!=(t=e.mediaType)?t:"image"===e.type?"image/*":void 0;let a="image"===e.type?e.image:e.data;if("string"==typeof a)try{a=new fe(a)}catch(e){}return{mediaType:n,data:a}})).filter((e=>e.data instanceof fe)).map((e=>({url:e.data,isUrlSupportedByModel:null!=e.mediaType&&(0,v.qs)({url:e.data.toString(),mediaType:e.mediaType,supportedUrls:n})}))),r=await t(a);return Object.fromEntries(r.map(((e,t)=>null==e?null:[a[t].url.toString(),{data:e.data,mediaType:e.mediaType}])).filter((e=>null!=e)))}(e.messages,n,t),r=[...null!=e.system?"string"==typeof e.system?[{role:"system",content:e.system}]:Ot(e.system).map((e=>({role:"system",content:e.content,providerOptions:e.providerOptions}))):[],...e.messages.map((e=>function({message:e,downloadedAssets:t}){const n=e.role;switch(n){case"system":return{role:"system",content:e.content,providerOptions:e.providerOptions};case"user":return"string"==typeof e.content?{role:"user",content:[{type:"text",text:e.content}],providerOptions:e.providerOptions}:{role:"user",content:e.content.map((e=>function(e,t){var n;if("text"===e.type)return{type:"text",text:e.text,providerOptions:e.providerOptions};let a;const r=e.type;switch(r){case"image":a=e.image;break;case"file":a=e.data;break;default:throw new Error(`Unsupported part type: ${r}`)}const{data:o,mediaType:s}=Nt(a);let i=null!=s?s:e.mediaType,l=o;if(l instanceof fe){const e=t[l.toString()];e&&(l=e.data,null!=i||(i=e.mediaType))}switch(r){case"image":return(l instanceof Uint8Array||"string"==typeof l)&&(i=null!=(n=function({data:e,signatures:t}){const n=function(e){return"string"==typeof e&&e.startsWith("SUQz")||"string"!=typeof e&&e.length>10&&73===e[0]&&68===e[1]&&51===e[2]?$t(e):e}(e),a="string"==typeof n?(0,v.Z9)(n.substring(0,Math.min(n.length,24))):n;for(const e of t)if(a.length>=e.bytesPrefix.length&&e.bytesPrefix.every(((e,t)=>null===e||a[t]===e)))return e.mediaType}({data:l,signatures:kt}))?n:i),{type:"file",mediaType:null!=i?i:"image/*",filename:void 0,data:l,providerOptions:e.providerOptions};case"file":if(null==i)throw new Error("Media type is missing for file part");return{type:"file",mediaType:i,filename:e.filename,data:l,providerOptions:e.providerOptions}}}(e,t))).filter((e=>"text"!==e.type||""!==e.text)),providerOptions:e.providerOptions};case"assistant":return"string"==typeof e.content?{role:"assistant",content:[{type:"text",text:e.content}],providerOptions:e.providerOptions}:{role:"assistant",content:e.content.filter((e=>"text"!==e.type||""!==e.text||null!=e.providerOptions)).filter((e=>"tool-approval-request"!==e.type)).map((e=>{const t=e.providerOptions;switch(e.type){case"file":{const{data:n,mediaType:a}=Nt(e.data);return{type:"file",data:n,filename:e.filename,mediaType:null!=a?a:e.mediaType,providerOptions:t}}case"reasoning":return{type:"reasoning",text:e.text,providerOptions:t};case"text":return{type:"text",text:e.text,providerOptions:t};case"tool-call":return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,providerExecuted:e.providerExecuted,providerOptions:t};case"tool-result":return{type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Ct(e.output),providerOptions:t}}})),providerOptions:e.providerOptions};case"tool":return{role:"tool",content:e.content.filter((e=>"tool-approval-response"!==e.type)).map((e=>({type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Ct(e.output),providerOptions:e.providerOptions}))),providerOptions:e.providerOptions};default:throw new ot({role:n})}}({message:e,downloadedAssets:a})))],o=[];for(const e of r){if("tool"!==e.role){o.push(e);continue}const t=o.at(-1);"tool"===(null==t?void 0:t.role)?t.content.push(...e.content):o.push(e)}return o}function Ct(e){return"content"!==e.type?e:{type:"content",value:e.value.map((e=>"media"!==e.type?e:e.mediaType.startsWith("image/")?{type:"image-data",data:e.data,mediaType:e.mediaType}:{type:"file-data",data:e.data,mediaType:e.mediaType}))}}function Rt({output:e,tool:t,errorMode:n}){return"text"===n?{type:"error-text",value:(0,y.u1)(e)}:"json"===n?{type:"error-json",value:Mt(e)}:(null==t?void 0:t.toModelOutput)?t.toModelOutput(e):"string"==typeof e?{type:"text",value:e}:{type:"json",value:Mt(e)}}function Mt(e){return void 0===e?null:e}var Pt=_.RZ((()=>_.KC([_.ch(),_.Yj(),_.ai(),_.zM(),_.g1(_.Yj(),Pt.optional()),_.YO(Pt)]))),Yt=_.g1(_.Yj(),_.g1(_.Yj(),Pt.optional())),Lt=_.Ik({type:_.eu("text"),text:_.Yj(),providerOptions:Yt.optional()}),Dt=_.Ik({type:_.eu("image"),image:_.KC([At,_.Nl(fe)]),mediaType:_.Yj().optional(),providerOptions:Yt.optional()}),zt=_.Ik({type:_.eu("file"),data:_.KC([At,_.Nl(fe)]),filename:_.Yj().optional(),mediaType:_.Yj(),providerOptions:Yt.optional()}),Ft=_.Ik({type:_.eu("reasoning"),text:_.Yj(),providerOptions:Yt.optional()}),qt=_.Ik({type:_.eu("tool-call"),toolCallId:_.Yj(),toolName:_.Yj(),input:_.L5(),providerOptions:Yt.optional(),providerExecuted:_.zM().optional()}),Zt=_.gM("type",[_.Ik({type:_.eu("text"),value:_.Yj(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("json"),value:Pt,providerOptions:Yt.optional()}),_.Ik({type:_.eu("execution-denied"),reason:_.Yj().optional(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("error-text"),value:_.Yj(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("error-json"),value:Pt,providerOptions:Yt.optional()}),_.Ik({type:_.eu("content"),value:_.YO(_.KC([_.Ik({type:_.eu("text"),text:_.Yj(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("media"),data:_.Yj(),mediaType:_.Yj()}),_.Ik({type:_.eu("file-data"),data:_.Yj(),mediaType:_.Yj(),filename:_.Yj().optional(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("file-url"),url:_.Yj(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("file-id"),fileId:_.KC([_.Yj(),_.g1(_.Yj(),_.Yj())]),providerOptions:Yt.optional()}),_.Ik({type:_.eu("image-data"),data:_.Yj(),mediaType:_.Yj(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("image-url"),url:_.Yj(),providerOptions:Yt.optional()}),_.Ik({type:_.eu("image-file-id"),fileId:_.KC([_.Yj(),_.g1(_.Yj(),_.Yj())]),providerOptions:Yt.optional()}),_.Ik({type:_.eu("custom"),providerOptions:Yt.optional()})]))})]),Ut=_.Ik({type:_.eu("tool-result"),toolCallId:_.Yj(),toolName:_.Yj(),output:Zt,providerOptions:Yt.optional()}),Vt=_.Ik({type:_.eu("tool-approval-request"),approvalId:_.Yj(),toolCallId:_.Yj()}),Bt=_.Ik({type:_.eu("tool-approval-response"),approvalId:_.Yj(),approved:_.zM(),reason:_.Yj().optional()}),Wt=_.Ik({role:_.eu("system"),content:_.Yj(),providerOptions:Yt.optional()}),Gt=_.Ik({role:_.eu("user"),content:_.KC([_.Yj(),_.YO(_.KC([Lt,Dt,zt]))]),providerOptions:Yt.optional()}),Kt=_.Ik({role:_.eu("assistant"),content:_.KC([_.Yj(),_.YO(_.KC([Lt,zt,Ft,qt,Ut,Vt]))]),providerOptions:Yt.optional()}),Ht=_.Ik({role:_.eu("tool"),content:_.YO(_.KC([Ut,Bt])),providerOptions:Yt.optional()}),Jt=_.KC([Wt,Gt,Kt,Ht]);function Xt(e){if(!T.isInstance(e))return e;const t="https://v6.ai-sdk.dev/unauthenticated-ai-gateway";return"production"===(null==ge?void 0:"production")?new y.bD({name:"GatewayError",message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${t}`}):Object.assign(new Error(`Unauthenticated request to AI Gateway.\n\nTo authenticate, set the AI_GATEWAY_API_KEY environment variable with your API key.\n\nAlternatively, you can use a provider module instead of the AI Gateway.\n\nLearn more: ${t}\n\n`),{name:"GatewayAuthenticationError"})}function Qt({operationId:e,telemetry:t}){return{"operation.name":`${e}${null!=(null==t?void 0:t.functionId)?` ${t.functionId}`:""}`,"resource.name":null==t?void 0:t.functionId,"ai.operationId":e,"ai.telemetry.functionId":null==t?void 0:t.functionId}}var en={startSpan:()=>tn,startActiveSpan:(e,t,n,a)=>"function"==typeof t?t(tn):"function"==typeof n?n(tn):"function"==typeof a?a(tn):void 0},tn={spanContext:()=>nn,setAttribute(){return this},setAttributes(){return this},addEvent(){return this},addLink(){return this},addLinks(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording:()=>!1,recordException(){return this}},nn={traceId:"",spanId:"",traceFlags:0};async function an({name:e,tracer:t,attributes:n,fn:a,endWhenDone:r=!0}){return t.startActiveSpan(e,{attributes:await n},(async e=>{try{const t=await a(e);return r&&e.end(),t}catch(t){try{rn(e,t)}finally{e.end()}throw t}}))}function rn(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:he.s.ERROR,message:t.message})):e.setStatus({code:he.s.ERROR})}async function on({telemetry:e,attributes:t}){if(!0!==(null==e?void 0:e.isEnabled))return{};const n={};for(const[a,r]of Object.entries(t))if(null!=r)if("object"==typeof r&&"input"in r&&"function"==typeof r.input){if(!1===(null==e?void 0:e.recordInputs))continue;const t=await r.input();null!=t&&(n[a]=t)}else if("object"==typeof r&&"output"in r&&"function"==typeof r.output){if(!1===(null==e?void 0:e.recordOutputs))continue;const t=await r.output();null!=t&&(n[a]=t)}else n[a]=r;return n}function sn(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:ln(e.inputTokens.total,e.outputTokens.total),raw:e.raw,reasoningTokens:e.outputTokens.reasoning,cachedInputTokens:e.inputTokens.cacheRead}}function ln(e,t){return null==e&&null==t?void 0:(null!=e?e:0)+(null!=t?t:0)}var un=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:a}={})=>async r=>cn(r,{maxRetries:e,delayInMs:t,backoffFactor:n,abortSignal:a});async function cn(e,{maxRetries:t,delayInMs:n,backoffFactor:a,abortSignal:r},o=[]){try{return await e()}catch(s){if((0,v.zf)(s))throw s;if(0===t)throw s;const i=(0,v.u1)(s),l=[...o,s],u=l.length;if(u>t)throw new bt({message:`Failed after ${u} attempts. Last error: ${i}`,reason:"maxRetriesExceeded",errors:l});if(s instanceof Error&&y.hL.isInstance(s)&&!0===s.isRetryable&&u<=t)return await(0,v.cb)(function({error:e,exponentialBackoffDelay:t}){const n=e.responseHeaders;if(!n)return t;let a;const r=n["retry-after-ms"];if(r){const e=parseFloat(r);Number.isNaN(e)||(a=e)}const o=n["retry-after"];if(o&&void 0===a){const e=parseFloat(o);a=Number.isNaN(e)?Date.parse(o)-Date.now():1e3*e}return null!=a&&!Number.isNaN(a)&&0<=a&&(a<6e4||a<t)?a:t}({error:s,exponentialBackoffDelay:n}),{abortSignal:r}),cn(e,{maxRetries:t,delayInMs:a*n,backoffFactor:a,abortSignal:r},l);if(1===u)throw s;throw new bt({message:`Failed after ${u} attempts with non-retryable error: '${i}'`,reason:"errorNotRetryable",errors:l})}}async function pn({toolCall:e,tools:t,tracer:n,telemetry:a,messages:r,abortSignal:o,experimental_context:s,onPreliminaryToolResult:i}){const{toolName:l,toolCallId:u,input:c}=e,p=null==t?void 0:t[l];if(null!=(null==p?void 0:p.execute))return an({name:"ai.toolCall",attributes:on({telemetry:a,attributes:{...Qt({operationId:"ai.toolCall",telemetry:a}),"ai.toolCall.name":l,"ai.toolCall.id":u,"ai.toolCall.args":{output:()=>JSON.stringify(c)}}}),tracer:n,fn:async t=>{let n;try{const t=(0,v.o8)({execute:p.execute.bind(p),input:c,options:{toolCallId:u,messages:r,abortSignal:o,experimental_context:s}});for await(const a of t)"preliminary"===a.type?null==i||i({...e,type:"tool-result",output:a.output,preliminary:!0}):n=a.output}catch(n){return rn(t,n),{type:"tool-error",toolCallId:u,toolName:l,input:c,error:n,dynamic:"dynamic"===p.type,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}}try{t.setAttributes(await on({telemetry:a,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(n)}}}))}catch(e){}return{type:"tool-result",toolCallId:u,toolName:l,input:c,output:n,dynamic:"dynamic"===p.type,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}}})}var dn=class{constructor({data:e,mediaType:t}){const n=e instanceof Uint8Array;this.base64Data=n?void 0:e,this.uint8ArrayData=n?e:void 0,this.mediaType=t}get base64(){return null==this.base64Data&&(this.base64Data=(0,v.n_)(this.uint8ArrayData)),this.base64Data}get uint8Array(){return null==this.uint8ArrayData&&(this.uint8ArrayData=(0,v.Z9)(this.base64Data)),this.uint8ArrayData}},mn=class extends dn{constructor(e){super(e),this.type="file"}};function hn(e){const t=["ROOT"];let n=-1,a=null;function r(e,r,o){switch(e){case'"':n=r,t.pop(),t.push(o),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=r,a=r,t.pop(),t.push(o),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(o),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":n=r,t.pop(),t.push(o),t.push("INSIDE_NUMBER");break;case"{":n=r,t.pop(),t.push(o),t.push("INSIDE_OBJECT_START");break;case"[":n=r,t.pop(),t.push(o),t.push("INSIDE_ARRAY_START")}}function o(e,a){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=a,t.pop()}}function s(e,a){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=a,t.pop()}}for(let i=0;i<e.length;i++){const l=e[i];switch(t[t.length-1]){case"ROOT":r(l,i,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=i,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===l&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":r(l,i,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":o(l,i);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),n=i;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=i}break;case"INSIDE_ARRAY_START":"]"===l?(n=i,t.pop()):(n=i,r(l,i,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(l){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=i,t.pop();break;default:n=i}break;case"INSIDE_ARRAY_AFTER_COMMA":r(l,i,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),n=i;break;case"INSIDE_NUMBER":switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=i;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,i),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&o(l,i);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&o(l,i);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,i);break;default:t.pop()}break;case"INSIDE_LITERAL":{const r=e.substring(a,i+1);"false".startsWith(r)||"true".startsWith(r)||"null".startsWith(r)?n=i:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?o(l,i):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,i));break}}}let i=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case"INSIDE_STRING":i+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":i+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":i+="]";break;case"INSIDE_LITERAL":{const t=e.substring(a,e.length);"true".startsWith(t)?i+="true".slice(t.length):"false".startsWith(t)?i+="false".slice(t.length):"null".startsWith(t)&&(i+="null".slice(t.length))}}return i}async function fn(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await(0,v.N8)({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await(0,v.N8)({text:hn(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}((e,t)=>{for(var n in t)ve(e,n,{get:t[n],enumerable:!0})})({},{array:()=>yn,choice:()=>_n,json:()=>bn,object:()=>vn,text:()=>gn});var gn=()=>({responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e})}),vn=({schema:e,name:t,description:n})=>{const a=(0,v.mD)(e);return{responseFormat:(0,v.hd)(a.jsonSchema).then((e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=n&&{description:n}}))),async parseCompleteOutput({text:e},t){const n=await(0,v.N8)({text:e});if(!n.success)throw new Ye({message:"No object generated: could not parse the response.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const r=await(0,v.ZZ)({value:n.value,schema:a});if(!r.success)throw new Ye({message:"No object generated: response did not match schema.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return r.value},async parsePartialOutput({text:e}){const t=await fn(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}}}},yn=({element:e,name:t,description:n})=>{const a=(0,v.mD)(e);return{responseFormat:(0,v.hd)(a.jsonSchema).then((e=>{const{$schema:a,...r}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:r}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=n&&{description:n}}})),async parseCompleteOutput({text:e},t){const n=await(0,v.N8)({text:e});if(!n.success)throw new Ye({message:"No object generated: could not parse the response.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const r=n.value;if(null==r||"object"!=typeof r||!("elements"in r)||!Array.isArray(r.elements))throw new Ye({message:"No object generated: response did not match schema.",cause:new y.iM({value:r,cause:"response must be an object with an elements array"}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(const n of r.elements){const r=await(0,v.ZZ)({value:n,schema:a});if(!r.success)throw new Ye({message:"No object generated: response did not match schema.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return r.elements},async parsePartialOutput({text:e}){const t=await fn(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const e=t.value;if(null==e||"object"!=typeof e||!("elements"in e)||!Array.isArray(e.elements))return;const n="repaired-parse"===t.state&&e.elements.length>0?e.elements.slice(0,-1):e.elements,r=[];for(const e of n){const t=await(0,v.ZZ)({value:e,schema:a});t.success&&r.push(t.value)}return{partial:r}}}}}},_n=({options:e,name:t,description:n})=>({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},...null!=t&&{name:t},...null!=n&&{description:n}}),async parseCompleteOutput({text:t},n){const a=await(0,v.N8)({text:t});if(!a.success)throw new Ye({message:"No object generated: could not parse the response.",cause:a.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});const r=a.value;if(null==r||"object"!=typeof r||!("result"in r)||"string"!=typeof r.result||!e.includes(r.result))throw new Ye({message:"No object generated: response did not match schema.",cause:new y.iM({value:r,cause:"response must be an object that contains a choice value."}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return r.result},async parsePartialOutput({text:t}){const n=await fn(t);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const t=n.value;if(null==t||"object"!=typeof t||!("result"in t)||"string"!=typeof t.result)return;const a=e.filter((e=>e.startsWith(t.result)));return"successful-parse"===n.state?a.includes(t.result)?{partial:t.result}:void 0:1===a.length?{partial:a[0]}:void 0}}}}),bn=({name:e,description:t}={})=>({responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){const n=await(0,v.N8)({text:e});if(!n.success)throw new Ye({message:"No object generated: could not parse the response.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){const t=await fn(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return void 0===t.value?void 0:{partial:t.value}}}});async function xn(e){const t=""===e.input.trim()?{success:!0,value:{}}:await(0,v.N8)({text:e.input});if(!1===t.success)throw new Oe({toolName:e.toolName,toolInput:e.input,cause:t.error});return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:t.value,providerExecuted:!0,dynamic:!0,providerMetadata:e.providerMetadata}}async function In({toolCall:e,tools:t}){const n=e.toolName,a=t[n];if(null==a){if(e.providerExecuted&&e.dynamic)return await xn(e);throw new We({toolName:e.toolName,availableTools:Object.keys(t)})}const r=(0,v.mD)(a.inputSchema),o=""===e.input.trim()?await(0,v.ZZ)({value:{},schema:r}):await(0,v.N8)({text:e.input,schema:r});if(!1===o.success)throw new Oe({toolName:n,toolInput:e.input,cause:o.error});return"dynamic"===a.type?{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:o.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,dynamic:!0,title:a.title}:{type:"tool-call",toolCallId:e.toolCallId,toolName:n,input:o.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:a.title}}var wn=class{constructor({content:e,finishReason:t,usage:n,warnings:a,request:r,response:o,providerMetadata:s}){this.content=e,this.finishReason=t,this.usage=n,this.warnings=a,this.request=r,this.response=o,this.providerMetadata=s}get text(){return this.content.filter((e=>"text"===e.type)).map((e=>e.text)).join("")}get reasoning(){return this.content.filter((e=>"reasoning"===e.type))}get reasoningText(){return 0===this.reasoning.length?void 0:this.reasoning.map((e=>e.text)).join("")}get files(){return this.content.filter((e=>"file"===e.type)).map((e=>e.file))}get sources(){return this.content.filter((e=>"source"===e.type))}get toolCalls(){return this.content.filter((e=>"tool-call"===e.type))}get staticToolCalls(){return this.toolCalls.filter((e=>!0!==e.dynamic))}get dynamicToolCalls(){return this.toolCalls.filter((e=>!0===e.dynamic))}get toolResults(){return this.content.filter((e=>"tool-result"===e.type))}get staticToolResults(){return this.toolResults.filter((e=>!0!==e.dynamic))}get dynamicToolResults(){return this.toolResults.filter((e=>!0===e.dynamic))}};function kn(e){return({steps:t})=>t.length===e}function $n({content:e,tools:t}){const n=[],a=e.filter((e=>"source"!==e.type)).filter((e=>("tool-result"!==e.type||e.providerExecuted)&&("tool-error"!==e.type||e.providerExecuted))).filter((e=>"text"!==e.type||e.text.length>0)).map((e=>{switch(e.type){case"text":return{type:"text",text:e.text,providerOptions:e.providerMetadata};case"reasoning":return{type:"reasoning",text:e.text,providerOptions:e.providerMetadata};case"file":return{type:"file",data:e.file.base64,mediaType:e.file.mediaType,providerOptions:e.providerMetadata};case"tool-call":return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,providerExecuted:e.providerExecuted,providerOptions:e.providerMetadata};case"tool-result":return{type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Rt({tool:null==t?void 0:t[e.toolName],output:e.output,errorMode:"none"}),providerExecuted:!0,providerOptions:e.providerMetadata};case"tool-error":return{type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Rt({tool:null==t?void 0:t[e.toolName],output:e.error,errorMode:"json"}),providerOptions:e.providerMetadata};case"tool-approval-request":return{type:"tool-approval-request",approvalId:e.approvalId,toolCallId:e.toolCall.toolCallId}}}));a.length>0&&n.push({role:"assistant",content:a});const r=e.filter((e=>"tool-result"===e.type||"tool-error"===e.type)).filter((e=>!e.providerExecuted)).map((e=>({type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Rt({tool:null==t?void 0:t[e.toolName],output:"tool-result"===e.type?e.output:e.error,errorMode:"tool-error"===e.type?"text":"none"}),...null!=e.providerMetadata?{providerOptions:e.providerMetadata}:{}})));return r.length>0&&n.push({role:"tool",content:r}),n}function En(e,t){const n=new Headers(null!=e?e:{});for(const[e,a]of Object.entries(t))n.has(e)||n.set(e,a);return n}function Sn({response:e,status:t,statusText:n,headers:a,stream:r}){e.writeHead(null!=t?t:200,n,a);const o=r.getReader();(async()=>{try{for(;;){const{done:t,value:n}=await o.read();if(t)break;e.write(n)||await new Promise((t=>{e.once("drain",t)}))}}catch(e){throw e}finally{e.end()}})()}(0,v.hK)({prefix:"aitxt",size:24});var Tn=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}\n\n`)},flush(e){e.enqueue("data: [DONE]\n\n")}})}},An={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};var Nn=(0,v.ID)((()=>(0,v.jN)(_.KC([_.re({type:_.eu("text-start"),id:_.Yj(),providerMetadata:Yt.optional()}),_.re({type:_.eu("text-delta"),id:_.Yj(),delta:_.Yj(),providerMetadata:Yt.optional()}),_.re({type:_.eu("text-end"),id:_.Yj(),providerMetadata:Yt.optional()}),_.re({type:_.eu("error"),errorText:_.Yj()}),_.re({type:_.eu("tool-input-start"),toolCallId:_.Yj(),toolName:_.Yj(),providerExecuted:_.zM().optional(),dynamic:_.zM().optional(),title:_.Yj().optional()}),_.re({type:_.eu("tool-input-delta"),toolCallId:_.Yj(),inputTextDelta:_.Yj()}),_.re({type:_.eu("tool-input-available"),toolCallId:_.Yj(),toolName:_.Yj(),input:_.L5(),providerExecuted:_.zM().optional(),providerMetadata:Yt.optional(),dynamic:_.zM().optional(),title:_.Yj().optional()}),_.re({type:_.eu("tool-input-error"),toolCallId:_.Yj(),toolName:_.Yj(),input:_.L5(),providerExecuted:_.zM().optional(),providerMetadata:Yt.optional(),dynamic:_.zM().optional(),errorText:_.Yj(),title:_.Yj().optional()}),_.re({type:_.eu("tool-approval-request"),approvalId:_.Yj(),toolCallId:_.Yj()}),_.re({type:_.eu("tool-output-available"),toolCallId:_.Yj(),output:_.L5(),providerExecuted:_.zM().optional(),dynamic:_.zM().optional(),preliminary:_.zM().optional()}),_.re({type:_.eu("tool-output-error"),toolCallId:_.Yj(),errorText:_.Yj(),providerExecuted:_.zM().optional(),dynamic:_.zM().optional()}),_.re({type:_.eu("tool-output-denied"),toolCallId:_.Yj()}),_.re({type:_.eu("reasoning-start"),id:_.Yj(),providerMetadata:Yt.optional()}),_.re({type:_.eu("reasoning-delta"),id:_.Yj(),delta:_.Yj(),providerMetadata:Yt.optional()}),_.re({type:_.eu("reasoning-end"),id:_.Yj(),providerMetadata:Yt.optional()}),_.re({type:_.eu("source-url"),sourceId:_.Yj(),url:_.Yj(),title:_.Yj().optional(),providerMetadata:Yt.optional()}),_.re({type:_.eu("source-document"),sourceId:_.Yj(),mediaType:_.Yj(),title:_.Yj(),filename:_.Yj().optional(),providerMetadata:Yt.optional()}),_.re({type:_.eu("file"),url:_.Yj(),mediaType:_.Yj(),providerMetadata:Yt.optional()}),_.re({type:_.Ie((e=>"string"==typeof e&&e.startsWith("data-")),{message:'Type must start with "data-"'}),id:_.Yj().optional(),data:_.L5(),transient:_.zM().optional()}),_.re({type:_.eu("start-step")}),_.re({type:_.eu("finish-step")}),_.re({type:_.eu("start"),messageId:_.Yj().optional(),messageMetadata:_.L5().optional()}),_.re({type:_.eu("finish"),finishReason:_.k5(["stop","length","content-filter","tool-calls","error","other","unknown"]).optional(),messageMetadata:_.L5().optional()}),_.re({type:_.eu("abort")}),_.re({type:_.eu("message-metadata"),messageMetadata:_.L5()})]))));function On(e,t){if(void 0===e&&void 0===t)return;if(void 0===e)return t;if(void 0===t)return e;const n={...e};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const r=t[a];if(void 0===r)continue;const o=a in e?e[a]:void 0,s=!(null===r||"object"!=typeof r||Array.isArray(r)||r instanceof Date||r instanceof RegExp),i=!(null==o||"object"!=typeof o||Array.isArray(o)||o instanceof Date||o instanceof RegExp);n[a]=s&&i?On(o,r):r}return n}function jn(e){return e.type.startsWith("data-")}function Cn(e){return"text"===e.type}function Rn(e){return"file"===e.type}function Mn(e){return"reasoning"===e.type}function Pn(e){return e.type.startsWith("tool-")}function Yn(e){return"dynamic-tool"===e.type}function Ln(e){return Pn(e)||Yn(e)}function Dn(e){return e.type.split("-").slice(1).join("-")}function zn(e){return Yn(e)?e.toolName:Dn(e)}function Fn({lastMessage:e,messageId:t}){return{message:"assistant"===(null==e?void 0:e.role)?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function qn({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:a,onError:r,onToolCall:o,onData:s}){return e.pipeThrough(new TransformStream({async transform(e,i){await a((async({state:a,write:l})=>{var u,c,p,d;function m(e){const t=a.message.parts.filter(Ln).find((t=>t.toolCallId===e));if(null==t)throw new Error(`no tool invocation found for tool call ${e}`);return t}function h(e){var t;const n=a.message.parts.find((t=>Pn(t)&&t.toolCallId===e.toolCallId)),r=e,o=n;null!=n?(n.state=e.state,o.input=r.input,o.output=r.output,o.errorText=r.errorText,o.rawInput=r.rawInput,o.preliminary=r.preliminary,void 0!==e.title&&(o.title=e.title),o.providerExecuted=null!=(t=r.providerExecuted)?t:n.providerExecuted,null!=r.providerMetadata&&"input-available"===n.state&&(n.callProviderMetadata=r.providerMetadata)):a.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:r.input,output:r.output,rawInput:r.rawInput,errorText:r.errorText,providerExecuted:r.providerExecuted,preliminary:r.preliminary,...null!=r.providerMetadata?{callProviderMetadata:r.providerMetadata}:{}})}function f(e){var t,n;const r=a.message.parts.find((t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId)),o=e,s=r;null!=r?(r.state=e.state,s.toolName=e.toolName,s.input=o.input,s.output=o.output,s.errorText=o.errorText,s.rawInput=null!=(t=o.rawInput)?t:s.rawInput,s.preliminary=o.preliminary,void 0!==e.title&&(s.title=e.title),s.providerExecuted=null!=(n=o.providerExecuted)?n:r.providerExecuted,null!=o.providerMetadata&&"input-available"===r.state&&(r.callProviderMetadata=o.providerMetadata)):a.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:o.input,output:o.output,errorText:o.errorText,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:e.title,...null!=o.providerMetadata?{callProviderMetadata:o.providerMetadata}:{}})}async function g(e){if(null!=e){const n=null!=a.message.metadata?On(a.message.metadata,e):e;null!=t&&await(0,v.k5)({value:n,schema:t}),a.message.metadata=n}}switch(e.type){case"text-start":{const t={type:"text",text:"",providerMetadata:e.providerMetadata,state:"streaming"};a.activeTextParts[e.id]=t,a.message.parts.push(t),l();break}case"text-delta":{const t=a.activeTextParts[e.id];t.text+=e.delta,t.providerMetadata=null!=(u=e.providerMetadata)?u:t.providerMetadata,l();break}case"text-end":{const t=a.activeTextParts[e.id];t.state="done",t.providerMetadata=null!=(c=e.providerMetadata)?c:t.providerMetadata,delete a.activeTextParts[e.id],l();break}case"reasoning-start":{const t={type:"reasoning",text:"",providerMetadata:e.providerMetadata,state:"streaming"};a.activeReasoningParts[e.id]=t,a.message.parts.push(t),l();break}case"reasoning-delta":{const t=a.activeReasoningParts[e.id];t.text+=e.delta,t.providerMetadata=null!=(p=e.providerMetadata)?p:t.providerMetadata,l();break}case"reasoning-end":{const t=a.activeReasoningParts[e.id];t.providerMetadata=null!=(d=e.providerMetadata)?d:t.providerMetadata,t.state="done",delete a.activeReasoningParts[e.id],l();break}case"file":a.message.parts.push({type:"file",mediaType:e.mediaType,url:e.url}),l();break;case"source-url":a.message.parts.push({type:"source-url",sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),l();break;case"source-document":a.message.parts.push({type:"source-document",sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),l();break;case"tool-input-start":{const t=a.message.parts.filter(Pn);a.partialToolCalls[e.toolCallId]={text:"",toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title},e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title}),l();break}case"tool-input-delta":{const t=a.partialToolCalls[e.toolCallId];t.text+=e.inputTextDelta;const{value:n}=await fn(t.text);t.dynamic?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:n,title:t.title}):h({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:n,title:t.title}),l();break}case"tool-input-available":e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),l(),o&&!e.providerExecuted&&await o({toolCall:e});break;case"tool-input-error":e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),l();break;case"tool-approval-request":{const t=m(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId},l();break}case"tool-output-denied":m(e.toolCallId).state="output-denied",l();break;case"tool-output-available":{const t=m(e.toolCallId);"dynamic-tool"===t.type?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-available",input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,title:t.title}):h({toolCallId:e.toolCallId,toolName:Dn(t),state:"output-available",input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,title:t.title}),l();break}case"tool-output-error":{const t=m(e.toolCallId);"dynamic-tool"===t.type?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-error",input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,title:t.title}):h({toolCallId:e.toolCallId,toolName:Dn(t),state:"output-error",input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,title:t.title}),l();break}case"start-step":a.message.parts.push({type:"step-start"});break;case"finish-step":a.activeTextParts={},a.activeReasoningParts={};break;case"start":null!=e.messageId&&(a.message.id=e.messageId),await g(e.messageMetadata),null==e.messageId&&null==e.messageMetadata||l();break;case"finish":null!=e.finishReason&&(a.finishReason=e.finishReason),await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"message-metadata":await g(e.messageMetadata),null!=e.messageMetadata&&l();break;case"error":null==r||r(new Error(e.errorText));break;default:if(function(e){return e.type.startsWith("data-")}(e)){null!=(null==n?void 0:n[e.type])&&await(0,v.k5)({value:e.data,schema:n[e.type]});const t=e;if(t.transient){null==s||s(t);break}const r=null!=t.id?a.message.parts.find((e=>t.type===e.type&&t.id===e.id)):void 0;null!=r?r.data=t.data:a.message.parts.push(t),null==s||s(t),l()}}i.enqueue(e)}))}}))}function Zn(e){const t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){const e=this.getReader();let t=!1;async function n(n){var a;t=!0;try{n&&await(null==(a=e.cancel)?void 0:a.call(e))}finally{try{e.releaseLock()}catch(e){}}}return{async next(){if(t)return{done:!0,value:void 0};const{done:a,value:r}=await e.read();return a?(await n(!0),{done:!0,value:void 0}):{done:!1,value:r}},return:async()=>(await n(!0),{done:!0,value:void 0}),async throw(e){throw await n(!0),e}}},t}async function Un({stream:e,onError:t}){const n=e.getReader();try{for(;;){const{done:e}=await n.read();if(e)break}}catch(e){null==t||t(e)}finally{n.releaseLock()}}function Vn(){let e,t;return{promise:new Promise(((n,a)=>{e=n,t=a})),resolve:e,reject:t}}function Bn(){var e,t;return null!=(t=null==(e=null==globalThis?void 0:globalThis.performance)?void 0:e.now())?t:Date.now()}var Wn=(0,v.hK)({prefix:"aitxt",size:24});function Gn({model:e,tools:t,toolChoice:n,system:a,prompt:r,messages:o,maxRetries:s,abortSignal:i,headers:l,stopWhen:u=kn(1),experimental_output:c,output:p=c,experimental_telemetry:d,prepareStep:m,providerOptions:h,experimental_activeTools:f,activeTools:g=f,experimental_repairToolCall:v,experimental_transform:y,experimental_download:_,includeRawChunks:b=!1,onChunk:x,onError:I=({error:e})=>{console.error(e)},onFinish:w,onAbort:k,onStepFinish:$,experimental_context:E,_internal:{now:S=Bn,generateId:T=Wn,currentDate:A=()=>new Date}={},...N}){return new Kn({model:wt(e),telemetry:d,headers:l,settings:N,maxRetries:s,abortSignal:i,system:a,prompt:r,messages:o,tools:t,toolChoice:n,transforms:Ot(y),activeTools:g,repairToolCall:v,stopConditions:Ot(u),output:p,providerOptions:h,prepareStep:m,includeRawChunks:b,onChunk:x,onError:I,onFinish:w,onAbort:k,onStepFinish:$,now:S,currentDate:A,generateId:T,experimental_context:E,download:_})}var Kn=class{constructor({model:e,telemetry:t,headers:n,settings:a,maxRetries:r,abortSignal:o,system:s,prompt:i,messages:l,tools:u,toolChoice:c,transforms:p,activeTools:d,repairToolCall:m,stopConditions:h,output:f,providerOptions:g,prepareStep:b,includeRawChunks:x,now:I,currentDate:w,generateId:k,onChunk:$,onError:E,onFinish:S,onAbort:T,onStepFinish:A,experimental_context:N,download:O}){let j;this._totalUsage=new v.e1,this._finishReason=new v.e1,this._steps=new v.e1,this.outputSpecification=f,this.includeRawChunks=x,this.tools=u;let C=[];const R=[];let M,P,Y={},L=[];const D=[];let z,F={},q={};const Z=new TransformStream({async transform(t,n){var a,r,o,s;n.enqueue(t);const{part:i}=t;if("text-delta"!==i.type&&"reasoning-delta"!==i.type&&"source"!==i.type&&"tool-call"!==i.type&&"tool-result"!==i.type&&"tool-input-start"!==i.type&&"tool-input-delta"!==i.type&&"raw"!==i.type||await(null==$?void 0:$({chunk:i})),"error"===i.type&&await E({error:Xt(i.error)}),"text-start"===i.type&&(F[i.id]={type:"text",text:"",providerMetadata:i.providerMetadata},C.push(F[i.id])),"text-delta"===i.type){const e=F[i.id];if(null==e)return void n.enqueue({part:{type:"error",error:`text part ${i.id} not found`},partialOutput:void 0});e.text+=i.text,e.providerMetadata=null!=(a=i.providerMetadata)?a:e.providerMetadata}if("text-end"===i.type){const e=F[i.id];if(null==e)return void n.enqueue({part:{type:"error",error:`text part ${i.id} not found`},partialOutput:void 0});e.providerMetadata=null!=(r=i.providerMetadata)?r:e.providerMetadata,delete F[i.id]}if("reasoning-start"===i.type&&(q[i.id]={type:"reasoning",text:"",providerMetadata:i.providerMetadata},C.push(q[i.id])),"reasoning-delta"===i.type){const e=q[i.id];if(null==e)return void n.enqueue({part:{type:"error",error:`reasoning part ${i.id} not found`},partialOutput:void 0});e.text+=i.text,e.providerMetadata=null!=(o=i.providerMetadata)?o:e.providerMetadata}if("reasoning-end"===i.type){const e=q[i.id];if(null==e)return void n.enqueue({part:{type:"error",error:`reasoning part ${i.id} not found`},partialOutput:void 0});e.providerMetadata=null!=(s=i.providerMetadata)?s:e.providerMetadata,delete q[i.id]}if("file"===i.type&&C.push({type:"file",file:i.file}),"source"===i.type&&C.push(i),"tool-call"===i.type&&C.push(i),"tool-result"!==i.type||i.preliminary||C.push(i),"tool-approval-request"===i.type&&C.push(i),"tool-error"===i.type&&C.push(i),"start-step"===i.type&&(C=[],q={},F={},Y=i.request,L=i.warnings),"finish-step"===i.type){const t=$n({content:C,tools:u}),n=new wn({content:C,finishReason:i.finishReason,usage:i.usage,warnings:L,request:Y,response:{...i.response,messages:[...R,...t]},providerMetadata:i.providerMetadata});await(null==A?void 0:A(n)),xe({warnings:L,provider:e.provider,model:e.modelId}),D.push(n),R.push(...t),j.resolve()}"finish"===i.type&&(P=i.totalUsage,M=i.finishReason)},async flush(e){try{if(0===D.length){const e=new qe({message:"No output generated. Check the stream for errors."});return X._finishReason.reject(e),X._totalUsage.reject(e),void X._steps.reject(e)}const e=null!=M?M:"unknown",n=null!=P?P:{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0};X._finishReason.resolve(e),X._totalUsage.resolve(n),X._steps.resolve(D);const a=D[D.length-1];await(null==S?void 0:S({finishReason:e,totalUsage:n,usage:a.usage,content:a.content,text:a.text,reasoningText:a.reasoningText,reasoning:a.reasoning,files:a.files,sources:a.sources,toolCalls:a.toolCalls,staticToolCalls:a.staticToolCalls,dynamicToolCalls:a.dynamicToolCalls,toolResults:a.toolResults,staticToolResults:a.staticToolResults,dynamicToolResults:a.dynamicToolResults,request:a.request,response:a.response,warnings:a.warnings,providerMetadata:a.providerMetadata,steps:D,experimental_context:N})),z.setAttributes(await on({telemetry:t,attributes:{"ai.response.finishReason":e,"ai.response.text":{output:()=>a.text},"ai.response.toolCalls":{output:()=>{var e;return(null==(e=a.toolCalls)?void 0:e.length)?JSON.stringify(a.toolCalls):void 0}},"ai.response.providerMetadata":JSON.stringify(a.providerMetadata),"ai.usage.inputTokens":n.inputTokens,"ai.usage.outputTokens":n.outputTokens,"ai.usage.totalTokens":n.totalTokens,"ai.usage.reasoningTokens":n.reasoningTokens,"ai.usage.cachedInputTokens":n.cachedInputTokens}}))}catch(t){e.error(t)}finally{z.end()}}}),U=function(){let e=[],t=null,n=!1,a=Vn();const r=()=>{n=!0,a.resolve(),e.forEach((e=>e.cancel())),e=[],null==t||t.close()},o=async()=>{if(n&&0===e.length)null==t||t.close();else{if(0===e.length)return a=Vn(),await a.promise,o();try{const{value:a,done:r}=await e[0].read();r?(e.shift(),0===e.length&&n?null==t||t.close():await o()):null==t||t.enqueue(a)}catch(n){null==t||t.error(n),e.shift(),r()}}};return{stream:new ReadableStream({start(e){t=e},pull:o,async cancel(){for(const t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw new Error("Cannot add inner stream: outer stream is closed");e.push(t.getReader()),a.resolve()},close:()=>{n=!0,a.resolve(),0===e.length&&(null==t||t.close())},terminate:r}}();this.addStream=U.addStream,this.closeStream=U.close;const V=U.stream.getReader();let B=new ReadableStream({async start(e){e.enqueue({type:"start"})},async pull(e){function t(){null==T||T({steps:D}),e.enqueue({type:"abort"}),e.close()}try{const{done:n,value:a}=await V.read();if(n)return void e.close();if(null==o?void 0:o.aborted)return void t();e.enqueue(a)}catch(n){(0,v.zf)(n)&&(null==o?void 0:o.aborted)?t():e.error(n)}},cancel:e=>U.stream.cancel(e)});for(const e of p)B=B.pipeThrough(e({tools:u,stopStream(){U.terminate()}}));this.baseStream=B.pipeThrough(function(e){let t,n,a="",r="",o="";function s({controller:e,partialOutput:a}){e.enqueue({part:{type:"text-delta",id:t,text:r,providerMetadata:n},partialOutput:a}),r=""}return new TransformStream({async transform(i,l){var u;if("finish-step"===i.type&&r.length>0&&s({controller:l}),"text-delta"!==i.type&&"text-start"!==i.type&&"text-end"!==i.type)return void l.enqueue({part:i,partialOutput:void 0});if(null==t)t=i.id;else if(i.id!==t)return void l.enqueue({part:i,partialOutput:void 0});if("text-start"===i.type)return void l.enqueue({part:i,partialOutput:void 0});if("text-end"===i.type)return r.length>0&&s({controller:l}),void l.enqueue({part:i,partialOutput:void 0});a+=i.text,r+=i.text,n=null!=(u=i.providerMetadata)?u:n;const c=await e.parsePartialOutput({text:a});if(void 0!==c){const e=JSON.stringify(c.partial);e!==o&&(s({controller:l,partialOutput:c.partial}),o=e)}}})}(null!=f?f:gn())).pipeThrough(Z);const{maxRetries:W,retry:G}=function({maxRetries:e,abortSignal:t}){if(null!=e){if(!Number.isInteger(e))throw new $e({parameter:"maxRetries",value:e,message:"maxRetries must be an integer"});if(e<0)throw new $e({parameter:"maxRetries",value:e,message:"maxRetries must be >= 0"})}const n=null!=e?e:2;return{maxRetries:n,retry:un({maxRetries:n,abortSignal:t})}}({maxRetries:r,abortSignal:o}),K=function({isEnabled:e=!1,tracer:t}={}){return e?t||me.u.getTracer("ai"):en}(t),H=function({maxOutputTokens:e,temperature:t,topP:n,topK:a,presencePenalty:r,frequencyPenalty:o,seed:s,stopSequences:i}){if(null!=e){if(!Number.isInteger(e))throw new $e({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be an integer"});if(e<1)throw new $e({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be >= 1"})}if(null!=t&&"number"!=typeof t)throw new $e({parameter:"temperature",value:t,message:"temperature must be a number"});if(null!=n&&"number"!=typeof n)throw new $e({parameter:"topP",value:n,message:"topP must be a number"});if(null!=a&&"number"!=typeof a)throw new $e({parameter:"topK",value:a,message:"topK must be a number"});if(null!=r&&"number"!=typeof r)throw new $e({parameter:"presencePenalty",value:r,message:"presencePenalty must be a number"});if(null!=o&&"number"!=typeof o)throw new $e({parameter:"frequencyPenalty",value:o,message:"frequencyPenalty must be a number"});if(null!=s&&!Number.isInteger(s))throw new $e({parameter:"seed",value:s,message:"seed must be an integer"});return{maxOutputTokens:e,temperature:t,topP:n,topK:a,presencePenalty:r,frequencyPenalty:o,stopSequences:i,seed:s}}(a),J=function({model:e,settings:t,telemetry:n,headers:a}){var r;return{"ai.model.provider":e.provider,"ai.model.id":e.modelId,...Object.entries(t).reduce(((e,[t,n])=>(e[`ai.settings.${t}`]=n,e)),{}),...Object.entries(null!=(r=null==n?void 0:n.metadata)?r:{}).reduce(((e,[t,n])=>(e[`ai.telemetry.metadata.${t}`]=n,e)),{}),...Object.entries(null!=a?a:{}).reduce(((e,[t,n])=>(void 0!==n&&(e[`ai.request.headers.${t}`]=n),e)),{})}}({model:e,telemetry:t,headers:n,settings:{...H,maxRetries:W}}),X=this;an({name:"ai.streamText",attributes:on({telemetry:t,attributes:{...Qt({operationId:"ai.streamText",telemetry:t}),...J,"ai.prompt":{input:()=>JSON.stringify({system:s,prompt:i,messages:l})}}}),tracer:K,endWhenDone:!1,fn:async a=>{z=a;const r=await async function(e){if(null==e.prompt&&null==e.messages)throw new y.M3({prompt:e,message:"prompt or messages must be defined"});if(null!=e.prompt&&null!=e.messages)throw new y.M3({prompt:e,message:"prompt and messages cannot be defined at the same time"});if(null!=e.system&&"string"!=typeof e.system&&!Ot(e.system).every((e=>"object"==typeof e&&null!==e&&"role"in e&&"system"===e.role)))throw new y.M3({prompt:e,message:"system must be a string, SystemModelMessage, or array of SystemModelMessage"});let t;if(null!=e.prompt&&"string"==typeof e.prompt)t=[{role:"user",content:e.prompt}];else if(null!=e.prompt&&Array.isArray(e.prompt))t=e.prompt;else{if(null==e.messages)throw new y.M3({prompt:e,message:"prompt or messages must be defined"});t=e.messages}if(0===t.length)throw new y.M3({prompt:e,message:"messages must not be empty"});const n=await(0,v.ZZ)({value:t,schema:_.YO(Jt)});if(!n.success)throw new y.M3({prompt:e,message:"The messages do not match the ModelMessage[] schema.",cause:n.error});return{messages:t,system:e.system}}({system:s,prompt:i,messages:l}),p=r.messages,x=[],{approvedToolApprovals:$,deniedToolApprovals:E}=function({messages:e}){const t=e.at(-1);if("tool"!=(null==t?void 0:t.role))return{approvedToolApprovals:[],deniedToolApprovals:[]};const n={};for(const t of e)if("assistant"===t.role&&"string"!=typeof t.content){const e=t.content;for(const t of e)"tool-call"===t.type&&(n[t.toolCallId]=t)}const a={};for(const t of e)if("assistant"===t.role&&"string"!=typeof t.content){const e=t.content;for(const t of e)"tool-approval-request"===t.type&&(a[t.approvalId]=t)}const r={};for(const e of t.content)"tool-result"===e.type&&(r[e.toolCallId]=e);const o=[],s=[],i=t.content.filter((e=>"tool-approval-response"===e.type));for(const e of i){const t=a[e.approvalId];if(null!=r[t.toolCallId])continue;const i={approvalRequest:t,approvalResponse:e,toolCall:n[t.toolCallId]};e.approved?o.push(i):s.push(i)}return{approvedToolApprovals:o,deniedToolApprovals:s}}({messages:p});if(E.length>0||$.length>0){let e;const n=new ReadableStream({start(t){e=t}});X.addStream(n);try{for(const t of E)null==e||e.enqueue({type:"tool-output-denied",toolCallId:t.toolCall.toolCallId,toolName:t.toolCall.toolName});const n=[];await Promise.all($.map((async a=>{const r=await pn({toolCall:a.toolCall,tools:u,tracer:K,telemetry:t,messages:p,abortSignal:o,experimental_context:N,onPreliminaryToolResult:t=>{null==e||e.enqueue(t)}});null!=r&&(null==e||e.enqueue(r),n.push(r))}))),x.push({role:"tool",content:[...n.map((e=>({type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Rt({tool:null==u?void 0:u[e.toolName],output:"tool-result"===e.type?e.output:e.error,errorMode:"tool-error"===e.type?"json":"none"})}))),...E.map((e=>({type:"tool-result",toolCallId:e.toolCall.toolCallId,toolName:e.toolCall.toolName,output:{type:"execution-denied",reason:e.approvalResponse.reason}})))]})}finally{null==e||e.close()}}R.push(...x),await async function a({currentStep:i,responseMessages:l,usage:y}){var _,x,$,E,S,T;const A=X.includeRawChunks;j=new v.e1;const C=[...p,...l],R=await(null==b?void 0:b({model:e,steps:D,stepNumber:D.length,messages:C,experimental_context:N})),M=wt(null!=(_=null==R?void 0:R.model)?_:e),P=await jt({prompt:{system:null!=(x=null==R?void 0:R.system)?x:r.system,messages:null!=($=null==R?void 0:R.messages)?$:C},supportedUrls:await M.supportedUrls,download:O}),{toolChoice:Y,tools:L}=await async function({tools:e,toolChoice:t,activeTools:n}){if(!(null!=(a=e)&&Object.keys(a).length>0))return{tools:void 0,toolChoice:void 0};var a;const r=null!=n?Object.entries(e).filter((([e])=>n.includes(e))):Object.entries(e),o=[];for(const[e,t]of r){const n=t.type;switch(n){case void 0:case"dynamic":case"function":o.push({type:"function",name:e,description:t.description,inputSchema:await(0,v.mD)(t.inputSchema).jsonSchema,...null!=t.inputExamples?{inputExamples:t.inputExamples}:{},providerOptions:t.providerOptions,...null!=t.strict?{strict:t.strict}:{}});break;case"provider":o.push({type:"provider",name:e,id:t.id,args:t.args});break;default:throw new Error(`Unsupported tool type: ${n}`)}}return{tools:o,toolChoice:null==t?{type:"auto"}:"string"==typeof t?{type:t}:{type:"tool",toolName:t.toolName}}}({tools:u,toolChoice:null!=(E=null==R?void 0:R.toolChoice)?E:c,activeTools:null!=(S=null==R?void 0:R.activeTools)?S:d});N=null!=(T=null==R?void 0:R.experimental_context)?T:N;const{result:{stream:z,response:F,request:q},doStreamSpan:Z,startTimestampMs:U}=await G((()=>an({name:"ai.streamText.doStream",attributes:on({telemetry:t,attributes:{...Qt({operationId:"ai.streamText.doStream",telemetry:t}),...J,"ai.model.provider":M.provider,"ai.model.id":M.modelId,"ai.prompt.messages":{input:()=>function(e){return JSON.stringify(e.map((e=>({...e,content:"string"==typeof e.content?e.content:e.content.map((e=>{return"file"===e.type?{...e,data:e.data instanceof Uint8Array?(t=e.data,"string"==typeof t?t:t instanceof ArrayBuffer?(0,v.n_)(new Uint8Array(t)):(0,v.n_)(t)):e.data}:e;var t}))}))))}(P)},"ai.prompt.tools":{input:()=>null==L?void 0:L.map((e=>JSON.stringify(e)))},"ai.prompt.toolChoice":{input:()=>null!=Y?JSON.stringify(Y):void 0},"gen_ai.system":M.provider,"gen_ai.request.model":M.modelId,"gen_ai.request.frequency_penalty":H.frequencyPenalty,"gen_ai.request.max_tokens":H.maxOutputTokens,"gen_ai.request.presence_penalty":H.presencePenalty,"gen_ai.request.stop_sequences":H.stopSequences,"gen_ai.request.temperature":H.temperature,"gen_ai.request.top_k":H.topK,"gen_ai.request.top_p":H.topP}}),tracer:K,endWhenDone:!1,fn:async e=>({startTimestampMs:I(),doStreamSpan:e,result:await M.doStream({...H,tools:L,toolChoice:Y,responseFormat:await(null==f?void 0:f.responseFormat),prompt:P,providerOptions:g,abortSignal:o,headers:n,includeRawChunks:A})})}))),V=function({tools:e,generatorStream:t,tracer:n,telemetry:a,system:r,messages:o,abortSignal:s,repairToolCall:i,experimental_context:l,generateId:u}){let c=null;const p=new ReadableStream({start(e){c=e}}),d=new Set,m=new Map;let h,f=!1;function g(){f&&0===d.size&&(null!=h&&c.enqueue(h),c.close())}const y=new TransformStream({async transform(t,p){const f=t.type;switch(f){case"stream-start":case"text-start":case"text-delta":case"text-end":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"tool-input-start":case"tool-input-delta":case"tool-input-end":case"source":case"response-metadata":case"error":case"raw":p.enqueue(t);break;case"file":p.enqueue({type:"file",file:new mn({data:t.data,mediaType:t.mediaType})});break;case"finish":h={type:"finish",finishReason:t.finishReason,usage:sn(t.usage),providerMetadata:t.providerMetadata};break;case"tool-call":try{const h=await async function({toolCall:e,tools:t,repairToolCall:n,system:a,messages:r}){var o;try{if(null==t){if(e.providerExecuted&&e.dynamic)return await xn(e);throw new We({toolName:e.toolName})}try{return await In({toolCall:e,tools:t})}catch(o){if(null==n||!We.isInstance(o)&&!Oe.isInstance(o))throw o;let s=null;try{s=await n({toolCall:e,tools:t,inputSchema:async({toolName:e})=>{const{inputSchema:n}=t[e];return await(0,v.mD)(n).jsonSchema},system:a,messages:r,error:o})}catch(e){throw new Xe({cause:e,originalError:o})}if(null==s)throw o;return await In({toolCall:s,tools:t})}}catch(n){const a=await(0,v.N8)({text:e.input}),r=a.success?a.value:e.input;return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:r,dynamic:!0,invalid:!0,error:n,title:null==(o=null==t?void 0:t[e.toolName])?void 0:o.title,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}}}({toolCall:t,tools:e,repairToolCall:i,system:r,messages:o});if(p.enqueue(h),h.invalid){c.enqueue({type:"tool-error",toolCallId:h.toolCallId,toolName:h.toolName,input:h.input,error:(0,v.u1)(h.error),dynamic:!0,title:h.title});break}const f=null==e?void 0:e[h.toolName];if(null==f)break;if(null!=f.onInputAvailable&&await f.onInputAvailable({input:h.input,toolCallId:h.toolCallId,messages:o,abortSignal:s,experimental_context:l}),await async function({tool:e,toolCall:t,messages:n,experimental_context:a}){return null!=e.needsApproval&&("boolean"==typeof e.needsApproval?e.needsApproval:await e.needsApproval(t.input,{toolCallId:t.toolCallId,messages:n,experimental_context:a}))}({tool:f,toolCall:h,messages:o,experimental_context:l})){c.enqueue({type:"tool-approval-request",approvalId:u(),toolCall:h});break}if(m.set(h.toolCallId,h.input),null!=f.execute&&!0!==h.providerExecuted){const t=u();d.add(t),pn({toolCall:h,tools:e,tracer:n,telemetry:a,messages:o,abortSignal:s,experimental_context:l,onPreliminaryToolResult:e=>{c.enqueue(e)}}).then((e=>{c.enqueue(e),d.delete(t),g()}))}}catch(e){c.enqueue({type:"error",error:e})}break;case"tool-result":{const e=t.toolName;t.isError?c.enqueue({type:"tool-error",toolCallId:t.toolCallId,toolName:e,input:m.get(t.toolCallId),providerExecuted:!0,error:t.result,dynamic:t.dynamic}):p.enqueue({type:"tool-result",toolCallId:t.toolCallId,toolName:e,input:m.get(t.toolCallId),output:t.result,providerExecuted:!0,dynamic:t.dynamic});break}default:throw new Error(`Unhandled chunk type: ${f}`)}},flush(){f=!0,g()}});return new ReadableStream({start:async e=>Promise.all([t.pipeThrough(y).pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){}})),p.pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){e.close()}}))])})}({tools:u,generatorStream:z,tracer:K,telemetry:t,system:s,messages:C,repairToolCall:m,abortSignal:o,experimental_context:N,generateId:k}),B=null!=q?q:{},W=[],Q=[];let ee;const te={};let ne,ae="unknown",re={inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0},oe=!0,se={id:k(),timestamp:w(),modelId:e.modelId},ie="";X.addStream(V.pipeThrough(new TransformStream({async transform(e,t){var n,a,r,s,i;if("stream-start"===e.type)return void(ee=e.warnings);if(oe){const e=I()-U;oe=!1,Z.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":e}),Z.setAttributes({"ai.response.msToFirstChunk":e}),t.enqueue({type:"start-step",request:B,warnings:null!=ee?ee:[]})}const l=e.type;switch(l){case"tool-approval-request":case"text-start":case"text-end":case"reasoning-start":case"reasoning-end":case"file":case"source":t.enqueue(e);break;case"text-delta":e.delta.length>0&&(t.enqueue({type:"text-delta",id:e.id,text:e.delta,providerMetadata:e.providerMetadata}),ie+=e.delta);break;case"reasoning-delta":t.enqueue({type:"reasoning-delta",id:e.id,text:e.delta,providerMetadata:e.providerMetadata});break;case"tool-call":t.enqueue(e),W.push(e);break;case"tool-result":t.enqueue(e),e.preliminary||Q.push(e);break;case"tool-error":t.enqueue(e),Q.push(e);break;case"response-metadata":se={id:null!=(n=e.id)?n:se.id,timestamp:null!=(a=e.timestamp)?a:se.timestamp,modelId:null!=(r=e.modelId)?r:se.modelId};break;case"finish":{re=e.usage,ae=e.finishReason,ne=e.providerMetadata;const t=I()-U;Z.addEvent("ai.stream.finish"),Z.setAttributes({"ai.response.msToFinish":t,"ai.response.avgOutputTokensPerSecond":1e3*(null!=(s=re.outputTokens)?s:0)/t});break}case"tool-input-start":{te[e.id]=e.toolName;const n=null==u?void 0:u[e.toolName];null!=(null==n?void 0:n.onInputStart)&&await n.onInputStart({toolCallId:e.id,messages:C,abortSignal:o,experimental_context:N}),t.enqueue({...e,dynamic:null!=(i=e.dynamic)?i:"dynamic"===(null==n?void 0:n.type),title:null==n?void 0:n.title});break}case"tool-input-end":delete te[e.id],t.enqueue(e);break;case"tool-input-delta":{const n=te[e.id],a=null==u?void 0:u[n];null!=(null==a?void 0:a.onInputDelta)&&await a.onInputDelta({inputTextDelta:e.delta,toolCallId:e.id,messages:C,abortSignal:o,experimental_context:N}),t.enqueue(e);break}case"error":t.enqueue(e),ae="error";break;case"raw":A&&t.enqueue(e);break;default:throw new Error(`Unknown chunk type: ${l}`)}},async flush(e){const n=W.length>0?JSON.stringify(W):void 0;try{Z.setAttributes(await on({telemetry:t,attributes:{"ai.response.finishReason":ae,"ai.response.text":{output:()=>ie},"ai.response.toolCalls":{output:()=>n},"ai.response.id":se.id,"ai.response.model":se.modelId,"ai.response.timestamp":se.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(ne),"ai.usage.inputTokens":re.inputTokens,"ai.usage.outputTokens":re.outputTokens,"ai.usage.totalTokens":re.totalTokens,"ai.usage.reasoningTokens":re.reasoningTokens,"ai.usage.cachedInputTokens":re.cachedInputTokens,"gen_ai.response.finish_reasons":[ae],"gen_ai.response.id":se.id,"gen_ai.response.model":se.modelId,"gen_ai.usage.input_tokens":re.inputTokens,"gen_ai.usage.output_tokens":re.outputTokens}}))}catch(e){}finally{Z.end()}e.enqueue({type:"finish-step",finishReason:ae,usage:re,providerMetadata:ne,response:{...se,headers:null==F?void 0:F.headers}});const r=function(e,t){var n,a,r,o,s,i,l,u,c,p;return{inputTokens:ln(e.inputTokens,t.inputTokens),inputTokenDetails:{noCacheTokens:ln(null==(n=e.inputTokenDetails)?void 0:n.noCacheTokens,null==(a=t.inputTokenDetails)?void 0:a.noCacheTokens),cacheReadTokens:ln(null==(r=e.inputTokenDetails)?void 0:r.cacheReadTokens,null==(o=t.inputTokenDetails)?void 0:o.cacheReadTokens),cacheWriteTokens:ln(null==(s=e.inputTokenDetails)?void 0:s.cacheWriteTokens,null==(i=t.inputTokenDetails)?void 0:i.cacheWriteTokens)},outputTokens:ln(e.outputTokens,t.outputTokens),outputTokenDetails:{textTokens:ln(null==(l=e.outputTokenDetails)?void 0:l.textTokens,null==(u=t.outputTokenDetails)?void 0:u.textTokens),reasoningTokens:ln(null==(c=e.outputTokenDetails)?void 0:c.reasoningTokens,null==(p=t.outputTokenDetails)?void 0:p.reasoningTokens)},totalTokens:ln(e.totalTokens,t.totalTokens),reasoningTokens:ln(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:ln(e.cachedInputTokens,t.cachedInputTokens)}}(y,re);await j.promise;const o=W.filter((e=>!0!==e.providerExecuted)),s=Q.filter((e=>!0!==e.providerExecuted));if(o.length>0&&s.length===o.length&&!await async function({stopConditions:e,steps:t}){return(await Promise.all(e.map((e=>e({steps:t}))))).some((e=>e))}({stopConditions:h,steps:D})){l.push(...$n({content:D[D.length-1].content,tools:u}));try{await a({currentStep:i+1,responseMessages:l,usage:r})}catch(t){e.enqueue({type:"error",error:t}),X.closeStream()}}else e.enqueue({type:"finish",finishReason:ae,totalUsage:r}),X.closeStream()}})))}({currentStep:0,responseMessages:x,usage:{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}})}}).catch((e=>{X.addStream(new ReadableStream({start(t){t.enqueue({type:"error",error:e}),t.close()}})),X.closeStream()}))}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then((e=>e[e.length-1]))}get content(){return this.finalStep.then((e=>e.content))}get warnings(){return this.finalStep.then((e=>e.warnings))}get providerMetadata(){return this.finalStep.then((e=>e.providerMetadata))}get text(){return this.finalStep.then((e=>e.text))}get reasoningText(){return this.finalStep.then((e=>e.reasoningText))}get reasoning(){return this.finalStep.then((e=>e.reasoning))}get sources(){return this.finalStep.then((e=>e.sources))}get files(){return this.finalStep.then((e=>e.files))}get toolCalls(){return this.finalStep.then((e=>e.toolCalls))}get staticToolCalls(){return this.finalStep.then((e=>e.staticToolCalls))}get dynamicToolCalls(){return this.finalStep.then((e=>e.dynamicToolCalls))}get toolResults(){return this.finalStep.then((e=>e.toolResults))}get staticToolResults(){return this.finalStep.then((e=>e.staticToolResults))}get dynamicToolResults(){return this.finalStep.then((e=>e.dynamicToolResults))}get usage(){return this.finalStep.then((e=>e.usage))}get request(){return this.finalStep.then((e=>e.request))}get response(){return this.finalStep.then((e=>e.response))}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}teeStream(){const[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return Zn(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){"text-delta"===e.type&&t.enqueue(e.text)}})))}get fullStream(){return Zn(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await Un({stream:this.fullStream,onError:null==e?void 0:e.onError})}catch(n){null==(t=null==e?void 0:e.onError)||t.call(e,n)}}get experimental_partialOutputStream(){return this.partialOutputStream}get partialOutputStream(){return Zn(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:e},t){null!=e&&t.enqueue(e)}})))}get output(){return this.finalStep.then((e=>{var t;return(null!=(t=this.outputSpecification)?t:gn()).parseCompleteOutput({text:e.text},{response:e.response,usage:e.usage,finishReason:e.finishReason})}))}toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:a,sendReasoning:r=!0,sendSources:o=!1,sendStart:s=!0,sendFinish:i=!0,onError:l=y.u1}={}){const u=null!=t?function({originalMessages:e,responseMessageId:t}){if(null==e)return;const n=e[e.length-1];return"assistant"===(null==n?void 0:n.role)?n.id:"function"==typeof t?t():t}({originalMessages:e,responseMessageId:t}):void 0,c=e=>{var t;const n=null==(t=this.tools)?void 0:t[e.toolName];return null==n?e.dynamic:"dynamic"===(null==n?void 0:n.type)||void 0};return Zn(function({messageId:e,originalMessages:t=[],onFinish:n,onError:a,stream:r}){let o=null==t?void 0:t[t.length-1];"assistant"!==(null==o?void 0:o.role)?o=void 0:e=o.id;let s=!1;const i=r.pipeThrough(new TransformStream({transform(t,n){if("start"===t.type){const n=t;null==n.messageId&&null!=e&&(n.messageId=e)}"abort"===t.type&&(s=!0),n.enqueue(t)}}));if(null==n)return i;const l=Fn({lastMessage:o?structuredClone(o):void 0,messageId:null!=e?e:""});let u=!1;const c=async()=>{if(u||!n)return;u=!0;const e=l.message.id===(null==o?void 0:o.id);await n({isAborted:s,isContinuation:e,responseMessage:l.message,messages:[...e?t.slice(0,-1):t,l.message],finishReason:l.finishReason})};return qn({stream:i,runUpdateMessageJob:async e=>{await e({state:l,write:()=>{}})},onError:a}).pipeThrough(new TransformStream({transform(e,t){t.enqueue(e)},async cancel(){await c()},async flush(){await c()}}))}({stream:this.fullStream.pipeThrough(new TransformStream({transform:async(e,t)=>{const n=null==a?void 0:a({part:e}),p=e.type;switch(p){case"text-start":t.enqueue({type:"text-start",id:e.id,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}});break;case"text-delta":t.enqueue({type:"text-delta",id:e.id,delta:e.text,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}});break;case"text-end":t.enqueue({type:"text-end",id:e.id,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}});break;case"reasoning-start":t.enqueue({type:"reasoning-start",id:e.id,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}});break;case"reasoning-delta":r&&t.enqueue({type:"reasoning-delta",id:e.id,delta:e.text,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}});break;case"reasoning-end":t.enqueue({type:"reasoning-end",id:e.id,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}});break;case"file":t.enqueue({type:"file",mediaType:e.file.mediaType,url:`data:${e.file.mediaType};base64,${e.file.base64}`});break;case"source":o&&"url"===e.sourceType&&t.enqueue({type:"source-url",sourceId:e.id,url:e.url,title:e.title,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}),o&&"document"===e.sourceType&&t.enqueue({type:"source-document",sourceId:e.id,mediaType:e.mediaType,title:e.title,filename:e.filename,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}});break;case"tool-input-start":{const n=c(e);t.enqueue({type:"tool-input-start",toolCallId:e.id,toolName:e.toolName,...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=n?{dynamic:n}:{},...null!=e.title?{title:e.title}:{}});break}case"tool-input-delta":t.enqueue({type:"tool-input-delta",toolCallId:e.id,inputTextDelta:e.delta});break;case"tool-call":{const n=c(e);e.invalid?t.enqueue({type:"tool-input-error",toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{},...null!=n?{dynamic:n}:{},errorText:l(e.error),...null!=e.title?{title:e.title}:{}}):t.enqueue({type:"tool-input-available",toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{},...null!=n?{dynamic:n}:{},...null!=e.title?{title:e.title}:{}});break}case"tool-approval-request":t.enqueue({type:"tool-approval-request",approvalId:e.approvalId,toolCallId:e.toolCall.toolCallId});break;case"tool-result":{const n=c(e);t.enqueue({type:"tool-output-available",toolCallId:e.toolCallId,output:e.output,...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=e.preliminary?{preliminary:e.preliminary}:{},...null!=n?{dynamic:n}:{}});break}case"tool-error":{const n=c(e);t.enqueue({type:"tool-output-error",toolCallId:e.toolCallId,errorText:l(e.error),...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=n?{dynamic:n}:{}});break}case"tool-output-denied":t.enqueue({type:"tool-output-denied",toolCallId:e.toolCallId});break;case"error":t.enqueue({type:"error",errorText:l(e.error)});break;case"start-step":t.enqueue({type:"start-step"});break;case"finish-step":t.enqueue({type:"finish-step"});break;case"start":s&&t.enqueue({type:"start",...null!=n?{messageMetadata:n}:{},...null!=u?{messageId:u}:{}});break;case"finish":i&&t.enqueue({type:"finish",finishReason:e.finishReason,...null!=n?{messageMetadata:n}:{}});break;case"abort":t.enqueue(e);break;case"tool-input-end":case"raw":break;default:throw new Error(`Unknown chunk type: ${p}`)}null!=n&&"start"!==p&&"finish"!==p&&t.enqueue({type:"message-metadata",messageMetadata:n})}})),messageId:null!=u?u:null==t?void 0:t(),originalMessages:e,onFinish:n,onError:l}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:n,onFinish:a,messageMetadata:r,sendReasoning:o,sendSources:s,sendFinish:i,sendStart:l,onError:u,...c}={}){!function({response:e,status:t,statusText:n,headers:a,stream:r,consumeSseStream:o}){let s=r.pipeThrough(new Tn);if(o){const[e,t]=s.tee();s=e,o({stream:t})}Sn({response:e,status:t,statusText:n,headers:Object.fromEntries(En(a,An).entries()),stream:s.pipeThrough(new TextEncoderStream)})}({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:n,onFinish:a,messageMetadata:r,sendReasoning:o,sendSources:s,sendFinish:i,sendStart:l,onError:u}),...c})}pipeTextStreamToResponse(e,t){!function({response:e,status:t,statusText:n,headers:a,textStream:r}){Sn({response:e,status:t,statusText:n,headers:Object.fromEntries(En(a,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:r.pipeThrough(new TextEncoderStream)})}({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:a,sendReasoning:r,sendSources:o,sendFinish:s,sendStart:i,onError:l,...u}={}){return function({status:e,statusText:t,headers:n,stream:a,consumeSseStream:r}){let o=a.pipeThrough(new Tn);if(r){const[e,t]=o.tee();o=e,r({stream:t})}return new Response(o.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:En(n,An)})}({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:n,messageMetadata:a,sendReasoning:r,sendSources:o,sendFinish:s,sendStart:i,onError:l}),...u})}toTextStreamResponse(e){return function({status:e,statusText:t,headers:n,textStream:a}){return new Response(a.pipeThrough(new TextEncoderStream),{status:null!=e?e:200,statusText:t,headers:En(n,{"content-type":"text/plain; charset=utf-8"})})}({textStream:this.textStream,...e})}};function Hn(e,t){const n=[];(null==t?void 0:t.ignoreIncompleteToolCalls)&&(e=e.map((e=>({...e,parts:e.parts.filter((e=>!Ln(e)||"input-streaming"!==e.state&&"input-available"!==e.state))}))));for(const a of e)switch(a.role){case"system":{const e=a.parts.filter((e=>"text"===e.type)),t=e.reduce(((e,t)=>null!=t.providerMetadata?{...e,...t.providerMetadata}:e),{});n.push({role:"system",content:e.map((e=>e.text)).join(""),...Object.keys(t).length>0?{providerOptions:t}:{}});break}case"user":n.push({role:"user",content:a.parts.map((e=>{var n;return Cn(e)?{type:"text",text:e.text,...null!=e.providerMetadata?{providerOptions:e.providerMetadata}:{}}:Rn(e)?{type:"file",mediaType:e.mediaType,filename:e.filename,data:e.url,...null!=e.providerMetadata?{providerOptions:e.providerMetadata}:{}}:jn(e)?null==(n=null==t?void 0:t.convertDataPart)?void 0:n.call(t,e):void 0})).filter(v.R)});break;case"assistant":if(null!=a.parts){let e=function(){var e,a,o;if(0===r.length)return;const s=[];for(const n of r)if(Cn(n))s.push({type:"text",text:n.text,...null!=n.providerMetadata?{providerOptions:n.providerMetadata}:{}});else if(Rn(n))s.push({type:"file",mediaType:n.mediaType,filename:n.filename,data:n.url});else if(Mn(n))s.push({type:"reasoning",text:n.text,providerOptions:n.providerMetadata});else if(Ln(n)){const r=zn(n);"input-streaming"!==n.state&&(s.push({type:"tool-call",toolCallId:n.toolCallId,toolName:r,input:"output-error"===n.state?null!=(e=n.input)?e:"rawInput"in n?n.rawInput:void 0:n.input,providerExecuted:n.providerExecuted,...null!=n.callProviderMetadata?{providerOptions:n.callProviderMetadata}:{}}),null!=n.approval&&s.push({type:"tool-approval-request",approvalId:n.approval.id,toolCallId:n.toolCallId}),!0!==n.providerExecuted||"output-available"!==n.state&&"output-error"!==n.state||s.push({type:"tool-result",toolCallId:n.toolCallId,toolName:r,output:Rt({output:"output-error"===n.state?n.errorText:n.output,tool:null==(a=null==t?void 0:t.tools)?void 0:a[r],errorMode:"output-error"===n.state?"json":"none"}),...null!=n.callProviderMetadata?{providerOptions:n.callProviderMetadata}:{}}))}else{if(!jn(n))throw new Error(`Unsupported part: ${n}`);{const e=null==(o=null==t?void 0:t.convertDataPart)?void 0:o.call(t,n);null!=e&&s.push(e)}}n.push({role:"assistant",content:s});const i=r.filter((e=>Ln(e)&&!0!==e.providerExecuted));i.length>0&&n.push({role:"tool",content:i.flatMap((e=>{var n,a,r;const o=[];switch(null!=(null==(n=e.approval)?void 0:n.approved)&&o.push({type:"tool-approval-response",approvalId:e.approval.id,approved:e.approval.approved,reason:e.approval.reason}),e.state){case"output-denied":o.push({type:"tool-result",toolCallId:e.toolCallId,toolName:zn(e),output:{type:"error-text",value:null!=(a=e.approval.reason)?a:"Tool execution denied."},...null!=e.callProviderMetadata?{providerOptions:e.callProviderMetadata}:{}});break;case"output-error":case"output-available":{const n=zn(e);o.push({type:"tool-result",toolCallId:e.toolCallId,toolName:n,output:Rt({output:"output-error"===e.state?e.errorText:e.output,tool:null==(r=null==t?void 0:t.tools)?void 0:r[n],errorMode:"output-error"===e.state?"text":"none"}),...null!=e.callProviderMetadata?{providerOptions:e.callProviderMetadata}:{}});break}}return o}))}),r=[]},r=[];for(const t of a.parts)Cn(t)||Mn(t)||Rn(t)||Ln(t)||jn(t)?r.push(t):"step-start"===t.type&&e();e();break}break;default:{const e=a.role;throw new ct({originalMessage:a,message:`Unsupported role: ${e}`})}}return n}(0,v.ID)((()=>(0,v.jN)(_.YO(_.Ik({id:_.Yj(),role:_.k5(["system","user","assistant"]),metadata:_.L5().optional(),parts:_.YO(_.KC([_.Ik({type:_.eu("text"),text:_.Yj(),state:_.k5(["streaming","done"]).optional(),providerMetadata:Yt.optional()}),_.Ik({type:_.eu("reasoning"),text:_.Yj(),state:_.k5(["streaming","done"]).optional(),providerMetadata:Yt.optional()}),_.Ik({type:_.eu("source-url"),sourceId:_.Yj(),url:_.Yj(),title:_.Yj().optional(),providerMetadata:Yt.optional()}),_.Ik({type:_.eu("source-document"),sourceId:_.Yj(),mediaType:_.Yj(),title:_.Yj(),filename:_.Yj().optional(),providerMetadata:Yt.optional()}),_.Ik({type:_.eu("file"),mediaType:_.Yj(),filename:_.Yj().optional(),url:_.Yj(),providerMetadata:Yt.optional()}),_.Ik({type:_.eu("step-start")}),_.Ik({type:_.Yj().startsWith("data-"),id:_.Yj().optional(),data:_.L5()}),_.Ik({type:_.eu("dynamic-tool"),toolName:_.Yj(),toolCallId:_.Yj(),state:_.eu("input-streaming"),input:_.L5().optional(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),approval:_.Zm().optional()}),_.Ik({type:_.eu("dynamic-tool"),toolName:_.Yj(),toolCallId:_.Yj(),state:_.eu("input-available"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Zm().optional()}),_.Ik({type:_.eu("dynamic-tool"),toolName:_.Yj(),toolCallId:_.Yj(),state:_.eu("approval-requested"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.Zm().optional(),reason:_.Zm().optional()})}),_.Ik({type:_.eu("dynamic-tool"),toolName:_.Yj(),toolCallId:_.Yj(),state:_.eu("approval-responded"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.zM(),reason:_.Yj().optional()})}),_.Ik({type:_.eu("dynamic-tool"),toolName:_.Yj(),toolCallId:_.Yj(),state:_.eu("output-available"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.L5(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),preliminary:_.zM().optional(),approval:_.Ik({id:_.Yj(),approved:_.eu(!0),reason:_.Yj().optional()}).optional()}),_.Ik({type:_.eu("dynamic-tool"),toolName:_.Yj(),toolCallId:_.Yj(),state:_.eu("output-error"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Yj(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.eu(!0),reason:_.Yj().optional()}).optional()}),_.Ik({type:_.eu("dynamic-tool"),toolName:_.Yj(),toolCallId:_.Yj(),state:_.eu("output-denied"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.eu(!1),reason:_.Yj().optional()})}),_.Ik({type:_.Yj().startsWith("tool-"),toolCallId:_.Yj(),state:_.eu("input-streaming"),providerExecuted:_.zM().optional(),input:_.L5().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),approval:_.Zm().optional()}),_.Ik({type:_.Yj().startsWith("tool-"),toolCallId:_.Yj(),state:_.eu("input-available"),providerExecuted:_.zM().optional(),input:_.L5(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Zm().optional()}),_.Ik({type:_.Yj().startsWith("tool-"),toolCallId:_.Yj(),state:_.eu("approval-requested"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.Zm().optional(),reason:_.Zm().optional()})}),_.Ik({type:_.Yj().startsWith("tool-"),toolCallId:_.Yj(),state:_.eu("approval-responded"),input:_.L5(),providerExecuted:_.zM().optional(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.zM(),reason:_.Yj().optional()})}),_.Ik({type:_.Yj().startsWith("tool-"),toolCallId:_.Yj(),state:_.eu("output-available"),providerExecuted:_.zM().optional(),input:_.L5(),output:_.L5(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),preliminary:_.zM().optional(),approval:_.Ik({id:_.Yj(),approved:_.eu(!0),reason:_.Yj().optional()}).optional()}),_.Ik({type:_.Yj().startsWith("tool-"),toolCallId:_.Yj(),state:_.eu("output-error"),providerExecuted:_.zM().optional(),input:_.L5(),output:_.Zm().optional(),errorText:_.Yj(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.eu(!0),reason:_.Yj().optional()}).optional()}),_.Ik({type:_.Yj().startsWith("tool-"),toolCallId:_.Yj(),state:_.eu("output-denied"),providerExecuted:_.zM().optional(),input:_.L5(),output:_.Zm().optional(),errorText:_.Zm().optional(),callProviderMetadata:Yt.optional(),approval:_.Ik({id:_.Yj(),approved:_.eu(!1),reason:_.Yj().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")))),(0,v.hK)({prefix:"aiobj",size:24});var Jn=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,n)=>{this.queue.push((async()=>{try{await e(),t()}catch(e){n(e)}})),this.processQueue()}))}};(0,v.hK)({prefix:"aiobj",size:24});var Xn=Symbol.for("vercel.ai.error.AI_NoSuchProviderError");y.eM,y.bD;var Qn=class{constructor({api:e="/api/chat",credentials:t,headers:n,body:a,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:s}){this.api=e,this.credentials=t,this.headers=n,this.body=a,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=s}async sendMessages({abortSignal:e,...t}){var n,a,r,o,s;const i=await(0,v.hd)(this.body),l=await(0,v.hd)(this.headers),u=await(0,v.hd)(this.credentials),c={...(0,v.qx)(l),...(0,v.qx)(t.headers)},p=await(null==(n=this.prepareSendMessagesRequest)?void 0:n.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...i,...t.body},headers:c,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),d=null!=(a=null==p?void 0:p.api)?a:this.api,m=void 0!==(null==p?void 0:p.headers)?(0,v.qx)(p.headers):c,h=void 0!==(null==p?void 0:p.body)?p.body:{...i,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},f=null!=(r=null==p?void 0:p.credentials)?r:u,g=null!=(o=this.fetch)?o:globalThis.fetch,y=await g(d,{method:"POST",headers:(0,v.WZ)({"Content-Type":"application/json",...m},`ai-sdk/${Et}`,(0,v.G1)()),body:JSON.stringify(h),credentials:f,signal:e});if(!y.ok)throw new Error(null!=(s=await y.text())?s:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,n,a,r,o;const s=await(0,v.hd)(this.body),i=await(0,v.hd)(this.headers),l=await(0,v.hd)(this.credentials),u={...(0,v.qx)(i),...(0,v.qx)(e.headers)},c=await(null==(t=this.prepareReconnectToStreamRequest)?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...s,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),p=null!=(n=null==c?void 0:c.api)?n:`${this.api}/${e.chatId}/stream`,d=void 0!==(null==c?void 0:c.headers)?(0,v.qx)(c.headers):u,m=null!=(a=null==c?void 0:c.credentials)?a:l,h=null!=(r=this.fetch)?r:globalThis.fetch,f=await h(p,{method:"GET",headers:(0,v.WZ)(d,`ai-sdk/${Et}`,(0,v.G1)()),credentials:m});if(204===f.status)return null;if(!f.ok)throw new Error(null!=(o=await f.text())?o:"Failed to fetch the chat response.");if(!f.body)throw new Error("The response body is empty.");return this.processResponseStream(f.body)}},ea=class extends Qn{constructor(e={}){super(e)}processResponseStream(e){return(0,v._Z)({stream:e,schema:Nn}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},ta=class{constructor({generateId:e=v.$C,id:t=e(),transport:n=new ea,messageMetadataSchema:a,dataPartSchemas:r,state:o,onError:s,onToolCall:i,onFinish:l,onData:u,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new Jn,this.sendMessage=async(e,t)=>{var n,a,r,o;if(null==e)return void await this.makeRequest({trigger:"submit-message",messageId:null==(n=this.lastMessage)?void 0:n.id,...t});let s;if("text"in e||"files"in e){const t=Array.isArray(e.files)?e.files:await async function(e){if(null==e)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 e=>{const{name:t,type:n}=e;return{type:"file",mediaType:n,filename:t,url:await new Promise(((t,n)=>{const a=new FileReader;a.onload=e=>{var n;t(null==(n=e.target)?void 0:n.result)},a.onerror=e=>n(e),a.readAsDataURL(e)}))}})))}(e.files);s={parts:[...t,..."text"in e&&null!=e.text?[{type:"text",text:e.text}]:[]]}}else s=e;if(null!=e.messageId){const t=this.state.messages.findIndex((t=>t.id===e.messageId));if(-1===t)throw new Error(`message with id ${e.messageId} not found`);if("user"!==this.state.messages[t].role)throw new Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...s,id:e.messageId,role:null!=(a=s.role)?a:"user",metadata:e.metadata})}else this.state.pushMessage({...s,id:null!=(r=s.id)?r:this.generateId(),role:null!=(o=s.role)?o:"user",metadata:e.metadata});await this.makeRequest({trigger:"submit-message",messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{const n=null==e?this.state.messages.length-1:this.state.messages.findIndex((t=>t.id===e));if(-1===n)throw new Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[n].role?n:n+1),await this.makeRequest({trigger:"regenerate-message",messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:"resume-stream",...e})},this.clearError=()=>{"error"===this.status&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n})=>this.jobExecutor.run((async()=>{var a,r;const o=this.state.messages,s=o[o.length-1],i=a=>Ln(a)&&"approval-requested"===a.state&&a.approval.id===e?{...a,state:"approval-responded",approval:{id:e,approved:t,reason:n}}:a;this.state.replaceMessage(o.length-1,{...s,parts:s.parts.map(i)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(i)),"streaming"!==this.status&&"submitted"!==this.status&&(null==(a=this.sendAutomaticallyWhen)?void 0:a.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:null==(r=this.lastMessage)?void 0:r.id})})),this.addToolOutput=async({state:e="output-available",tool:t,toolCallId:n,output:a,errorText:r})=>this.jobExecutor.run((async()=>{var t,o;const s=this.state.messages,i=s[s.length-1],l=t=>Ln(t)&&t.toolCallId===n?{...t,state:e,output:a,errorText:r}:t;this.state.replaceMessage(s.length-1,{...i,parts:i.parts.map(l)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(l)),"streaming"!==this.status&&"submitted"!==this.status&&(null==(t=this.sendAutomaticallyWhen)?void 0:t.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:null==(o=this.lastMessage)?void 0:o.id})})),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;"streaming"!==this.status&&"submitted"!==this.status||(null==(e=this.activeResponse)?void 0:e.abortController)&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=a,this.dataPartSchemas=r,this.state=o,this.onError=s,this.onToolCall=i,this.onFinish=l,this.onData=u,this.sendAutomaticallyWhen=c}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:n,body:a,messageId:r}){var o,s,i,l;this.setStatus({status:"submitted",error:void 0});const u=this.lastMessage;let c=!1,p=!1,d=!1;try{const o={state:Fn({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};let s;if(o.abortController.signal.addEventListener("abort",(()=>{c=!0})),this.activeResponse=o,"resume-stream"===e){const e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:a});if(null==e)return void this.setStatus({status:"ready"});s=e}else s=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:n,body:a,trigger:e,messageId:r});const i=e=>this.jobExecutor.run((()=>e({state:o.state,write:()=>{var e;this.setStatus({status:"streaming"}),o.state.message.id===(null==(e=this.lastMessage)?void 0:e.id)?this.state.replaceMessage(this.state.messages.length-1,o.state.message):this.state.pushMessage(o.state.message)}})));await Un({stream:qn({stream:s,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:i,onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:"ready"})}catch(e){if(c||"AbortError"===e.name)return c=!0,this.setStatus({status:"ready"}),null;d=!0,e instanceof TypeError&&(e.message.toLowerCase().includes("fetch")||e.message.toLowerCase().includes("network"))&&(p=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e})}finally{try{null==(s=this.onFinish)||s.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:p,isError:d,finishReason:null==(o=this.activeResponse)?void 0:o.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}(null==(i=this.sendAutomaticallyWhen)?void 0:i.call(this,{messages:this.state.messages}))&&!d&&await this.makeRequest({trigger:"submit-message",messageId:null==(l=this.lastMessage)?void 0:l.id,metadata:t,headers:n,body:a})}}},93766:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BSON_TYPE_ALIASES=void 0,t.BSON_TYPE_ALIASES=[{name:"double",value:"double",label:"double",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"string",value:"string",label:"string",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"object",value:"object",label:"object",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"array",value:"array",label:"array",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"binData",value:"binData",label:"binData",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"objectId",value:"objectId",label:"objectId",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"bool",value:"bool",label:"bool",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"date",value:"date",label:"date",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"null",value:"null",label:"null",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"double",value:"double",label:"double",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"regex",value:"regex",label:"regex",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"javascript",value:"javascript",label:"javascript",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"javascriptWithScope",value:"javascriptWithScope",label:"javascriptWithScope",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"int",value:"int",label:"int",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"timestamp",value:"timestamp",label:"timestamp",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"long",value:"long",label:"long",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"decimal",value:"decimal",label:"decimal",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"minKey",value:"minKey",label:"minKey",score:1,meta:"bson-type-aliases",version:"3.6.0"},{name:"maxKey",value:"maxKey",label:"maxKey",score:1,meta:"bson-type-aliases",version:"3.6.0"}]},94893:(e,t,n)=>{n.d(t,{rS:()=>Xe,EB:()=>je,bz:()=>it,YO:()=>mt,zM:()=>at,Ie:()=>Zt,gM:()=>bt,k5:()=>$t,Nl:()=>Ut,RZ:()=>Ft,eu:()=>St,Zm:()=>pt,ch:()=>ot,ai:()=>Qe,Ik:()=>ft,g1:()=>wt,re:()=>gt,Yj:()=>Oe,KC:()=>yt,L5:()=>ut});var a=n(49189),r=n(71295);class o{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),a=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of a)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}var s=n(84527),i=n(7263),l=n(72510);const u={major:4,minor:0,patch:0};var c=n(9606).URL;const p=a.xI("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=u;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let r,o=l.QH(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,i=s._zod.check(e);if(i instanceof Promise&&!1===n?.async)throw new a.GT;if(r||i instanceof Promise)r=(r??Promise.resolve()).then((async()=>{await i,e.issues.length!==t&&(o||(o=l.QH(e,t)))}));else{if(e.issues.length===t)continue;o||(o=l.QH(e,t))}}return r?r.then((()=>e)):e};e._zod.run=(n,o)=>{const s=e._zod.parse(n,o);if(s instanceof Promise){if(!1===o.async)throw new a.GT;return s.then((e=>t(e,r,o)))}return t(s,r,o)}}e["~standard"]={validate:t=>{try{const n=(0,s.xL)(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return(0,s.bp)(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),d=a.xI("$ZodString",((e,t)=>{p.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??i.Yj(e._zod.bag),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=String(n.value)}catch(a){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),m=a.xI("$ZodStringFormat",((e,t)=>{r.ql.init(e,t),d.init(e,t)})),h=a.xI("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=i.Os),m.init(e,t)})),f=a.xI("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=i.uR(e))}else t.pattern??(t.pattern=i.uR());m.init(e,t)})),g=a.xI("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=i.Rp),m.init(e,t)})),v=a.xI("$ZodURL",((e,t)=>{m.init(e,t),e._zod.check=n=>{try{const a=n.value,r=new c(a),o=r.href;return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.OI.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(!a.endsWith("/")&&o.endsWith("/")?n.value=o.slice(0,-1):n.value=o)}catch(a){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),y=a.xI("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=i.Zg()),m.init(e,t)})),_=a.xI("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=i.Ak),m.init(e,t)})),b=a.xI("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=i.gF),m.init(e,t)})),x=a.xI("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=i.Gl),m.init(e,t)})),I=a.xI("$ZodULID",((e,t)=>{t.pattern??(t.pattern=i.Z0),m.init(e,t)})),w=a.xI("$ZodXID",((e,t)=>{t.pattern??(t.pattern=i.kM),m.init(e,t)})),k=a.xI("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=i.fO),m.init(e,t)})),$=a.xI("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=i.w$(t)),m.init(e,t)})),E=a.xI("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=i.p6),m.init(e,t)})),S=a.xI("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=i.kB(t)),m.init(e,t)})),T=a.xI("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=i.p0),m.init(e,t)})),A=a.xI("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=i.uX),m.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),N=a.xI("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=i.ug),m.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=n=>{try{new c(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),O=a.xI("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=i.zr),m.init(e,t)})),j=a.xI("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=i.l7),m.init(e,t),e._zod.check=n=>{const[a,r]=n.value.split("/");try{if(!r)throw new Error;const e=Number(r);if(`${e}`!==r)throw new Error;if(e<0||e>128)throw new Error;new c(`http://[${a}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function C(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const R=a.xI("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=i.K3),m.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=n=>{C(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}})),M=a.xI("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=i.r0),m.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=n=>{(function(e){if(!i.r0.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return C(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),P=a.xI("$ZodE164",((e,t)=>{t.pattern??(t.pattern=i.hQ),m.init(e,t)})),Y=a.xI("$ZodJWT",((e,t)=>{m.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[a]=n;if(!a)return!1;const r=JSON.parse(atob(a));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),L=a.xI("$ZodNumber",((e,t)=>{p.init(e,t),e._zod.pattern=e._zod.bag.pattern??i.ai,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const o="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}})),D=a.xI("$ZodNumber",((e,t)=>{r.KH.init(e,t),L.init(e,t)})),z=a.xI("$ZodBoolean",((e,t)=>{p.init(e,t),e._zod.pattern=i.zM,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}})),F=a.xI("$ZodNull",((e,t)=>{p.init(e,t),e._zod.pattern=i.ch,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{const a=t.value;return null===a||t.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),t}})),q=a.xI("$ZodAny",((e,t)=>{p.init(e,t),e._zod.parse=e=>e})),Z=a.xI("$ZodUnknown",((e,t)=>{p.init(e,t),e._zod.parse=e=>e})),U=a.xI("$ZodNever",((e,t)=>{p.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}));function V(e,t,n){e.issues.length&&t.issues.push(...l.lQ(n,e.issues)),t.value[n]=e.value}const B=a.xI("$ZodArray",((e,t)=>{p.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const o=[];for(let e=0;e<r.length;e++){const s=r[e],i=t.element._zod.run({value:s,issues:[]},a);i instanceof Promise?o.push(i.then((t=>V(t,n,e)))):V(i,n,e)}return o.length?Promise.all(o).then((()=>n)):n}}));function W(e,t,n){e.issues.length&&t.issues.push(...l.lQ(n,e.issues)),t.value[n]=e.value}function G(e,t,n,a){e.issues.length?void 0===a[n]?t.value[n]=n in a?void 0:e.value:t.issues.push(...l.lQ(n,e.issues)):void 0===e.value?n in a&&(t.value[n]=void 0):t.value[n]=e.value}const K=a.xI("$ZodObject",((e,t)=>{p.init(e,t);const n=l.PO((()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof p))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=l.NM(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}));let r;l.gJ(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const a=e[t]._zod;if(a.values){n[t]??(n[t]=new Set);for(const e of a.values)n[t].add(e)}}return n}));const s=l.Gv,i=!a.cr.jitless,u=l.hI,c=i&&u.value,d=t.catchall;let m;e._zod.parse=(a,u)=>{m??(m=n.value);const p=a.value;if(!s(p))return a.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),a;const h=[];if(i&&c&&!1===u?.async&&!0!==u.jitless)r||(r=(e=>{const t=new o(["shape","payload","ctx"]),a=n.value,r=e=>{const t=l.UQ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let i=0;for(const e of a.keys)s[e]="key_"+i++;t.write("const newResult = {}");for(const e of a.keys)if(a.optionalKeys.has(e)){const n=s[e];t.write(`const ${n} = ${r(e)};`);const a=l.UQ(e);t.write(`\n if (${n}.issues.length) {\n if (input[${a}] === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${a} in input) newResult[${a}] = undefined;\n } else {\n newResult[${a}] = ${n}.value;\n }\n `)}else{const n=s[e];t.write(`const ${n} = ${r(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${l.UQ(e)}, ...iss.path] : [${l.UQ(e)}]\n })));`),t.write(`newResult[${l.UQ(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const u=t.compile();return(t,n)=>u(e,t,n)})(t.shape)),a=r(a,u);else{a.value={};const e=m.shape;for(const t of m.keys){const n=e[t],r=n._zod.run({value:p[t],issues:[]},u),o="optional"===n._zod.optin&&"optional"===n._zod.optout;r instanceof Promise?h.push(r.then((e=>o?G(e,a,t,p):W(e,a,t)))):o?G(r,a,t,p):W(r,a,t)}}if(!d)return h.length?Promise.all(h).then((()=>a)):a;const f=[],g=m.keySet,v=d._zod,y=v.def.type;for(const e of Object.keys(p)){if(g.has(e))continue;if("never"===y){f.push(e);continue}const t=v.run({value:p[e],issues:[]},u);t instanceof Promise?h.push(t.then((t=>W(t,a,e)))):W(t,a,e)}return f.length&&a.issues.push({code:"unrecognized_keys",keys:f,input:p,inst:e}),h.length?Promise.all(h).then((()=>a)):a}}));function H(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>l.iR(e,r,a.$W())))))}),t}const J=a.xI("$ZodUnion",((e,t)=>{p.init(e,t),l.gJ(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),l.gJ(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),l.gJ(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),l.gJ(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>l.p6(e.source))).join("|")})$`)}})),e._zod.parse=(n,a)=>{let r=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},a);if(t instanceof Promise)o.push(t),r=!0;else{if(0===t.issues.length)return t;o.push(t)}}return r?Promise.all(o).then((t=>H(t,n,e,a))):H(o,n,e,a)}})),X=a.xI("$ZodDiscriminatedUnion",((e,t)=>{J.init(e,t);const n=e._zod.parse;l.gJ(e._zod,"propValues",(()=>{const e={};for(const n of t.options){const a=n._zod.propValues;if(!a||0===Object.keys(a).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(a)){e[t]||(e[t]=new Set);for(const a of n)e[t].add(a)}}return e}));const a=l.PO((()=>{const e=t.options,n=new Map;for(const a of e){const e=a._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,a)}}return n}));e._zod.parse=(r,o)=>{const s=r.value;if(!l.Gv(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;const i=a.value.get(s?.[t.discriminator]);return i?i._zod.run(r,o):t.unionFallback?n(r,o):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),r)}})),Q=a.xI("$ZodIntersection",((e,t)=>{p.init(e,t),e._zod.parse=(e,n)=>{const a=e.value,r=t.left._zod.run({value:a,issues:[]},n),o=t.right._zod.run({value:a,issues:[]},n);return r instanceof Promise||o instanceof Promise?Promise.all([r,o]).then((([t,n])=>te(e,t,n))):te(e,r,o)}}));function ee(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(l.Qd(e)&&l.Qd(t)){const n=Object.keys(t),a=Object.keys(e).filter((e=>-1!==n.indexOf(e))),r={...e,...t};for(const n of a){const a=ee(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r[n]=a.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const r=ee(e[a],t[a]);if(!r.valid)return{valid:!1,mergeErrorPath:[a,...r.mergeErrorPath]};n.push(r.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function te(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),l.QH(e))return e;const a=ee(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const ne=a.xI("$ZodRecord",((e,t)=>{p.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!l.Qd(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[];if(t.keyType._zod.values){const a=t.keyType._zod.values;n.value={};for(const e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const a=t.valueType._zod.run({value:o[e],issues:[]},r);a instanceof Promise?s.push(a.then((t=>{t.issues.length&&n.issues.push(...l.lQ(e,t.issues)),n.value[e]=t.value}))):(a.issues.length&&n.issues.push(...l.lQ(e,a.issues)),n.value[e]=a.value)}let i;for(const e in o)a.has(e)||(i=i??[],i.push(e));i&&i.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:i})}else{n.value={};for(const i of Reflect.ownKeys(o)){if("__proto__"===i)continue;const u=t.keyType._zod.run({value:i,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map((e=>l.iR(e,r,a.$W()))),input:i,path:[i],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:o[i],issues:[]},r);c instanceof Promise?s.push(c.then((e=>{e.issues.length&&n.issues.push(...l.lQ(i,e.issues)),n.value[u.value]=e.value}))):(c.issues.length&&n.issues.push(...l.lQ(i,c.issues)),n.value[u.value]=c.value)}}return s.length?Promise.all(s).then((()=>n)):n}})),ae=a.xI("$ZodEnum",((e,t)=>{p.init(e,t);const n=l.w5(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter((e=>l.qQ.has(typeof e))).map((e=>"string"==typeof e?l.$f(e):e.toString())).join("|")})$`),e._zod.parse=(t,a)=>{const r=t.value;return e._zod.values.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}})),re=a.xI("$ZodLiteral",((e,t)=>{p.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?l.$f(e):e?e.toString():String(e))).join("|")})$`),e._zod.parse=(n,a)=>{const r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}})),oe=a.xI("$ZodTransform",((e,t)=>{p.init(e,t),e._zod.parse=(e,n)=>{const r=t.transform(e.value,e);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then((t=>(e.value=t,e)));if(r instanceof Promise)throw new a.GT;return e.value=r,e}})),se=a.xI("$ZodOptional",((e,t)=>{p.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l.gJ(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),l.gJ(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${l.p6(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>"optional"===t.innerType._zod.optin?t.innerType._zod.run(e,n):void 0===e.value?e:t.innerType._zod.run(e,n)})),ie=a.xI("$ZodNullable",((e,t)=>{p.init(e,t),l.gJ(e._zod,"optin",(()=>t.innerType._zod.optin)),l.gJ(e._zod,"optout",(()=>t.innerType._zod.optout)),l.gJ(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${l.p6(e.source)}|null)$`):void 0})),l.gJ(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),le=a.xI("$ZodDefault",((e,t)=>{p.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const a=t.innerType._zod.run(e,n);return a instanceof Promise?a.then((e=>ue(e,t))):ue(a,t)}}));function ue(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const ce=a.xI("$ZodPrefault",((e,t)=>{p.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),pe=a.xI("$ZodNonOptional",((e,t)=>{p.init(e,t),l.gJ(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,a)=>{const r=t.innerType._zod.run(n,a);return r instanceof Promise?r.then((t=>de(t,e))):de(r,e)}}));function de(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const me=a.xI("$ZodCatch",((e,t)=>{p.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"optout",(()=>t.innerType._zod.optout)),l.gJ(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>l.iR(e,n,a.$W())))},input:e.value}),e.issues=[]),e))):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>l.iR(e,n,a.$W())))},input:e.value}),e.issues=[]),e)}})),he=a.xI("$ZodPipe",((e,t)=>{p.init(e,t),l.gJ(e._zod,"values",(()=>t.in._zod.values)),l.gJ(e._zod,"optin",(()=>t.in._zod.optin)),l.gJ(e._zod,"optout",(()=>t.out._zod.optout)),e._zod.parse=(e,n)=>{const a=t.in._zod.run(e,n);return a instanceof Promise?a.then((e=>fe(e,t,n))):fe(a,t,n)}}));function fe(e,t,n){return l.QH(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const ge=a.xI("$ZodReadonly",((e,t)=>{p.init(e,t),l.gJ(e._zod,"propValues",(()=>t.innerType._zod.propValues)),l.gJ(e._zod,"values",(()=>t.innerType._zod.values)),l.gJ(e._zod,"optin",(()=>t.innerType._zod.optin)),l.gJ(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{const a=t.innerType._zod.run(e,n);return a instanceof Promise?a.then(ve):ve(a)}}));function ve(e){return e.value=Object.freeze(e.value),e}const ye=a.xI("$ZodLazy",((e,t)=>{p.init(e,t),l.gJ(e._zod,"innerType",(()=>t.getter())),l.gJ(e._zod,"pattern",(()=>e._zod.innerType._zod.pattern)),l.gJ(e._zod,"propValues",(()=>e._zod.innerType._zod.propValues)),l.gJ(e._zod,"optin",(()=>e._zod.innerType._zod.optin)),l.gJ(e._zod,"optout",(()=>e._zod.innerType._zod.optout)),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)})),_e=a.xI("$ZodCustom",((e,t)=>{r.QP.init(e,t),p.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const a=n.value,r=t.fn(a);if(r instanceof Promise)return r.then((t=>be(t,n,a,e)));be(r,n,a,e)}}));function be(e,t,n,a){if(!e){const e={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(e.params=a._zod.def.params),t.issues.push(l.sn(e))}}var xe=n(39581),Ie=n(1280);const we=a.xI("ZodISODateTime",((e,t)=>{$.init(e,t),je.init(e,t)})),ke=a.xI("ZodISODate",((e,t)=>{E.init(e,t),je.init(e,t)})),$e=a.xI("ZodISOTime",((e,t)=>{S.init(e,t),je.init(e,t)})),Ee=a.xI("ZodISODuration",((e,t)=>{T.init(e,t),je.init(e,t)}));var Se=n(2420);const Te=a.xI("ZodType",((e,t)=>(p.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>l.o8(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>Se.qg(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Se.xL(e,t,n),e.parseAsync=async(t,n)=>Se.EJ(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Se.bp(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(function(e,t={}){return Ie.fU(qt,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new r.QP({check:"custom"});return t._zod.check=e,t}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(l.sn(e,n.value,t._zod.def));else{const a=e;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),a.continue??(a.continue=!t._zod.def.abort),n.issues.push(l.sn(a))}},e(n.value,n))));return t}(t)),e.overwrite=t=>e.check(Ie.bS(t)),e.optional=()=>Nt(e),e.nullable=()=>jt(e),e.nullish=()=>Nt(jt(e)),e.nonoptional=t=>function(e,t){return new Mt({type:"nonoptional",innerType:e,...l.A2(t)})}(e,t),e.array=()=>mt(e),e.or=t=>yt([e,t]),e.and=t=>new xt({type:"intersection",left:e,right:t}),e.transform=t=>Lt(e,new Tt({type:"transform",transform:t})),e.default=t=>{return n=t,new Ct({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.prefault=t=>{return n=t,new Rt({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.catch=t=>{return new Pt({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>Lt(e,t),e.readonly=()=>new Dt({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return xe.fd.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>xe.fd.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return xe.fd.get(e);const n=e.clone();return xe.fd.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),Ae=a.xI("_ZodString",((e,t)=>{d.init(e,t),Te.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ie.Fk(...t)),e.includes=(...t)=>e.check(Ie.dR(...t)),e.startsWith=(...t)=>e.check(Ie.$S(...t)),e.endsWith=(...t)=>e.check(Ie.ER(...t)),e.min=(...t)=>e.check(Ie.m9(...t)),e.max=(...t)=>e.check(Ie.Eb(...t)),e.length=(...t)=>e.check(Ie.YA(...t)),e.nonempty=(...t)=>e.check(Ie.m9(1,...t)),e.lowercase=t=>e.check(Ie.hH(t)),e.uppercase=t=>e.check(Ie.qF(t)),e.trim=()=>e.check(Ie.WN()),e.normalize=(...t)=>e.check(Ie.lo(...t)),e.toLowerCase=()=>e.check(Ie.Il()),e.toUpperCase=()=>e.check(Ie.xY())})),Ne=a.xI("ZodString",((e,t)=>{d.init(e,t),Ae.init(e,t),e.email=t=>e.check(Ie.Mu(Ce,t)),e.url=t=>e.check(Ie.Fn(Pe,t)),e.jwt=t=>e.check(Ie.rk(Je,t)),e.emoji=t=>e.check(Ie.aC(Ye,t)),e.guid=t=>e.check(Ie.tB(Re,t)),e.uuid=t=>e.check(Ie.Be(Me,t)),e.uuidv4=t=>e.check(Ie.nA(Me,t)),e.uuidv6=t=>e.check(Ie.pY(Me,t)),e.uuidv7=t=>e.check(Ie.wA(Me,t)),e.nanoid=t=>e.check(Ie.Dl(Le,t)),e.guid=t=>e.check(Ie.tB(Re,t)),e.cuid=t=>e.check(Ie.fs(De,t)),e.cuid2=t=>e.check(Ie.Bj(ze,t)),e.ulid=t=>e.check(Ie.Ct(Fe,t)),e.base64=t=>e.check(Ie.rt(Ge,t)),e.base64url=t=>e.check(Ie.cU(Ke,t)),e.xid=t=>e.check(Ie.Pw(qe,t)),e.ksuid=t=>e.check(Ie._z(Ze,t)),e.ipv4=t=>e.check(Ie.Ny(Ue,t)),e.ipv6=t=>e.check(Ie.$O(Ve,t)),e.cidrv4=t=>e.check(Ie.Uy(Be,t)),e.cidrv6=t=>e.check(Ie.gP(We,t)),e.e164=t=>e.check(Ie.KB(He,t)),e.datetime=t=>e.check(function(e){return Ie.G1(we,e)}(t)),e.date=t=>e.check(function(e){return Ie.db(ke,e)}(t)),e.time=t=>e.check(function(e){return Ie.Kn($e,e)}(t)),e.duration=t=>e.check(function(e){return Ie.f2(Ee,e)}(t))}));function Oe(e){return Ie.Rl(Ne,e)}const je=a.xI("ZodStringFormat",((e,t)=>{m.init(e,t),Ae.init(e,t)})),Ce=a.xI("ZodEmail",((e,t)=>{g.init(e,t),je.init(e,t)})),Re=a.xI("ZodGUID",((e,t)=>{h.init(e,t),je.init(e,t)})),Me=a.xI("ZodUUID",((e,t)=>{f.init(e,t),je.init(e,t)})),Pe=a.xI("ZodURL",((e,t)=>{v.init(e,t),je.init(e,t)})),Ye=a.xI("ZodEmoji",((e,t)=>{y.init(e,t),je.init(e,t)})),Le=a.xI("ZodNanoID",((e,t)=>{_.init(e,t),je.init(e,t)})),De=a.xI("ZodCUID",((e,t)=>{b.init(e,t),je.init(e,t)})),ze=a.xI("ZodCUID2",((e,t)=>{x.init(e,t),je.init(e,t)})),Fe=a.xI("ZodULID",((e,t)=>{I.init(e,t),je.init(e,t)})),qe=a.xI("ZodXID",((e,t)=>{w.init(e,t),je.init(e,t)})),Ze=a.xI("ZodKSUID",((e,t)=>{k.init(e,t),je.init(e,t)})),Ue=a.xI("ZodIPv4",((e,t)=>{A.init(e,t),je.init(e,t)})),Ve=a.xI("ZodIPv6",((e,t)=>{N.init(e,t),je.init(e,t)})),Be=a.xI("ZodCIDRv4",((e,t)=>{O.init(e,t),je.init(e,t)})),We=a.xI("ZodCIDRv6",((e,t)=>{j.init(e,t),je.init(e,t)})),Ge=a.xI("ZodBase64",((e,t)=>{R.init(e,t),je.init(e,t)})),Ke=a.xI("ZodBase64URL",((e,t)=>{M.init(e,t),je.init(e,t)})),He=a.xI("ZodE164",((e,t)=>{P.init(e,t),je.init(e,t)})),Je=a.xI("ZodJWT",((e,t)=>{Y.init(e,t),je.init(e,t)})),Xe=a.xI("ZodNumber",((e,t)=>{L.init(e,t),Te.init(e,t),e.gt=(t,n)=>e.check(Ie.Tx(t,n)),e.gte=(t,n)=>e.check(Ie.qm(t,n)),e.min=(t,n)=>e.check(Ie.qm(t,n)),e.lt=(t,n)=>e.check(Ie.Au(t,n)),e.lte=(t,n)=>e.check(Ie.Zm(t,n)),e.max=(t,n)=>e.check(Ie.Zm(t,n)),e.int=t=>e.check(tt(t)),e.safe=t=>e.check(tt(t)),e.positive=t=>e.check(Ie.Tx(0,t)),e.nonnegative=t=>e.check(Ie.qm(0,t)),e.negative=t=>e.check(Ie.Au(0,t)),e.nonpositive=t=>e.check(Ie.Zm(0,t)),e.multipleOf=(t,n)=>e.check(Ie.Hi(t,n)),e.step=(t,n)=>e.check(Ie.Hi(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Qe(e){return Ie.F7(Xe,e)}const et=a.xI("ZodNumberFormat",((e,t)=>{D.init(e,t),Xe.init(e,t)}));function tt(e){return Ie.LK(et,e)}const nt=a.xI("ZodBoolean",((e,t)=>{z.init(e,t),Te.init(e,t)}));function at(e){return Ie._L(nt,e)}const rt=a.xI("ZodNull",((e,t)=>{F.init(e,t),Te.init(e,t)}));function ot(e){return Ie.jw(rt,e)}const st=a.xI("ZodAny",((e,t)=>{q.init(e,t),Te.init(e,t)}));function it(){return Ie.KA(st)}const lt=a.xI("ZodUnknown",((e,t)=>{Z.init(e,t),Te.init(e,t)}));function ut(){return Ie.em(lt)}const ct=a.xI("ZodNever",((e,t)=>{U.init(e,t),Te.init(e,t)}));function pt(e){return Ie.G8(ct,e)}const dt=a.xI("ZodArray",((e,t)=>{B.init(e,t),Te.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Ie.m9(t,n)),e.nonempty=t=>e.check(Ie.m9(1,t)),e.max=(t,n)=>e.check(Ie.Eb(t,n)),e.length=(t,n)=>e.check(Ie.YA(t,n)),e.unwrap=()=>e.element}));function mt(e,t){return Ie.dZ(dt,e,t)}const ht=a.xI("ZodObject",((e,t)=>{K.init(e,t),Te.init(e,t),l.gJ(e,"shape",(()=>t.shape)),e.keyof=()=>$t(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ut()}),e.loose=()=>e.clone({...e._zod.def,catchall:ut()}),e.strict=()=>e.clone({...e._zod.def,catchall:pt()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>l.X$(e,t),e.merge=t=>l.h1(e,t),e.pick=t=>l.Up(e,t),e.omit=t=>l.cJ(e,t),e.partial=(...t)=>l.OH(At,e,t[0]),e.required=(...t)=>l.mw(Mt,e,t[0])}));function ft(e,t){const n={type:"object",get shape(){return l.Vy(this,"shape",{...e}),this.shape},...l.A2(t)};return new ht(n)}function gt(e,t){return new ht({type:"object",get shape(){return l.Vy(this,"shape",{...e}),this.shape},catchall:pt(),...l.A2(t)})}const vt=a.xI("ZodUnion",((e,t)=>{J.init(e,t),Te.init(e,t),e.options=t.options}));function yt(e,t){return new vt({type:"union",options:e,...l.A2(t)})}const _t=a.xI("ZodDiscriminatedUnion",((e,t)=>{vt.init(e,t),X.init(e,t)}));function bt(e,t,n){return new _t({type:"union",options:t,discriminator:e,...l.A2(n)})}const xt=a.xI("ZodIntersection",((e,t)=>{Q.init(e,t),Te.init(e,t)})),It=a.xI("ZodRecord",((e,t)=>{ne.init(e,t),Te.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}));function wt(e,t,n){return new It({type:"record",keyType:e,valueType:t,...l.A2(n)})}const kt=a.xI("ZodEnum",((e,t)=>{ae.init(e,t),Te.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,a)=>{const r={};for(const a of e){if(!n.has(a))throw new Error(`Key ${a} not found in enum`);r[a]=t.entries[a]}return new kt({...t,checks:[],...l.A2(a),entries:r})},e.exclude=(e,a)=>{const r={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new kt({...t,checks:[],...l.A2(a),entries:r})}}));function $t(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new kt({type:"enum",entries:n,...l.A2(t)})}const Et=a.xI("ZodLiteral",((e,t)=>{re.init(e,t),Te.init(e,t),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 St(e,t){return new Et({type:"literal",values:Array.isArray(e)?e:[e],...l.A2(t)})}const Tt=a.xI("ZodTransform",((e,t)=>{oe.init(e,t),Te.init(e,t),e._zod.parse=(n,a)=>{n.addIssue=a=>{if("string"==typeof a)n.issues.push(l.sn(a,n.value,t));else{const t=a;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),n.issues.push(l.sn(t))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then((e=>(n.value=e,n))):(n.value=r,n)}}));const At=a.xI("ZodOptional",((e,t)=>{se.init(e,t),Te.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function Nt(e){return new At({type:"optional",innerType:e})}const Ot=a.xI("ZodNullable",((e,t)=>{ie.init(e,t),Te.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function jt(e){return new Ot({type:"nullable",innerType:e})}const Ct=a.xI("ZodDefault",((e,t)=>{le.init(e,t),Te.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap})),Rt=a.xI("ZodPrefault",((e,t)=>{ce.init(e,t),Te.init(e,t),e.unwrap=()=>e._zod.def.innerType})),Mt=a.xI("ZodNonOptional",((e,t)=>{pe.init(e,t),Te.init(e,t),e.unwrap=()=>e._zod.def.innerType})),Pt=a.xI("ZodCatch",((e,t)=>{me.init(e,t),Te.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap})),Yt=a.xI("ZodPipe",((e,t)=>{he.init(e,t),Te.init(e,t),e.in=t.in,e.out=t.out}));function Lt(e,t){return new Yt({type:"pipe",in:e,out:t})}const Dt=a.xI("ZodReadonly",((e,t)=>{ge.init(e,t),Te.init(e,t)})),zt=a.xI("ZodLazy",((e,t)=>{ye.init(e,t),Te.init(e,t),e.unwrap=()=>e._zod.def.getter()}));function Ft(e){return new zt({type:"lazy",getter:e})}const qt=a.xI("ZodCustom",((e,t)=>{_e.init(e,t),Te.init(e,t)}));function Zt(e,t){return Ie.FO(qt,e??(()=>!0),t)}function Ut(e,t={error:`Input not instance of ${e.name}`}){const n=new qt({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...l.A2(t)});return n._zod.bag.Class=e,n}},95869:(e,t,n)=>{var a=n(65994).e;const r="object"==typeof a&&a.env&&a.env.NODE_DEBUG&&/\bsemver\b/i.test(a.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=r},98727:(e,t,n)=>{var a=n(40811);e.exports=new a("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},98736:(e,t,n)=>{const a=n(25583);e.exports=(e,t)=>a(e,t,!0)},98855:(e,t,n)=>{const a=n(88825);e.exports=(e,t,n=!1)=>{if(e instanceof a)return e;try{return new a(e,t)}catch(e){if(!n)return null;throw e}}},99174:e=>{function t(e){return null==e}e.exports.isNothing=t,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:t(e)?[]:[e]},e.exports.repeat=function(e,t){var n,a="";for(n=0;n<t;n+=1)a+=e;return a},e.exports.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},e.exports.extend=function(e,t){var n,a,r,o;if(t)for(n=0,a=(o=Object.keys(t)).length;n<a;n+=1)e[r=o[n]]=t[r];return e}},99571:(e,t,n)=>{const a=n(20360),r=n(67105),{ANY:o}=r,s=n(72849),i=n(25583),l=[new r(">=0.0.0-0")],u=[new r(">=0.0.0")],c=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===o){if(1===t.length&&t[0].semver===o)return!0;e=n.includePrerelease?l:u}if(1===t.length&&t[0].semver===o){if(n.includePrerelease)return!0;t=u}const a=new Set;let r,c,m,h,f,g,v;for(const t of e)">"===t.operator||">="===t.operator?r=p(r,t,n):"<"===t.operator||"<="===t.operator?c=d(c,t,n):a.add(t.semver);if(a.size>1)return null;if(r&&c){if(m=i(r.semver,c.semver,n),m>0)return null;if(0===m&&(">="!==r.operator||"<="!==c.operator))return null}for(const e of a){if(r&&!s(e,String(r),n))return null;if(c&&!s(e,String(c),n))return null;for(const a of t)if(!s(e,String(a),n))return!1;return!0}let y=!(!c||n.includePrerelease||!c.semver.prerelease.length)&&c.semver,_=!(!r||n.includePrerelease||!r.semver.prerelease.length)&&r.semver;y&&1===y.prerelease.length&&"<"===c.operator&&0===y.prerelease[0]&&(y=!1);for(const e of t){if(v=v||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,r)if(_&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===_.major&&e.semver.minor===_.minor&&e.semver.patch===_.patch&&(_=!1),">"===e.operator||">="===e.operator){if(h=p(r,e,n),h===e&&h!==r)return!1}else if(">="===r.operator&&!s(r.semver,String(e),n))return!1;if(c)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),"<"===e.operator||"<="===e.operator){if(f=d(c,e,n),f===e&&f!==c)return!1}else if("<="===c.operator&&!s(c.semver,String(e),n))return!1;if(!e.operator&&(c||r)&&0!==m)return!1}return!(r&&g&&!c&&0!==m||c&&v&&!r&&0!==m||_||y)},p=(e,t,n)=>{if(!e)return t;const a=i(e.semver,t.semver,n);return a>0?e:a<0||">"===t.operator&&">="===e.operator?t:e},d=(e,t,n)=>{if(!e)return t;const a=i(e.semver,t.semver,n);return a<0?e:a>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n={})=>{if(e===t)return!0;e=new a(e,n),t=new a(t,n);let r=!1;e:for(const a of e.set){for(const e of t.set){const t=c(a,e,n);if(r=r||null!==t,t)continue e}if(r)return!1}return!0}},99629:(e,t,n)=>{n.d(t,{JM:()=>l,Kd:()=>i,Wk:()=>u,a$:()=>s});var a=n(49189),r=n(72510);const o=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,r.k8,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},s=(0,a.xI)("$ZodError",o),i=(0,a.xI)("$ZodError",o,{Parent:Error});function l(e,t=e=>e.message){const n={},a=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):a.push(t(r));return{formErrors:a,fieldErrors:n}}function u(e,t){const n=t||function(e){return e.message},a={_errors:[]},r=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>r({issues:e})));else if("invalid_key"===t.code)r({issues:t.issues});else if("invalid_element"===t.code)r({issues:t.issues});else if(0===t.path.length)a._errors.push(n(t));else{let e=a,r=0;for(;r<t.path.length;){const a=t.path[r];r===t.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(n(t))):e[a]=e[a]||{_errors:[]},e=e[a],r++}}};return r(e),a}}};