@mongodb-js/compass-web 0.34.0 → 0.35.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 (31) hide show
  1. package/dist/128.d74f22fdbc215f781713.mjs +2 -0
  2. package/dist/145.bb3ab3ecc577c03d4719.mjs +1 -0
  3. package/dist/455.00dd3b68f4afab746f19.mjs +1 -0
  4. package/dist/{174.9b919a5407fdc3851924.mjs → 531.763ecadd9feb95d2dac6.mjs} +3 -3
  5. package/dist/583.aa2542a4a9a81cf18049.mjs +378 -0
  6. package/dist/689.fc3ea78ca03540c88c5e.mjs +2 -0
  7. package/dist/755.3d354b04ff596a23fd46.mjs +2 -0
  8. package/dist/755.3d354b04ff596a23fd46.mjs.LICENSE.txt +5 -0
  9. package/dist/{800.dcb5412b380b659e88ac.mjs → 800.6acd53ae9617e3cb63ed.mjs} +2 -2
  10. package/dist/901.2101dc93082369c119a3.mjs +2 -0
  11. package/dist/965.d5a6b7e950f14396c862.mjs +1 -0
  12. package/dist/assets-manifest.json +11 -10
  13. package/dist/compass-web.d.ts +1 -1
  14. package/dist/compass-web.mjs +25 -25
  15. package/dist/{index-bde52cb3.8627a1873c0630586210.mjs → index-bde52cb3.291f8ae4bc856eb51b2e.mjs} +1 -1
  16. package/dist/tsdoc-metadata.json +1 -1
  17. package/package.json +47 -46
  18. package/dist/128.9e3ffe7449cca93fbcb4.mjs +0 -2
  19. package/dist/400.ee421ec0c79f2e659fa8.mjs +0 -378
  20. package/dist/455.e6b707cae57e3018c29e.mjs +0 -1
  21. package/dist/48.9ca2dbc319085729bea6.mjs +0 -1
  22. package/dist/753.c784df67afeae6565839.mjs +0 -2
  23. package/dist/753.c784df67afeae6565839.mjs.LICENSE.txt +0 -16
  24. package/dist/772.2baa874c0109bdb1a2cb.mjs +0 -2
  25. package/dist/915.2a425bc2ab5dfa3e6a60.mjs +0 -2
  26. /package/dist/{128.9e3ffe7449cca93fbcb4.mjs.LICENSE.txt → 128.d74f22fdbc215f781713.mjs.LICENSE.txt} +0 -0
  27. /package/dist/{174.9b919a5407fdc3851924.mjs.LICENSE.txt → 531.763ecadd9feb95d2dac6.mjs.LICENSE.txt} +0 -0
  28. /package/dist/{400.ee421ec0c79f2e659fa8.mjs.LICENSE.txt → 583.aa2542a4a9a81cf18049.mjs.LICENSE.txt} +0 -0
  29. /package/dist/{772.2baa874c0109bdb1a2cb.mjs.LICENSE.txt → 689.fc3ea78ca03540c88c5e.mjs.LICENSE.txt} +0 -0
  30. /package/dist/{800.dcb5412b380b659e88ac.mjs.LICENSE.txt → 800.6acd53ae9617e3cb63ed.mjs.LICENSE.txt} +0 -0
  31. /package/dist/{915.2a425bc2ab5dfa3e6a60.mjs.LICENSE.txt → 901.2101dc93082369c119a3.mjs.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 755.3d354b04ff596a23fd46.mjs.LICENSE.txt */
2
+ export const __webpack_esm_id__=755;export const __webpack_esm_ids__=[755];export const __webpack_esm_modules__={160:(e,t,r)=>{const a=r(98855);e.exports=(e,t)=>{const r=a(e,t);return r&&r.prerelease.length?r.prerelease:null}},1726:(e,t,r)=>{var a=r(40811);e.exports=new a("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},3449:(e,t,r)=>{const a=r(40289);e.exports=(e,t,r)=>a(e,t,r)<0},4113:(e,t,r)=>{const a=r(98855);e.exports=(e,t)=>{const r=a(e,null,!0),s=a(t,null,!0),n=r.compare(s);if(0===n)return null;const o=n>0,i=o?r:s,l=o?s:r,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 r.major!==s.major?c+"major":r.minor!==s.minor?c+"minor":r.patch!==s.patch?c+"patch":"prerelease"}},4292: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}},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,r)=>{const a=r(87866);e.exports=(e,t,r)=>a(e,t,"<",r)},5286:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const a=t.test(e),s=t.test(r);return a&&s&&(e=+e,r=+r),e===r?0:a&&!s?-1:s&&!a?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},5544:(e,t,r)=>{const a=r(26620),s=r(32056),n=r(51269),o=r(54838),i=r(18082),l=r(71851);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return a(e,r,u);case"!=":return s(e,r,u);case">":return n(e,r,u);case">=":return o(e,r,u);case"<":return i(e,r,u);case"<=":return l(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},5992:(e,t,r)=>{const a=r(99385);e.exports=(e,t,r)=>a(e,t,"<",r)},6340:(e,t,r)=>{var a=r(54420);e.exports=new a({include:[r(15037)]})},8573:e=>{const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},8999:(e,t,r)=>{const a=r(48381),s=r(20332);e.exports=(e,t,r)=>{let n=null,o=null,i=null;try{i=new s(t,r)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(n&&-1!==o.compare(e)||(n=e,o=new a(n,r)))})),n}},9357:(e,t,r)=>{const a=r(88825);e.exports=(e,t)=>new a(e,t).minor},9418:(e,t,r)=>{const a=r(40289);e.exports=(e,t,r)=>a(e,t,r)<=0},9480:(e,t,r)=>{const a=r(71333);e.exports=(e,t,r)=>{try{t=new a(t,r)}catch(e){return!1}return t.test(e)}},9982:(e,t,r)=>{const a=r(56206);e.exports=(e,t)=>e.sort(((e,r)=>a(e,r,t)))},10017:(e,t,r)=>{const a=r(34219);e.exports=(e,t)=>{const r=a(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},10560:(e,t,r)=>{var a;try{a=r(20745)}catch(e){"undefined"!=typeof window&&(a=window.esprima)}var s=r(40811);e.exports=new s("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",r=a.parse(t,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&("ArrowFunctionExpression"===r.body[0].expression.type||"FunctionExpression"===r.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,r="("+e+")",s=a.parse(r,{range:!0}),n=[];if("Program"!==s.type||1!==s.body.length||"ExpressionStatement"!==s.body[0].type||"ArrowFunctionExpression"!==s.body[0].expression.type&&"FunctionExpression"!==s.body[0].expression.type)throw new Error("Failed to resolve function");return s.body[0].expression.params.forEach((function(e){n.push(e.name)})),t=s.body[0].expression.body.range,"BlockStatement"===s.body[0].expression.body.type?new Function(n,r.slice(t[0]+1,t[1]-1)):new Function(n,"return "+r.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},10933:(e,t,r)=>{const a=r(48381),s=r(20332);e.exports=(e,t,r)=>{let n=null,o=null,i=null;try{i=new s(t,r)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(n&&1!==o.compare(e)||(n=e,o=new a(n,r)))})),n}},11420:(e,t,r)=>{const a=r(48381);e.exports=(e,t,r,s,n)=>{"string"==typeof r&&(n=s,s=r,r=void 0);try{return new a(e instanceof a?e.version:e,r).inc(t,s,n).version}catch(e){return null}}},11710:(e,t,r)=>{var a=r(99174);function s(e,t,r,a,s){this.name=e,this.buffer=t,this.position=r,this.line=a,this.column=s}s.prototype.getSnippet=function(e,t){var r,s,n,o,i;if(!this.buffer)return null;for(e=e||4,t=t||75,r="",s=this.position;s>0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(s-1));)if(s-=1,this.position-s>t/2-1){r=" ... ",s+=5;break}for(n="",o=this.position;o<this.buffer.length&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>t/2-1){n=" ... ",o-=5;break}return i=this.buffer.slice(s,o),a.repeat(" ",e)+r+i+n+"\n"+a.repeat(" ",e+this.position-s+r.length)+"^"},s.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(r+=":\n"+t),r},e.exports=s},12169:(e,t,r)=>{const a=r(88825);e.exports=(e,t)=>new a(e,t).major},12574:(e,t,r)=>{r.d(t,{Di:()=>L,M3:()=>F,Tt:()=>x,b8:()=>ue,bD:()=>p,eM:()=>ee,hL:()=>f,iM:()=>ne,u1:()=>E,u6:()=>G});var a,s,n,o,i,l,u="vercel.ai.error",c=Symbol.for(u),p=class e extends(s=Error,a=c,s){constructor({name:e,message:t,cause:r}){super(t),this[a]=!0,this.name=e,this.cause=r}static isInstance(t){return e.hasMarker(t,u)}static hasMarker(e,t){const r=Symbol.for(t);return null!=e&&"object"==typeof e&&r in e&&"boolean"==typeof e[r]&&!0===e[r]}},d="AI_APICallError",h=`vercel.ai.error.${d}`,m=Symbol.for(h),f=class extends(o=p,n=m,o){constructor({message:e,url:t,requestBodyValues:r,statusCode:a,responseHeaders:s,responseBody:o,cause:i,isRetryable:l=null!=a&&(408===a||409===a||429===a||a>=500),data:u}){super({name:d,message:e,cause:i}),this[n]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=a,this.responseHeaders=s,this.responseBody=o,this.isRetryable=l,this.data=u}static isInstance(e){return p.hasMarker(e,h)}},g="AI_EmptyResponseBodyError",v=`vercel.ai.error.${g}`,y=Symbol.for(v),x=class extends(l=p,i=y,l){constructor({message:e="Empty response body"}={}){super({name:g,message:e}),this[i]=!0}static isInstance(e){return p.hasMarker(e,v)}};function E(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var b,I,w,k,S,T,A,C,_,R,N,O,M="AI_InvalidArgumentError",P=`vercel.ai.error.${M}`,$=Symbol.for(P),L=class extends(I=p,b=$,I){constructor({message:e,cause:t,argument:r}){super({name:M,message:e,cause:t}),this[b]=!0,this.argument=r}static isInstance(e){return p.hasMarker(e,P)}},j="AI_InvalidPromptError",D=`vercel.ai.error.${j}`,Y=Symbol.for(D),F=class extends(k=p,w=Y,k){constructor({prompt:e,message:t,cause:r}){super({name:j,message:`Invalid prompt: ${t}`,cause:r}),this[w]=!0,this.prompt=e}static isInstance(e){return p.hasMarker(e,D)}},V=Symbol.for("vercel.ai.error.AI_InvalidResponseDataError"),q="AI_JSONParseError",U=`vercel.ai.error.${q}`,B=Symbol.for(U),G=class extends(T=p,S=B,T){constructor({text:e,cause:t}){super({name:q,message:`JSON parsing failed: Text: ${e}.\nError message: ${E(t)}`,cause:t}),this[S]=!0,this.text=e}static isInstance(e){return p.hasMarker(e,U)}},Z=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError"),z=`vercel.ai.error.${"AI_LoadSettingError"}`,H=Symbol.for(z),W=`vercel.ai.error.${"AI_NoContentGeneratedError"}`,K=Symbol.for(W),X="AI_NoSuchModelError",J=`vercel.ai.error.${X}`,Q=Symbol.for(J),ee=class extends(C=p,A=Q,C){constructor({errorName:e=X,modelId:t,modelType:r,message:a=`No such ${r}: ${t}`}){super({name:e,message:a}),this[A]=!0,this.modelId=t,this.modelType=r}static isInstance(e){return p.hasMarker(e,J)}},te=Symbol.for("vercel.ai.error.AI_TooManyEmbeddingValuesForCallError"),re="AI_TypeValidationError",ae=`vercel.ai.error.${re}`,se=Symbol.for(ae),ne=class e extends(R=p,_=se,R){constructor({value:e,cause:t}){super({name:re,message:`Type validation failed: Value: ${JSON.stringify(e)}.\nError message: ${E(t)}`,cause:t}),this[_]=!0,this.value=e}static isInstance(e){return p.hasMarker(e,ae)}static wrap({value:t,cause:r}){return e.isInstance(r)&&r.value===t?r:new e({value:t,cause:r})}},oe="AI_UnsupportedFunctionalityError",ie=`vercel.ai.error.${oe}`,le=Symbol.for(ie),ue=class extends(O=p,N=le,O){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:oe,message:t}),this[N]=!0,this.functionality=e}static isInstance(e){return p.hasMarker(e,ie)}}},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,r)=>{var a=r(40811),s=Object.prototype.toString;e.exports=new a("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,a,n,o,i=e;for(o=new Array(i.length),t=0,r=i.length;t<r;t+=1){if(a=i[t],"[object Object]"!==s.call(a))return!1;if(1!==(n=Object.keys(a)).length)return!1;o[t]=[n[0],a[n[0]]]}return!0},construct:function(e){if(null===e)return[];var t,r,a,s,n,o=e;for(n=new Array(o.length),t=0,r=o.length;t<r;t+=1)a=o[t],s=Object.keys(a),n[t]=[s[0],a[s[0]]];return n}})},13559:(e,t,r)=>{const a=r(48381),s=r(34219),{safeRe:n,t:o}=r(92625);e.exports=(e,t)=>{if(e instanceof a)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const a=t.includePrerelease?n[o.COERCERTLFULL]:n[o.COERCERTL];let s;for(;(s=a.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),a.lastIndex=s.index+s[1].length+s[2].length;a.lastIndex=-1}else r=e.match(t.includePrerelease?n[o.COERCEFULL]:n[o.COERCE]);if(null===r)return null;const i=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",p=t.includePrerelease&&r[6]?`+${r[6]}`:"";return s(`${i}.${l}.${u}${c}${p}`,t)}},14753:(e,t,r)=>{var a=r(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,r=/\/([gim]*)$/.exec(e),a="";if("/"===t[0]){if(r&&(a=r[1]),a.length>3)return!1;if("/"!==t[t.length-a.length-1])return!1}return!0},construct:function(e){var t=e,r=/\/([gim]*)$/.exec(e),a="";return"/"===t[0]&&(r&&(a=r[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}})},15011:(e,t,r)=>{const a=r(20332);e.exports=(e,t)=>{try{return new a(e,t).range||"*"}catch(e){return null}}},15037:(e,t,r)=>{var a=r(54420);e.exports=new a({include:[r(91714)],implicit:[r(89295),r(81602),r(48013),r(44490)]})},15144:(e,t,r)=>{const a=r(83586);e.exports=(e,t)=>{const r=a(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},18082:(e,t,r)=>{const a=r(25583);e.exports=(e,t,r)=>a(e,t,r)<0},18104:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:n}=r(4292),o=r(72082),i=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],p=t.t={};let d=0;const h="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",n],[h,s]],f=(e,t,r)=>{const a=(e=>{for(const[t,r]of m)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),s=d++;o(e,s,t),p[e]=s,u[s]=t,c[s]=a,i[s]=new RegExp(t,r?"g":void 0),l[s]=new RegExp(a,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),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",`${h}+`),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*$")},18184:(e,t,r)=>{var a=r(54420);e.exports=new a({include:[r(6340)],implicit:[r(78316),r(45848)],explicit:[r(52711),r(27195),r(13445),r(51228)]})},18894:(e,t,r)=>{const a=r(43301),s=r(77203);e.exports=(e,t,r)=>{const n=[];let o=null,i=null;const l=e.sort(((e,t)=>s(e,t,r)));for(const e of l)a(e,t,r)?(i=e,o||(o=e)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);const u=[];for(const[e,t]of n)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}},19896:(e,t,r)=>{const a=r(40289);e.exports=(e,t,r)=>a(t,e,r)},20038:(e,t,r)=>{const a=r(77203);e.exports=(e,t,r)=>a(e,t,r)<0},20332:(e,t,r)=>{const a=/\s+/g;class s{constructor(e,t){if(t=o(t),e instanceof s)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new s(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,r=n.get(t);if(r)return r;const a=this.options.loose,s=a?c[p.HYPHENRANGELOOSE]:c[p.HYPHENRANGE];e=e.replace(s,R(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(c[p.COMPARATORTRIM],d),l("comparator trim",e),e=e.replace(c[p.TILDETRIM],h),l("tilde trim",e),e=e.replace(c[p.CARETTRIM],m),l("caret trim",e);let o=e.split(" ").map((e=>E(e,this.options))).join(" ").split(/\s+/).map((e=>_(e,this.options)));a&&(o=o.filter((e=>(l("loose invalid filter",e,this.options),!!e.match(c[p.COMPARATORLOOSE]))))),l("range list",o);const u=new Map,y=o.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 x=[...u.values()];return n.set(t,x),x}intersects(e,t){if(!(e instanceof s))throw new TypeError("a Range is required");return this.set.some((r=>x(r,t)&&e.set.some((e=>x(e,t)&&r.every((r=>e.every((e=>r.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(N(this.set[t],e,this.options))return!0;return!1}}e.exports=s;const n=new(r(92721)),o=r(83214),i=r(55141),l=r(29385),u=r(48381),{safeRe:c,t:p,comparatorTrimReplace:d,tildeTrimReplace:h,caretTrimReplace:m}=r(92625),{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:g}=r(24159),v=e=>"<0.0.0-0"===e.value,y=e=>""===e.value,x=(e,t)=>{let r=!0;const a=e.slice();let s=a.pop();for(;r&&a.length;)r=a.every((e=>s.intersects(e,t))),s=a.pop();return r},E=(e,t)=>(l("comp",e,t),e=k(e,t),l("caret",e),e=I(e,t),l("tildes",e),e=T(e,t),l("xrange",e),e=C(e,t),l("stars",e),e),b=e=>!e||"x"===e.toLowerCase()||"*"===e,I=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const r=t.loose?c[p.TILDELOOSE]:c[p.TILDE];return e.replace(r,((t,r,a,s,n)=>{let o;return l("tilde",e,t,r,a,s,n),b(r)?o="":b(a)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:b(s)?o=`>=${r}.${a}.0 <${r}.${+a+1}.0-0`:n?(l("replaceTilde pr",n),o=`>=${r}.${a}.${s}-${n} <${r}.${+a+1}.0-0`):o=`>=${r}.${a}.${s} <${r}.${+a+1}.0-0`,l("tilde return",o),o}))},k=(e,t)=>e.trim().split(/\s+/).map((e=>S(e,t))).join(" "),S=(e,t)=>{l("caret",e,t);const r=t.loose?c[p.CARETLOOSE]:c[p.CARET],a=t.includePrerelease?"-0":"";return e.replace(r,((t,r,s,n,o)=>{let i;return l("caret",e,t,r,s,n,o),b(r)?i="":b(s)?i=`>=${r}.0.0${a} <${+r+1}.0.0-0`:b(n)?i="0"===r?`>=${r}.${s}.0${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.0${a} <${+r+1}.0.0-0`:o?(l("replaceCaret pr",o),i="0"===r?"0"===s?`>=${r}.${s}.${n}-${o} <${r}.${s}.${+n+1}-0`:`>=${r}.${s}.${n}-${o} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${n}-${o} <${+r+1}.0.0-0`):(l("no pr"),i="0"===r?"0"===s?`>=${r}.${s}.${n}${a} <${r}.${s}.${+n+1}-0`:`>=${r}.${s}.${n}${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${n} <${+r+1}.0.0-0`),l("caret return",i),i}))},T=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map((e=>A(e,t))).join(" ")),A=(e,t)=>{e=e.trim();const r=t.loose?c[p.XRANGELOOSE]:c[p.XRANGE];return e.replace(r,((r,a,s,n,o,i)=>{l("xRange",e,r,a,s,n,o,i);const u=b(s),c=u||b(n),p=c||b(o),d=p;return"="===a&&d&&(a=""),i=t.includePrerelease?"-0":"",u?r=">"===a||"<"===a?"<0.0.0-0":"*":a&&d?(c&&(n=0),o=0,">"===a?(a=">=",c?(s=+s+1,n=0,o=0):(n=+n+1,o=0)):"<="===a&&(a="<",c?s=+s+1:n=+n+1),"<"===a&&(i="-0"),r=`${a+s}.${n}.${o}${i}`):c?r=`>=${s}.0.0${i} <${+s+1}.0.0-0`:p&&(r=`>=${s}.${n}.0${i} <${s}.${+n+1}.0-0`),l("xRange return",r),r}))},C=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[p.STAR],"")),_=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),R=e=>(t,r,a,s,n,o,i,l,u,c,p,d)=>`${r=b(a)?"":b(s)?`>=${a}.0.0${e?"-0":""}`:b(n)?`>=${a}.${s}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=b(u)?"":b(c)?`<${+u+1}.0.0-0`:b(p)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${p}-${d}`:e?`<${u}.${c}.${+p+1}-0`:`<=${l}`}`.trim(),N=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==i.ANY&&e[r].semver.prerelease.length>0){const a=e[r].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0}},20360:(e,t,r)=>{const a=/\s+/g;class s{constructor(e,t){if(t=o(t),e instanceof s)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new s(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,r=n.get(t);if(r)return r;const a=this.options.loose,s=a?c[p.HYPHENRANGELOOSE]:c[p.HYPHENRANGE];e=e.replace(s,R(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(c[p.COMPARATORTRIM],d),l("comparator trim",e),e=e.replace(c[p.TILDETRIM],h),l("tilde trim",e),e=e.replace(c[p.CARETTRIM],m),l("caret trim",e);let o=e.split(" ").map((e=>E(e,this.options))).join(" ").split(/\s+/).map((e=>_(e,this.options)));a&&(o=o.filter((e=>(l("loose invalid filter",e,this.options),!!e.match(c[p.COMPARATORLOOSE]))))),l("range list",o);const u=new Map,y=o.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 x=[...u.values()];return n.set(t,x),x}intersects(e,t){if(!(e instanceof s))throw new TypeError("a Range is required");return this.set.some((r=>x(r,t)&&e.set.some((e=>x(e,t)&&r.every((r=>e.every((e=>r.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(N(this.set[t],e,this.options))return!0;return!1}}e.exports=s;const n=new(r(13349)),o=r(40594),i=r(67105),l=r(95869),u=r(88825),{safeRe:c,t:p,comparatorTrimReplace:d,tildeTrimReplace:h,caretTrimReplace:m}=r(36165),{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:g}=r(41755),v=e=>"<0.0.0-0"===e.value,y=e=>""===e.value,x=(e,t)=>{let r=!0;const a=e.slice();let s=a.pop();for(;r&&a.length;)r=a.every((e=>s.intersects(e,t))),s=a.pop();return r},E=(e,t)=>(l("comp",e,t),e=k(e,t),l("caret",e),e=I(e,t),l("tildes",e),e=T(e,t),l("xrange",e),e=C(e,t),l("stars",e),e),b=e=>!e||"x"===e.toLowerCase()||"*"===e,I=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const r=t.loose?c[p.TILDELOOSE]:c[p.TILDE];return e.replace(r,((t,r,a,s,n)=>{let o;return l("tilde",e,t,r,a,s,n),b(r)?o="":b(a)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:b(s)?o=`>=${r}.${a}.0 <${r}.${+a+1}.0-0`:n?(l("replaceTilde pr",n),o=`>=${r}.${a}.${s}-${n} <${r}.${+a+1}.0-0`):o=`>=${r}.${a}.${s} <${r}.${+a+1}.0-0`,l("tilde return",o),o}))},k=(e,t)=>e.trim().split(/\s+/).map((e=>S(e,t))).join(" "),S=(e,t)=>{l("caret",e,t);const r=t.loose?c[p.CARETLOOSE]:c[p.CARET],a=t.includePrerelease?"-0":"";return e.replace(r,((t,r,s,n,o)=>{let i;return l("caret",e,t,r,s,n,o),b(r)?i="":b(s)?i=`>=${r}.0.0${a} <${+r+1}.0.0-0`:b(n)?i="0"===r?`>=${r}.${s}.0${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.0${a} <${+r+1}.0.0-0`:o?(l("replaceCaret pr",o),i="0"===r?"0"===s?`>=${r}.${s}.${n}-${o} <${r}.${s}.${+n+1}-0`:`>=${r}.${s}.${n}-${o} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${n}-${o} <${+r+1}.0.0-0`):(l("no pr"),i="0"===r?"0"===s?`>=${r}.${s}.${n}${a} <${r}.${s}.${+n+1}-0`:`>=${r}.${s}.${n}${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${n} <${+r+1}.0.0-0`),l("caret return",i),i}))},T=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map((e=>A(e,t))).join(" ")),A=(e,t)=>{e=e.trim();const r=t.loose?c[p.XRANGELOOSE]:c[p.XRANGE];return e.replace(r,((r,a,s,n,o,i)=>{l("xRange",e,r,a,s,n,o,i);const u=b(s),c=u||b(n),p=c||b(o),d=p;return"="===a&&d&&(a=""),i=t.includePrerelease?"-0":"",u?r=">"===a||"<"===a?"<0.0.0-0":"*":a&&d?(c&&(n=0),o=0,">"===a?(a=">=",c?(s=+s+1,n=0,o=0):(n=+n+1,o=0)):"<="===a&&(a="<",c?s=+s+1:n=+n+1),"<"===a&&(i="-0"),r=`${a+s}.${n}.${o}${i}`):c?r=`>=${s}.0.0${i} <${+s+1}.0.0-0`:p&&(r=`>=${s}.${n}.0${i} <${s}.${+n+1}.0-0`),l("xRange return",r),r}))},C=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[p.STAR],"")),_=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),R=e=>(t,r,a,s,n,o,i,l,u,c,p,d)=>`${r=b(a)?"":b(s)?`>=${a}.0.0${e?"-0":""}`:b(n)?`>=${a}.${s}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=b(u)?"":b(c)?`<${+u+1}.0.0-0`:b(p)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${p}-${d}`:e?`<${u}.${c}.${+p+1}-0`:`<=${l}`}`.trim(),N=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==i.ANY&&e[r].semver.prerelease.length>0){const a=e[r].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0}},20903:(e,t,r)=>{const a=r(83586);e.exports=(e,t)=>{const r=a(e,t);return r?r.version:null}},20930:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},21212: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}}},21665:(e,t,r)=>{var a=r(29520);e.exports=a},22038:(e,t,r)=>{const a=r(87866);e.exports=(e,t,r)=>a(e,t,">",r)},23252:(e,t,r)=>{const a=r(88825),s=r(20360),n=r(51269);e.exports=(e,t)=>{e=new s(e,t);let r=new a("0.0.0");if(e.test(r))return r;if(r=new a("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const s=e.set[t];let o=null;s.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">=":o&&!n(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!n(r,o)||(r=o)}return r&&e.test(r)?r:null}},24159: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}},24482:(e,t,r)=>{const a=r(34219);e.exports=(e,t)=>{const r=a(e,t);return r?r.version:null}},24975:(e,t,r)=>{const a=r(25583);e.exports=(e,t,r)=>a(t,e,r)},25157:(e,t,r)=>{var a,s=r(98437),n=r(17642);function o(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),-1===e.indexOf("-")&&-1===e.indexOf("_"))return e;{let t="",r=!1;const a=e.match(/^-+/);for(let s=a?a[0].length:0;s<e.length;s++){let a=e.charAt(s);r&&(r=!1,a=a.toUpperCase()),0===s||"-"!==a&&"_"!==a?"-"!==a&&"_"!==a&&(t+=a):r=!0}return t}}function i(e,t){const r=e.toLowerCase();t=t||"-";let a="";for(let s=0;s<e.length;s++){const n=r.charAt(s),o=e.charAt(s);a+=n!==o&&s>0?`${t}${r.charAt(s)}`:o}return a}function l(e){return null!=e&&("number"==typeof e||!!/^0x[0-9a-f]+$/i.test(e)||!/^0[^.]/.test(e)&&/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e))}let u;function c(e){return void 0!==e?e+1:1}function p(e){return"__proto__"===e?"___proto___":e}!function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"}(a||(a={}));var d,h,m,f=r(36374),g=r(65994).process;const v=g&&g.env&&g.env.YARGS_MIN_NODE_VERSION?Number(g.env.YARGS_MIN_NODE_VERSION):12,y=null!==(h=null===(d=null==g?void 0:g.versions)||void 0===d?void 0:d.node)&&void 0!==h?h:null===(m=null==g?void 0:g.version)||void 0===m?void 0:m.slice(1);if(y&&Number(y.match(/^([^.]+)/)[1])<v)throw Error(`yargs parser supports a minimum Node.js version of ${v}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const x=g?g.env:{},E=new class{constructor(e){u=e}parse(e,t){const r=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),s=function(e){if(Array.isArray(e))return e.map((e=>"string"!=typeof e?e+"":e));e=e.trim();let t=0,r=null,a=null,s=null;const n=[];for(let o=0;o<e.length;o++)r=a,a=e.charAt(o)," "!==a||s?(a===s?s=null:"'"!==a&&'"'!==a||s||(s=a),n[t]||(n[t]=""),n[t]+=a):" "!==r&&t++;return n}(e),n="string"==typeof e,d=function(e){const t=[],r=Object.create(null);let a=!0;for(Object.keys(e).forEach((function(r){t.push([].concat(e[r],r))}));a;){a=!1;for(let e=0;e<t.length;e++)for(let r=e+1;r<t.length;r++)if(t[e].filter((function(e){return-1!==t[r].indexOf(e)})).length){t[e]=t[e].concat(t[r]),t.splice(r,1),a=!0;break}}return t.forEach((function(e){const t=(e=e.filter((function(e,t,r){return r.indexOf(e)===t}))).pop();void 0!==t&&"string"==typeof t&&(r[t]=e)})),r}(Object.assign(Object.create(null),r.alias)),h=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},r.configuration),m=Object.assign(Object.create(null),r.default),f=r.configObjects||[],g=r.envPrefix,v=h["populate--"],y=v?"--":"_",x=Object.create(null),E=Object.create(null),b=r.__||u.format,I={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},w=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,k=new RegExp("^--"+h["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach((function(e){const t="object"==typeof e?e.key:e,r=Object.keys(e).map((function(e){return{boolean:"bools",string:"strings",number:"numbers"}[e]})).filter(Boolean).pop();r&&(I[r][t]=!0),I.arrays[t]=!0,I.keys.push(t)})),[].concat(r.boolean||[]).filter(Boolean).forEach((function(e){I.bools[e]=!0,I.keys.push(e)})),[].concat(r.string||[]).filter(Boolean).forEach((function(e){I.strings[e]=!0,I.keys.push(e)})),[].concat(r.number||[]).filter(Boolean).forEach((function(e){I.numbers[e]=!0,I.keys.push(e)})),[].concat(r.count||[]).filter(Boolean).forEach((function(e){I.counts[e]=!0,I.keys.push(e)})),[].concat(r.normalize||[]).filter(Boolean).forEach((function(e){I.normalize[e]=!0,I.keys.push(e)})),"object"==typeof r.narg&&Object.entries(r.narg).forEach((([e,t])=>{"number"==typeof t&&(I.nargs[e]=t,I.keys.push(e))})),"object"==typeof r.coerce&&Object.entries(r.coerce).forEach((([e,t])=>{"function"==typeof t&&(I.coercions[e]=t,I.keys.push(e))})),void 0!==r.config&&(Array.isArray(r.config)||"string"==typeof r.config?[].concat(r.config).filter(Boolean).forEach((function(e){I.configs[e]=!0})):"object"==typeof r.config&&Object.entries(r.config).forEach((([e,t])=>{"boolean"!=typeof t&&"function"!=typeof t||(I.configs[e]=t)}))),function(...e){e.forEach((function(e){Object.keys(e||{}).forEach((function(e){I.aliases[e]||(I.aliases[e]=[].concat(d[e]||[]),I.aliases[e].concat(e).forEach((function(t){if(/-/.test(t)&&h["camel-case-expansion"]){const r=o(t);r!==e&&-1===I.aliases[e].indexOf(r)&&(I.aliases[e].push(r),x[r]=!0)}})),I.aliases[e].concat(e).forEach((function(t){if(t.length>1&&/[A-Z]/.test(t)&&h["camel-case-expansion"]){const r=i(t,"-");r!==e&&-1===I.aliases[e].indexOf(r)&&(I.aliases[e].push(r),x[r]=!0)}})),I.aliases[e].forEach((function(t){I.aliases[t]=[e].concat(I.aliases[e].filter((function(e){return t!==e})))})))}))}))}(r.key,d,r.default,I.arrays),Object.keys(m).forEach((function(e){(I.aliases[e]||[]).forEach((function(t){m[t]=m[e]}))}));let S=null;Object.keys(I.counts).find((e=>V(e,I.arrays)?(S=Error(b("Invalid configuration: %s, opts.count excludes opts.array.",e)),!0):!!V(e,I.nargs)&&(S=Error(b("Invalid configuration: %s, opts.count excludes opts.narg.",e)),!0)));let T=[];const A=Object.assign(Object.create(null),{_:[]}),C={};for(let e=0;e<s.length;e++){const t=s[e],r=t.replace(/^-{3,}/,"---");let a,n,o,i,l,u;if("--"!==t&&/^-/.test(t)&&U(t))_(t);else{if(r.match(/^---+(=|$)/)){_(t);continue}if(t.match(/^--.+=/)||!h["short-option-groups"]&&t.match(/^-.+=/))i=t.match(/^--?([^=]+)=([\s\S]*)$/),null!==i&&Array.isArray(i)&&i.length>=3&&(V(i[1],I.arrays)?e=N(e,i[1],s,i[2]):!1!==V(i[1],I.nargs)?e=R(e,i[1],s,i[2]):O(i[1],i[2],!0));else if(t.match(k)&&h["boolean-negation"])i=t.match(k),null!==i&&Array.isArray(i)&&i.length>=2&&(n=i[1],O(n,!!V(n,I.arrays)&&[!1]));else if(t.match(/^--.+/)||!h["short-option-groups"]&&t.match(/^-[^-]+/))i=t.match(/^--?(.+)/),null!==i&&Array.isArray(i)&&i.length>=2&&(n=i[1],V(n,I.arrays)?e=N(e,n,s):!1!==V(n,I.nargs)?e=R(e,n,s):(l=s[e+1],void 0===l||l.match(/^-/)&&!l.match(w)||V(n,I.bools)||V(n,I.counts)?/^(true|false)$/.test(l)?(O(n,l),e++):O(n,B(n)):(O(n,l),e++)));else if(t.match(/^-.\..+=/))i=t.match(/^-([^=]+)=([\s\S]*)$/),null!==i&&Array.isArray(i)&&i.length>=3&&O(i[1],i[2]);else if(t.match(/^-.\..+/)&&!t.match(w))l=s[e+1],i=t.match(/^-(.\..+)/),null!==i&&Array.isArray(i)&&i.length>=2&&(n=i[1],void 0===l||l.match(/^-/)||V(n,I.bools)||V(n,I.counts)?O(n,B(n)):(O(n,l),e++));else if(t.match(/^-[^-]+/)&&!t.match(w)){o=t.slice(1,-1).split(""),a=!1;for(let r=0;r<o.length;r++){if(l=t.slice(r+2),o[r+1]&&"="===o[r+1]){u=t.slice(r+3),n=o[r],V(n,I.arrays)?e=N(e,n,s,u):!1!==V(n,I.nargs)?e=R(e,n,s,u):O(n,u),a=!0;break}if("-"!==l){if(/[A-Za-z]/.test(o[r])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(l)&&!1===V(l,I.bools)){O(o[r],l),a=!0;break}if(o[r+1]&&o[r+1].match(/\W/)){O(o[r],l),a=!0;break}O(o[r],B(o[r]))}else O(o[r],l)}n=t.slice(-1)[0],a||"-"===n||(V(n,I.arrays)?e=N(e,n,s):!1!==V(n,I.nargs)?e=R(e,n,s):(l=s[e+1],void 0===l||/^(-|--)[^-]/.test(l)&&!l.match(w)||V(n,I.bools)||V(n,I.counts)?/^(true|false)$/.test(l)?(O(n,l),e++):O(n,B(n)):(O(n,l),e++)))}else if(t.match(/^-[0-9]$/)&&t.match(w)&&V(t.slice(1),I.bools))n=t.slice(1),O(n,B(n));else{if("--"===t){T=s.slice(e+1);break}if(h["halt-at-non-option"]){T=s.slice(e);break}_(t)}}}function _(e){const t=$("_",e);"string"!=typeof t&&"number"!=typeof t||A._.push(t)}function R(e,t,r,a){let s,n=V(t,I.nargs);if(n="number"!=typeof n||isNaN(n)?1:n,0===n)return G(a)||(S=Error(b("Argument unexpected for: %s",t))),O(t,B(t)),e;let o=G(a)?0:1;if(h["nargs-eats-options"])r.length-(e+1)+o<n&&(S=Error(b("Not enough arguments following: %s",t))),o=n;else{for(s=e+1;s<r.length&&(!r[s].match(/^-[^0-9]/)||r[s].match(w)||U(r[s]));s++)o++;o<n&&(S=Error(b("Not enough arguments following: %s",t)))}let i=Math.min(o,n);for(!G(a)&&i>0&&(O(t,a),i--),s=e+1;s<i+e+1;s++)O(t,r[s]);return e+i}function N(e,t,r,a){let s=[],o=a||r[e+1];const i=V(t,I.nargs);if(V(t,I.bools)&&!/^(true|false)$/.test(o))s.push(!0);else if(G(o)||G(a)&&/^-/.test(o)&&!w.test(o)&&!U(o)){if(void 0!==m[t]){const e=m[t];s=Array.isArray(e)?e:[e]}}else{G(a)||s.push(P(t,a,!0));for(let a=e+1;a<r.length&&!(!h["greedy-arrays"]&&s.length>0||i&&"number"==typeof i&&s.length>=i)&&(o=r[a],!/^-/.test(o)||w.test(o)||U(o));a++)e=a,s.push(P(t,o,n))}return"number"==typeof i&&(i&&s.length<i||isNaN(i)&&0===s.length)&&(S=Error(b("Not enough arguments following: %s",t))),O(t,s),e}function O(e,t,r=n){if(/-/.test(e)&&h["camel-case-expansion"]){const t=e.split(".").map((function(e){return o(e)})).join(".");M(e,t)}const a=P(e,t,r),s=e.split(".");F(A,s,a),I.aliases[e]&&I.aliases[e].forEach((function(e){const t=e.split(".");F(A,t,a)})),s.length>1&&h["dot-notation"]&&(I.aliases[s[0]]||[]).forEach((function(t){let r=t.split(".");const n=[].concat(s);n.shift(),r=r.concat(n),(I.aliases[e]||[]).includes(r.join("."))||F(A,r,a)})),V(e,I.normalize)&&!V(e,I.arrays)&&[e].concat(I.aliases[e]||[]).forEach((function(e){Object.defineProperty(C,e,{enumerable:!0,get:()=>t,set(e){t="string"==typeof e?u.normalize(e):e}})}))}function M(e,t){I.aliases[e]&&I.aliases[e].length||(I.aliases[e]=[t],x[t]=!0),I.aliases[t]&&I.aliases[t].length||M(t,e)}function P(e,t,r){r&&(t=function(e){return"string"!=typeof e||"'"!==e[0]&&'"'!==e[0]||e[e.length-1]!==e[0]?e:e.substring(1,e.length-1)}(t)),(V(e,I.bools)||V(e,I.counts))&&"string"==typeof t&&(t="true"===t);let a=Array.isArray(t)?t.map((function(t){return $(e,t)})):$(e,t);return V(e,I.counts)&&(G(a)||"boolean"==typeof a)&&(a=c()),V(e,I.normalize)&&V(e,I.arrays)&&(a=Array.isArray(t)?t.map((e=>u.normalize(e))):u.normalize(t)),a}function $(e,t){return h["parse-positional-numbers"]||"_"!==e?(V(e,I.strings)||V(e,I.bools)||Array.isArray(t)||(l(t)&&h["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))||!G(t)&&V(e,I.numbers))&&(t=Number(t)),t):t}function L(e,t){Object.keys(e).forEach((function(r){const a=e[r],s=t?t+"."+r:r;"object"==typeof a&&null!==a&&!Array.isArray(a)&&h["dot-notation"]?L(a,s):(!Y(A,s.split("."))||V(s,I.arrays)&&h["combine-arrays"])&&O(s,a)}))}function j(e,t){if(void 0===g)return;const r="string"==typeof g?g:"",a=u.env();Object.keys(a).forEach((function(s){if(""===r||0===s.lastIndexOf(r,0)){const n=s.split("__").map((function(e,t){return 0===t&&(e=e.substring(r.length)),o(e)}));(t&&I.configs[n.join(".")]||!t)&&!Y(e,n)&&O(n.join("."),a[s])}}))}function D(e,t,r,a=!1){Object.keys(r).forEach((function(s){Y(e,s.split("."))||(F(e,s.split("."),r[s]),a&&(E[s]=!0),(t[s]||[]).forEach((function(t){Y(e,t.split("."))||F(e,t.split("."),r[s])})))}))}function Y(e,t){let r=e;h["dot-notation"]||(t=[t.join(".")]),t.slice(0,-1).forEach((function(e){r=r[e]||{}}));const a=t[t.length-1];return"object"==typeof r&&a in r}function F(e,t,r){let a=e;h["dot-notation"]||(t=[t.join(".")]),t.slice(0,-1).forEach((function(e){e=p(e),"object"==typeof a&&void 0===a[e]&&(a[e]={}),"object"!=typeof a[e]||Array.isArray(a[e])?(Array.isArray(a[e])?a[e].push({}):a[e]=[a[e],{}],a=a[e][a[e].length-1]):a=a[e]}));const s=p(t[t.length-1]),n=V(t.join("."),I.arrays),o=Array.isArray(r);let i=h["duplicate-arguments-array"];!i&&V(s,I.nargs)&&(i=!0,(!G(a[s])&&1===I.nargs[s]||Array.isArray(a[s])&&a[s].length===I.nargs[s])&&(a[s]=void 0)),r===c()?a[s]=c(a[s]):Array.isArray(a[s])?i&&n&&o?a[s]=h["flatten-duplicate-arrays"]?a[s].concat(r):(Array.isArray(a[s][0])?a[s]:[a[s]]).concat([r]):i||Boolean(n)!==Boolean(o)?a[s]=a[s].concat([r]):a[s]=r:void 0===a[s]&&n?a[s]=o?r:[r]:!i||void 0===a[s]||V(s,I.counts)||V(s,I.bools)?a[s]=r:a[s]=[a[s],r]}function V(e,t){const r=[].concat(I.aliases[e]||[],e),a=Object.keys(t),s=r.find((e=>a.includes(e)));return!!s&&t[s]}function q(e){const t=Object.keys(I);return[].concat(t.map((e=>I[e]))).some((function(t){return Array.isArray(t)?t.includes(e):t[e]}))}function U(e){return h["unknown-options-as-args"]&&function(e){return!(e=e.replace(/^-{3,}/,"--")).match(w)&&(!function(e){if(e.match(w)||!e.match(/^-[^-]+/))return!1;let t,r=!0;const a=e.slice(1).split("");for(let s=0;s<a.length;s++){if(t=e.slice(s+2),!q(a[s])){r=!1;break}if(a[s+1]&&"="===a[s+1]||"-"===t||/[A-Za-z]/.test(a[s])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(t)||a[s+1]&&a[s+1].match(/\W/))break}return r}(e)&&!function(e,...t){return[].concat(...t).some((function(t){const r=e.match(t);return r&&q(r[1])}))}(e,/^-+([^=]+?)=[\s\S]*$/,k,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/))}(e)}function B(e){return V(e,I.bools)||V(e,I.counts)||!(`${e}`in m)?(t=function(e){let t=a.BOOLEAN;return V(e,I.strings)?t=a.STRING:V(e,I.numbers)?t=a.NUMBER:V(e,I.bools)?t=a.BOOLEAN:V(e,I.arrays)&&(t=a.ARRAY),t}(e),{[a.BOOLEAN]:!0,[a.STRING]:"",[a.NUMBER]:void 0,[a.ARRAY]:[]}[t]):m[e];var t}function G(e){return void 0===e}return j(A,!0),j(A,!1),function(e){const t=Object.create(null);D(t,I.aliases,m),Object.keys(I.configs).forEach((function(r){const a=e[r]||t[r];if(a)try{let e=null;const t=u.resolve(u.cwd(),a),s=I.configs[r];if("function"==typeof s){try{e=s(t)}catch(t){e=t}if(e instanceof Error)return void(S=e)}else e=u.require(t);L(e)}catch(t){"PermissionDenied"===t.name?S=t:e[r]&&(S=Error(b("Invalid JSON config file: %s",a)))}}))}(A),void 0!==f&&f.forEach((function(e){L(e)})),D(A,I.aliases,m,!0),function(e){let t;const r=new Set;Object.keys(e).forEach((function(a){if(!r.has(a)&&(t=V(a,I.coercions),"function"==typeof t))try{const s=$(a,t(e[a]));[].concat(I.aliases[a]||[],a).forEach((t=>{r.add(t),e[t]=s}))}catch(e){S=e}}))}(A),h["set-placeholder-key"]&&function(e){I.keys.forEach((t=>{~t.indexOf(".")||void 0===e[t]&&(e[t]=void 0)}))}(A),Object.keys(I.counts).forEach((function(e){Y(A,e.split("."))||O(e,0)})),v&&T.length&&(A[y]=[]),T.forEach((function(e){A[y].push(e)})),h["camel-case-expansion"]&&h["strip-dashed"]&&Object.keys(A).filter((e=>"--"!==e&&e.includes("-"))).forEach((e=>{delete A[e]})),h["strip-aliased"]&&[].concat(...Object.keys(d).map((e=>d[e]))).forEach((e=>{h["camel-case-expansion"]&&e.includes("-")&&delete A[e.split(".").map((e=>o(e))).join(".")],delete A[e]})),{aliases:Object.assign({},I.aliases),argv:Object.assign(C,A),configuration:h,defaulted:Object.assign({},E),error:S,newAliases:Object.assign({},x)}}}({cwd:g.cwd,env:()=>x,format:s.format,normalize:n.normalize,resolve:n.resolve,require:e=>{if("undefined"!=typeof require)return require(e);if(e.match(/\.json$/))return JSON.parse((0,f.readFileSync)(e,"utf8"));throw Error("only .json config files are supported in ESM")}}),b=function(e,t){return E.parse(e.slice(),t).argv};b.detailed=function(e,t){return E.parse(e.slice(),t)},b.camelCase=o,b.decamelize=i,b.looksLikeNumber=l},25583:(e,t,r)=>{const a=r(88825);e.exports=(e,t,r)=>new a(e,r).compare(new a(t,r))},25812:(e,t,r)=>{const a=r(77203);e.exports=(e,t,r)=>0!==a(e,t,r)},26620:(e,t,r)=>{const a=r(25583);e.exports=(e,t,r)=>0===a(e,t,r)},27195:(e,t,r)=>{var a=r(40811),s=Object.prototype.hasOwnProperty,n=Object.prototype.toString;e.exports=new a("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,a,o,i,l=[],u=e;for(t=0,r=u.length;t<r;t+=1){if(a=u[t],i=!1,"[object Object]"!==n.call(a))return!1;for(o in a)if(s.call(a,o)){if(i)return!1;i=!0}if(!i)return!1;if(-1!==l.indexOf(o))return!1;l.push(o)}return!0},construct:function(e){return null!==e?e:[]}})},27995:(e,t,r)=>{const a=r(20360);e.exports=(e,t,r)=>(e=new a(e,r),t=new a(t,r),e.intersects(t,r))},28333:(e,t,r)=>{r.d(t,{vl:()=>pi,ut:()=>ii,Sd:()=>di,gM:()=>ni});var a,s,n,o,i="vercel.ai.error",l=Symbol.for(i),u=class e extends(s=Error,a=l,s){constructor({name:e,message:t,cause:r}){super(t),this[a]=!0,this.name=e,this.cause=r}static isInstance(t){return e.hasMarker(t,i)}static hasMarker(e,t){const r=Symbol.for(t);return null!=e&&"object"==typeof e&&r in e&&"boolean"==typeof e[r]&&!0===e[r]}},c="AI_APICallError",p=`vercel.ai.error.${c}`,d=Symbol.for(p),h=class extends(o=u,n=d,o){constructor({message:e,url:t,requestBodyValues:r,statusCode:a,responseHeaders:s,responseBody:o,cause:i,isRetryable:l=null!=a&&(408===a||409===a||429===a||a>=500),data:u}){super({name:c,message:e,cause:i}),this[n]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=a,this.responseHeaders=s,this.responseBody=o,this.isRetryable=l,this.data=u}static isInstance(e){return u.hasMarker(e,p)}},m=Symbol.for("vercel.ai.error.AI_EmptyResponseBodyError");function f(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var g,v,y,x,E,b,I,w,k,S,T="AI_InvalidArgumentError",A=`vercel.ai.error.${T}`,C=Symbol.for(A),_=class extends(v=u,g=C,v){constructor({message:e,cause:t,argument:r}){super({name:T,message:e,cause:t}),this[g]=!0,this.argument=r}static isInstance(e){return u.hasMarker(e,A)}},R="AI_InvalidPromptError",N=`vercel.ai.error.${R}`,O=Symbol.for(N),M=class extends(x=u,y=O,x){constructor({prompt:e,message:t,cause:r}){super({name:R,message:`Invalid prompt: ${t}`,cause:r}),this[y]=!0,this.prompt=e}static isInstance(e){return u.hasMarker(e,N)}},P=Symbol.for("vercel.ai.error.AI_InvalidResponseDataError"),$="AI_JSONParseError",L=`vercel.ai.error.${$}`,j=Symbol.for(L),D=class extends(b=u,E=j,b){constructor({text:e,cause:t}){super({name:$,message:`JSON parsing failed: Text: ${e}.\nError message: ${f(t)}`,cause:t}),this[E]=!0,this.text=e}static isInstance(e){return u.hasMarker(e,L)}},Y=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError"),F=`vercel.ai.error.${"AI_LoadSettingError"}`,V=Symbol.for(F),q=`vercel.ai.error.${"AI_NoContentGeneratedError"}`,U=Symbol.for(q),B=`vercel.ai.error.${"AI_NoSuchModelError"}`,G=Symbol.for(B),Z=`vercel.ai.error.${"AI_TooManyEmbeddingValuesForCallError"}`,z=Symbol.for(Z),H="AI_TypeValidationError",W=`vercel.ai.error.${H}`,K=Symbol.for(W),X=class e extends(w=u,I=K,w){constructor({value:e,cause:t}){super({name:H,message:`Type validation failed: Value: ${JSON.stringify(e)}.\nError message: ${f(t)}`,cause:t}),this[I]=!0,this.value=e}static isInstance(e){return u.hasMarker(e,W)}static wrap({value:t,cause:r}){return e.isInstance(r)&&r.value===t?r:new e({value:t,cause:r})}},J="AI_UnsupportedFunctionalityError",Q=`vercel.ai.error.${J}`,ee=Symbol.for(Q),te=class extends(S=u,k=ee,S){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:J,message:t}),this[k]=!0,this.functionality=e}static isInstance(e){return u.hasMarker(e,Q)}},re=r(21935),ae=r(67299),se=r(84340),ne=r(29744);function oe(){return new DOMException("Delay was aborted","AbortError")}r(65994).process;var ie=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}},{btoa:le,atob:ue}=globalThis;function ce(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=ue(t);return Uint8Array.from(r,(e=>e.codePointAt(0)))}function pe(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return le(t)}var de,he,me="AI_DownloadError",fe=`vercel.ai.error.${me}`,ge=Symbol.for(fe),ve=class extends(he=u,de=ge,he){constructor({url:e,statusCode:t,statusText:r,cause:a,message:s=(null==a?`Failed to download ${e}: ${t} ${r}`:`Failed to download ${e}: ${a}`)}){super({name:me,message:s,cause:a}),this[de]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return u.hasMarker(e,fe)}},ye=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{const s=()=>{const e=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[Math.random()*e|0];return a.join("")};if(null==e)return s;if(r.includes(a))throw new _({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${r}".`});return()=>`${e}${a}${s()}`},xe=ye();function Ee(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}function be(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}function Ie(e=globalThis){var t,r,a;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(a=null==(r=e.process)?void 0:r.versions)?void 0:a.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function we(e){if(null==e)return{};const t={};if(e instanceof Headers)e.forEach(((e,r)=>{t[r.toLowerCase()]=e}));else{Array.isArray(e)||(e=Object.entries(e));for(const[r,a]of e)null!=a&&(t[r.toLowerCase()]=a)}return t}function ke(e,...t){const r=new Headers(we(e)),a=r.get("user-agent")||"";return r.set("user-agent",[a,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}function Se(e){return null!=e}function Te({mediaType:e,url:t,supportedUrls:r}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(r).map((([e,t])=>{const r=e.toLowerCase();return"*"===r||"*/*"===r?{mediaTypePrefix:"",regexes:t}:{mediaTypePrefix:r.replace(/\*/,""),regexes:t}})).filter((({mediaTypePrefix:t})=>e.startsWith(t))).flatMap((({regexes:e})=>e)).some((e=>e.test(t)))}var Ae=/"__proto__"\s*:/,Ce=/"constructor"\s*:/;function _e(e){const t=JSON.parse(e);return null===t||"object"!=typeof t||!1===Ae.test(e)&&!1===Ce.test(e)?t:function(e){let t=[e];for(;t.length;){const e=t;t=[];for(const r of e){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const e in r){const a=r[e];a&&"object"==typeof a&&t.push(a)}}}return e}(t)}function Re(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=Ne(t[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(Ne):Ne(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(Ne)),null!=e.allOf&&(e.allOf=e.allOf.map(Ne)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(Ne));const{definitions:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=Ne(t[e]);return e}function Ne(e){return"boolean"==typeof e?e:Re(e)}var Oe=Symbol("Let zodToJsonSchema decide on which parser to use"),Me={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 Pe(e,t){return Ke(e.type._def,t)}function $e(e,t,r){const a=null!=r?r:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map(((r,a)=>$e(e,t,r)))};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 Le(e)}}var Le=e=>{const t={type:"integer",format:"unix-time"};for(const r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value}return t},je=void 0,De={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===je&&(je=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),je),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 Ye(e,t){const r={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"email":switch(t.emailStrategy){case"format:email":qe(r,"email",a.message,t);break;case"format:idn-email":qe(r,"idn-email",a.message,t);break;case"pattern:zod":Ue(r,De.email,a.message,t)}break;case"url":qe(r,"uri",a.message,t);break;case"uuid":qe(r,"uuid",a.message,t);break;case"regex":Ue(r,a.regex,a.message,t);break;case"cuid":Ue(r,De.cuid,a.message,t);break;case"cuid2":Ue(r,De.cuid2,a.message,t);break;case"startsWith":Ue(r,RegExp(`^${Fe(a.value,t)}`),a.message,t);break;case"endsWith":Ue(r,RegExp(`${Fe(a.value,t)}$`),a.message,t);break;case"datetime":qe(r,"date-time",a.message,t);break;case"date":qe(r,"date",a.message,t);break;case"time":qe(r,"time",a.message,t);break;case"duration":qe(r,"duration",a.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"includes":Ue(r,RegExp(Fe(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&qe(r,"ipv4",a.message,t),"v4"!==a.version&&qe(r,"ipv6",a.message,t);break;case"base64url":Ue(r,De.base64url,a.message,t);break;case"jwt":Ue(r,De.jwt,a.message,t);break;case"cidr":"v6"!==a.version&&Ue(r,De.ipv4Cidr,a.message,t),"v4"!==a.version&&Ue(r,De.ipv6Cidr,a.message,t);break;case"emoji":Ue(r,De.emoji(),a.message,t);break;case"ulid":Ue(r,De.ulid,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":qe(r,"binary",a.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":Ue(r,De.base64,a.message,t)}break;case"nanoid":Ue(r,De.nanoid,a.message,t)}return r}function Fe(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)Ve.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var Ve=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function qe(e,t,r,a){var s;e.format||(null==(s=e.anyOf)?void 0:s.some((e=>e.format)))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function Ue(e,t,r,a){var s;e.pattern||(null==(s=e.allOf)?void 0:s.some((e=>e.pattern)))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Be(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=Be(t,a)}function Be(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),s=e.flags.includes("m"),n=e.flags.includes("s"),o=a?e.source.toLowerCase():e.source;let i="",l=!1,u=!1,c=!1;for(let e=0;e<o.length;e++)if(l)i+=o[e],l=!1;else{if(a)if(u){if(o[e].match(/[a-z]/)){c?(i+=o[e],i+=`${o[e-2]}-${o[e]}`.toUpperCase(),c=!1):"-"===o[e+1]&&(null==(r=o[e+2])?void 0:r.match(/[a-z]/))?(i+=o[e],c=!0):i+=`${o[e]}${o[e].toUpperCase()}`;continue}}else if(o[e].match(/[a-z]/)){i+=`[${o[e]}${o[e].toUpperCase()}]`;continue}if(s){if("^"===o[e]){i+="(^|(?<=[\r\n]))";continue}if("$"===o[e]){i+="($|(?=[\r\n]))";continue}}n&&"."===o[e]?i+=u?`${o[e]}\r\n`:`[${o[e]}\r\n]`:(i+=o[e],"\\"===o[e]?l=!0:u&&"]"===o[e]?u=!1:u||"["!==o[e]||(u=!0))}try{new RegExp(i)}catch(r){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 Ge(e,t){var r,a,s,n,o,i;const l={type:"object",additionalProperties:null!=(r=Ke(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(a=e.keyType)?void 0:a._def.typeName)===se.kY.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:r,...a}=Ye(e.keyType._def,t);return{...l,propertyNames:a}}if((null==(n=e.keyType)?void 0:n._def.typeName)===se.kY.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===se.kY.ZodBranded&&e.keyType._def.type._def.typeName===se.kY.ZodString&&(null==(i=e.keyType._def.type._def.checks)?void 0:i.length)){const{type:r,...a}=Pe(e.keyType._def,t);return{...l,propertyNames:a}}return l}var Ze={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ze(e){try{return e.isOptional()}catch(e){return!0}}var He=(e,t,r)=>{switch(t){case se.kY.ZodString:return Ye(e,r);case se.kY.ZodNumber:return function(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case se.kY.ZodObject:return function(e,t){const r={type:"object",properties:{}},a=[],s=e.shape();for(const e in s){let n=s[e];if(void 0===n||void 0===n._def)continue;const o=ze(n),i=Ke(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==i&&(r.properties[e]=i,o||a.push(e))}a.length&&(r.required=a);const n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Ke(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!==n&&(r.additionalProperties=n),r}(e,r);case se.kY.ZodBigInt:return function(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case se.kY.ZodBoolean:return{type:"boolean"};case se.kY.ZodDate:return $e(e,r);case se.kY.ZodUndefined:return{not:{}};case se.kY.ZodNull:return{type:"null"};case se.kY.ZodArray:return function(e,t){var r,a,s;const n={type:"array"};return(null==(r=e.type)?void 0:r._def)&&(null==(s=null==(a=e.type)?void 0:a._def)?void 0:s.typeName)!==se.kY.ZodAny&&(n.items=Ke(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}(e,r);case se.kY.ZodUnion:case se.kY.ZodDiscriminatedUnion:return function(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((e=>e._def.typeName in Ze&&(!e._def.checks||!e._def.checks.length)))){const e=r.reduce(((e,t)=>{const r=Ze[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e}),[]);return{type:e.length>1?e:e[0]}}if(r.every((e=>"ZodLiteral"===e._def.typeName&&!e.description))){const e=r.reduce(((e,t)=>{const r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}}),[]);if(e.length===r.length){const t=e.filter(((e,t,r)=>r.indexOf(e)===t));return{type:t.length>1?t:t[0],enum:r.reduce(((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value]),[])}}}else if(r.every((e=>"ZodEnum"===e._def.typeName)))return{type:"string",enum:r.reduce(((e,t)=>[...e,...t._def.values.filter((t=>!e.includes(t)))]),[])};return((e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map(((e,r)=>Ke(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]}))).filter((e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0)));return r.length?{anyOf:r}:void 0})(e,t)}(e,r);case se.kY.ZodIntersection:return function(e,t){const r=[Ke(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Ke(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((e=>!!e)),a=[];return r.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:r,...a}=e;t=a}a.push(t)}else a.push(...e.allOf);var t})),a.length?{allOf:a}:void 0}(e,r);case se.kY.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map(((e,r)=>Ke(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[]),additionalItems:Ke(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map(((e,r)=>Ke(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[])}}(e,r);case se.kY.ZodRecord:return Ge(e,r);case se.kY.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 se.kY.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case se.kY.ZodNativeEnum:return function(e){const t=e.values,r=Object.keys(e.values).filter((e=>"number"!=typeof t[t[e]])).map((e=>t[e])),a=Array.from(new Set(r.map((e=>typeof e))));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:r}}(e);case se.kY.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:[Ze[e.innerType._def.typeName],"null"]};const r=Ke(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}(e,r);case se.kY.ZodOptional:return((e,t)=>{var r;if(t.currentPath.toString()===(null==(r=t.propertyPath)?void 0:r.toString()))return Ke(e.innerType._def,t);const a=Ke(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:{}},a]}:{}})(e,r);case se.kY.ZodMap:return function(e,t){return"record"===t.mapStrategy?Ge(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Ke(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},Ke(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}(e,r);case se.kY.ZodSet:return function(e,t){const r={type:"array",uniqueItems:!0,items:Ke(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}(e,r);case se.kY.ZodLazy:return()=>e.getter()._def;case se.kY.ZodPromise:return function(e,t){return Ke(e.type._def,t)}(e,r);case se.kY.ZodNaN:case se.kY.ZodNever:return{not:{}};case se.kY.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Ke(e.schema._def,t):{}}(e,r);case se.kY.ZodAny:case se.kY.ZodUnknown:return{};case se.kY.ZodDefault:return function(e,t){return{...Ke(e.innerType._def,t),default:e.defaultValue()}}(e,r);case se.kY.ZodBranded:return Pe(e,r);case se.kY.ZodReadonly:case se.kY.ZodCatch:return((e,t)=>Ke(e.innerType._def,t))(e,r);case se.kY.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Ke(e.in._def,t);if("output"===t.pipeStrategy)return Ke(e.out._def,t);const r=Ke(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[r,Ke(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]})].filter((e=>void 0!==e))}})(e,r);case se.kY.ZodFunction:case se.kY.ZodVoid:case se.kY.ZodSymbol:default:return}},We=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function Ke(e,t,r=!1){var a;const s=t.seen.get(e);if(t.override){const n=null==(a=t.override)?void 0:a.call(t,e,t,s,r);if(n!==Oe)return n}if(s&&!r){const e=Xe(s,t);if(void 0!==e)return e}const n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);const o=He(e,e.typeName,t),i="function"==typeof o?Ke(o(),t):o;if(i&&Je(e,t,i),t.postProcess){const r=t.postProcess(i,e,t);return n.jsonSchema=i,r}return n.jsonSchema=i,i}var Xe=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:We(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(((e,r)=>t.currentPath[r]===e))?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):"seen"===t.$refStrategy?{}:void 0}},Je=(e,t,r)=>(e.description&&(r.description=e.description),r),Qe=(e,t)=>{var r;const a=(e=>{const t=(e=>"string"==typeof e?{...Me,name:e}:{...Me,...e})(e),r=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map((([e,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}])))}})(t);let s="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce(((e,[t,r])=>{var s;return{...e,[t]:null!=(s=Ke(r._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?s:{}}}),{}):void 0;const n="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,o=null!=(r=Ke(e._def,void 0===n?a:{...a,currentPath:[...a.basePath,a.definitionPath,n]},!1))?r:{},i="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==i&&(o.title=i);const l=void 0===n?s?{...o,[a.definitionPath]:s}:o:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,n].join("/"),[a.definitionPath]:{...s,[n]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},et=Symbol.for("vercel.ai.schema");function tt(e){let t;return()=>(null==t&&(t=e()),t)}function rt(e,{validate:t}={}){return{[et]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function at(e){return null==e?rt({properties:{},additionalProperties:!1}):"object"==typeof(r=e)&&null!==r&&et in r&&!0===r[et]&&"jsonSchema"in r&&"validate"in r?e:"~standard"in e?"zod"===e["~standard"].vendor?st(e):(t=e,rt((()=>Re(t["~standard"].jsonSchema.input({target:"draft-07"}))),{validate:async e=>{const r=await t["~standard"].validate(e);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new X({value:e,cause:r.issues})}}})):e();var t,r}function st(e,t){return function(e){return"_zod"in e}(e)?function(e,t){var r;const a=null!=(r=null==t?void 0:t.useReferences)&&r;return rt((()=>Re(re.b(e,{target:"draft-7",io:"input",reused:a?"ref":"inline"}))),{validate:async t=>{const r=await ae.bp(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t):function(e,t){var r;const a=null!=(r=null==t?void 0:t.useReferences)&&r;return rt((()=>Qe(e,{$refStrategy:a?"root":"none"})),{validate:async t=>{const r=await e.safeParseAsync(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t)}async function nt({value:e,schema:t}){const r=await ot({value:e,schema:t});if(!r.success)throw X.wrap({value:e,cause:r.error});return r.value}async function ot({value:e,schema:t}){const r=at(t);try{if(null==r.validate)return{success:!0,value:e,rawValue:e};const t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:X.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:X.wrap({value:e,cause:t}),rawValue:e}}}async function it({text:e,schema:t}){try{const r=function(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return _e(e)}try{return _e(e)}finally{Error.stackTraceLimit=t}}(e);return null==t?{success:!0,value:r,rawValue:r}:await ot({value:r,schema:t})}catch(t){return{success:!1,error:D.isInstance(t)?t:new D({text:e,cause:t}),rawValue:void 0}}}async function lt(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var ut,ct,pt,dt,ht,mt,ft="vercel.ai.error",gt=Symbol.for(ft),vt=class e extends(ct=Error,ut=gt,ct){constructor({name:e,message:t,cause:r}){super(t),this[ut]=!0,this.name=e,this.cause=r}static isInstance(t){return e.hasMarker(t,ft)}static hasMarker(e,t){const r=Symbol.for(t);return null!=e&&"object"==typeof e&&r in e&&"boolean"==typeof e[r]&&!0===e[r]}},yt="AI_APICallError",xt=`vercel.ai.error.${yt}`,Et=Symbol.for(xt),bt=class extends(dt=vt,pt=Et,dt){constructor({message:e,url:t,requestBodyValues:r,statusCode:a,responseHeaders:s,responseBody:n,cause:o,isRetryable:i=null!=a&&(408===a||409===a||429===a||a>=500),data:l}){super({name:yt,message:e,cause:o}),this[pt]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=a,this.responseHeaders=s,this.responseBody=n,this.isRetryable=i,this.data=l}static isInstance(e){return vt.hasMarker(e,xt)}},It="AI_EmptyResponseBodyError",wt=`vercel.ai.error.${It}`,kt=Symbol.for(wt),St=class extends(mt=vt,ht=kt,mt){constructor({message:e="Empty response body"}={}){super({name:It,message:e}),this[ht]=!0}static isInstance(e){return vt.hasMarker(e,wt)}};function Tt(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var At,Ct,_t,Rt,Nt,Ot,Mt="AI_InvalidArgumentError",Pt=`vercel.ai.error.${Mt}`,$t=Symbol.for(Pt),Lt=class extends(Ct=vt,At=$t,Ct){constructor({message:e,cause:t,argument:r}){super({name:Mt,message:e,cause:t}),this[At]=!0,this.argument=r}static isInstance(e){return vt.hasMarker(e,Pt)}},jt=Symbol.for("vercel.ai.error.AI_InvalidPromptError"),Dt=`vercel.ai.error.${"AI_InvalidResponseDataError"}`,Yt=Symbol.for(Dt),Ft="AI_JSONParseError",Vt=`vercel.ai.error.${Ft}`,qt=Symbol.for(Vt),Ut=class extends(Rt=vt,_t=qt,Rt){constructor({text:e,cause:t}){super({name:Ft,message:`JSON parsing failed: Text: ${e}.\nError message: ${Tt(t)}`,cause:t}),this[_t]=!0,this.text=e}static isInstance(e){return vt.hasMarker(e,Vt)}},Bt=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError"),Gt=`vercel.ai.error.${"AI_LoadSettingError"}`,Zt=Symbol.for(Gt),zt=`vercel.ai.error.${"AI_NoContentGeneratedError"}`,Ht=Symbol.for(zt),Wt=`vercel.ai.error.${"AI_NoSuchModelError"}`,Kt=Symbol.for(Wt),Xt=`vercel.ai.error.${"AI_TooManyEmbeddingValuesForCallError"}`,Jt=Symbol.for(Xt),Qt="AI_TypeValidationError",er=`vercel.ai.error.${Qt}`,tr=Symbol.for(er),rr=class e extends(Ot=vt,Nt=tr,Ot){constructor({value:e,cause:t}){super({name:Qt,message:`Type validation failed: Value: ${JSON.stringify(e)}.\nError message: ${Tt(t)}`,cause:t}),this[Nt]=!0,this.value=e}static isInstance(e){return vt.hasMarker(e,er)}static wrap({value:t,cause:r}){return e.isInstance(r)&&r.value===t?r:new e({value:t,cause:r})}},ar=Symbol.for("vercel.ai.error.AI_UnsupportedFunctionalityError");var sr=r(65994).process;function nr(...e){return e.reduce(((e,t)=>({...e,...null!=t?t:{}})),{})}function or(e){return Object.fromEntries([...e.headers])}var{btoa:ir,atob:lr}=globalThis;function ur(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return ir(t)}var cr=Symbol.for("vercel.ai.error.AI_DownloadError");function pr(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}(({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{if(null==e)return()=>{const e=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[Math.random()*e|0];return a.join("")};if(r.includes(a))throw new Lt({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${r}".`})})();var dr=["fetch failed","failed to fetch"];function hr({error:e,url:t,requestBodyValues:r}){if(pr(e))return e;if(e instanceof TypeError&&dr.includes(e.message.toLowerCase())){const a=e.cause;if(null!=a)return new bt({message:`Cannot connect to API: ${a.message}`,cause:a,url:t,requestBodyValues:r,isRetryable:!0})}return e}function mr(e=globalThis){var t,r,a;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(a=null==(r=e.process)?void 0:r.versions)?void 0:a.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function fr(e,...t){const r=new Headers(function(e){if(null==e)return{};const t={};if(e instanceof Headers)e.forEach(((e,r)=>{t[r.toLowerCase()]=e}));else{Array.isArray(e)||(e=Object.entries(e));for(const[r,a]of e)null!=a&&(t[r.toLowerCase()]=a)}return t}(e)),a=r.get("user-agent")||"";return r.set("user-agent",[a,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var gr="4.0.5",vr=()=>globalThis.fetch,yr=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:a,abortSignal:s,fetch:n=vr()})=>{try{const o=await n(e,{method:"GET",headers:fr(t,`ai-sdk/provider-utils/${gr}`,mr()),signal:s}),i=or(o);if(!o.ok){let t;try{t=await a({response:o,url:e,requestBodyValues:{}})}catch(t){if(pr(t)||bt.isInstance(t))throw t;throw new bt({message:"Failed to process error response",cause:t,statusCode:o.status,url:e,responseHeaders:i,requestBodyValues:{}})}throw t.value}try{return await r({response:o,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(pr(t)||bt.isInstance(t)))throw t;throw new bt({message:"Failed to process successful response",cause:t,statusCode:o.status,url:e,responseHeaders:i,requestBodyValues:{}})}}catch(t){throw hr({error:t,url:e,requestBodyValues:{}})}};function xr({settingValue:e,environmentVariableName:t}){return"string"==typeof e||null==e&&void 0!==sr&&null!=(e=sr.env[t])&&"string"==typeof e?e:void 0}var Er=/"__proto__"\s*:/,br=/"constructor"\s*:/;function Ir(e){const t=JSON.parse(e);return null===t||"object"!=typeof t||!1===Er.test(e)&&!1===br.test(e)?t:function(e){let t=[e];for(;t.length;){const e=t;t=[];for(const r of e){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const e in r){const a=r[e];a&&"object"==typeof a&&t.push(a)}}}return e}(t)}function wr(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return Ir(e)}try{return Ir(e)}finally{Error.stackTraceLimit=t}}function kr(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=Sr(t[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(Sr):Sr(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(Sr)),null!=e.allOf&&(e.allOf=e.allOf.map(Sr)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(Sr));const{definitions:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=Sr(t[e]);return e}function Sr(e){return"boolean"==typeof e?e:kr(e)}var Tr=Symbol("Let zodToJsonSchema decide on which parser to use"),Ar={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 Cr(e,t){return Br(e.type._def,t)}function _r(e,t,r){const a=null!=r?r:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map(((r,a)=>_r(e,t,r)))};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 Rr(e)}}var Rr=e=>{const t={type:"integer",format:"unix-time"};for(const r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value}return t},Nr=void 0,Or={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===Nr&&(Nr=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Nr),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 Mr(e,t){const r={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"email":switch(t.emailStrategy){case"format:email":Lr(r,"email",a.message,t);break;case"format:idn-email":Lr(r,"idn-email",a.message,t);break;case"pattern:zod":jr(r,Or.email,a.message,t)}break;case"url":Lr(r,"uri",a.message,t);break;case"uuid":Lr(r,"uuid",a.message,t);break;case"regex":jr(r,a.regex,a.message,t);break;case"cuid":jr(r,Or.cuid,a.message,t);break;case"cuid2":jr(r,Or.cuid2,a.message,t);break;case"startsWith":jr(r,RegExp(`^${Pr(a.value,t)}`),a.message,t);break;case"endsWith":jr(r,RegExp(`${Pr(a.value,t)}$`),a.message,t);break;case"datetime":Lr(r,"date-time",a.message,t);break;case"date":Lr(r,"date",a.message,t);break;case"time":Lr(r,"time",a.message,t);break;case"duration":Lr(r,"duration",a.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"includes":jr(r,RegExp(Pr(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&Lr(r,"ipv4",a.message,t),"v4"!==a.version&&Lr(r,"ipv6",a.message,t);break;case"base64url":jr(r,Or.base64url,a.message,t);break;case"jwt":jr(r,Or.jwt,a.message,t);break;case"cidr":"v6"!==a.version&&jr(r,Or.ipv4Cidr,a.message,t),"v4"!==a.version&&jr(r,Or.ipv6Cidr,a.message,t);break;case"emoji":jr(r,Or.emoji(),a.message,t);break;case"ulid":jr(r,Or.ulid,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Lr(r,"binary",a.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":jr(r,Or.base64,a.message,t)}break;case"nanoid":jr(r,Or.nanoid,a.message,t)}return r}function Pr(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)$r.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var $r=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Lr(e,t,r,a){var s;e.format||(null==(s=e.anyOf)?void 0:s.some((e=>e.format)))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function jr(e,t,r,a){var s;e.pattern||(null==(s=e.allOf)?void 0:s.some((e=>e.pattern)))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Dr(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=Dr(t,a)}function Dr(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),s=e.flags.includes("m"),n=e.flags.includes("s"),o=a?e.source.toLowerCase():e.source;let i="",l=!1,u=!1,c=!1;for(let e=0;e<o.length;e++)if(l)i+=o[e],l=!1;else{if(a)if(u){if(o[e].match(/[a-z]/)){c?(i+=o[e],i+=`${o[e-2]}-${o[e]}`.toUpperCase(),c=!1):"-"===o[e+1]&&(null==(r=o[e+2])?void 0:r.match(/[a-z]/))?(i+=o[e],c=!0):i+=`${o[e]}${o[e].toUpperCase()}`;continue}}else if(o[e].match(/[a-z]/)){i+=`[${o[e]}${o[e].toUpperCase()}]`;continue}if(s){if("^"===o[e]){i+="(^|(?<=[\r\n]))";continue}if("$"===o[e]){i+="($|(?=[\r\n]))";continue}}n&&"."===o[e]?i+=u?`${o[e]}\r\n`:`[${o[e]}\r\n]`:(i+=o[e],"\\"===o[e]?l=!0:u&&"]"===o[e]?u=!1:u||"["!==o[e]||(u=!0))}try{new RegExp(i)}catch(r){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 Yr(e,t){var r,a,s,n,o,i;const l={type:"object",additionalProperties:null!=(r=Br(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(a=e.keyType)?void 0:a._def.typeName)===se.kY.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:r,...a}=Mr(e.keyType._def,t);return{...l,propertyNames:a}}if((null==(n=e.keyType)?void 0:n._def.typeName)===se.kY.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===se.kY.ZodBranded&&e.keyType._def.type._def.typeName===se.kY.ZodString&&(null==(i=e.keyType._def.type._def.checks)?void 0:i.length)){const{type:r,...a}=Cr(e.keyType._def,t);return{...l,propertyNames:a}}return l}var Fr={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Vr(e){try{return e.isOptional()}catch(e){return!0}}var qr=(e,t,r)=>{switch(t){case se.kY.ZodString:return Mr(e,r);case se.kY.ZodNumber:return function(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case se.kY.ZodObject:return function(e,t){const r={type:"object",properties:{}},a=[],s=e.shape();for(const e in s){let n=s[e];if(void 0===n||void 0===n._def)continue;const o=Vr(n),i=Br(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==i&&(r.properties[e]=i,o||a.push(e))}a.length&&(r.required=a);const n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Br(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!==n&&(r.additionalProperties=n),r}(e,r);case se.kY.ZodBigInt:return function(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case se.kY.ZodBoolean:return{type:"boolean"};case se.kY.ZodDate:return _r(e,r);case se.kY.ZodUndefined:return{not:{}};case se.kY.ZodNull:return{type:"null"};case se.kY.ZodArray:return function(e,t){var r,a,s;const n={type:"array"};return(null==(r=e.type)?void 0:r._def)&&(null==(s=null==(a=e.type)?void 0:a._def)?void 0:s.typeName)!==se.kY.ZodAny&&(n.items=Br(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}(e,r);case se.kY.ZodUnion:case se.kY.ZodDiscriminatedUnion:return function(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((e=>e._def.typeName in Fr&&(!e._def.checks||!e._def.checks.length)))){const e=r.reduce(((e,t)=>{const r=Fr[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e}),[]);return{type:e.length>1?e:e[0]}}if(r.every((e=>"ZodLiteral"===e._def.typeName&&!e.description))){const e=r.reduce(((e,t)=>{const r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}}),[]);if(e.length===r.length){const t=e.filter(((e,t,r)=>r.indexOf(e)===t));return{type:t.length>1?t:t[0],enum:r.reduce(((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value]),[])}}}else if(r.every((e=>"ZodEnum"===e._def.typeName)))return{type:"string",enum:r.reduce(((e,t)=>[...e,...t._def.values.filter((t=>!e.includes(t)))]),[])};return((e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map(((e,r)=>Br(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]}))).filter((e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0)));return r.length?{anyOf:r}:void 0})(e,t)}(e,r);case se.kY.ZodIntersection:return function(e,t){const r=[Br(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Br(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((e=>!!e)),a=[];return r.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:r,...a}=e;t=a}a.push(t)}else a.push(...e.allOf);var t})),a.length?{allOf:a}:void 0}(e,r);case se.kY.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map(((e,r)=>Br(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[]),additionalItems:Br(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map(((e,r)=>Br(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[])}}(e,r);case se.kY.ZodRecord:return Yr(e,r);case se.kY.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 se.kY.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case se.kY.ZodNativeEnum:return function(e){const t=e.values,r=Object.keys(e.values).filter((e=>"number"!=typeof t[t[e]])).map((e=>t[e])),a=Array.from(new Set(r.map((e=>typeof e))));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:r}}(e);case se.kY.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:[Fr[e.innerType._def.typeName],"null"]};const r=Br(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}(e,r);case se.kY.ZodOptional:return((e,t)=>{var r;if(t.currentPath.toString()===(null==(r=t.propertyPath)?void 0:r.toString()))return Br(e.innerType._def,t);const a=Br(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:{}},a]}:{}})(e,r);case se.kY.ZodMap:return function(e,t){return"record"===t.mapStrategy?Yr(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Br(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},Br(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}(e,r);case se.kY.ZodSet:return function(e,t){const r={type:"array",uniqueItems:!0,items:Br(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}(e,r);case se.kY.ZodLazy:return()=>e.getter()._def;case se.kY.ZodPromise:return function(e,t){return Br(e.type._def,t)}(e,r);case se.kY.ZodNaN:case se.kY.ZodNever:return{not:{}};case se.kY.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Br(e.schema._def,t):{}}(e,r);case se.kY.ZodAny:case se.kY.ZodUnknown:return{};case se.kY.ZodDefault:return function(e,t){return{...Br(e.innerType._def,t),default:e.defaultValue()}}(e,r);case se.kY.ZodBranded:return Cr(e,r);case se.kY.ZodReadonly:case se.kY.ZodCatch:return((e,t)=>Br(e.innerType._def,t))(e,r);case se.kY.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Br(e.in._def,t);if("output"===t.pipeStrategy)return Br(e.out._def,t);const r=Br(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[r,Br(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]})].filter((e=>void 0!==e))}})(e,r);case se.kY.ZodFunction:case se.kY.ZodVoid:case se.kY.ZodSymbol:default:return}},Ur=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function Br(e,t,r=!1){var a;const s=t.seen.get(e);if(t.override){const n=null==(a=t.override)?void 0:a.call(t,e,t,s,r);if(n!==Tr)return n}if(s&&!r){const e=Gr(s,t);if(void 0!==e)return e}const n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);const o=qr(e,e.typeName,t),i="function"==typeof o?Br(o(),t):o;if(i&&Zr(e,t,i),t.postProcess){const r=t.postProcess(i,e,t);return n.jsonSchema=i,r}return n.jsonSchema=i,i}var Gr=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ur(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(((e,r)=>t.currentPath[r]===e))?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):"seen"===t.$refStrategy?{}:void 0}},Zr=(e,t,r)=>(e.description&&(r.description=e.description),r),zr=(e,t)=>{var r;const a=(e=>{const t=(e=>"string"==typeof e?{...Ar,name:e}:{...Ar,...e})(e),r=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map((([e,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}])))}})(t);let s="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce(((e,[t,r])=>{var s;return{...e,[t]:null!=(s=Br(r._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?s:{}}}),{}):void 0;const n="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,o=null!=(r=Br(e._def,void 0===n?a:{...a,currentPath:[...a.basePath,a.definitionPath,n]},!1))?r:{},i="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==i&&(o.title=i);const l=void 0===n?s?{...o,[a.definitionPath]:s}:o:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,n].join("/"),[a.definitionPath]:{...s,[n]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},Hr=Symbol.for("vercel.ai.schema");function Wr(e){let t;return()=>(null==t&&(t=e()),t)}function Kr(e,{validate:t}={}){return{[Hr]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function Xr(e,t){return function(e){return"_zod"in e}(e)?function(e,t){var r;const a=null!=(r=null==t?void 0:t.useReferences)&&r;return Kr((()=>kr(re.b(e,{target:"draft-7",io:"input",reused:a?"ref":"inline"}))),{validate:async t=>{const r=await ae.bp(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t):function(e,t){var r;const a=null!=(r=null==t?void 0:t.useReferences)&&r;return Kr((()=>zr(e,{$refStrategy:a?"root":"none"})),{validate:async t=>{const r=await e.safeParseAsync(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t)}async function Jr({value:e,schema:t}){const r=function(e){return null==e?Kr({properties:{},additionalProperties:!1}):"object"==typeof(r=e)&&null!==r&&Hr in r&&!0===r[Hr]&&"jsonSchema"in r&&"validate"in r?e:"~standard"in e?"zod"===e["~standard"].vendor?Xr(e):(t=e,Kr((()=>kr(t["~standard"].jsonSchema.input({target:"draft-07"}))),{validate:async e=>{const r=await t["~standard"].validate(e);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new rr({value:e,cause:r.issues})}}})):e();var t,r}(t);try{if(null==r.validate)return{success:!0,value:e,rawValue:e};const t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:rr.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:rr.wrap({value:e,cause:t}),rawValue:e}}}async function Qr({text:e,schema:t}){try{const r=wr(e);return null==t?{success:!0,value:r,rawValue:r}:await Jr({value:r,schema:t})}catch(t){return{success:!1,error:Ut.isInstance(t)?t:new Ut({text:e,cause:t}),rawValue:void 0}}}function ea({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new ne.Z).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await Qr({text:e,schema:t}))}}))}var ta=()=>globalThis.fetch,ra=async({url:e,headers:t,body:r,failedResponseHandler:a,successfulResponseHandler:s,abortSignal:n,fetch:o})=>aa({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:a,successfulResponseHandler:s,abortSignal:n,fetch:o}),aa=async({url:e,headers:t={},body:r,successfulResponseHandler:a,failedResponseHandler:s,abortSignal:n,fetch:o=ta()})=>{try{const i=await o(e,{method:"POST",headers:fr(t,`ai-sdk/provider-utils/${gr}`,mr()),body:r.content,signal:n}),l=or(i);if(!i.ok){let t;try{t=await s({response:i,url:e,requestBodyValues:r.values})}catch(t){if(pr(t)||bt.isInstance(t))throw t;throw new bt({message:"Failed to process error response",cause:t,statusCode:i.status,url:e,responseHeaders:l,requestBodyValues:r.values})}throw t.value}try{return await a({response:i,url:e,requestBodyValues:r.values})}catch(t){if(t instanceof Error&&(pr(t)||bt.isInstance(t)))throw t;throw new bt({message:"Failed to process successful response",cause:t,statusCode:i.status,url:e,responseHeaders:l,requestBodyValues:r.values})}}catch(t){throw hr({error:t,url:e,requestBodyValues:r.values})}};async function sa(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var na,oa,ia,la,ua,ca,pa,da,ha,ma,fa,ga,va,ya,xa=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:a,url:s,requestBodyValues:n})=>{const o=await a.text(),i=or(a);if(""===o.trim())return{responseHeaders:i,value:new bt({message:a.statusText,url:s,requestBodyValues:n,statusCode:a.status,responseHeaders:i,responseBody:o,isRetryable:null==r?void 0:r(a)})};try{const l=await async function({text:e,schema:t}){try{const r=wr(e);return null==t?r:async function({value:e,schema:t}){const r=await Jr({value:e,schema:t});if(!r.success)throw rr.wrap({value:e,cause:r.error});return r.value}({value:r,schema:t})}catch(t){if(Ut.isInstance(t)||rr.isInstance(t))throw t;throw new Ut({text:e,cause:t})}}({text:o,schema:e});return{responseHeaders:i,value:new bt({message:t(l),url:s,requestBodyValues:n,statusCode:a.status,responseHeaders:i,responseBody:o,data:l,isRetryable:null==r?void 0:r(a,l)})}}catch(e){return{responseHeaders:i,value:new bt({message:a.statusText,url:s,requestBodyValues:n,statusCode:a.status,responseHeaders:i,responseBody:o,isRetryable:null==r?void 0:r(a)})}}},Ea=e=>async({response:t,url:r,requestBodyValues:a})=>{const s=await t.text(),n=await Qr({text:s,schema:e}),o=or(t);if(!n.success)throw new bt({message:"Invalid JSON response",cause:n.error,statusCode:t.status,responseHeaders:o,responseBody:s,url:r,requestBodyValues:a});return{responseHeaders:o,value:n.value,rawValue:n.rawValue}},ba=r(8645),Ia=r(39889),wa=r(9606).URL,ka=r(67787).Buffer,Sa=Symbol.for("vercel.ai.gateway.error"),Ta=class e extends(oa=Error,na=Sa,oa){constructor({message:e,statusCode:t=500,cause:r}){super(e),this[na]=!0,this.statusCode=t,this.cause=r}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return"object"==typeof e&&null!==e&&Sa in e&&!0===e[Sa]}},Aa="GatewayAuthenticationError",Ca=`vercel.ai.gateway.error.${Aa}`,_a=Symbol.for(Ca),Ra=class e extends(la=Ta,ia=_a,la){constructor({message:e="Authentication failed",statusCode:t=401,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[ia]=!0,this.name=Aa,this.type="authentication_error"}static isInstance(e){return Ta.hasMarker(e)&&_a in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:a="Authentication failed",statusCode:s=401,cause:n}){let o;return o=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.":r?"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:o,statusCode:s,cause:n})}},Na="GatewayInvalidRequestError",Oa=`vercel.ai.gateway.error.${Na}`,Ma=Symbol.for(Oa),Pa=class extends(ca=Ta,ua=Ma,ca){constructor({message:e="Invalid request",statusCode:t=400,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[ua]=!0,this.name=Na,this.type="invalid_request_error"}static isInstance(e){return Ta.hasMarker(e)&&Ma in e}},$a="GatewayRateLimitError",La=`vercel.ai.gateway.error.${$a}`,ja=Symbol.for(La),Da=class extends(da=Ta,pa=ja,da){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[pa]=!0,this.name=$a,this.type="rate_limit_exceeded"}static isInstance(e){return Ta.hasMarker(e)&&ja in e}},Ya="GatewayModelNotFoundError",Fa=`vercel.ai.gateway.error.${Ya}`,Va=Symbol.for(Fa),qa=Wr((()=>Xr(ba.Ik({modelId:ba.Yj()})))),Ua=class extends(ma=Ta,ha=Va,ma){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:a}={}){super({message:e,statusCode:t,cause:a}),this[ha]=!0,this.name=Ya,this.type="model_not_found",this.modelId=r}static isInstance(e){return Ta.hasMarker(e)&&Va in e}},Ba="GatewayInternalServerError",Ga=`vercel.ai.gateway.error.${Ba}`,Za=Symbol.for(Ga),za=class extends(ga=Ta,fa=Za,ga){constructor({message:e="Internal server error",statusCode:t=500,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[fa]=!0,this.name=Ba,this.type="internal_server_error"}static isInstance(e){return Ta.hasMarker(e)&&Za in e}},Ha="GatewayResponseError",Wa=`vercel.ai.gateway.error.${Ha}`,Ka=Symbol.for(Wa),Xa=class extends(ya=Ta,va=Ka,ya){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:a,cause:s}={}){super({message:e,statusCode:t,cause:s}),this[va]=!0,this.name=Ha,this.type="response_error",this.response=r,this.validationError=a}static isInstance(e){return Ta.hasMarker(e)&&Ka in e}};async function Ja({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:a,authMethod:s}){const n=await Jr({value:e,schema:Qa});if(!n.success)return new Xa({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:n.error,cause:a});const o=n.value,i=o.error.type,l=o.error.message;switch(i){case"authentication_error":return Ra.createContextualError({apiKeyProvided:"api-key"===s,oidcTokenProvided:"oidc"===s,statusCode:t,cause:a});case"invalid_request_error":return new Pa({message:l,statusCode:t,cause:a});case"rate_limit_exceeded":return new Da({message:l,statusCode:t,cause:a});case"model_not_found":{const e=await Jr({value:o.error.param,schema:qa});return new Ua({message:l,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:a})}default:return new za({message:l,statusCode:t,cause:a})}}var Qa=Wr((()=>Xr(ba.Ik({error:ba.Ik({message:ba.Yj(),type:ba.Yj().nullish(),param:ba.L5().nullish(),code:ba.KC([ba.Yj(),ba.ai()]).nullish()})}))));function es(e,t){var r;return Ta.isInstance(e)?e:bt.isInstance(e)?Ja({response:ts(e),statusCode:null!=(r=e.statusCode)?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):Ja({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}function ts(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 rs="ai-gateway-auth-method";async function as(e){const t=await Jr({value:e[rs],schema:ss});return t.success?t.value:void 0}var ss=Wr((()=>Xr(ba.KC([ba.eu("api-key"),ba.eu("oidc")])))),ns=class{constructor(e){this.config=e}async getAvailableModels(){try{const{value:e}=await yr({url:`${this.config.baseURL}/config`,headers:await sa(this.config.headers()),successfulResponseHandler:Ea(os),failedResponseHandler:xa({errorSchema:ba.bz(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await es(e)}}async getCredits(){try{const e=new wa(this.config.baseURL),{value:t}=await yr({url:`${e.origin}/v1/credits`,headers:await sa(this.config.headers()),successfulResponseHandler:Ea(is),failedResponseHandler:xa({errorSchema:ba.bz(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await es(e)}}},os=Wr((()=>Xr(ba.Ik({models:ba.YO(ba.Ik({id:ba.Yj(),name:ba.Yj(),description:ba.Yj().nullish(),pricing:ba.Ik({input:ba.Yj(),output:ba.Yj(),input_cache_read:ba.Yj().nullish(),input_cache_write:ba.Yj().nullish()}).transform((({input:e,output:t,input_cache_read:r,input_cache_write:a})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...a?{cacheCreationInputTokens:a}:{}}))).nullish(),specification:ba.Ik({specificationVersion:ba.eu("v3"),provider:ba.Yj(),modelId:ba.Yj()}),modelType:ba.k5(["language","embedding","image"]).nullish()}))})))),is=Wr((()=>Xr(ba.Ik({balance:ba.Yj(),total_used:ba.Yj()}).transform((({balance:e,total_used:t})=>({balance:e,totalUsed:t})))))),ls=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,...r}=e;return{args:this.maybeEncodeFileParts(r),warnings:[]}}async doGenerate(e){const{args:t,warnings:r}=await this.getArgs(e),{abortSignal:a}=e,s=await sa(this.config.headers());try{const{responseHeaders:n,value:o,rawValue:i}=await ra({url:this.getUrl(),headers:nr(s,e.headers,this.getModelConfigHeaders(this.modelId,!1),await sa(this.config.o11yHeaders)),body:t,successfulResponseHandler:Ea(ba.bz()),failedResponseHandler:xa({errorSchema:ba.bz(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:n,body:i},warnings:r}}catch(e){throw await es(e,await as(s))}}async doStream(e){const{args:t,warnings:r}=await this.getArgs(e),{abortSignal:a}=e,s=await sa(this.config.headers());try{const{value:o,responseHeaders:i}=await ra({url:this.getUrl(),headers:nr(s,e.headers,this.getModelConfigHeaders(this.modelId,!0),await sa(this.config.o11yHeaders)),body:t,successfulResponseHandler:(n=ba.bz(),async({response:e})=>{const t=or(e);if(null==e.body)throw new St({});return{responseHeaders:t,value:ea({stream:e.body,schema:n})}}),failedResponseHandler:xa({errorSchema:ba.bz(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{stream:o.pipeThrough(new TransformStream({start(e){r.length>0&&e.enqueue({type:"stream-start",warnings:r})},transform(t,r){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)),r.enqueue(a)}else r.error(t.error)}})),request:{body:t},response:{headers:i}}}catch(e){throw await es(e,await as(s))}var n}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),r=ka.from(e).toString("base64");t.data=new wa(`data:${t.mediaType||"application/octet-stream"};base64,${r}`)}}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":"3","ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},us=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:r,providerOptions:a}){var s;const n=await sa(this.config.headers());try{const{responseHeaders:o,value:i,rawValue:l}=await ra({url:this.getUrl(),headers:nr(n,null!=t?t:{},this.getModelConfigHeaders(),await sa(this.config.o11yHeaders)),body:{values:e,...a?{providerOptions:a}:{}},successfulResponseHandler:Ea(cs),failedResponseHandler:xa({errorSchema:ba.bz(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{embeddings:i.embeddings,usage:null!=(s=i.usage)?s:void 0,providerMetadata:i.providerMetadata,response:{headers:o,body:l},warnings:[]}}catch(e){throw await es(e,await as(n))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},cs=Wr((()=>Xr(ba.Ik({embeddings:ba.YO(ba.YO(ba.ai())),usage:ba.Ik({tokens:ba.ai()}).nullish(),providerMetadata:ba.g1(ba.Yj(),ba.g1(ba.Yj(),ba.L5())).optional()})))),ps=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:r,aspectRatio:a,seed:s,files:n,mask:o,providerOptions:i,headers:l,abortSignal:u}){var c;const p=await sa(this.config.headers());try{const{responseHeaders:d,value:h,rawValue:m}=await ra({url:this.getUrl(),headers:nr(p,null!=l?l:{},this.getModelConfigHeaders(),await sa(this.config.o11yHeaders)),body:{prompt:e,n:t,...r&&{size:r},...a&&{aspectRatio:a},...s&&{seed:s},...i&&{providerOptions:i},...n&&{files:n.map((e=>ds(e)))},...o&&{mask:ds(o)}},successfulResponseHandler:Ea(fs),failedResponseHandler:xa({errorSchema:ba.bz(),errorToMessage:e=>e}),...u&&{abortSignal:u},fetch:this.config.fetch});return{images:h.images,warnings:null!=(c=h.warnings)?c:[],providerMetadata:h.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:d}}}catch(e){throw es(e,await as(p))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function ds(e){return"file"===e.type&&e.data instanceof Uint8Array?{...e,data:ur(e.data)}:e}var hs,ms=ba.Ik({images:ba.YO(ba.L5()).optional()}).catchall(ba.L5()),fs=ba.Ik({images:ba.YO(ba.Yj()),warnings:ba.YO(ba.Ik({type:ba.eu("other"),message:ba.Yj()})).optional(),providerMetadata:ba.g1(ba.Yj(),ms).optional()}),gs=function({id:e,inputSchema:t,outputSchema:r,supportsDeferredResults:a}){return({execute:s,needsApproval:n,toModelOutput:o,onInputStart:i,onInputDelta:l,onInputAvailable:u,...c})=>({type:"provider",id:e,args:c,inputSchema:t,outputSchema:r,execute:s,needsApproval:n,toModelOutput:o,onInputStart:i,onInputDelta:l,onInputAvailable:u,supportsDeferredResults:a})}({id:"gateway.perplexity_search",inputSchema:Wr((()=>Xr(se.Ik({query:se.KC([se.Yj(),se.YO(se.Yj())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:se.ai().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:se.ai().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:se.ai().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:se.Yj().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:se.YO(se.Yj()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:se.YO(se.Yj()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:se.Yj().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:se.Yj().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:se.Yj().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:se.Yj().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:se.k5(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")})))),outputSchema:Wr((()=>Xr(se.KC([se.Ik({results:se.YO(se.Ik({title:se.Yj(),url:se.Yj(),snippet:se.Yj(),date:se.Yj().optional(),lastUpdated:se.Yj().optional()})),id:se.Yj()}),se.Ik({error:se.k5(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:se.ai().optional(),message:se.Yj()})]))))}),vs={perplexitySearch:(e={})=>gs(e)},ys=function(e={}){var t,r;let a=null,s=null;const n=null!=(t=e.metadataCacheRefreshMillis)?t:3e5;let o=0;const i=null!=(r=null==(l=e.baseURL)?void 0:l.replace(/\/$/,""))?r:"https://ai-gateway.vercel.sh/v3/ai";var l;const u=async()=>{try{const t=await async function(e){const t=xr({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});return t?{token:t,authMethod:"api-key"}:{token:await(0,Ia.getVercelOidcToken)(),authMethod:"oidc"}}(e);return fr({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":"0.0.1",[rs]:t.authMethod,...e.headers},"ai-sdk/gateway/3.0.13")}catch(e){throw Ra.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=()=>{const e=xr({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),t=xr({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),r=xr({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{const a=await async function(){var e;return null==(e=(0,Ia.getContext)().headers)?void 0:e["x-vercel-id"]}();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...r&&{"ai-o11y-region":r},...a&&{"ai-o11y-request-id":a}}}},p=t=>new ls(t,{provider:"gateway",baseURL:i,headers:u,fetch:e.fetch,o11yHeaders:c()}),d=function(e){if(new.target)throw new Error("The Gateway Provider model function cannot be called with the new keyword.");return p(e)};d.specificationVersion="v3",d.getAvailableModels=async()=>{var t,r,l;const c=null!=(l=null==(r=null==(t=e._internal)?void 0:t.currentDate)?void 0:r.call(t).getTime())?l:Date.now();return(!a||c-o>n)&&(o=c,a=new ns({baseURL:i,headers:u,fetch:e.fetch}).getAvailableModels().then((e=>(s=e,e))).catch((async e=>{throw await es(e,await as(await u()))}))),s?Promise.resolve(s):a},d.getCredits=async()=>new ns({baseURL:i,headers:u,fetch:e.fetch}).getCredits().catch((async e=>{throw await es(e,await as(await u()))})),d.imageModel=t=>new ps(t,{provider:"gateway",baseURL:i,headers:u,fetch:e.fetch,o11yHeaders:c()}),d.languageModel=p;const h=t=>new us(t,{provider:"gateway",baseURL:i,headers:u,fetch:e.fetch,o11yHeaders:c()});return d.embeddingModel=h,d.textEmbeddingModel=h,d.tools=vs,d}(),xs=r(44631),Es=r(19917),bs=r(9606).URL,Is=r(65994).process,ws=Object.defineProperty,ks="AI_InvalidArgumentError",Ss=`vercel.ai.error.${ks}`,Ts=Symbol.for(Ss),As=class extends u{constructor({parameter:e,value:t,message:r}){super({name:ks,message:`Invalid argument for parameter ${e}: ${r}`}),this[hs]=!0,this.parameter=e,this.value=t}static isInstance(e){return u.hasMarker(e,Ss)}};hs=Ts;Symbol.for("vercel.ai.error.AI_InvalidStreamPartError");var Cs,_s="AI_InvalidToolApprovalError",Rs=`vercel.ai.error.${_s}`,Ns=Symbol.for(Rs),Os=class extends u{constructor({approvalId:e}){super({name:_s,message:`Tool approval response references unknown approvalId: "${e}". No matching tool-approval-request found in message history.`}),this[Cs]=!0,this.approvalId=e}static isInstance(e){return u.hasMarker(e,Rs)}};Cs=Ns;var Ms,Ps="AI_InvalidToolInputError",$s=`vercel.ai.error.${Ps}`,Ls=Symbol.for($s),js=class extends u{constructor({toolInput:e,toolName:t,cause:r,message:a=`Invalid input for tool ${t}: ${f(r)}`}){super({name:Ps,message:a,cause:r}),this[Ms]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return u.hasMarker(e,$s)}};Ms=Ls;var Ds,Ys="AI_ToolCallNotFoundForApprovalError",Fs=`vercel.ai.error.${Ys}`,Vs=Symbol.for(Fs),qs=class extends u{constructor({toolCallId:e,approvalId:t}){super({name:Ys,message:`Tool call "${e}" not found for approval request "${t}".`}),this[Ds]=!0,this.toolCallId=e,this.approvalId=t}static isInstance(e){return u.hasMarker(e,Fs)}};Ds=Vs;Symbol.for("vercel.ai.error.AI_NoImageGeneratedError");var Us,Bs="AI_NoObjectGeneratedError",Gs=`vercel.ai.error.${Bs}`,Zs=Symbol.for(Gs),zs=class extends u{constructor({message:e="No object generated.",cause:t,text:r,response:a,usage:s,finishReason:n}){super({name:Bs,message:e,cause:t}),this[Us]=!0,this.text=r,this.response=a,this.usage=s,this.finishReason=n}static isInstance(e){return u.hasMarker(e,Gs)}};Us=Zs;var Hs,Ws="AI_NoOutputGeneratedError",Ks=`vercel.ai.error.${Ws}`,Xs=Symbol.for(Ks),Js=class extends u{constructor({message:e="No output generated.",cause:t}={}){super({name:Ws,message:e,cause:t}),this[Hs]=!0}static isInstance(e){return u.hasMarker(e,Ks)}};Hs=Xs;var Qs,en="AI_NoSuchToolError",tn=`vercel.ai.error.${en}`,rn=Symbol.for(tn),an=class extends u{constructor({toolName:e,availableTools:t,message:r=`Model tried to call unavailable tool '${e}'. ${void 0===t?"No tools are available.":`Available tools: ${t.join(", ")}.`}`}){super({name:en,message:r}),this[Qs]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return u.hasMarker(e,tn)}};Qs=rn;var sn,nn="AI_ToolCallRepairError",on=`vercel.ai.error.${nn}`,ln=Symbol.for(on),un=class extends u{constructor({cause:e,originalError:t,message:r=`Error repairing tool call: ${f(e)}`}){super({name:nn,message:r,cause:e}),this[sn]=!0,this.originalError=t}static isInstance(e){return u.hasMarker(e,on)}};sn=ln;var cn,pn=class extends u{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}},dn=(Symbol.for("vercel.ai.error.AI_InvalidDataContentError"),"AI_InvalidMessageRoleError"),hn=`vercel.ai.error.${dn}`,mn=Symbol.for(hn),fn=class extends u{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:dn,message:t}),this[cn]=!0,this.role=e}static isInstance(e){return u.hasMarker(e,hn)}};cn=mn;var gn,vn="AI_MessageConversionError",yn=`vercel.ai.error.${vn}`,xn=Symbol.for(yn),En=class extends u{constructor({originalMessage:e,message:t}){super({name:vn,message:t}),this[gn]=!0,this.originalMessage=e}static isInstance(e){return u.hasMarker(e,yn)}};gn=xn;var bn,In="AI_RetryError",wn=`vercel.ai.error.${In}`,kn=Symbol.for(wn),Sn=class extends u{constructor({message:e,reason:t,errors:r}){super({name:In,message:e}),this[bn]=!0,this.reason=t,this.errors=r,this.lastError=r[r.length-1]}static isInstance(e){return u.hasMarker(e,wn)}};function Tn({warning:e,provider:t,model:r}){const a=`AI SDK Warning (${t} / ${r}):`;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)}`}}bn=kn;var An=!1,Cn=e=>{if(0===e.warnings.length)return;const t=globalThis.AI_SDK_LOG_WARNINGS;if(!1!==t)if("function"!=typeof t){An||(An=!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(Tn({warning:t,provider:e.provider,model:e.model}))}else t(e)};function _n(e){return"v3"===e.specificationVersion?e:(function({provider:e,modelId:t}){Cn({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 r=await e.doGenerate(...t);return{...r,finishReason:Rn(r.finishReason),usage:Nn(r.usage)}};case"doStream":return async(...t)=>{const r=await e.doStream(...t);return{...r,stream:(a=r.stream,a.pipeThrough(new TransformStream({transform(e,t){"finish"===e.type?t.enqueue({...e,finishReason:Rn(e.finishReason),usage:Nn(e.usage)}):t.enqueue(e)}})))};var a};default:return e[t]}}}))}function Rn(e){return{unified:"unknown"===e?"other":e,raw:void 0}}function Nn(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 On(e){if("string"!=typeof e){if("v3"!==e.specificationVersion&&"v2"!==e.specificationVersion){const t=e;throw new pn({version:t.specificationVersion,provider:t.provider,modelId:t.modelId})}return _n(e)}return(null!=(t=globalThis.AI_SDK_DEFAULT_PROVIDER)?t:ys).languageModel(e);var t}function Mn(e){if(null!=e)return"number"==typeof e?e:e.totalMs}var Pn=[{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]}],$n=e=>{const t="string"==typeof e?ce(e):e,r=(127&t[6])<<21|(127&t[7])<<14|(127&t[8])<<7|127&t[9];return t.slice(r+10)};var Ln="6.0.33",jn=async({url:e})=>{var t;const r=e.toString();try{const e=await fetch(r,{headers:ke({},`ai-sdk/${Ln}`,Ie())});if(!e.ok)throw new ve({url:r,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(ve.isInstance(e))throw e;throw new ve({url:r,cause:e})}},Dn=(e=jn)=>t=>Promise.all(t.map((async t=>t.isUrlSupportedByModel?null:e(t))));var Yn=ba.KC([ba.Yj(),ba.Nl(Uint8Array),ba.Nl(ArrayBuffer),ba.Ie((e=>{var t,r;return null!=(r=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&r}),{message:"Must be a Buffer"})]);function Fn(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 bs(e)}catch(e){}if(e instanceof bs&&"data:"===e.protocol){const{mediaType:t,base64Content:r}=function(e){try{const[t,r]=e.split(",");return{mediaType:t.split(";")[0].split(":")[1],base64Content:r}}catch(e){return{mediaType:void 0,base64Content:void 0}}}(e.toString());if(null==t||null==r)throw new u({name:"InvalidDataContentError",message:`Invalid data URL format in content ${e.toString()}`});return{data:r,mediaType:t}}return{data:e,mediaType:void 0}}function Vn(e){return void 0===e?[]:Array.isArray(e)?e:[e]}async function qn({prompt:e,supportedUrls:t,download:r=Dn()}){const a=await async function(e,t,r){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 r=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 bs(a)}catch(e){}return{mediaType:r,data:a}})).filter((e=>e.data instanceof bs)).map((e=>({url:e.data,isUrlSupportedByModel:null!=e.mediaType&&Te({url:e.data.toString(),mediaType:e.mediaType,supportedUrls:r})}))),s=await t(a);return Object.fromEntries(s.map(((e,t)=>null==e?null:[a[t].url.toString(),{data:e.data,mediaType:e.mediaType}])).filter((e=>null!=e)))}(e.messages,r,t),s=[...null!=e.system?"string"==typeof e.system?[{role:"system",content:e.system}]:Vn(e.system).map((e=>({role:"system",content:e.content,providerOptions:e.providerOptions}))):[],...e.messages.map((e=>function({message:e,downloadedAssets:t}){const r=e.role;switch(r){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 r;if("text"===e.type)return{type:"text",text:e.text,providerOptions:e.providerOptions};let a;const s=e.type;switch(s){case"image":a=e.image;break;case"file":a=e.data;break;default:throw new Error(`Unsupported part type: ${s}`)}const{data:n,mediaType:o}=Fn(a);let i=null!=o?o:e.mediaType,l=n;if(l instanceof bs){const e=t[l.toString()];e&&(l=e.data,null!=i||(i=e.mediaType))}switch(s){case"image":return(l instanceof Uint8Array||"string"==typeof l)&&(i=null!=(r=function({data:e,signatures:t}){const r=function(e){return"string"==typeof e&&e.startsWith("SUQz")||"string"!=typeof e&&e.length>10&&73===e[0]&&68===e[1]&&51===e[2]?$n(e):e}(e),a="string"==typeof r?ce(r.substring(0,Math.min(r.length,24))):r;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:Pn}))?r: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:r,mediaType:a}=Fn(e.data);return{type:"file",data:r,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:Un(e.output),providerOptions:t}}})),providerOptions:e.providerOptions};case"tool":return{role:"tool",content:e.content.filter((e=>"tool-approval-response"!==e.type||e.providerExecuted)).map((e=>{switch(e.type){case"tool-result":return{type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Un(e.output),providerOptions:e.providerOptions};case"tool-approval-response":return{type:"tool-approval-response",approvalId:e.approvalId,approved:e.approved,reason:e.reason}}})),providerOptions:e.providerOptions};default:throw new fn({role:r})}}({message:e,downloadedAssets:a})))],n=[];for(const e of s){if("tool"!==e.role){n.push(e);continue}const t=n.at(-1);"tool"===(null==t?void 0:t.role)?t.content.push(...e.content):n.push(e)}return n}function Un(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}))}}async function Bn({toolCallId:e,input:t,output:r,tool:a,errorMode:s}){return"text"===s?{type:"error-text",value:f(r)}:"json"===s?{type:"error-json",value:Gn(r)}:(null==a?void 0:a.toModelOutput)?await a.toModelOutput({toolCallId:e,input:t,output:r}):"string"==typeof r?{type:"text",value:r}:{type:"json",value:Gn(r)}}function Gn(e){return void 0===e?null:e}var Zn=ba.RZ((()=>ba.KC([ba.ch(),ba.Yj(),ba.ai(),ba.zM(),ba.g1(ba.Yj(),Zn.optional()),ba.YO(Zn)]))),zn=ba.g1(ba.Yj(),ba.g1(ba.Yj(),Zn.optional())),Hn=ba.Ik({type:ba.eu("text"),text:ba.Yj(),providerOptions:zn.optional()}),Wn=ba.Ik({type:ba.eu("image"),image:ba.KC([Yn,ba.Nl(bs)]),mediaType:ba.Yj().optional(),providerOptions:zn.optional()}),Kn=ba.Ik({type:ba.eu("file"),data:ba.KC([Yn,ba.Nl(bs)]),filename:ba.Yj().optional(),mediaType:ba.Yj(),providerOptions:zn.optional()}),Xn=ba.Ik({type:ba.eu("reasoning"),text:ba.Yj(),providerOptions:zn.optional()}),Jn=ba.Ik({type:ba.eu("tool-call"),toolCallId:ba.Yj(),toolName:ba.Yj(),input:ba.L5(),providerOptions:zn.optional(),providerExecuted:ba.zM().optional()}),Qn=ba.gM("type",[ba.Ik({type:ba.eu("text"),value:ba.Yj(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("json"),value:Zn,providerOptions:zn.optional()}),ba.Ik({type:ba.eu("execution-denied"),reason:ba.Yj().optional(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("error-text"),value:ba.Yj(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("error-json"),value:Zn,providerOptions:zn.optional()}),ba.Ik({type:ba.eu("content"),value:ba.YO(ba.KC([ba.Ik({type:ba.eu("text"),text:ba.Yj(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("media"),data:ba.Yj(),mediaType:ba.Yj()}),ba.Ik({type:ba.eu("file-data"),data:ba.Yj(),mediaType:ba.Yj(),filename:ba.Yj().optional(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("file-url"),url:ba.Yj(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("file-id"),fileId:ba.KC([ba.Yj(),ba.g1(ba.Yj(),ba.Yj())]),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("image-data"),data:ba.Yj(),mediaType:ba.Yj(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("image-url"),url:ba.Yj(),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("image-file-id"),fileId:ba.KC([ba.Yj(),ba.g1(ba.Yj(),ba.Yj())]),providerOptions:zn.optional()}),ba.Ik({type:ba.eu("custom"),providerOptions:zn.optional()})]))})]),eo=ba.Ik({type:ba.eu("tool-result"),toolCallId:ba.Yj(),toolName:ba.Yj(),output:Qn,providerOptions:zn.optional()}),to=ba.Ik({type:ba.eu("tool-approval-request"),approvalId:ba.Yj(),toolCallId:ba.Yj()}),ro=ba.Ik({type:ba.eu("tool-approval-response"),approvalId:ba.Yj(),approved:ba.zM(),reason:ba.Yj().optional()}),ao=ba.Ik({role:ba.eu("system"),content:ba.Yj(),providerOptions:zn.optional()}),so=ba.Ik({role:ba.eu("user"),content:ba.KC([ba.Yj(),ba.YO(ba.KC([Hn,Wn,Kn]))]),providerOptions:zn.optional()}),no=ba.Ik({role:ba.eu("assistant"),content:ba.KC([ba.Yj(),ba.YO(ba.KC([Hn,Kn,Xn,Jn,eo,to]))]),providerOptions:zn.optional()}),oo=ba.Ik({role:ba.eu("tool"),content:ba.YO(ba.KC([eo,ro])),providerOptions:zn.optional()}),io=ba.KC([ao,so,no,oo]);function lo(e){if(!Ra.isInstance(e))return e;const t="https://ai-sdk.dev/unauthenticated-ai-gateway";return"production"===(null==Is?void 0:"production")?new u({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 uo({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 co={startSpan:()=>po,startActiveSpan:(e,t,r,a)=>"function"==typeof t?t(po):"function"==typeof r?r(po):"function"==typeof a?a(po):void 0},po={spanContext:()=>ho,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}},ho={traceId:"",spanId:"",traceFlags:0};async function mo({name:e,tracer:t,attributes:r,fn:a,endWhenDone:s=!0}){return t.startActiveSpan(e,{attributes:await r},(async e=>{try{const t=await a(e);return s&&e.end(),t}catch(t){try{fo(e,t)}finally{e.end()}throw t}}))}function fo(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:Es.s.ERROR,message:t.message})):e.setStatus({code:Es.s.ERROR})}async function go({telemetry:e,attributes:t}){if(!0!==(null==e?void 0:e.isEnabled))return{};const r={};for(const[a,s]of Object.entries(t))if(null!=s)if("object"==typeof s&&"input"in s&&"function"==typeof s.input){if(!1===(null==e?void 0:e.recordInputs))continue;const t=await s.input();null!=t&&(r[a]=t)}else if("object"==typeof s&&"output"in s&&"function"==typeof s.output){if(!1===(null==e?void 0:e.recordOutputs))continue;const t=await s.output();null!=t&&(r[a]=t)}else r[a]=s;return r}function vo(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:yo(e.inputTokens.total,e.outputTokens.total),raw:e.raw,reasoningTokens:e.outputTokens.reasoning,cachedInputTokens:e.inputTokens.cacheRead}}function yo(e,t){return null==e&&null==t?void 0:(null!=e?e:0)+(null!=t?t:0)}function xo(e,t){if(void 0===e&&void 0===t)return;if(void 0===e)return t;if(void 0===t)return e;const r={...e};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const s=t[a];if(void 0===s)continue;const n=a in e?e[a]:void 0,o=!(null===s||"object"!=typeof s||Array.isArray(s)||s instanceof Date||s instanceof RegExp),i=!(null==n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||n instanceof RegExp);r[a]=o&&i?xo(n,s):s}return r}var Eo=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:r=2,abortSignal:a}={})=>async s=>bo(s,{maxRetries:e,delayInMs:t,backoffFactor:r,abortSignal:a});async function bo(e,{maxRetries:t,delayInMs:r,backoffFactor:a,abortSignal:s},n=[]){try{return await e()}catch(o){if(be(o))throw o;if(0===t)throw o;const i=Ee(o),l=[...n,o],u=l.length;if(u>t)throw new Sn({message:`Failed after ${u} attempts. Last error: ${i}`,reason:"maxRetriesExceeded",errors:l});if(o instanceof Error&&h.isInstance(o)&&!0===o.isRetryable&&u<=t)return await async function(e,t){if(null==e)return Promise.resolve();const r=null==t?void 0:t.abortSignal;return new Promise(((t,a)=>{if(null==r?void 0:r.aborted)return void a(oe());const s=setTimeout((()=>{n(),t()}),e),n=()=>{clearTimeout(s),null==r||r.removeEventListener("abort",o)},o=()=>{n(),a(oe())};null==r||r.addEventListener("abort",o)}))}(function({error:e,exponentialBackoffDelay:t}){const r=e.responseHeaders;if(!r)return t;let a;const s=r["retry-after-ms"];if(s){const e=parseFloat(s);Number.isNaN(e)||(a=e)}const n=r["retry-after"];if(n&&void 0===a){const e=parseFloat(n);a=Number.isNaN(e)?Date.parse(n)-Date.now():1e3*e}return null!=a&&!Number.isNaN(a)&&0<=a&&(a<6e4||a<t)?a:t}({error:o,exponentialBackoffDelay:r}),{abortSignal:s}),bo(e,{maxRetries:t,delayInMs:a*r,backoffFactor:a,abortSignal:s},l);if(1===u)throw o;throw new Sn({message:`Failed after ${u} attempts with non-retryable error: '${i}'`,reason:"errorNotRetryable",errors:l})}}async function Io({toolCall:e,tools:t,tracer:r,telemetry:a,messages:s,abortSignal:n,experimental_context:o,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 mo({name:"ai.toolCall",attributes:go({telemetry:a,attributes:{...uo({operationId:"ai.toolCall",telemetry:a}),"ai.toolCall.name":l,"ai.toolCall.id":u,"ai.toolCall.args":{output:()=>JSON.stringify(c)}}}),tracer:r,fn:async t=>{let r;try{const t=async function*({execute:e,input:t,options:r}){const a=e(t,r);if(null!=(s=a)&&"function"==typeof s[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 s}({execute:p.execute.bind(p),input:c,options:{toolCallId:u,messages:s,abortSignal:n,experimental_context:o}});for await(const a of t)"preliminary"===a.type?null==i||i({...e,type:"tool-result",output:a.output,preliminary:!0}):r=a.output}catch(r){return fo(t,r),{type:"tool-error",toolCallId:u,toolName:l,input:c,error:r,dynamic:"dynamic"===p.type,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}}try{t.setAttributes(await go({telemetry:a,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(r)}}}))}catch(e){}return{type:"tool-result",toolCallId:u,toolName:l,input:c,output:r,dynamic:"dynamic"===p.type,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}}})}var wo=class{constructor({data:e,mediaType:t}){const r=e instanceof Uint8Array;this.base64Data=r?void 0:e,this.uint8ArrayData=r?e:void 0,this.mediaType=t}get base64(){return null==this.base64Data&&(this.base64Data=pe(this.uint8ArrayData)),this.base64Data}get uint8Array(){return null==this.uint8ArrayData&&(this.uint8ArrayData=ce(this.base64Data)),this.uint8ArrayData}},ko=class extends wo{constructor(e){super(e),this.type="file"}};function So(e){const t=["ROOT"];let r=-1,a=null;function s(e,s,n){switch(e){case'"':r=s,t.pop(),t.push(n),t.push("INSIDE_STRING");break;case"f":case"t":case"n":r=s,a=s,t.pop(),t.push(n),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(n),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=s,t.pop(),t.push(n),t.push("INSIDE_NUMBER");break;case"{":r=s,t.pop(),t.push(n),t.push("INSIDE_OBJECT_START");break;case"[":r=s,t.pop(),t.push(n),t.push("INSIDE_ARRAY_START")}}function n(e,a){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=a,t.pop()}}function o(e,a){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=a,t.pop()}}for(let i=0;i<e.length;i++){const l=e[i];switch(t[t.length-1]){case"ROOT":s(l,i,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":r=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":s(l,i,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":n(l,i);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),r=i;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:r=i}break;case"INSIDE_ARRAY_START":"]"===l?(r=i,t.pop()):(r=i,s(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"]":r=i,t.pop();break;default:r=i}break;case"INSIDE_ARRAY_AFTER_COMMA":s(l,i,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),r=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":r=i;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,i),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&n(l,i);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&n(l,i);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,i);break;default:t.pop()}break;case"INSIDE_LITERAL":{const s=e.substring(a,i+1);"false".startsWith(s)||"true".startsWith(s)||"null".startsWith(s)?r=i:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?n(l,i):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,i));break}}}let i=e.slice(0,r+1);for(let r=t.length-1;r>=0;r--)switch(t[r]){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 To(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await it({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await it({text:So(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}((e,t)=>{for(var r in t)ws(e,r,{get:t[r],enumerable:!0})})({},{array:()=>_o,choice:()=>Ro,json:()=>No,object:()=>Co,text:()=>Ao});var Ao=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e}),createElementStreamTransform(){}}),Co=({schema:e,name:t,description:r})=>{const a=at(e);return{name:"object",responseFormat:lt(a.jsonSchema).then((e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=r&&{description:r}}))),async parseCompleteOutput({text:e},t){const r=await it({text:e});if(!r.success)throw new zs({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const s=await ot({value:r.value,schema:a});if(!s.success)throw new zs({message:"No object generated: response did not match schema.",cause:s.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return s.value},async parsePartialOutput({text:e}){const t=await To(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}},createElementStreamTransform(){}}},_o=({element:e,name:t,description:r})=>{const a=at(e);return{name:"array",responseFormat:lt(a.jsonSchema).then((e=>{const{$schema:a,...s}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}})),async parseCompleteOutput({text:e},t){const r=await it({text:e});if(!r.success)throw new zs({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const s=r.value;if(null==s||"object"!=typeof s||!("elements"in s)||!Array.isArray(s.elements))throw new zs({message:"No object generated: response did not match schema.",cause:new X({value:s,cause:"response must be an object with an elements array"}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(const r of s.elements){const s=await ot({value:r,schema:a});if(!s.success)throw new zs({message:"No object generated: response did not match schema.",cause:s.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return s.elements},async parsePartialOutput({text:e}){const t=await To(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 r="repaired-parse"===t.state&&e.elements.length>0?e.elements.slice(0,-1):e.elements,s=[];for(const e of r){const t=await ot({value:e,schema:a});t.success&&s.push(t.value)}return{partial:s}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},r){if(null!=t)for(;e<t.length;e++)r.enqueue(t[e])}})}}},Ro=({options:e,name:t,description:r})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}),async parseCompleteOutput({text:t},r){const a=await it({text:t});if(!a.success)throw new zs({message:"No object generated: could not parse the response.",cause:a.error,text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});const s=a.value;if(null==s||"object"!=typeof s||!("result"in s)||"string"!=typeof s.result||!e.includes(s.result))throw new zs({message:"No object generated: response did not match schema.",cause:new X({value:s,cause:"response must be an object that contains a choice value."}),text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});return s.result},async parsePartialOutput({text:t}){const r=await To(t);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const t=r.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"===r.state?a.includes(t.result)?{partial:t.result}:void 0:1===a.length?{partial:a[0]}:void 0}}},createElementStreamTransform(){}}),No=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){const r=await it({text:e});if(!r.success)throw new zs({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return r.value},async parsePartialOutput({text:e}){const t=await To(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}}},createElementStreamTransform(){}});async function Oo(e){const t=""===e.input.trim()?{success:!0,value:{}}:await it({text:e.input});if(!1===t.success)throw new js({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 Mo({toolCall:e,tools:t}){const r=e.toolName,a=t[r];if(null==a){if(e.providerExecuted&&e.dynamic)return await Oo(e);throw new an({toolName:e.toolName,availableTools:Object.keys(t)})}const s=at(a.inputSchema),n=""===e.input.trim()?await ot({value:{},schema:s}):await it({text:e.input,schema:s});if(!1===n.success)throw new js({toolName:r,toolInput:e.input,cause:n.error});return"dynamic"===a.type?{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:n.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,dynamic:!0,title:a.title}:{type:"tool-call",toolCallId:e.toolCallId,toolName:r,input:n.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:a.title}}var Po=class{constructor({content:e,finishReason:t,rawFinishReason:r,usage:a,warnings:s,request:n,response:o,providerMetadata:i}){this.content=e,this.finishReason=t,this.rawFinishReason=r,this.usage=a,this.warnings=s,this.request=n,this.response=o,this.providerMetadata=i}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 $o(e){return({steps:t})=>t.length===e}async function Lo({content:e,tools:t}){const r=[],a=[];for(const r of e)if("source"!==r.type&&("tool-result"!==r.type&&"tool-error"!==r.type||r.providerExecuted)&&("text"!==r.type||0!==r.text.length))switch(r.type){case"text":a.push({type:"text",text:r.text,providerOptions:r.providerMetadata});break;case"reasoning":a.push({type:"reasoning",text:r.text,providerOptions:r.providerMetadata});break;case"file":a.push({type:"file",data:r.file.base64,mediaType:r.file.mediaType,providerOptions:r.providerMetadata});break;case"tool-call":a.push({type:"tool-call",toolCallId:r.toolCallId,toolName:r.toolName,input:r.input,providerExecuted:r.providerExecuted,providerOptions:r.providerMetadata});break;case"tool-result":{const e=await Bn({toolCallId:r.toolCallId,input:r.input,tool:null==t?void 0:t[r.toolName],output:r.output,errorMode:"none"});a.push({type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:e,providerOptions:r.providerMetadata});break}case"tool-error":{const e=await Bn({toolCallId:r.toolCallId,input:r.input,tool:null==t?void 0:t[r.toolName],output:r.error,errorMode:"json"});a.push({type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:e,providerOptions:r.providerMetadata});break}case"tool-approval-request":a.push({type:"tool-approval-request",approvalId:r.approvalId,toolCallId:r.toolCall.toolCallId})}a.length>0&&r.push({role:"assistant",content:a});const s=[];for(const r of e){if("tool-result"!==r.type&&"tool-error"!==r.type||r.providerExecuted)continue;const e=await Bn({toolCallId:r.toolCallId,input:r.input,tool:null==t?void 0:t[r.toolName],output:"tool-result"===r.type?r.output:r.error,errorMode:"tool-error"===r.type?"text":"none"});s.push({type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:e,...null!=r.providerMetadata?{providerOptions:r.providerMetadata}:{}})}return s.length>0&&r.push({role:"tool",content:s}),r}function jo(...e){const t=e.filter((e=>null!=e));if(0===t.length)return;if(1===t.length)return t[0];const r=new AbortController;for(const e of t){if(e.aborted)return r.abort(e.reason),r.signal;e.addEventListener("abort",(()=>{r.abort(e.reason)}),{once:!0})}return r.signal}function Do(e,t){const r=new Headers(null!=e?e:{});for(const[e,a]of Object.entries(t))r.has(e)||r.set(e,a);return r}function Yo({response:e,status:t,statusText:r,headers:a,stream:s}){const n=null!=t?t:200;void 0!==r?e.writeHead(n,r,a):e.writeHead(n,a);const o=s.getReader();(async()=>{try{for(;;){const{done:t,value:r}=await o.read();if(t)break;e.write(r)||await new Promise((t=>{e.once("drain",t)}))}}catch(e){throw e}finally{e.end()}})()}ye({prefix:"aitxt",size:24});var Fo=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}\n\n`)},flush(e){e.enqueue("data: [DONE]\n\n")}})}},Vo={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};var qo=tt((()=>st(ba.KC([ba.re({type:ba.eu("text-start"),id:ba.Yj(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("text-delta"),id:ba.Yj(),delta:ba.Yj(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("text-end"),id:ba.Yj(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("error"),errorText:ba.Yj()}),ba.re({type:ba.eu("tool-input-start"),toolCallId:ba.Yj(),toolName:ba.Yj(),providerExecuted:ba.zM().optional(),dynamic:ba.zM().optional(),title:ba.Yj().optional()}),ba.re({type:ba.eu("tool-input-delta"),toolCallId:ba.Yj(),inputTextDelta:ba.Yj()}),ba.re({type:ba.eu("tool-input-available"),toolCallId:ba.Yj(),toolName:ba.Yj(),input:ba.L5(),providerExecuted:ba.zM().optional(),providerMetadata:zn.optional(),dynamic:ba.zM().optional(),title:ba.Yj().optional()}),ba.re({type:ba.eu("tool-input-error"),toolCallId:ba.Yj(),toolName:ba.Yj(),input:ba.L5(),providerExecuted:ba.zM().optional(),providerMetadata:zn.optional(),dynamic:ba.zM().optional(),errorText:ba.Yj(),title:ba.Yj().optional()}),ba.re({type:ba.eu("tool-approval-request"),approvalId:ba.Yj(),toolCallId:ba.Yj()}),ba.re({type:ba.eu("tool-output-available"),toolCallId:ba.Yj(),output:ba.L5(),providerExecuted:ba.zM().optional(),dynamic:ba.zM().optional(),preliminary:ba.zM().optional()}),ba.re({type:ba.eu("tool-output-error"),toolCallId:ba.Yj(),errorText:ba.Yj(),providerExecuted:ba.zM().optional(),dynamic:ba.zM().optional()}),ba.re({type:ba.eu("tool-output-denied"),toolCallId:ba.Yj()}),ba.re({type:ba.eu("reasoning-start"),id:ba.Yj(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("reasoning-delta"),id:ba.Yj(),delta:ba.Yj(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("reasoning-end"),id:ba.Yj(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("source-url"),sourceId:ba.Yj(),url:ba.Yj(),title:ba.Yj().optional(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("source-document"),sourceId:ba.Yj(),mediaType:ba.Yj(),title:ba.Yj(),filename:ba.Yj().optional(),providerMetadata:zn.optional()}),ba.re({type:ba.eu("file"),url:ba.Yj(),mediaType:ba.Yj(),providerMetadata:zn.optional()}),ba.re({type:ba.Ie((e=>"string"==typeof e&&e.startsWith("data-")),{message:'Type must start with "data-"'}),id:ba.Yj().optional(),data:ba.L5(),transient:ba.zM().optional()}),ba.re({type:ba.eu("start-step")}),ba.re({type:ba.eu("finish-step")}),ba.re({type:ba.eu("start"),messageId:ba.Yj().optional(),messageMetadata:ba.L5().optional()}),ba.re({type:ba.eu("finish"),finishReason:ba.k5(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ba.L5().optional()}),ba.re({type:ba.eu("abort"),reason:ba.Yj().optional()}),ba.re({type:ba.eu("message-metadata"),messageMetadata:ba.L5()})]))));function Uo(e){return e.type.startsWith("data-")}function Bo(e){return"text"===e.type}function Go(e){return"file"===e.type}function Zo(e){return"reasoning"===e.type}function zo(e){return e.type.startsWith("tool-")}function Ho(e){return"dynamic-tool"===e.type}function Wo(e){return zo(e)||Ho(e)}function Ko(e){return e.type.split("-").slice(1).join("-")}function Xo(e){return Ho(e)?e.toolName:Ko(e)}function Jo({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 Qo({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:a,onError:s,onToolCall:n,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,i){await a((async({state:a,write:l})=>{var u,c,p,d;function h(e){const t=a.message.parts.filter(Wo).find((t=>t.toolCallId===e));if(null==t)throw new Error(`no tool invocation found for tool call ${e}`);return t}function m(e){var t;const r=a.message.parts.find((t=>zo(t)&&t.toolCallId===e.toolCallId)),s=e,n=r;null!=r?(r.state=e.state,n.input=s.input,n.output=s.output,n.errorText=s.errorText,n.rawInput=s.rawInput,n.preliminary=s.preliminary,void 0!==e.title&&(n.title=e.title),n.providerExecuted=null!=(t=s.providerExecuted)?t:r.providerExecuted,null!=s.providerMetadata&&"input-available"===r.state&&(r.callProviderMetadata=s.providerMetadata)):a.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:s.input,output:s.output,rawInput:s.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted,preliminary:s.preliminary,...null!=s.providerMetadata?{callProviderMetadata:s.providerMetadata}:{}})}function f(e){var t,r;const s=a.message.parts.find((t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId)),n=e,o=s;null!=s?(s.state=e.state,o.toolName=e.toolName,o.input=n.input,o.output=n.output,o.errorText=n.errorText,o.rawInput=null!=(t=n.rawInput)?t:o.rawInput,o.preliminary=n.preliminary,void 0!==e.title&&(o.title=e.title),o.providerExecuted=null!=(r=n.providerExecuted)?r:s.providerExecuted,null!=n.providerMetadata&&"input-available"===s.state&&(s.callProviderMetadata=n.providerMetadata)):a.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:n.input,output:n.output,errorText:n.errorText,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:e.title,...null!=n.providerMetadata?{callProviderMetadata:n.providerMetadata}:{}})}async function g(e){if(null!=e){const r=null!=a.message.metadata?xo(a.message.metadata,e):e;null!=t&&await nt({value:r,schema:t}),a.message.metadata=r}}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(zo);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}):m({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:r}=await To(t.text);t.dynamic?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title}):m({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,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}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),l(),n&&!e.providerExecuted&&await n({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}):m({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=h(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId},l();break}case"tool-output-denied":h(e.toolCallId).state="output-denied",l();break;case"tool-output-available":{const t=h(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}):m({toolCallId:e.toolCallId,toolName:Ko(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=h(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}):m({toolCallId:e.toolCallId,toolName:Ko(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==s||s(new Error(e.errorText));break;default:if(function(e){return e.type.startsWith("data-")}(e)){null!=(null==r?void 0:r[e.type])&&await nt({value:e.data,schema:r[e.type]});const t=e;if(t.transient){null==o||o(t);break}const s=null!=t.id?a.message.parts.find((e=>t.type===e.type&&t.id===e.id)):void 0;null!=s?s.data=t.data:a.message.parts.push(t),null==o||o(t),l()}}i.enqueue(e)}))}}))}function ei(e){const t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){const e=this.getReader();let t=!1;async function r(r){var a;if(!t){t=!0;try{r&&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:s}=await e.read();return a?(await r(!0),{done:!0,value:void 0}):{done:!1,value:s}},return:async()=>(await r(!0),{done:!0,value:void 0}),async throw(e){throw await r(!0),e}}},t}async function ti({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:e}=await r.read();if(e)break}}catch(e){null==t||t(e)}finally{r.releaseLock()}}function ri(){let e,t;return{promise:new Promise(((r,a)=>{e=r,t=a})),resolve:e,reject:t}}function ai(){var e,t;return null!=(t=null==(e=null==globalThis?void 0:globalThis.performance)?void 0:e.now())?t:Date.now()}var si=ye({prefix:"aitxt",size:24});function ni({model:e,tools:t,toolChoice:r,system:a,prompt:s,messages:n,maxRetries:o,abortSignal:i,timeout:l,headers:u,stopWhen:c=$o(1),experimental_output:p,output:d=p,experimental_telemetry:h,prepareStep:m,providerOptions:f,experimental_activeTools:g,activeTools:v=g,experimental_repairToolCall:y,experimental_transform:x,experimental_download:E,includeRawChunks:b=!1,onChunk:I,onError:w=({error:e})=>{console.error(e)},onFinish:k,onAbort:S,onStepFinish:T,experimental_context:A,_internal:{now:C=ai,generateId:_=si}={},...R}){const N=Mn(l),O=function(e){if(null!=e&&"number"!=typeof e)return e.stepMs}(l),M=function(e){if(null!=e&&"number"!=typeof e)return e.chunkMs}(l),P=null!=O?new AbortController:void 0,$=null!=M?new AbortController:void 0;return new oi({model:On(e),telemetry:h,headers:u,settings:R,maxRetries:o,abortSignal:jo(i,null!=N?AbortSignal.timeout(N):void 0,null==P?void 0:P.signal,null==$?void 0:$.signal),stepTimeoutMs:O,stepAbortController:P,chunkTimeoutMs:M,chunkAbortController:$,system:a,prompt:s,messages:n,tools:t,toolChoice:r,transforms:Vn(x),activeTools:v,repairToolCall:y,stopConditions:Vn(c),output:d,providerOptions:f,prepareStep:m,includeRawChunks:b,onChunk:I,onError:w,onFinish:k,onAbort:S,onStepFinish:T,now:C,generateId:_,experimental_context:A,download:E})}var oi=class{constructor({model:e,telemetry:t,headers:r,settings:a,maxRetries:s,abortSignal:n,stepTimeoutMs:o,stepAbortController:i,chunkTimeoutMs:l,chunkAbortController:u,system:c,prompt:p,messages:d,tools:h,toolChoice:m,transforms:g,activeTools:v,repairToolCall:y,stopConditions:x,output:E,providerOptions:b,prepareStep:I,includeRawChunks:w,now:k,generateId:S,onChunk:T,onError:A,onFinish:C,onAbort:_,onStepFinish:R,experimental_context:N,download:O}){let P;this._totalUsage=new ie,this._finishReason=new ie,this._rawFinishReason=new ie,this._steps=new ie,this.outputSpecification=E,this.includeRawChunks=w,this.tools=h;let $=[];const L=[];let j,D,Y,F={},V=[];const q=[],U=new Map;let B,G={},Z={};const z=new TransformStream({async transform(t,r){var a,s,n,o;r.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==T?void 0:T({chunk:i})),"error"===i.type&&await A({error:lo(i.error)}),"text-start"===i.type&&(G[i.id]={type:"text",text:"",providerMetadata:i.providerMetadata},$.push(G[i.id])),"text-delta"===i.type){const e=G[i.id];if(null==e)return void r.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=G[i.id];if(null==e)return void r.enqueue({part:{type:"error",error:`text part ${i.id} not found`},partialOutput:void 0});e.providerMetadata=null!=(s=i.providerMetadata)?s:e.providerMetadata,delete G[i.id]}if("reasoning-start"===i.type&&(Z[i.id]={type:"reasoning",text:"",providerMetadata:i.providerMetadata},$.push(Z[i.id])),"reasoning-delta"===i.type){const e=Z[i.id];if(null==e)return void r.enqueue({part:{type:"error",error:`reasoning part ${i.id} not found`},partialOutput:void 0});e.text+=i.text,e.providerMetadata=null!=(n=i.providerMetadata)?n:e.providerMetadata}if("reasoning-end"===i.type){const e=Z[i.id];if(null==e)return void r.enqueue({part:{type:"error",error:`reasoning part ${i.id} not found`},partialOutput:void 0});e.providerMetadata=null!=(o=i.providerMetadata)?o:e.providerMetadata,delete Z[i.id]}if("file"===i.type&&$.push({type:"file",file:i.file}),"source"===i.type&&$.push(i),"tool-call"===i.type&&$.push(i),"tool-result"!==i.type||i.preliminary||$.push(i),"tool-approval-request"===i.type&&$.push(i),"tool-error"===i.type&&$.push(i),"start-step"===i.type&&($=[],Z={},G={},F=i.request,V=i.warnings),"finish-step"===i.type){const t=await Lo({content:$,tools:h}),r=new Po({content:$,finishReason:i.finishReason,rawFinishReason:i.rawFinishReason,usage:i.usage,warnings:V,request:F,response:{...i.response,messages:[...L,...t]},providerMetadata:i.providerMetadata});await(null==R?void 0:R(r)),Cn({warnings:V,provider:e.provider,model:e.modelId}),q.push(r),L.push(...t),P.resolve()}"finish"===i.type&&(Y=i.totalUsage,j=i.finishReason,D=i.rawFinishReason)},async flush(e){try{if(0===q.length){const e=(null==n?void 0:n.aborted)?n.reason:new Js({message:"No output generated. Check the stream for errors."});return re._finishReason.reject(e),re._rawFinishReason.reject(e),re._totalUsage.reject(e),void re._steps.reject(e)}const e=null!=j?j:"other",r=null!=Y?Y:{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};re._finishReason.resolve(e),re._rawFinishReason.resolve(D),re._totalUsage.resolve(r),re._steps.resolve(q);const a=q[q.length-1];await(null==C?void 0:C({finishReason:a.finishReason,rawFinishReason:a.rawFinishReason,totalUsage:r,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:q,experimental_context:N})),B.setAttributes(await go({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":r.inputTokens,"ai.usage.outputTokens":r.outputTokens,"ai.usage.totalTokens":r.totalTokens,"ai.usage.reasoningTokens":r.reasoningTokens,"ai.usage.cachedInputTokens":r.cachedInputTokens}}))}catch(t){e.error(t)}finally{B.end()}}}),H=function(){let e=[],t=null,r=!1,a=ri();const s=()=>{r=!0,a.resolve(),e.forEach((e=>e.cancel())),e=[],null==t||t.close()},n=async()=>{if(r&&0===e.length)null==t||t.close();else{if(0===e.length)return a=ri(),await a.promise,n();try{const{value:a,done:s}=await e[0].read();s?(e.shift(),0===e.length&&r?null==t||t.close():await n()):null==t||t.enqueue(a)}catch(r){null==t||t.error(r),e.shift(),s()}}};return{stream:new ReadableStream({start(e){t=e},pull:n,async cancel(){for(const t of e)await t.cancel();e=[],r=!0}}),addStream:t=>{if(r)throw new Error("Cannot add inner stream: outer stream is closed");e.push(t.getReader()),a.resolve()},close:()=>{r=!0,a.resolve(),0===e.length&&(null==t||t.close())},terminate:s}}();this.addStream=H.addStream,this.closeStream=H.close;const W=H.stream.getReader();let K=new ReadableStream({async start(e){e.enqueue({type:"start"})},async pull(e){function t(){null==_||_({steps:q}),e.enqueue({type:"abort",...void 0!==(null==n?void 0:n.reason)?{reason:f(n.reason)}:{}}),e.close()}try{const{done:r,value:a}=await W.read();if(r)return void e.close();if(null==n?void 0:n.aborted)return void t();e.enqueue(a)}catch(r){be(r)&&(null==n?void 0:n.aborted)?t():e.error(r)}},cancel:e=>H.stream.cancel(e)});for(const e of g)K=K.pipeThrough(e({tools:h,stopStream(){H.terminate()}}));this.baseStream=K.pipeThrough(function(e){let t,r,a="",s="",n="";function o({controller:e,partialOutput:a}){e.enqueue({part:{type:"text-delta",id:t,text:s,providerMetadata:r},partialOutput:a}),s=""}return new TransformStream({async transform(i,l){var u;if("finish-step"===i.type&&s.length>0&&o({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 s.length>0&&o({controller:l}),void l.enqueue({part:i,partialOutput:void 0});a+=i.text,s+=i.text,r=null!=(u=i.providerMetadata)?u:r;const c=await e.parsePartialOutput({text:a});if(void 0!==c){const e=JSON.stringify(c.partial);e!==n&&(o({controller:l,partialOutput:c.partial}),n=e)}}})}(null!=E?E:Ao())).pipeThrough(z);const{maxRetries:X,retry:J}=function({maxRetries:e,abortSignal:t}){if(null!=e){if(!Number.isInteger(e))throw new As({parameter:"maxRetries",value:e,message:"maxRetries must be an integer"});if(e<0)throw new As({parameter:"maxRetries",value:e,message:"maxRetries must be >= 0"})}const r=null!=e?e:2;return{maxRetries:r,retry:Eo({maxRetries:r,abortSignal:t})}}({maxRetries:s,abortSignal:n}),Q=function({isEnabled:e=!1,tracer:t}={}){return e?t||xs.u.getTracer("ai"):co}(t),ee=function({maxOutputTokens:e,temperature:t,topP:r,topK:a,presencePenalty:s,frequencyPenalty:n,seed:o,stopSequences:i}){if(null!=e){if(!Number.isInteger(e))throw new As({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be an integer"});if(e<1)throw new As({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be >= 1"})}if(null!=t&&"number"!=typeof t)throw new As({parameter:"temperature",value:t,message:"temperature must be a number"});if(null!=r&&"number"!=typeof r)throw new As({parameter:"topP",value:r,message:"topP must be a number"});if(null!=a&&"number"!=typeof a)throw new As({parameter:"topK",value:a,message:"topK must be a number"});if(null!=s&&"number"!=typeof s)throw new As({parameter:"presencePenalty",value:s,message:"presencePenalty must be a number"});if(null!=n&&"number"!=typeof n)throw new As({parameter:"frequencyPenalty",value:n,message:"frequencyPenalty must be a number"});if(null!=o&&!Number.isInteger(o))throw new As({parameter:"seed",value:o,message:"seed must be an integer"});return{maxOutputTokens:e,temperature:t,topP:r,topK:a,presencePenalty:s,frequencyPenalty:n,stopSequences:i,seed:o}}(a),te=function({model:e,settings:t,telemetry:r,headers:a}){var s;return{"ai.model.provider":e.provider,"ai.model.id":e.modelId,...Object.entries(t).reduce(((e,[t,r])=>{if("timeout"===t){const a=Mn(r);null!=a&&(e[`ai.settings.${t}`]=a)}else e[`ai.settings.${t}`]=r;return e}),{}),...Object.entries(null!=(s=null==r?void 0:r.metadata)?s:{}).reduce(((e,[t,r])=>(e[`ai.telemetry.metadata.${t}`]=r,e)),{}),...Object.entries(null!=a?a:{}).reduce(((e,[t,r])=>(void 0!==r&&(e[`ai.request.headers.${t}`]=r),e)),{})}}({model:e,telemetry:t,headers:r,settings:{...ee,maxRetries:X}}),re=this;mo({name:"ai.streamText",attributes:go({telemetry:t,attributes:{...uo({operationId:"ai.streamText",telemetry:t}),...te,"ai.prompt":{input:()=>JSON.stringify({system:c,prompt:p,messages:d})}}}),tracer:Q,endWhenDone:!1,fn:async a=>{B=a;const s=await async function(e){if(null==e.prompt&&null==e.messages)throw new M({prompt:e,message:"prompt or messages must be defined"});if(null!=e.prompt&&null!=e.messages)throw new M({prompt:e,message:"prompt and messages cannot be defined at the same time"});if(null!=e.system&&"string"!=typeof e.system&&!Vn(e.system).every((e=>"object"==typeof e&&null!==e&&"role"in e&&"system"===e.role)))throw new M({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 M({prompt:e,message:"prompt or messages must be defined"});t=e.messages}if(0===t.length)throw new M({prompt:e,message:"messages must not be empty"});const r=await ot({value:t,schema:ba.YO(io)});if(!r.success)throw new M({prompt:e,message:"The messages do not match the ModelMessage[] schema.",cause:r.error});return{messages:t,system:e.system}}({system:c,prompt:p,messages:d}),f=s.messages,g=[],{approvedToolApprovals:w,deniedToolApprovals:T}=function({messages:e}){const t=e.at(-1);if("tool"!=(null==t?void 0:t.role))return{approvedToolApprovals:[],deniedToolApprovals:[]};const r={};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&&(r[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 s={};for(const e of t.content)"tool-result"===e.type&&(s[e.toolCallId]=e);const n=[],o=[],i=t.content.filter((e=>"tool-approval-response"===e.type));for(const e of i){const t=a[e.approvalId];if(null==t)throw new Os({approvalId:e.approvalId});if(null!=s[t.toolCallId])continue;const i=r[t.toolCallId];if(null==i)throw new qs({toolCallId:t.toolCallId,approvalId:t.approvalId});const l={approvalRequest:t,approvalResponse:e,toolCall:i};e.approved?n.push(l):o.push(l)}return{approvedToolApprovals:n,deniedToolApprovals:o}}({messages:f});if(T.length>0||w.length>0){const e=[...w,...T].filter((e=>e.toolCall.providerExecuted)),r=w.filter((e=>!e.toolCall.providerExecuted)),a=T.filter((e=>!e.toolCall.providerExecuted)),s=T.filter((e=>e.toolCall.providerExecuted));let o;const i=new ReadableStream({start(e){o=e}});re.addStream(i);try{for(const e of[...a,...s])null==o||o.enqueue({type:"tool-output-denied",toolCallId:e.toolCall.toolCallId,toolName:e.toolCall.toolName});const i=[];if(await Promise.all(r.map((async e=>{const r=await Io({toolCall:e.toolCall,tools:h,tracer:Q,telemetry:t,messages:f,abortSignal:n,experimental_context:N,onPreliminaryToolResult:e=>{null==o||o.enqueue(e)}});null!=r&&(null==o||o.enqueue(r),i.push(r))}))),e.length>0&&g.push({role:"tool",content:e.map((e=>({type:"tool-approval-response",approvalId:e.approvalResponse.approvalId,approved:e.approvalResponse.approved,reason:e.approvalResponse.reason,providerExecuted:!0})))}),i.length>0||a.length>0){const e=[];for(const t of i)e.push({type:"tool-result",toolCallId:t.toolCallId,toolName:t.toolName,output:await Bn({toolCallId:t.toolCallId,input:t.input,tool:null==h?void 0:h[t.toolName],output:"tool-result"===t.type?t.output:t.error,errorMode:"tool-error"===t.type?"json":"none"})});for(const t of a)e.push({type:"tool-result",toolCallId:t.toolCall.toolCallId,toolName:t.toolCall.toolName,output:{type:"execution-denied",reason:t.approvalResponse.reason}});g.push({role:"tool",content:e})}}finally{null==o||o.close()}}L.push(...g),await async function a({currentStep:p,responseMessages:d,usage:g}){var w,T,A,C,_,R;const M=re.includeRawChunks,$=null!=o?setTimeout((()=>i.abort()),o):void 0;let L;P=new ie;const j=[...f,...d],D=await(null==I?void 0:I({model:e,steps:q,stepNumber:q.length,messages:j,experimental_context:N})),Y=On(null!=(w=null==D?void 0:D.model)?w:e),F=await qn({prompt:{system:null!=(T=null==D?void 0:D.system)?T:s.system,messages:null!=(A=null==D?void 0:D.messages)?A:j},supportedUrls:await Y.supportedUrls,download:O}),{toolChoice:V,tools:B}=await async function({tools:e,toolChoice:t,activeTools:r}){if(!(null!=(a=e)&&Object.keys(a).length>0))return{tools:void 0,toolChoice:void 0};var a;const s=null!=r?Object.entries(e).filter((([e])=>r.includes(e))):Object.entries(e),n=[];for(const[e,t]of s){const r=t.type;switch(r){case void 0:case"dynamic":case"function":n.push({type:"function",name:e,description:t.description,inputSchema:await at(t.inputSchema).jsonSchema,...null!=t.inputExamples?{inputExamples:t.inputExamples}:{},providerOptions:t.providerOptions,...null!=t.strict?{strict:t.strict}:{}});break;case"provider":n.push({type:"provider",name:e,id:t.id,args:t.args});break;default:throw new Error(`Unsupported tool type: ${r}`)}}return{tools:n,toolChoice:null==t?{type:"auto"}:"string"==typeof t?{type:t}:{type:"tool",toolName:t.toolName}}}({tools:h,toolChoice:null!=(C=null==D?void 0:D.toolChoice)?C:m,activeTools:null!=(_=null==D?void 0:D.activeTools)?_:v});N=null!=(R=null==D?void 0:D.experimental_context)?R:N;const G=xo(b,null==D?void 0:D.providerOptions),{result:{stream:Z,response:z,request:H},doStreamSpan:W,startTimestampMs:K}=await J((()=>mo({name:"ai.streamText.doStream",attributes:go({telemetry:t,attributes:{...uo({operationId:"ai.streamText.doStream",telemetry:t}),...te,"ai.model.provider":Y.provider,"ai.model.id":Y.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?pe(new Uint8Array(t)):pe(t)):e.data}:e;var t}))}))))}(F)},"ai.prompt.tools":{input:()=>null==B?void 0:B.map((e=>JSON.stringify(e)))},"ai.prompt.toolChoice":{input:()=>null!=V?JSON.stringify(V):void 0},"gen_ai.system":Y.provider,"gen_ai.request.model":Y.modelId,"gen_ai.request.frequency_penalty":ee.frequencyPenalty,"gen_ai.request.max_tokens":ee.maxOutputTokens,"gen_ai.request.presence_penalty":ee.presencePenalty,"gen_ai.request.stop_sequences":ee.stopSequences,"gen_ai.request.temperature":ee.temperature,"gen_ai.request.top_k":ee.topK,"gen_ai.request.top_p":ee.topP}}),tracer:Q,endWhenDone:!1,fn:async e=>({startTimestampMs:k(),doStreamSpan:e,result:await Y.doStream({...ee,tools:B,toolChoice:V,responseFormat:await(null==E?void 0:E.responseFormat),prompt:F,providerOptions:G,abortSignal:n,headers:r,includeRawChunks:M})})}))),X=function({tools:e,generatorStream:t,tracer:r,telemetry:a,system:s,messages:n,abortSignal:o,repairToolCall:i,experimental_context:l,generateId:u}){let c=null;const p=new ReadableStream({start(e){c=e}}),d=new Set,h=new Map,m=new Map;let f,g=!1;function v(){g&&0===d.size&&(null!=f&&c.enqueue(f),c.close())}const y=new TransformStream({async transform(t,p){const g=t.type;switch(g){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 ko({data:t.data,mediaType:t.mediaType})});break;case"finish":f={type:"finish",finishReason:t.finishReason.unified,rawFinishReason:t.finishReason.raw,usage:vo(t.usage),providerMetadata:t.providerMetadata};break;case"tool-approval-request":{const e=m.get(t.toolCallId);if(null==e){c.enqueue({type:"error",error:new qs({toolCallId:t.toolCallId,approvalId:t.approvalId})});break}p.enqueue({type:"tool-approval-request",approvalId:t.approvalId,toolCall:e});break}case"tool-call":try{const f=await async function({toolCall:e,tools:t,repairToolCall:r,system:a,messages:s}){var n;try{if(null==t){if(e.providerExecuted&&e.dynamic)return await Oo(e);throw new an({toolName:e.toolName})}try{return await Mo({toolCall:e,tools:t})}catch(n){if(null==r||!an.isInstance(n)&&!js.isInstance(n))throw n;let o=null;try{o=await r({toolCall:e,tools:t,inputSchema:async({toolName:e})=>{const{inputSchema:r}=t[e];return await at(r).jsonSchema},system:a,messages:s,error:n})}catch(e){throw new un({cause:e,originalError:n})}if(null==o)throw n;return await Mo({toolCall:o,tools:t})}}catch(r){const a=await it({text:e.input}),s=a.success?a.value:e.input;return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:s,dynamic:!0,invalid:!0,error:r,title:null==(n=null==t?void 0:t[e.toolName])?void 0:n.title,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}}}({toolCall:t,tools:e,repairToolCall:i,system:s,messages:n});if(m.set(f.toolCallId,f),p.enqueue(f),f.invalid){c.enqueue({type:"tool-error",toolCallId:f.toolCallId,toolName:f.toolName,input:f.input,error:Ee(f.error),dynamic:!0,title:f.title});break}const g=null==e?void 0:e[f.toolName];if(null==g)break;if(null!=g.onInputAvailable&&await g.onInputAvailable({input:f.input,toolCallId:f.toolCallId,messages:n,abortSignal:o,experimental_context:l}),await async function({tool:e,toolCall:t,messages:r,experimental_context:a}){return null!=e.needsApproval&&("boolean"==typeof e.needsApproval?e.needsApproval:await e.needsApproval(t.input,{toolCallId:t.toolCallId,messages:r,experimental_context:a}))}({tool:g,toolCall:f,messages:n,experimental_context:l})){c.enqueue({type:"tool-approval-request",approvalId:u(),toolCall:f});break}if(h.set(f.toolCallId,f.input),null!=g.execute&&!0!==f.providerExecuted){const t=u();d.add(t),Io({toolCall:f,tools:e,tracer:r,telemetry:a,messages:n,abortSignal:o,experimental_context:l,onPreliminaryToolResult:e=>{c.enqueue(e)}}).then((e=>{c.enqueue(e)})).catch((e=>{c.enqueue({type:"error",error:e})})).finally((()=>{d.delete(t),v()}))}}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:h.get(t.toolCallId),providerExecuted:!0,error:t.result,dynamic:t.dynamic}):p.enqueue({type:"tool-result",toolCallId:t.toolCallId,toolName:e,input:h.get(t.toolCallId),output:t.result,providerExecuted:!0,dynamic:t.dynamic});break}default:throw new Error(`Unhandled chunk type: ${g}`)}},flush(){g=!0,v()}});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:h,generatorStream:Z,tracer:Q,telemetry:t,system:c,messages:j,repairToolCall:y,abortSignal:n,experimental_context:N,generateId:S}),ae=null!=H?H:{},se=[],ne=[];let oe;const le={};let ue,ce,de="other",he={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},me=!0,fe={id:S(),timestamp:new Date,modelId:e.modelId},ge="";re.addStream(X.pipeThrough(new TransformStream({async transform(e,t){var r,a,s,o,i;if(null!=l&&(null!=L&&clearTimeout(L),L=setTimeout((()=>u.abort()),l)),"stream-start"===e.type)return void(oe=e.warnings);if(me){const e=k()-K;me=!1,W.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":e}),W.setAttributes({"ai.response.msToFirstChunk":e}),t.enqueue({type:"start-step",request:ae,warnings:null!=oe?oe:[]})}const c=e.type;switch(c){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}),ge+=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),se.push(e);break;case"tool-result":t.enqueue(e),e.preliminary||ne.push(e);break;case"tool-error":t.enqueue(e),ne.push(e);break;case"response-metadata":fe={id:null!=(r=e.id)?r:fe.id,timestamp:null!=(a=e.timestamp)?a:fe.timestamp,modelId:null!=(s=e.modelId)?s:fe.modelId};break;case"finish":{he=e.usage,de=e.finishReason,ue=e.rawFinishReason,ce=e.providerMetadata;const t=k()-K;W.addEvent("ai.stream.finish"),W.setAttributes({"ai.response.msToFinish":t,"ai.response.avgOutputTokensPerSecond":1e3*(null!=(o=he.outputTokens)?o:0)/t});break}case"tool-input-start":{le[e.id]=e.toolName;const r=null==h?void 0:h[e.toolName];null!=(null==r?void 0:r.onInputStart)&&await r.onInputStart({toolCallId:e.id,messages:j,abortSignal:n,experimental_context:N}),t.enqueue({...e,dynamic:null!=(i=e.dynamic)?i:"dynamic"===(null==r?void 0:r.type),title:null==r?void 0:r.title});break}case"tool-input-end":delete le[e.id],t.enqueue(e);break;case"tool-input-delta":{const r=le[e.id],a=null==h?void 0:h[r];null!=(null==a?void 0:a.onInputDelta)&&await a.onInputDelta({inputTextDelta:e.delta,toolCallId:e.id,messages:j,abortSignal:n,experimental_context:N}),t.enqueue(e);break}case"error":t.enqueue(e),de="error";break;case"raw":M&&t.enqueue(e);break;default:throw new Error(`Unknown chunk type: ${c}`)}},async flush(e){const r=se.length>0?JSON.stringify(se):void 0;try{W.setAttributes(await go({telemetry:t,attributes:{"ai.response.finishReason":de,"ai.response.text":{output:()=>ge},"ai.response.toolCalls":{output:()=>r},"ai.response.id":fe.id,"ai.response.model":fe.modelId,"ai.response.timestamp":fe.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(ce),"ai.usage.inputTokens":he.inputTokens,"ai.usage.outputTokens":he.outputTokens,"ai.usage.totalTokens":he.totalTokens,"ai.usage.reasoningTokens":he.reasoningTokens,"ai.usage.cachedInputTokens":he.cachedInputTokens,"gen_ai.response.finish_reasons":[de],"gen_ai.response.id":fe.id,"gen_ai.response.model":fe.modelId,"gen_ai.usage.input_tokens":he.inputTokens,"gen_ai.usage.output_tokens":he.outputTokens}}))}catch(e){}finally{W.end()}e.enqueue({type:"finish-step",finishReason:de,rawFinishReason:ue,usage:he,providerMetadata:ce,response:{...fe,headers:null==z?void 0:z.headers}});const s=function(e,t){var r,a,s,n,o,i,l,u,c,p;return{inputTokens:yo(e.inputTokens,t.inputTokens),inputTokenDetails:{noCacheTokens:yo(null==(r=e.inputTokenDetails)?void 0:r.noCacheTokens,null==(a=t.inputTokenDetails)?void 0:a.noCacheTokens),cacheReadTokens:yo(null==(s=e.inputTokenDetails)?void 0:s.cacheReadTokens,null==(n=t.inputTokenDetails)?void 0:n.cacheReadTokens),cacheWriteTokens:yo(null==(o=e.inputTokenDetails)?void 0:o.cacheWriteTokens,null==(i=t.inputTokenDetails)?void 0:i.cacheWriteTokens)},outputTokens:yo(e.outputTokens,t.outputTokens),outputTokenDetails:{textTokens:yo(null==(l=e.outputTokenDetails)?void 0:l.textTokens,null==(u=t.outputTokenDetails)?void 0:u.textTokens),reasoningTokens:yo(null==(c=e.outputTokenDetails)?void 0:c.reasoningTokens,null==(p=t.outputTokenDetails)?void 0:p.reasoningTokens)},totalTokens:yo(e.totalTokens,t.totalTokens),reasoningTokens:yo(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:yo(e.cachedInputTokens,t.cachedInputTokens)}}(g,he);await P.promise;const n=se.filter((e=>!0!==e.providerExecuted)),o=ne.filter((e=>!0!==e.providerExecuted));for(const e of se){if(!0!==e.providerExecuted)continue;const t=null==h?void 0:h[e.toolName];"provider"===(null==t?void 0:t.type)&&t.supportsDeferredResults&&(ne.some((t=>"tool-result"===t.type&&t.toolCallId===e.toolCallId))||U.set(e.toolCallId,{toolName:e.toolName}))}for(const e of ne)"tool-result"===e.type&&U.delete(e.toolCallId);if(null!=$&&clearTimeout($),null!=L&&(clearTimeout(L),L=void 0),(n.length>0&&o.length===n.length||U.size>0)&&!await async function({stopConditions:e,steps:t}){return(await Promise.all(e.map((e=>e({steps:t}))))).some((e=>e))}({stopConditions:x,steps:q})){d.push(...await Lo({content:q[q.length-1].content,tools:h}));try{await a({currentStep:p+1,responseMessages:d,usage:s})}catch(t){e.enqueue({type:"error",error:t}),re.closeStream()}}else e.enqueue({type:"finish",finishReason:de,rawFinishReason:ue,totalUsage:s}),re.closeStream()}})))}({currentStep:0,responseMessages:g,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=>{re.addStream(new ReadableStream({start(t){t.enqueue({type:"error",error:e}),t.close()}})),re.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}get rawFinishReason(){return this.consumeStream(),this._rawFinishReason.promise}teeStream(){const[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return ei(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){"text-delta"===e.type&&t.enqueue(e.text)}})))}get fullStream(){return ei(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await ti({stream:this.fullStream,onError:null==e?void 0:e.onError})}catch(r){null==(t=null==e?void 0:e.onError)||t.call(e,r)}}get experimental_partialOutputStream(){return this.partialOutputStream}get partialOutputStream(){return ei(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:e},t){null!=e&&t.enqueue(e)}})))}get elementStream(){var e,t,r;const a=null==(e=this.outputSpecification)?void 0:e.createElementStreamTransform();if(null==a)throw new te({functionality:`element streams in ${null!=(r=null==(t=this.outputSpecification)?void 0:t.name)?r:"text"} mode`});return ei(this.teeStream().pipeThrough(a))}get output(){return this.finalStep.then((e=>{var t;return(null!=(t=this.outputSpecification)?t:Ao()).parseCompleteOutput({text:e.text},{response:e.response,usage:e.usage,finishReason:e.finishReason})}))}toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:s=!0,sendSources:n=!1,sendStart:o=!0,sendFinish:i=!0,onError:l=f}={}){const u=null!=t?function({originalMessages:e,responseMessageId:t}){if(null==e)return;const r=e[e.length-1];return"assistant"===(null==r?void 0:r.role)?r.id:"function"==typeof t?t():t}({originalMessages:e,responseMessageId:t}):void 0,c=e=>{var t;const r=null==(t=this.tools)?void 0:t[e.toolName];return null==r?e.dynamic:"dynamic"===(null==r?void 0:r.type)||void 0};return ei(function({messageId:e,originalMessages:t=[],onFinish:r,onError:a,stream:s}){let n=null==t?void 0:t[t.length-1];"assistant"!==(null==n?void 0:n.role)?n=void 0:e=n.id;let o=!1;const i=s.pipeThrough(new TransformStream({transform(t,r){if("start"===t.type){const r=t;null==r.messageId&&null!=e&&(r.messageId=e)}"abort"===t.type&&(o=!0),r.enqueue(t)}}));if(null==r)return i;const l=Jo({lastMessage:n?structuredClone(n):void 0,messageId:null!=e?e:""});let u=!1;const c=async()=>{if(u||!r)return;u=!0;const e=l.message.id===(null==n?void 0:n.id);await r({isAborted:o,isContinuation:e,responseMessage:l.message,messages:[...e?t.slice(0,-1):t,l.message],finishReason:l.finishReason})};return Qo({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 r=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":s&&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":n&&"url"===e.sourceType&&t.enqueue({type:"source-url",sourceId:e.id,url:e.url,title:e.title,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}),n&&"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 r=c(e);t.enqueue({type:"tool-input-start",toolCallId:e.id,toolName:e.toolName,...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=r?{dynamic:r}:{},...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 r=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!=r?{dynamic:r}:{},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!=r?{dynamic:r}:{},...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 r=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!=r?{dynamic:r}:{}});break}case"tool-error":{const r=c(e);t.enqueue({type:"tool-output-error",toolCallId:e.toolCallId,errorText:l(e.error),...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=r?{dynamic:r}:{}});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":o&&t.enqueue({type:"start",...null!=r?{messageMetadata:r}:{},...null!=u?{messageId:u}:{}});break;case"finish":i&&t.enqueue({type:"finish",finishReason:e.finishReason,...null!=r?{messageMetadata:r}:{}});break;case"abort":t.enqueue(e);break;case"tool-input-end":case"raw":break;default:throw new Error(`Unknown chunk type: ${p}`)}null!=r&&"start"!==p&&"finish"!==p&&t.enqueue({type:"message-metadata",messageMetadata:r})}})),messageId:null!=u?u:null==t?void 0:t(),originalMessages:e,onFinish:r,onError:l}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:r,onFinish:a,messageMetadata:s,sendReasoning:n,sendSources:o,sendFinish:i,sendStart:l,onError:u,...c}={}){!function({response:e,status:t,statusText:r,headers:a,stream:s,consumeSseStream:n}){let o=s.pipeThrough(new Fo);if(n){const[e,t]=o.tee();o=e,n({stream:t})}Yo({response:e,status:t,statusText:r,headers:Object.fromEntries(Do(a,Vo).entries()),stream:o.pipeThrough(new TextEncoderStream)})}({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:r,onFinish:a,messageMetadata:s,sendReasoning:n,sendSources:o,sendFinish:i,sendStart:l,onError:u}),...c})}pipeTextStreamToResponse(e,t){!function({response:e,status:t,statusText:r,headers:a,textStream:s}){Yo({response:e,status:t,statusText:r,headers:Object.fromEntries(Do(a,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:s.pipeThrough(new TextEncoderStream)})}({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:s,sendSources:n,sendFinish:o,sendStart:i,onError:l,...u}={}){return function({status:e,statusText:t,headers:r,stream:a,consumeSseStream:s}){let n=a.pipeThrough(new Fo);if(s){const[e,t]=n.tee();n=e,s({stream:t})}return new Response(n.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:Do(r,Vo)})}({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:s,sendSources:n,sendFinish:o,sendStart:i,onError:l}),...u})}toTextStreamResponse(e){return function({status:e,statusText:t,headers:r,textStream:a}){return new Response(a.pipeThrough(new TextEncoderStream),{status:null!=e?e:200,statusText:t,headers:Do(r,{"content-type":"text/plain; charset=utf-8"})})}({textStream:this.textStream,...e})}};async function ii(e,t){const r=[];(null==t?void 0:t.ignoreIncompleteToolCalls)&&(e=e.map((e=>({...e,parts:e.parts.filter((e=>!Wo(e)||"input-streaming"!==e.state&&"input-available"!==e.state))}))));for(const a of e)switch(a.role){case"system":{const s=a.parts.filter((e=>"text"===e.type)),n=s.reduce(((e,t)=>null!=t.providerMetadata?{...e,...t.providerMetadata}:e),{});r.push({role:"system",content:s.map((e=>e.text)).join(""),...Object.keys(n).length>0?{providerOptions:n}:{}});break}case"user":r.push({role:"user",content:a.parts.map((e=>{var r;return Bo(e)?{type:"text",text:e.text,...null!=e.providerMetadata?{providerOptions:e.providerMetadata}:{}}:Go(e)?{type:"file",mediaType:e.mediaType,filename:e.filename,data:e.url,...null!=e.providerMetadata?{providerOptions:e.providerMetadata}:{}}:Uo(e)?null==(r=null==t?void 0:t.convertDataPart)?void 0:r.call(t,e):void 0})).filter(Se)});break;case"assistant":if(null!=a.parts){let o=[];async function i(){var e,a,s,n,i,l;if(0===o.length)return;const u=[];for(const r of o)if(Bo(r))u.push({type:"text",text:r.text,...null!=r.providerMetadata?{providerOptions:r.providerMetadata}:{}});else if(Go(r))u.push({type:"file",mediaType:r.mediaType,filename:r.filename,data:r.url});else if(Zo(r))u.push({type:"reasoning",text:r.text,providerOptions:r.providerMetadata});else if(Wo(r)){const s=Xo(r);"input-streaming"!==r.state&&(u.push({type:"tool-call",toolCallId:r.toolCallId,toolName:s,input:"output-error"===r.state?null!=(e=r.input)?e:"rawInput"in r?r.rawInput:void 0:r.input,providerExecuted:r.providerExecuted,...null!=r.callProviderMetadata?{providerOptions:r.callProviderMetadata}:{}}),null!=r.approval&&u.push({type:"tool-approval-request",approvalId:r.approval.id,toolCallId:r.toolCallId}),!0!==r.providerExecuted||"approval-responded"===r.state||"output-available"!==r.state&&"output-error"!==r.state||u.push({type:"tool-result",toolCallId:r.toolCallId,toolName:s,output:await Bn({toolCallId:r.toolCallId,input:r.input,output:"output-error"===r.state?r.errorText:r.output,tool:null==(a=null==t?void 0:t.tools)?void 0:a[s],errorMode:"output-error"===r.state?"json":"none"}),...null!=r.callProviderMetadata?{providerOptions:r.callProviderMetadata}:{}}))}else{if(!Uo(r))throw new Error(`Unsupported part: ${r}`);{const e=null==(s=null==t?void 0:t.convertDataPart)?void 0:s.call(t,r);null!=e&&u.push(e)}}r.push({role:"assistant",content:u});const c=o.filter((e=>{var t;return Wo(e)&&(!0!==e.providerExecuted||null!=(null==(t=e.approval)?void 0:t.approved))}));if(c.length>0){const e=[];for(const r of c)if(null!=(null==(n=r.approval)?void 0:n.approved)&&e.push({type:"tool-approval-response",approvalId:r.approval.id,approved:r.approval.approved,reason:r.approval.reason,providerExecuted:r.providerExecuted}),!0!==r.providerExecuted)switch(r.state){case"output-denied":e.push({type:"tool-result",toolCallId:r.toolCallId,toolName:Xo(r),output:{type:"error-text",value:null!=(i=r.approval.reason)?i:"Tool execution denied."},...null!=r.callProviderMetadata?{providerOptions:r.callProviderMetadata}:{}});break;case"output-error":case"output-available":{const a=Xo(r);e.push({type:"tool-result",toolCallId:r.toolCallId,toolName:a,output:await Bn({toolCallId:r.toolCallId,input:r.input,output:"output-error"===r.state?r.errorText:r.output,tool:null==(l=null==t?void 0:t.tools)?void 0:l[a],errorMode:"output-error"===r.state?"text":"none"}),...null!=r.callProviderMetadata?{providerOptions:r.callProviderMetadata}:{}});break}}e.length>0&&r.push({role:"tool",content:e})}o=[]}for(const l of a.parts)Bo(l)||Zo(l)||Go(l)||Wo(l)||Uo(l)?o.push(l):"step-start"===l.type&&await i();await i();break}break;default:{const u=a.role;throw new En({originalMessage:a,message:`Unsupported role: ${u}`})}}return r}tt((()=>st(ba.YO(ba.Ik({id:ba.Yj(),role:ba.k5(["system","user","assistant"]),metadata:ba.L5().optional(),parts:ba.YO(ba.KC([ba.Ik({type:ba.eu("text"),text:ba.Yj(),state:ba.k5(["streaming","done"]).optional(),providerMetadata:zn.optional()}),ba.Ik({type:ba.eu("reasoning"),text:ba.Yj(),state:ba.k5(["streaming","done"]).optional(),providerMetadata:zn.optional()}),ba.Ik({type:ba.eu("source-url"),sourceId:ba.Yj(),url:ba.Yj(),title:ba.Yj().optional(),providerMetadata:zn.optional()}),ba.Ik({type:ba.eu("source-document"),sourceId:ba.Yj(),mediaType:ba.Yj(),title:ba.Yj(),filename:ba.Yj().optional(),providerMetadata:zn.optional()}),ba.Ik({type:ba.eu("file"),mediaType:ba.Yj(),filename:ba.Yj().optional(),url:ba.Yj(),providerMetadata:zn.optional()}),ba.Ik({type:ba.eu("step-start")}),ba.Ik({type:ba.Yj().startsWith("data-"),id:ba.Yj().optional(),data:ba.L5()}),ba.Ik({type:ba.eu("dynamic-tool"),toolName:ba.Yj(),toolCallId:ba.Yj(),state:ba.eu("input-streaming"),input:ba.L5().optional(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),approval:ba.Zm().optional()}),ba.Ik({type:ba.eu("dynamic-tool"),toolName:ba.Yj(),toolCallId:ba.Yj(),state:ba.eu("input-available"),input:ba.L5(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Zm().optional()}),ba.Ik({type:ba.eu("dynamic-tool"),toolName:ba.Yj(),toolCallId:ba.Yj(),state:ba.eu("approval-requested"),input:ba.L5(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.Zm().optional(),reason:ba.Zm().optional()})}),ba.Ik({type:ba.eu("dynamic-tool"),toolName:ba.Yj(),toolCallId:ba.Yj(),state:ba.eu("approval-responded"),input:ba.L5(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.zM(),reason:ba.Yj().optional()})}),ba.Ik({type:ba.eu("dynamic-tool"),toolName:ba.Yj(),toolCallId:ba.Yj(),state:ba.eu("output-available"),input:ba.L5(),providerExecuted:ba.zM().optional(),output:ba.L5(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),preliminary:ba.zM().optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.eu(!0),reason:ba.Yj().optional()}).optional()}),ba.Ik({type:ba.eu("dynamic-tool"),toolName:ba.Yj(),toolCallId:ba.Yj(),state:ba.eu("output-error"),input:ba.L5(),rawInput:ba.L5().optional(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Yj(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.eu(!0),reason:ba.Yj().optional()}).optional()}),ba.Ik({type:ba.eu("dynamic-tool"),toolName:ba.Yj(),toolCallId:ba.Yj(),state:ba.eu("output-denied"),input:ba.L5(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.eu(!1),reason:ba.Yj().optional()})}),ba.Ik({type:ba.Yj().startsWith("tool-"),toolCallId:ba.Yj(),state:ba.eu("input-streaming"),providerExecuted:ba.zM().optional(),input:ba.L5().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),approval:ba.Zm().optional()}),ba.Ik({type:ba.Yj().startsWith("tool-"),toolCallId:ba.Yj(),state:ba.eu("input-available"),providerExecuted:ba.zM().optional(),input:ba.L5(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Zm().optional()}),ba.Ik({type:ba.Yj().startsWith("tool-"),toolCallId:ba.Yj(),state:ba.eu("approval-requested"),input:ba.L5(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.Zm().optional(),reason:ba.Zm().optional()})}),ba.Ik({type:ba.Yj().startsWith("tool-"),toolCallId:ba.Yj(),state:ba.eu("approval-responded"),input:ba.L5(),providerExecuted:ba.zM().optional(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.zM(),reason:ba.Yj().optional()})}),ba.Ik({type:ba.Yj().startsWith("tool-"),toolCallId:ba.Yj(),state:ba.eu("output-available"),providerExecuted:ba.zM().optional(),input:ba.L5(),output:ba.L5(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),preliminary:ba.zM().optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.eu(!0),reason:ba.Yj().optional()}).optional()}),ba.Ik({type:ba.Yj().startsWith("tool-"),toolCallId:ba.Yj(),state:ba.eu("output-error"),providerExecuted:ba.zM().optional(),input:ba.L5(),rawInput:ba.L5().optional(),output:ba.Zm().optional(),errorText:ba.Yj(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.eu(!0),reason:ba.Yj().optional()}).optional()}),ba.Ik({type:ba.Yj().startsWith("tool-"),toolCallId:ba.Yj(),state:ba.eu("output-denied"),providerExecuted:ba.zM().optional(),input:ba.L5(),output:ba.Zm().optional(),errorText:ba.Zm().optional(),callProviderMetadata:zn.optional(),approval:ba.Ik({id:ba.Yj(),approved:ba.eu(!1),reason:ba.Yj().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")))),ye({prefix:"aiobj",size:24});var li=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise(((t,r)=>{this.queue.push((async()=>{try{await e(),t()}catch(e){r(e)}})),this.processQueue()}))}};ye({prefix:"aiobj",size:24});Symbol.for("vercel.ai.error.AI_NoSuchProviderError");var ui=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:a,fetch:s,prepareSendMessagesRequest:n,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=r,this.body=a,this.fetch=s,this.prepareSendMessagesRequest=n,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){var r,a,s,n,o;const i=await lt(this.body),l=await lt(this.headers),u=await lt(this.credentials),c={...we(l),...we(t.headers)},p=await(null==(r=this.prepareSendMessagesRequest)?void 0:r.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,h=void 0!==(null==p?void 0:p.headers)?we(p.headers):c,m=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!=(s=null==p?void 0:p.credentials)?s:u,g=null!=(n=this.fetch)?n:globalThis.fetch,v=await g(d,{method:"POST",headers:ke({"Content-Type":"application/json",...h},`ai-sdk/${Ln}`,Ie()),body:JSON.stringify(m),credentials:f,signal:e});if(!v.ok)throw new Error(null!=(o=await v.text())?o:"Failed to fetch the chat response.");if(!v.body)throw new Error("The response body is empty.");return this.processResponseStream(v.body)}async reconnectToStream(e){var t,r,a,s,n;const o=await lt(this.body),i=await lt(this.headers),l=await lt(this.credentials),u={...we(i),...we(e.headers)},c=await(null==(t=this.prepareReconnectToStreamRequest)?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...o,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),p=null!=(r=null==c?void 0:c.api)?r:`${this.api}/${e.chatId}/stream`,d=void 0!==(null==c?void 0:c.headers)?we(c.headers):u,h=null!=(a=null==c?void 0:c.credentials)?a:l,m=null!=(s=this.fetch)?s:globalThis.fetch,f=await m(p,{method:"GET",headers:ke(d,`ai-sdk/${Ln}`,Ie()),credentials:h});if(204===f.status)return null;if(!f.ok)throw new Error(null!=(n=await f.text())?n:"Failed to fetch the chat response.");if(!f.body)throw new Error("The response body is empty.");return this.processResponseStream(f.body)}},ci=class extends ui{constructor(e={}){super(e)}processResponseStream(e){return function({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new ne.Z).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await it({text:e,schema:t}))}}))}({stream:e,schema:qo}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},pi=class{constructor({generateId:e=xe,id:t=e(),transport:r=new ci,messageMetadataSchema:a,dataPartSchemas:s,state:n,onError:o,onToolCall:i,onFinish:l,onData:u,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new li,this.sendMessage=async(e,t)=>{var r,a,s,n;if(null==e)return void await this.makeRequest({trigger:"submit-message",messageId:null==(r=this.lastMessage)?void 0:r.id,...t});let o;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:r}=e;return{type:"file",mediaType:r,filename:t,url:await new Promise(((t,r)=>{const a=new FileReader;a.onload=e=>{var r;t(null==(r=e.target)?void 0:r.result)},a.onerror=e=>r(e),a.readAsDataURL(e)}))}})))}(e.files);o={parts:[...t,..."text"in e&&null!=e.text?[{type:"text",text:e.text}]:[]]}}else o=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,{...o,id:e.messageId,role:null!=(a=o.role)?a:"user",metadata:e.metadata})}else this.state.pushMessage({...o,id:null!=(s=o.id)?s:this.generateId(),role:null!=(n=o.role)?n:"user",metadata:e.metadata});await this.makeRequest({trigger:"submit-message",messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{const r=null==e?this.state.messages.length-1:this.state.messages.findIndex((t=>t.id===e));if(-1===r)throw new Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[r].role?r:r+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:r})=>this.jobExecutor.run((async()=>{var a,s;const n=this.state.messages,o=n[n.length-1],i=a=>Wo(a)&&"approval-requested"===a.state&&a.approval.id===e?{...a,state:"approval-responded",approval:{id:e,approved:t,reason:r}}:a;this.state.replaceMessage(n.length-1,{...o,parts:o.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==(s=this.lastMessage)?void 0:s.id})})),this.addToolOutput=async({state:e="output-available",tool:t,toolCallId:r,output:a,errorText:s})=>this.jobExecutor.run((async()=>{var t,n;const o=this.state.messages,i=o[o.length-1],l=t=>Wo(t)&&t.toolCallId===r?{...t,state:e,output:a,errorText:s}:t;this.state.replaceMessage(o.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==(n=this.lastMessage)?void 0:n.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=r,this.generateId=e,this.messageMetadataSchema=a,this.dataPartSchemas=s,this.state=n,this.onError=o,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:r,body:a,messageId:s}){var n,o,i,l;this.setStatus({status:"submitted",error:void 0});const u=this.lastMessage;let c=!1,p=!1,d=!1;try{const n={state:Jo({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};let o;if(n.abortController.signal.addEventListener("abort",(()=>{c=!0})),this.activeResponse=n,"resume-stream"===e){const e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:a});if(null==e)return void this.setStatus({status:"ready"});o=e}else o=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:n.abortController.signal,metadata:t,headers:r,body:a,trigger:e,messageId:s});const i=e=>this.jobExecutor.run((()=>e({state:n.state,write:()=>{var e;this.setStatus({status:"streaming"}),n.state.message.id===(null==(e=this.lastMessage)?void 0:e.id)?this.state.replaceMessage(this.state.messages.length-1,n.state.message):this.state.pushMessage(n.state.message)}})));await ti({stream:Qo({stream:o,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==(o=this.onFinish)||o.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:p,isError:d,finishReason:null==(n=this.activeResponse)?void 0:n.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:r,body:a})}};function di({messages:e}){const t=e[e.length-1];if(!t)return!1;if("assistant"!==t.role)return!1;const r=t.parts.reduce(((e,t,r)=>"step-start"===t.type?r:e),-1),a=t.parts.slice(r+1).filter(Wo).filter((e=>!e.providerExecuted));return a.filter((e=>"approval-responded"===e.state)).length>0&&a.every((e=>"output-available"===e.state||"output-error"===e.state||"approval-responded"===e.state))}},28742:e=>{var t={};e.exports=function(e,r){var a=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(r)}},29385:(e,t,r)=>{var a=r(65994).process;const s="object"==typeof a&&a.env&&a.env.NODE_DEBUG&&/\bsemver\b/i.test(a.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=s},29478:(e,t,r)=>{const a=r(88825);e.exports=(e,t)=>new a(e,t).patch},29520:(e,t,r)=>{var a=r(69316),s=r(76462);function n(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=r(40811),e.exports.Schema=r(54420),e.exports.FAILSAFE_SCHEMA=r(91714),e.exports.JSON_SCHEMA=r(15037),e.exports.CORE_SCHEMA=r(6340),e.exports.DEFAULT_SAFE_SCHEMA=r(18184),e.exports.DEFAULT_FULL_SCHEMA=r(57116),e.exports.load=a.load,e.exports.loadAll=a.loadAll,e.exports.safeLoad=a.safeLoad,e.exports.safeLoadAll=a.safeLoadAll,e.exports.dump=s.dump,e.exports.safeDump=s.safeDump,e.exports.YAMLException=r(4414),e.exports.MINIMAL_SCHEMA=r(91714),e.exports.SAFE_SCHEMA=r(18184),e.exports.DEFAULT_SCHEMA=r(57116),e.exports.scan=n("scan"),e.exports.parse=n("parse"),e.exports.compose=n("compose"),e.exports.addConstructor=n("addConstructor")},30044:(e,t,r)=>{const a=r(34219);e.exports=(e,t)=>{const r=a(e,t);return r&&r.prerelease.length?r.prerelease:null}},30403:(e,t,r)=>{const a=r(83586);e.exports=(e,t)=>{const r=a(e,t);return r&&r.prerelease.length?r.prerelease:null}},32056:(e,t,r)=>{const a=r(25583);e.exports=(e,t,r)=>0!==a(e,t,r)},32910:(e,t,r)=>{const a=r(48381),s=r(55141),{ANY:n}=s,o=r(20332),i=r(43301),l=r(58809),u=r(20038),c=r(66239),p=r(54506);e.exports=(e,t,r,d)=>{let h,m,f,g,v;switch(e=new a(e,d),t=new o(t,d),r){case">":h=l,m=c,f=u,g=">",v=">=";break;case"<":h=u,m=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 r=0;r<t.set.length;++r){const a=t.set[r];let o=null,i=null;if(a.forEach((e=>{e.semver===n&&(e=new s(">=0.0.0")),o=o||e,i=i||e,h(e.semver,o.semver,d)?o=e:f(e.semver,i.semver,d)&&(i=e)})),o.operator===g||o.operator===v)return!1;if((!i.operator||i.operator===g)&&m(e,i.semver))return!1;if(i.operator===v&&f(e,i.semver))return!1}return!0}},32924:(e,t,r)=>{const a=r(41694);e.exports=(e,t)=>new a(e,t).minor},34218:(e,t,r)=>{const a=r(41694),s=r(71333);e.exports=(e,t,r)=>{let n=null,o=null,i=null;try{i=new s(t,r)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(n&&-1!==o.compare(e)||(n=e,o=new a(n,r)))})),n}},34219:(e,t,r)=>{const a=r(48381);e.exports=(e,t,r=!1)=>{if(e instanceof a)return e;try{return new a(e,t)}catch(e){if(!r)return null;throw e}}},34335:(e,t,r)=>{const a=r(20332),s=r(55141),{ANY:n}=s,o=r(43301),i=r(77203),l=[new s(">=0.0.0-0")],u=[new s(">=0.0.0")],c=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===n){if(1===t.length&&t[0].semver===n)return!0;e=r.includePrerelease?l:u}if(1===t.length&&t[0].semver===n){if(r.includePrerelease)return!0;t=u}const a=new Set;let s,c,h,m,f,g,v;for(const t of e)">"===t.operator||">="===t.operator?s=p(s,t,r):"<"===t.operator||"<="===t.operator?c=d(c,t,r):a.add(t.semver);if(a.size>1)return null;if(s&&c){if(h=i(s.semver,c.semver,r),h>0)return null;if(0===h&&(">="!==s.operator||"<="!==c.operator))return null}for(const e of a){if(s&&!o(e,String(s),r))return null;if(c&&!o(e,String(c),r))return null;for(const a of t)if(!o(e,String(a),r))return!1;return!0}let y=!(!c||r.includePrerelease||!c.semver.prerelease.length)&&c.semver,x=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.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,s)if(x&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===x.major&&e.semver.minor===x.minor&&e.semver.patch===x.patch&&(x=!1),">"===e.operator||">="===e.operator){if(m=p(s,e,r),m===e&&m!==s)return!1}else if(">="===s.operator&&!o(s.semver,String(e),r))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,r),f===e&&f!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),r))return!1;if(!e.operator&&(c||s)&&0!==h)return!1}return!(s&&g&&!c&&0!==h||c&&v&&!s&&0!==h||x||y)},p=(e,t,r)=>{if(!e)return t;const a=i(e.semver,t.semver,r);return a>0?e:a<0||">"===t.operator&&">="===e.operator?t:e},d=(e,t,r)=>{if(!e)return t;const a=i(e.semver,t.semver,r);return a<0?e:a>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new a(e,r),t=new a(t,r);let s=!1;e:for(const a of e.set){for(const e of t.set){const t=c(a,e,r);if(s=s||null!==t,t)continue e}if(s)return!1}return!0}},36059:(e,t,r)=>{const a=r(77203);e.exports=(e,t,r)=>a(t,e,r)},36165:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:n}=r(41755),o=r(95869),i=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],p=t.t={};let d=0;const h="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",n],[h,s]],f=(e,t,r)=>{const a=(e=>{for(const[t,r]of m)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),s=d++;o(e,s,t),p[e]=s,u[s]=t,c[s]=a,i[s]=new RegExp(t,r?"g":void 0),l[s]=new RegExp(a,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),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",`${h}+`),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*$")},36582:(e,t,r)=>{const a=r(71333),s=r(96082),{ANY:n}=s,o=r(9480),i=r(40289),l=[new s(">=0.0.0-0")],u=[new s(">=0.0.0")],c=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===n){if(1===t.length&&t[0].semver===n)return!0;e=r.includePrerelease?l:u}if(1===t.length&&t[0].semver===n){if(r.includePrerelease)return!0;t=u}const a=new Set;let s,c,h,m,f,g,v;for(const t of e)">"===t.operator||">="===t.operator?s=p(s,t,r):"<"===t.operator||"<="===t.operator?c=d(c,t,r):a.add(t.semver);if(a.size>1)return null;if(s&&c){if(h=i(s.semver,c.semver,r),h>0)return null;if(0===h&&(">="!==s.operator||"<="!==c.operator))return null}for(const e of a){if(s&&!o(e,String(s),r))return null;if(c&&!o(e,String(c),r))return null;for(const a of t)if(!o(e,String(a),r))return!1;return!0}let y=!(!c||r.includePrerelease||!c.semver.prerelease.length)&&c.semver,x=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.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,s)if(x&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===x.major&&e.semver.minor===x.minor&&e.semver.patch===x.patch&&(x=!1),">"===e.operator||">="===e.operator){if(m=p(s,e,r),m===e&&m!==s)return!1}else if(">="===s.operator&&!o(s.semver,String(e),r))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,r),f===e&&f!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),r))return!1;if(!e.operator&&(c||s)&&0!==h)return!1}return!(s&&g&&!c&&0!==h||c&&v&&!s&&0!==h||x||y)},p=(e,t,r)=>{if(!e)return t;const a=i(e.semver,t.semver,r);return a>0?e:a<0||">"===t.operator&&">="===e.operator?t:e},d=(e,t,r)=>{if(!e)return t;const a=i(e.semver,t.semver,r);return a<0?e:a>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new a(e,r),t=new a(t,r);let s=!1;e:for(const a of e.set){for(const e of t.set){const t=c(a,e,r);if(s=s||null!==t,t)continue e}if(s)return!1}return!0}},36749:(e,t,r)=>{const a=r(40289);e.exports=(e,t,r)=>0!==a(e,t,r)},37276:(e,t,r)=>{const a=r(71333);e.exports=(e,t)=>{try{return new a(e,t).range||"*"}catch(e){return null}}},37359:(e,t,r)=>{const a=r(87391);e.exports=(e,t)=>e.sort(((e,r)=>a(r,e,t)))},37385:(e,t,r)=>{e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},38185:(e,t,r)=>{const a=r(88825),s=r(20360);e.exports=(e,t,r)=>{let n=null,o=null,i=null;try{i=new s(t,r)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(n&&1!==o.compare(e)||(n=e,o=new a(n,r)))})),n}},38248:(e,t,r)=>{r.d(t,{gM:()=>zr});var a,s,n,o,i,l,u,c,p,d,h,m,f,g,v=r(41210),y=r(12574),x=r(8645),E=r(84340),b=r(39889),I=r(9606).URL,w=r(67787).Buffer,k=Symbol.for("vercel.ai.gateway.error"),S=class e extends(s=Error,a=k,s){constructor({message:e,statusCode:t=500,cause:r}){super(e),this[a]=!0,this.statusCode=t,this.cause=r}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return"object"==typeof e&&null!==e&&k in e&&!0===e[k]}},T="GatewayAuthenticationError",A=`vercel.ai.gateway.error.${T}`,C=Symbol.for(A),_=class e extends(o=S,n=C,o){constructor({message:e="Authentication failed",statusCode:t=401,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[n]=!0,this.name=T,this.type="authentication_error"}static isInstance(e){return S.hasMarker(e)&&C in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:a="Authentication failed",statusCode:s=401,cause:n}){let o;return o=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.":r?"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:o,statusCode:s,cause:n})}},R="GatewayInvalidRequestError",N=`vercel.ai.gateway.error.${R}`,O=Symbol.for(N),M=class extends(l=S,i=O,l){constructor({message:e="Invalid request",statusCode:t=400,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[i]=!0,this.name=R,this.type="invalid_request_error"}static isInstance(e){return S.hasMarker(e)&&O in e}},P="GatewayRateLimitError",$=`vercel.ai.gateway.error.${P}`,L=Symbol.for($),j=class extends(c=S,u=L,c){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[u]=!0,this.name=P,this.type="rate_limit_exceeded"}static isInstance(e){return S.hasMarker(e)&&L in e}},D="GatewayModelNotFoundError",Y=`vercel.ai.gateway.error.${D}`,F=Symbol.for(Y),V=(0,v.ID)((()=>(0,v.jN)(x.Ik({modelId:x.Yj()})))),q=class extends(d=S,p=F,d){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:a}={}){super({message:e,statusCode:t,cause:a}),this[p]=!0,this.name=D,this.type="model_not_found",this.modelId=r}static isInstance(e){return S.hasMarker(e)&&F in e}},U="GatewayInternalServerError",B=`vercel.ai.gateway.error.${U}`,G=Symbol.for(B),Z=class extends(m=S,h=G,m){constructor({message:e="Internal server error",statusCode:t=500,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[h]=!0,this.name=U,this.type="internal_server_error"}static isInstance(e){return S.hasMarker(e)&&G in e}},z="GatewayResponseError",H=`vercel.ai.gateway.error.${z}`,W=Symbol.for(H),K=class extends(g=S,f=W,g){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:a,cause:s}={}){super({message:e,statusCode:t,cause:s}),this[f]=!0,this.name=z,this.type="response_error",this.response=r,this.validationError=a}static isInstance(e){return S.hasMarker(e)&&W in e}};async function X({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:a,authMethod:s}){const n=await(0,v.ZZ)({value:e,schema:J});if(!n.success)return new K({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:n.error,cause:a});const o=n.value,i=o.error.type,l=o.error.message;switch(i){case"authentication_error":return _.createContextualError({apiKeyProvided:"api-key"===s,oidcTokenProvided:"oidc"===s,statusCode:t,cause:a});case"invalid_request_error":return new M({message:l,statusCode:t,cause:a});case"rate_limit_exceeded":return new j({message:l,statusCode:t,cause:a});case"model_not_found":{const e=await(0,v.ZZ)({value:o.error.param,schema:V});return new q({message:l,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:a})}default:return new Z({message:l,statusCode:t,cause:a})}}var J=(0,v.ID)((()=>(0,v.jN)(x.Ik({error:x.Ik({message:x.Yj(),type:x.Yj().nullish(),param:x.L5().nullish(),code:x.KC([x.Yj(),x.ai()]).nullish()})}))));function Q(e,t){var r;return S.isInstance(e)?e:y.hL.isInstance(e)?X({response:ee(e),statusCode:null!=(r=e.statusCode)?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):X({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}function ee(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 te="ai-gateway-auth-method";async function re(e){const t=await(0,v.ZZ)({value:e[te],schema:ae});return t.success?t.value:void 0}var ae=(0,v.ID)((()=>(0,v.jN)(x.KC([x.eu("api-key"),x.eu("oidc")])))),se=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)(ne),failedResponseHandler:(0,v.sl)({errorSchema:x.bz(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await Q(e)}}async getCredits(){try{const e=new I(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:x.bz(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await Q(e)}}},ne=(0,v.ID)((()=>(0,v.jN)(x.Ik({models:x.YO(x.Ik({id:x.Yj(),name:x.Yj(),description:x.Yj().nullish(),pricing:x.Ik({input:x.Yj(),output:x.Yj(),input_cache_read:x.Yj().nullish(),input_cache_write:x.Yj().nullish()}).transform((({input:e,output:t,input_cache_read:r,input_cache_write:a})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...a?{cacheCreationInputTokens:a}:{}}))).nullish(),specification:x.Ik({specificationVersion:x.eu("v3"),provider:x.Yj(),modelId:x.Yj()}),modelType:x.k5(["language","embedding","image"]).nullish()}))})))),oe=(0,v.ID)((()=>(0,v.jN)(x.Ik({balance:x.Yj(),total_used:x.Yj()}).transform((({balance:e,total_used:t})=>({balance:e,totalUsed:t})))))),ie=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,...r}=e;return{args:this.maybeEncodeFileParts(r),warnings:[]}}async doGenerate(e){const{args:t,warnings:r}=await this.getArgs(e),{abortSignal:a}=e,s=await(0,v.hd)(this.config.headers());try{const{responseHeaders:n,value:o,rawValue:i}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(s,e.headers,this.getModelConfigHeaders(this.modelId,!1),await(0,v.hd)(this.config.o11yHeaders)),body:t,successfulResponseHandler:(0,v.cV)(x.bz()),failedResponseHandler:(0,v.sl)({errorSchema:x.bz(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:n,body:i},warnings:r}}catch(e){throw await Q(e,await re(s))}}async doStream(e){const{args:t,warnings:r}=await this.getArgs(e),{abortSignal:a}=e,s=await(0,v.hd)(this.config.headers());try{const{value:n,responseHeaders:o}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(s,e.headers,this.getModelConfigHeaders(this.modelId,!0),await(0,v.hd)(this.config.o11yHeaders)),body:t,successfulResponseHandler:(0,v.Ds)(x.bz()),failedResponseHandler:(0,v.sl)({errorSchema:x.bz(),errorToMessage:e=>e}),...a&&{abortSignal:a},fetch:this.config.fetch});return{stream:n.pipeThrough(new TransformStream({start(e){r.length>0&&e.enqueue({type:"stream-start",warnings:r})},transform(t,r){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)),r.enqueue(a)}else r.error(t.error)}})),request:{body:t},response:{headers:o}}}catch(e){throw await Q(e,await re(s))}}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),r=w.from(e).toString("base64");t.data=new I(`data:${t.mediaType||"application/octet-stream"};base64,${r}`)}}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":"3","ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},le=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:r,providerOptions:a}){var s;const n=await(0,v.hd)(this.config.headers());try{const{responseHeaders:o,value:i,rawValue:l}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(n,null!=t?t:{},this.getModelConfigHeaders(),await(0,v.hd)(this.config.o11yHeaders)),body:{values:e,...a?{providerOptions:a}:{}},successfulResponseHandler:(0,v.cV)(ue),failedResponseHandler:(0,v.sl)({errorSchema:x.bz(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{embeddings:i.embeddings,usage:null!=(s=i.usage)?s:void 0,providerMetadata:i.providerMetadata,response:{headers:o,body:l},warnings:[]}}catch(e){throw await Q(e,await re(n))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},ue=(0,v.ID)((()=>(0,v.jN)(x.Ik({embeddings:x.YO(x.YO(x.ai())),usage:x.Ik({tokens:x.ai()}).nullish(),providerMetadata:x.g1(x.Yj(),x.g1(x.Yj(),x.L5())).optional()})))),ce=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:r,aspectRatio:a,seed:s,files:n,mask:o,providerOptions:i,headers:l,abortSignal:u}){var c;const p=await(0,v.hd)(this.config.headers());try{const{responseHeaders:d,value:h,rawValue:m}=await(0,v.GU)({url:this.getUrl(),headers:(0,v.m2)(p,null!=l?l:{},this.getModelConfigHeaders(),await(0,v.hd)(this.config.o11yHeaders)),body:{prompt:e,n:t,...r&&{size:r},...a&&{aspectRatio:a},...s&&{seed:s},...i&&{providerOptions:i},...n&&{files:n.map((e=>pe(e)))},...o&&{mask:pe(o)}},successfulResponseHandler:(0,v.cV)(me),failedResponseHandler:(0,v.sl)({errorSchema:x.bz(),errorToMessage:e=>e}),...u&&{abortSignal:u},fetch:this.config.fetch});return{images:h.images,warnings:null!=(c=h.warnings)?c:[],providerMetadata:h.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:d}}}catch(e){throw Q(e,await re(p))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function pe(e){return"file"===e.type&&e.data instanceof Uint8Array?{...e,data:(0,v.n_)(e.data)}:e}var de,he=x.Ik({images:x.YO(x.L5()).optional()}).catchall(x.L5()),me=x.Ik({images:x.YO(x.Yj()),warnings:x.YO(x.Ik({type:x.eu("other"),message:x.Yj()})).optional(),providerMetadata:x.g1(x.Yj(),he).optional()}),fe=(0,v.ID)((()=>(0,v.jN)(E.Ik({query:E.KC([E.Yj(),E.YO(E.Yj())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:E.ai().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:E.ai().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:E.ai().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:E.Yj().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:E.YO(E.Yj()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:E.YO(E.Yj()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:E.Yj().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:E.Yj().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:E.Yj().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:E.Yj().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:E.k5(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")})))),ge=(0,v.ID)((()=>(0,v.jN)(E.KC([E.Ik({results:E.YO(E.Ik({title:E.Yj(),url:E.Yj(),snippet:E.Yj(),date:E.Yj().optional(),lastUpdated:E.Yj().optional()})),id:E.Yj()}),E.Ik({error:E.k5(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:E.ai().optional(),message:E.Yj()})])))),ve=(0,v.wA)({id:"gateway.perplexity_search",inputSchema:fe,outputSchema:ge}),ye={perplexitySearch:(e={})=>ve(e)},xe=function(e={}){var t,r;let a=null,s=null;const n=null!=(t=e.metadataCacheRefreshMillis)?t:3e5;let o=0;const i=null!=(r=(0,v.ae)(e.baseURL))?r:"https://ai-gateway.vercel.sh/v3/ai",l=async()=>{try{const t=await async function(e){const t=(0,v.x3)({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});return t?{token:t,authMethod:"api-key"}:{token:await(0,b.getVercelOidcToken)(),authMethod:"oidc"}}(e);return(0,v.WZ)({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":"0.0.1",[te]:t.authMethod,...e.headers},"ai-sdk/gateway/3.0.13")}catch(e){throw _.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},u=()=>{const e=(0,v.x3)({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),t=(0,v.x3)({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),r=(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},...r&&{"ai-o11y-region":r},...a&&{"ai-o11y-request-id":a}}}},c=t=>new ie(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)};p.specificationVersion="v3",p.getAvailableModels=async()=>{var t,r,u;const c=null!=(u=null==(r=null==(t=e._internal)?void 0:t.currentDate)?void 0:r.call(t).getTime())?u:Date.now();return(!a||c-o>n)&&(o=c,a=new se({baseURL:i,headers:l,fetch:e.fetch}).getAvailableModels().then((e=>(s=e,e))).catch((async e=>{throw await Q(e,await re(await l()))}))),s?Promise.resolve(s):a},p.getCredits=async()=>new se({baseURL:i,headers:l,fetch:e.fetch}).getCredits().catch((async e=>{throw await Q(e,await re(await l()))})),p.imageModel=t=>new ce(t,{provider:"gateway",baseURL:i,headers:l,fetch:e.fetch,o11yHeaders:u()}),p.languageModel=c;const d=t=>new le(t,{provider:"gateway",baseURL:i,headers:l,fetch:e.fetch,o11yHeaders:u()});return p.embeddingModel=d,p.textEmbeddingModel=d,p.tools=ye,p}(),Ee=r(44631),be=r(19917),Ie=r(9606).URL,we=r(65994).process,ke=Object.defineProperty,Se="AI_InvalidArgumentError",Te=`vercel.ai.error.${Se}`,Ae=Symbol.for(Te),Ce=class extends y.bD{constructor({parameter:e,value:t,message:r}){super({name:Se,message:`Invalid argument for parameter ${e}: ${r}`}),this[de]=!0,this.parameter=e,this.value=t}static isInstance(e){return y.bD.hasMarker(e,Te)}};de=Ae;var _e=Symbol.for("vercel.ai.error.AI_InvalidStreamPartError");y.bD;var Re,Ne="AI_InvalidToolApprovalError",Oe=`vercel.ai.error.${Ne}`,Me=Symbol.for(Oe),Pe=class extends y.bD{constructor({approvalId:e}){super({name:Ne,message:`Tool approval response references unknown approvalId: "${e}". No matching tool-approval-request found in message history.`}),this[Re]=!0,this.approvalId=e}static isInstance(e){return y.bD.hasMarker(e,Oe)}};Re=Me;var $e,Le="AI_InvalidToolInputError",je=`vercel.ai.error.${Le}`,De=Symbol.for(je),Ye=class extends y.bD{constructor({toolInput:e,toolName:t,cause:r,message:a=`Invalid input for tool ${t}: ${(0,y.u1)(r)}`}){super({name:Le,message:a,cause:r}),this[$e]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return y.bD.hasMarker(e,je)}};$e=De;var Fe,Ve="AI_ToolCallNotFoundForApprovalError",qe=`vercel.ai.error.${Ve}`,Ue=Symbol.for(qe),Be=class extends y.bD{constructor({toolCallId:e,approvalId:t}){super({name:Ve,message:`Tool call "${e}" not found for approval request "${t}".`}),this[Fe]=!0,this.toolCallId=e,this.approvalId=t}static isInstance(e){return y.bD.hasMarker(e,qe)}};Fe=Ue;var Ge=Symbol.for("vercel.ai.error.AI_NoImageGeneratedError");y.bD;var Ze,ze="AI_NoObjectGeneratedError",He=`vercel.ai.error.${ze}`,We=Symbol.for(He),Ke=class extends y.bD{constructor({message:e="No object generated.",cause:t,text:r,response:a,usage:s,finishReason:n}){super({name:ze,message:e,cause:t}),this[Ze]=!0,this.text=r,this.response=a,this.usage=s,this.finishReason=n}static isInstance(e){return y.bD.hasMarker(e,He)}};Ze=We;var Xe,Je="AI_NoOutputGeneratedError",Qe=`vercel.ai.error.${Je}`,et=Symbol.for(Qe),tt=class extends y.bD{constructor({message:e="No output generated.",cause:t}={}){super({name:Je,message:e,cause:t}),this[Xe]=!0}static isInstance(e){return y.bD.hasMarker(e,Qe)}};Xe=et,y.bD;var rt,at="AI_NoSuchToolError",st=`vercel.ai.error.${at}`,nt=Symbol.for(st),ot=class extends y.bD{constructor({toolName:e,availableTools:t,message:r=`Model tried to call unavailable tool '${e}'. ${void 0===t?"No tools are available.":`Available tools: ${t.join(", ")}.`}`}){super({name:at,message:r}),this[rt]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return y.bD.hasMarker(e,st)}};rt=nt;var it,lt="AI_ToolCallRepairError",ut=`vercel.ai.error.${lt}`,ct=Symbol.for(ut),pt=class extends y.bD{constructor({cause:e,originalError:t,message:r=`Error repairing tool call: ${(0,y.u1)(e)}`}){super({name:lt,message:r,cause:e}),this[it]=!0,this.originalError=t}static isInstance(e){return y.bD.hasMarker(e,ut)}};it=ct;var dt=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}},ht=Symbol.for("vercel.ai.error.AI_InvalidDataContentError");y.bD;var mt,ft="AI_InvalidMessageRoleError",gt=`vercel.ai.error.${ft}`,vt=Symbol.for(gt),yt=class extends y.bD{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:ft,message:t}),this[mt]=!0,this.role=e}static isInstance(e){return y.bD.hasMarker(e,gt)}};mt=vt;var xt=Symbol.for("vercel.ai.error.AI_MessageConversionError");y.bD;var Et,bt="AI_RetryError",It=`vercel.ai.error.${bt}`,wt=Symbol.for(It),kt=class extends y.bD{constructor({message:e,reason:t,errors:r}){super({name:bt,message:e}),this[Et]=!0,this.reason=t,this.errors=r,this.lastError=r[r.length-1]}static isInstance(e){return y.bD.hasMarker(e,It)}};function St({warning:e,provider:t,model:r}){const a=`AI SDK Warning (${t} / ${r}):`;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)}`}}Et=wt;var Tt=!1,At=e=>{if(0===e.warnings.length)return;const t=globalThis.AI_SDK_LOG_WARNINGS;if(!1!==t)if("function"!=typeof t){Tt||(Tt=!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(St({warning:t,provider:e.provider,model:e.model}))}else t(e)};function Ct(e){return"v3"===e.specificationVersion?e:(function({provider:e,modelId:t}){At({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 r=await e.doGenerate(...t);return{...r,finishReason:_t(r.finishReason),usage:Rt(r.usage)}};case"doStream":return async(...t)=>{const r=await e.doStream(...t);return{...r,stream:(a=r.stream,a.pipeThrough(new TransformStream({transform(e,t){"finish"===e.type?t.enqueue({...e,finishReason:_t(e.finishReason),usage:Rt(e.usage)}):t.enqueue(e)}})))};var a};default:return e[t]}}}))}function _t(e){return{unified:"unknown"===e?"other":e,raw:void 0}}function Rt(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 Nt(e){if("string"!=typeof e){if("v3"!==e.specificationVersion&&"v2"!==e.specificationVersion){const t=e;throw new dt({version:t.specificationVersion,provider:t.provider,modelId:t.modelId})}return Ct(e)}return(null!=(t=globalThis.AI_SDK_DEFAULT_PROVIDER)?t:xe).languageModel(e);var t}function Ot(e){if(null!=e)return"number"==typeof e?e:e.totalMs}var Mt=[{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]}],Pt=e=>{const t="string"==typeof e?(0,v.Z9)(e):e,r=(127&t[6])<<21|(127&t[7])<<14|(127&t[8])<<7|127&t[9];return t.slice(r+10)};var $t=async({url:e})=>{var t;const r=e.toString();try{const e=await fetch(r,{headers:(0,v.WZ)({},"ai-sdk/6.0.33",(0,v.G1)())});if(!e.ok)throw new v.nV({url:r,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(v.nV.isInstance(e))throw e;throw new v.nV({url:r,cause:e})}},Lt=(e=$t)=>t=>Promise.all(t.map((async t=>t.isUrlSupportedByModel?null:e(t))));var jt=x.KC([x.Yj(),x.Nl(Uint8Array),x.Nl(ArrayBuffer),x.Ie((e=>{var t,r;return null!=(r=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&r}),{message:"Must be a Buffer"})]);function Dt(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 Ie(e)}catch(e){}if(e instanceof Ie&&"data:"===e.protocol){const{mediaType:t,base64Content:r}=function(e){try{const[t,r]=e.split(",");return{mediaType:t.split(";")[0].split(":")[1],base64Content:r}}catch(e){return{mediaType:void 0,base64Content:void 0}}}(e.toString());if(null==t||null==r)throw new y.bD({name:"InvalidDataContentError",message:`Invalid data URL format in content ${e.toString()}`});return{data:r,mediaType:t}}return{data:e,mediaType:void 0}}function Yt(e){return void 0===e?[]:Array.isArray(e)?e:[e]}async function Ft({prompt:e,supportedUrls:t,download:r=Lt()}){const a=await async function(e,t,r){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 r=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 Ie(a)}catch(e){}return{mediaType:r,data:a}})).filter((e=>e.data instanceof Ie)).map((e=>({url:e.data,isUrlSupportedByModel:null!=e.mediaType&&(0,v.qs)({url:e.data.toString(),mediaType:e.mediaType,supportedUrls:r})}))),s=await t(a);return Object.fromEntries(s.map(((e,t)=>null==e?null:[a[t].url.toString(),{data:e.data,mediaType:e.mediaType}])).filter((e=>null!=e)))}(e.messages,r,t),s=[...null!=e.system?"string"==typeof e.system?[{role:"system",content:e.system}]:Yt(e.system).map((e=>({role:"system",content:e.content,providerOptions:e.providerOptions}))):[],...e.messages.map((e=>function({message:e,downloadedAssets:t}){const r=e.role;switch(r){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 r;if("text"===e.type)return{type:"text",text:e.text,providerOptions:e.providerOptions};let a;const s=e.type;switch(s){case"image":a=e.image;break;case"file":a=e.data;break;default:throw new Error(`Unsupported part type: ${s}`)}const{data:n,mediaType:o}=Dt(a);let i=null!=o?o:e.mediaType,l=n;if(l instanceof Ie){const e=t[l.toString()];e&&(l=e.data,null!=i||(i=e.mediaType))}switch(s){case"image":return(l instanceof Uint8Array||"string"==typeof l)&&(i=null!=(r=function({data:e,signatures:t}){const r=function(e){return"string"==typeof e&&e.startsWith("SUQz")||"string"!=typeof e&&e.length>10&&73===e[0]&&68===e[1]&&51===e[2]?Pt(e):e}(e),a="string"==typeof r?(0,v.Z9)(r.substring(0,Math.min(r.length,24))):r;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:Mt}))?r: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:r,mediaType:a}=Dt(e.data);return{type:"file",data:r,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:Vt(e.output),providerOptions:t}}})),providerOptions:e.providerOptions};case"tool":return{role:"tool",content:e.content.filter((e=>"tool-approval-response"!==e.type||e.providerExecuted)).map((e=>{switch(e.type){case"tool-result":return{type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,output:Vt(e.output),providerOptions:e.providerOptions};case"tool-approval-response":return{type:"tool-approval-response",approvalId:e.approvalId,approved:e.approved,reason:e.reason}}})),providerOptions:e.providerOptions};default:throw new yt({role:r})}}({message:e,downloadedAssets:a})))],n=[];for(const e of s){if("tool"!==e.role){n.push(e);continue}const t=n.at(-1);"tool"===(null==t?void 0:t.role)?t.content.push(...e.content):n.push(e)}return n}function Vt(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}))}}async function qt({toolCallId:e,input:t,output:r,tool:a,errorMode:s}){return"text"===s?{type:"error-text",value:(0,y.u1)(r)}:"json"===s?{type:"error-json",value:Ut(r)}:(null==a?void 0:a.toModelOutput)?await a.toModelOutput({toolCallId:e,input:t,output:r}):"string"==typeof r?{type:"text",value:r}:{type:"json",value:Ut(r)}}function Ut(e){return void 0===e?null:e}var Bt=x.RZ((()=>x.KC([x.ch(),x.Yj(),x.ai(),x.zM(),x.g1(x.Yj(),Bt.optional()),x.YO(Bt)]))),Gt=x.g1(x.Yj(),x.g1(x.Yj(),Bt.optional())),Zt=x.Ik({type:x.eu("text"),text:x.Yj(),providerOptions:Gt.optional()}),zt=x.Ik({type:x.eu("image"),image:x.KC([jt,x.Nl(Ie)]),mediaType:x.Yj().optional(),providerOptions:Gt.optional()}),Ht=x.Ik({type:x.eu("file"),data:x.KC([jt,x.Nl(Ie)]),filename:x.Yj().optional(),mediaType:x.Yj(),providerOptions:Gt.optional()}),Wt=x.Ik({type:x.eu("reasoning"),text:x.Yj(),providerOptions:Gt.optional()}),Kt=x.Ik({type:x.eu("tool-call"),toolCallId:x.Yj(),toolName:x.Yj(),input:x.L5(),providerOptions:Gt.optional(),providerExecuted:x.zM().optional()}),Xt=x.gM("type",[x.Ik({type:x.eu("text"),value:x.Yj(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("json"),value:Bt,providerOptions:Gt.optional()}),x.Ik({type:x.eu("execution-denied"),reason:x.Yj().optional(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("error-text"),value:x.Yj(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("error-json"),value:Bt,providerOptions:Gt.optional()}),x.Ik({type:x.eu("content"),value:x.YO(x.KC([x.Ik({type:x.eu("text"),text:x.Yj(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("media"),data:x.Yj(),mediaType:x.Yj()}),x.Ik({type:x.eu("file-data"),data:x.Yj(),mediaType:x.Yj(),filename:x.Yj().optional(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("file-url"),url:x.Yj(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("file-id"),fileId:x.KC([x.Yj(),x.g1(x.Yj(),x.Yj())]),providerOptions:Gt.optional()}),x.Ik({type:x.eu("image-data"),data:x.Yj(),mediaType:x.Yj(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("image-url"),url:x.Yj(),providerOptions:Gt.optional()}),x.Ik({type:x.eu("image-file-id"),fileId:x.KC([x.Yj(),x.g1(x.Yj(),x.Yj())]),providerOptions:Gt.optional()}),x.Ik({type:x.eu("custom"),providerOptions:Gt.optional()})]))})]),Jt=x.Ik({type:x.eu("tool-result"),toolCallId:x.Yj(),toolName:x.Yj(),output:Xt,providerOptions:Gt.optional()}),Qt=x.Ik({type:x.eu("tool-approval-request"),approvalId:x.Yj(),toolCallId:x.Yj()}),er=x.Ik({type:x.eu("tool-approval-response"),approvalId:x.Yj(),approved:x.zM(),reason:x.Yj().optional()}),tr=x.Ik({role:x.eu("system"),content:x.Yj(),providerOptions:Gt.optional()}),rr=x.Ik({role:x.eu("user"),content:x.KC([x.Yj(),x.YO(x.KC([Zt,zt,Ht]))]),providerOptions:Gt.optional()}),ar=x.Ik({role:x.eu("assistant"),content:x.KC([x.Yj(),x.YO(x.KC([Zt,Ht,Wt,Kt,Jt,Qt]))]),providerOptions:Gt.optional()}),sr=x.Ik({role:x.eu("tool"),content:x.YO(x.KC([Jt,er])),providerOptions:Gt.optional()}),nr=x.KC([tr,rr,ar,sr]);function or(e){if(!_.isInstance(e))return e;const t="https://ai-sdk.dev/unauthenticated-ai-gateway";return"production"===(null==we?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 ir({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 lr={startSpan:()=>ur,startActiveSpan:(e,t,r,a)=>"function"==typeof t?t(ur):"function"==typeof r?r(ur):"function"==typeof a?a(ur):void 0},ur={spanContext:()=>cr,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}},cr={traceId:"",spanId:"",traceFlags:0};async function pr({name:e,tracer:t,attributes:r,fn:a,endWhenDone:s=!0}){return t.startActiveSpan(e,{attributes:await r},(async e=>{try{const t=await a(e);return s&&e.end(),t}catch(t){try{dr(e,t)}finally{e.end()}throw t}}))}function dr(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:be.s.ERROR,message:t.message})):e.setStatus({code:be.s.ERROR})}async function hr({telemetry:e,attributes:t}){if(!0!==(null==e?void 0:e.isEnabled))return{};const r={};for(const[a,s]of Object.entries(t))if(null!=s)if("object"==typeof s&&"input"in s&&"function"==typeof s.input){if(!1===(null==e?void 0:e.recordInputs))continue;const t=await s.input();null!=t&&(r[a]=t)}else if("object"==typeof s&&"output"in s&&"function"==typeof s.output){if(!1===(null==e?void 0:e.recordOutputs))continue;const t=await s.output();null!=t&&(r[a]=t)}else r[a]=s;return r}function mr(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:fr(e.inputTokens.total,e.outputTokens.total),raw:e.raw,reasoningTokens:e.outputTokens.reasoning,cachedInputTokens:e.inputTokens.cacheRead}}function fr(e,t){return null==e&&null==t?void 0:(null!=e?e:0)+(null!=t?t:0)}function gr(e,t){if(void 0===e&&void 0===t)return;if(void 0===e)return t;if(void 0===t)return e;const r={...e};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const s=t[a];if(void 0===s)continue;const n=a in e?e[a]:void 0,o=!(null===s||"object"!=typeof s||Array.isArray(s)||s instanceof Date||s instanceof RegExp),i=!(null==n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||n instanceof RegExp);r[a]=o&&i?gr(n,s):s}return r}var vr=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:r=2,abortSignal:a}={})=>async s=>yr(s,{maxRetries:e,delayInMs:t,backoffFactor:r,abortSignal:a});async function yr(e,{maxRetries:t,delayInMs:r,backoffFactor:a,abortSignal:s},n=[]){try{return await e()}catch(o){if((0,v.zf)(o))throw o;if(0===t)throw o;const i=(0,v.u1)(o),l=[...n,o],u=l.length;if(u>t)throw new kt({message:`Failed after ${u} attempts. Last error: ${i}`,reason:"maxRetriesExceeded",errors:l});if(o instanceof Error&&y.hL.isInstance(o)&&!0===o.isRetryable&&u<=t)return await(0,v.cb)(function({error:e,exponentialBackoffDelay:t}){const r=e.responseHeaders;if(!r)return t;let a;const s=r["retry-after-ms"];if(s){const e=parseFloat(s);Number.isNaN(e)||(a=e)}const n=r["retry-after"];if(n&&void 0===a){const e=parseFloat(n);a=Number.isNaN(e)?Date.parse(n)-Date.now():1e3*e}return null!=a&&!Number.isNaN(a)&&0<=a&&(a<6e4||a<t)?a:t}({error:o,exponentialBackoffDelay:r}),{abortSignal:s}),yr(e,{maxRetries:t,delayInMs:a*r,backoffFactor:a,abortSignal:s},l);if(1===u)throw o;throw new kt({message:`Failed after ${u} attempts with non-retryable error: '${i}'`,reason:"errorNotRetryable",errors:l})}}async function xr({toolCall:e,tools:t,tracer:r,telemetry:a,messages:s,abortSignal:n,experimental_context:o,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 pr({name:"ai.toolCall",attributes:hr({telemetry:a,attributes:{...ir({operationId:"ai.toolCall",telemetry:a}),"ai.toolCall.name":l,"ai.toolCall.id":u,"ai.toolCall.args":{output:()=>JSON.stringify(c)}}}),tracer:r,fn:async t=>{let r;try{const t=(0,v.o8)({execute:p.execute.bind(p),input:c,options:{toolCallId:u,messages:s,abortSignal:n,experimental_context:o}});for await(const a of t)"preliminary"===a.type?null==i||i({...e,type:"tool-result",output:a.output,preliminary:!0}):r=a.output}catch(r){return dr(t,r),{type:"tool-error",toolCallId:u,toolName:l,input:c,error:r,dynamic:"dynamic"===p.type,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}}try{t.setAttributes(await hr({telemetry:a,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(r)}}}))}catch(e){}return{type:"tool-result",toolCallId:u,toolName:l,input:c,output:r,dynamic:"dynamic"===p.type,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}}})}var Er=class{constructor({data:e,mediaType:t}){const r=e instanceof Uint8Array;this.base64Data=r?void 0:e,this.uint8ArrayData=r?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}},br=class extends Er{constructor(e){super(e),this.type="file"}};function Ir(e){const t=["ROOT"];let r=-1,a=null;function s(e,s,n){switch(e){case'"':r=s,t.pop(),t.push(n),t.push("INSIDE_STRING");break;case"f":case"t":case"n":r=s,a=s,t.pop(),t.push(n),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(n),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=s,t.pop(),t.push(n),t.push("INSIDE_NUMBER");break;case"{":r=s,t.pop(),t.push(n),t.push("INSIDE_OBJECT_START");break;case"[":r=s,t.pop(),t.push(n),t.push("INSIDE_ARRAY_START")}}function n(e,a){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=a,t.pop()}}function o(e,a){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":r=a,t.pop()}}for(let i=0;i<e.length;i++){const l=e[i];switch(t[t.length-1]){case"ROOT":s(l,i,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":r=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":s(l,i,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":n(l,i);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),r=i;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:r=i}break;case"INSIDE_ARRAY_START":"]"===l?(r=i,t.pop()):(r=i,s(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"]":r=i,t.pop();break;default:r=i}break;case"INSIDE_ARRAY_AFTER_COMMA":s(l,i,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),r=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":r=i;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,i),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&n(l,i);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&n(l,i);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,i);break;default:t.pop()}break;case"INSIDE_LITERAL":{const s=e.substring(a,i+1);"false".startsWith(s)||"true".startsWith(s)||"null".startsWith(s)?r=i:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?n(l,i):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&o(l,i));break}}}let i=e.slice(0,r+1);for(let r=t.length-1;r>=0;r--)switch(t[r]){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 wr(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:Ir(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}((e,t)=>{for(var r in t)ke(e,r,{get:t[r],enumerable:!0})})({},{array:()=>Tr,choice:()=>Ar,json:()=>Cr,object:()=>Sr,text:()=>kr});var kr=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e}),createElementStreamTransform(){}}),Sr=({schema:e,name:t,description:r})=>{const a=(0,v.mD)(e);return{name:"object",responseFormat:(0,v.hd)(a.jsonSchema).then((e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=r&&{description:r}}))),async parseCompleteOutput({text:e},t){const r=await(0,v.N8)({text:e});if(!r.success)throw new Ke({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const s=await(0,v.ZZ)({value:r.value,schema:a});if(!s.success)throw new Ke({message:"No object generated: response did not match schema.",cause:s.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return s.value},async parsePartialOutput({text:e}){const t=await wr(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}},createElementStreamTransform(){}}},Tr=({element:e,name:t,description:r})=>{const a=(0,v.mD)(e);return{name:"array",responseFormat:(0,v.hd)(a.jsonSchema).then((e=>{const{$schema:a,...s}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}})),async parseCompleteOutput({text:e},t){const r=await(0,v.N8)({text:e});if(!r.success)throw new Ke({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const s=r.value;if(null==s||"object"!=typeof s||!("elements"in s)||!Array.isArray(s.elements))throw new Ke({message:"No object generated: response did not match schema.",cause:new y.iM({value:s,cause:"response must be an object with an elements array"}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(const r of s.elements){const s=await(0,v.ZZ)({value:r,schema:a});if(!s.success)throw new Ke({message:"No object generated: response did not match schema.",cause:s.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return s.elements},async parsePartialOutput({text:e}){const t=await wr(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 r="repaired-parse"===t.state&&e.elements.length>0?e.elements.slice(0,-1):e.elements,s=[];for(const e of r){const t=await(0,v.ZZ)({value:e,schema:a});t.success&&s.push(t.value)}return{partial:s}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},r){if(null!=t)for(;e<t.length;e++)r.enqueue(t[e])}})}}},Ar=({options:e,name:t,description:r})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...null!=t&&{name:t},...null!=r&&{description:r}}),async parseCompleteOutput({text:t},r){const a=await(0,v.N8)({text:t});if(!a.success)throw new Ke({message:"No object generated: could not parse the response.",cause:a.error,text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});const s=a.value;if(null==s||"object"!=typeof s||!("result"in s)||"string"!=typeof s.result||!e.includes(s.result))throw new Ke({message:"No object generated: response did not match schema.",cause:new y.iM({value:s,cause:"response must be an object that contains a choice value."}),text:t,response:r.response,usage:r.usage,finishReason:r.finishReason});return s.result},async parsePartialOutput({text:t}){const r=await wr(t);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const t=r.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"===r.state?a.includes(t.result)?{partial:t.result}:void 0:1===a.length?{partial:a[0]}:void 0}}},createElementStreamTransform(){}}),Cr=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){const r=await(0,v.N8)({text:e});if(!r.success)throw new Ke({message:"No object generated: could not parse the response.",cause:r.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return r.value},async parsePartialOutput({text:e}){const t=await wr(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}}},createElementStreamTransform(){}});async function _r(e){const t=""===e.input.trim()?{success:!0,value:{}}:await(0,v.N8)({text:e.input});if(!1===t.success)throw new Ye({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 Rr({toolCall:e,tools:t}){const r=e.toolName,a=t[r];if(null==a){if(e.providerExecuted&&e.dynamic)return await _r(e);throw new ot({toolName:e.toolName,availableTools:Object.keys(t)})}const s=(0,v.mD)(a.inputSchema),n=""===e.input.trim()?await(0,v.ZZ)({value:{},schema:s}):await(0,v.N8)({text:e.input,schema:s});if(!1===n.success)throw new Ye({toolName:r,toolInput:e.input,cause:n.error});return"dynamic"===a.type?{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:n.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,dynamic:!0,title:a.title}:{type:"tool-call",toolCallId:e.toolCallId,toolName:r,input:n.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:a.title}}var Nr=class{constructor({content:e,finishReason:t,rawFinishReason:r,usage:a,warnings:s,request:n,response:o,providerMetadata:i}){this.content=e,this.finishReason=t,this.rawFinishReason=r,this.usage=a,this.warnings=s,this.request=n,this.response=o,this.providerMetadata=i}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 Or(e){return({steps:t})=>t.length===e}async function Mr({content:e,tools:t}){const r=[],a=[];for(const r of e)if("source"!==r.type&&("tool-result"!==r.type&&"tool-error"!==r.type||r.providerExecuted)&&("text"!==r.type||0!==r.text.length))switch(r.type){case"text":a.push({type:"text",text:r.text,providerOptions:r.providerMetadata});break;case"reasoning":a.push({type:"reasoning",text:r.text,providerOptions:r.providerMetadata});break;case"file":a.push({type:"file",data:r.file.base64,mediaType:r.file.mediaType,providerOptions:r.providerMetadata});break;case"tool-call":a.push({type:"tool-call",toolCallId:r.toolCallId,toolName:r.toolName,input:r.input,providerExecuted:r.providerExecuted,providerOptions:r.providerMetadata});break;case"tool-result":{const e=await qt({toolCallId:r.toolCallId,input:r.input,tool:null==t?void 0:t[r.toolName],output:r.output,errorMode:"none"});a.push({type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:e,providerOptions:r.providerMetadata});break}case"tool-error":{const e=await qt({toolCallId:r.toolCallId,input:r.input,tool:null==t?void 0:t[r.toolName],output:r.error,errorMode:"json"});a.push({type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:e,providerOptions:r.providerMetadata});break}case"tool-approval-request":a.push({type:"tool-approval-request",approvalId:r.approvalId,toolCallId:r.toolCall.toolCallId})}a.length>0&&r.push({role:"assistant",content:a});const s=[];for(const r of e){if("tool-result"!==r.type&&"tool-error"!==r.type||r.providerExecuted)continue;const e=await qt({toolCallId:r.toolCallId,input:r.input,tool:null==t?void 0:t[r.toolName],output:"tool-result"===r.type?r.output:r.error,errorMode:"tool-error"===r.type?"text":"none"});s.push({type:"tool-result",toolCallId:r.toolCallId,toolName:r.toolName,output:e,...null!=r.providerMetadata?{providerOptions:r.providerMetadata}:{}})}return s.length>0&&r.push({role:"tool",content:s}),r}function Pr(...e){const t=e.filter((e=>null!=e));if(0===t.length)return;if(1===t.length)return t[0];const r=new AbortController;for(const e of t){if(e.aborted)return r.abort(e.reason),r.signal;e.addEventListener("abort",(()=>{r.abort(e.reason)}),{once:!0})}return r.signal}function $r(e,t){const r=new Headers(null!=e?e:{});for(const[e,a]of Object.entries(t))r.has(e)||r.set(e,a);return r}function Lr({response:e,status:t,statusText:r,headers:a,stream:s}){const n=null!=t?t:200;void 0!==r?e.writeHead(n,r,a):e.writeHead(n,a);const o=s.getReader();(async()=>{try{for(;;){const{done:t,value:r}=await o.read();if(t)break;e.write(r)||await new Promise((t=>{e.once("drain",t)}))}}catch(e){throw e}finally{e.end()}})()}(0,v.hK)({prefix:"aitxt",size:24});var jr=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}\n\n`)},flush(e){e.enqueue("data: [DONE]\n\n")}})}},Dr={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};function Yr(e){return e.type.startsWith("tool-")}function Fr(e){return Yr(e)||function(e){return"dynamic-tool"===e.type}(e)}function Vr(e){return e.type.split("-").slice(1).join("-")}function qr({messageId:e,originalMessages:t=[],onFinish:r,onError:a,stream:s}){let n=null==t?void 0:t[t.length-1];"assistant"!==(null==n?void 0:n.role)?n=void 0:e=n.id;let o=!1;const i=s.pipeThrough(new TransformStream({transform(t,r){if("start"===t.type){const r=t;null==r.messageId&&null!=e&&(r.messageId=e)}"abort"===t.type&&(o=!0),r.enqueue(t)}}));if(null==r)return i;const l=function({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:{}}}({lastMessage:n?structuredClone(n):void 0,messageId:null!=e?e:""});let u=!1;const c=async()=>{if(u||!r)return;u=!0;const e=l.message.id===(null==n?void 0:n.id);await r({isAborted:o,isContinuation:e,responseMessage:l.message,messages:[...e?t.slice(0,-1):t,l.message],finishReason:l.finishReason})};return function({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:a,onError:s,onToolCall:n,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,i){await a((async({state:a,write:l})=>{var u,c,p,d;function h(e){const t=a.message.parts.filter(Fr).find((t=>t.toolCallId===e));if(null==t)throw new Error(`no tool invocation found for tool call ${e}`);return t}function m(e){var t;const r=a.message.parts.find((t=>Yr(t)&&t.toolCallId===e.toolCallId)),s=e,n=r;null!=r?(r.state=e.state,n.input=s.input,n.output=s.output,n.errorText=s.errorText,n.rawInput=s.rawInput,n.preliminary=s.preliminary,void 0!==e.title&&(n.title=e.title),n.providerExecuted=null!=(t=s.providerExecuted)?t:r.providerExecuted,null!=s.providerMetadata&&"input-available"===r.state&&(r.callProviderMetadata=s.providerMetadata)):a.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:s.input,output:s.output,rawInput:s.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted,preliminary:s.preliminary,...null!=s.providerMetadata?{callProviderMetadata:s.providerMetadata}:{}})}function f(e){var t,r;const s=a.message.parts.find((t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId)),n=e,o=s;null!=s?(s.state=e.state,o.toolName=e.toolName,o.input=n.input,o.output=n.output,o.errorText=n.errorText,o.rawInput=null!=(t=n.rawInput)?t:o.rawInput,o.preliminary=n.preliminary,void 0!==e.title&&(o.title=e.title),o.providerExecuted=null!=(r=n.providerExecuted)?r:s.providerExecuted,null!=n.providerMetadata&&"input-available"===s.state&&(s.callProviderMetadata=n.providerMetadata)):a.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:n.input,output:n.output,errorText:n.errorText,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:e.title,...null!=n.providerMetadata?{callProviderMetadata:n.providerMetadata}:{}})}async function g(e){if(null!=e){const r=null!=a.message.metadata?gr(a.message.metadata,e):e;null!=t&&await(0,v.k5)({value:r,schema:t}),a.message.metadata=r}}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(Yr);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}):m({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:r}=await wr(t.text);t.dynamic?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,title:t.title}):m({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:r,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}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),l(),n&&!e.providerExecuted&&await n({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}):m({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=h(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId},l();break}case"tool-output-denied":h(e.toolCallId).state="output-denied",l();break;case"tool-output-available":{const t=h(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}):m({toolCallId:e.toolCallId,toolName:Vr(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=h(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}):m({toolCallId:e.toolCallId,toolName:Vr(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==s||s(new Error(e.errorText));break;default:if(function(e){return e.type.startsWith("data-")}(e)){null!=(null==r?void 0:r[e.type])&&await(0,v.k5)({value:e.data,schema:r[e.type]});const t=e;if(t.transient){null==o||o(t);break}const s=null!=t.id?a.message.parts.find((e=>t.type===e.type&&t.id===e.id)):void 0;null!=s?s.data=t.data:a.message.parts.push(t),null==o||o(t),l()}}i.enqueue(e)}))}}))}({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()}}))}function Ur(e){const t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){const e=this.getReader();let t=!1;async function r(r){var a;if(!t){t=!0;try{r&&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:s}=await e.read();return a?(await r(!0),{done:!0,value:void 0}):{done:!1,value:s}},return:async()=>(await r(!0),{done:!0,value:void 0}),async throw(e){throw await r(!0),e}}},t}function Br(){let e,t;return{promise:new Promise(((r,a)=>{e=r,t=a})),resolve:e,reject:t}}function Gr(){var e,t;return null!=(t=null==(e=null==globalThis?void 0:globalThis.performance)?void 0:e.now())?t:Date.now()}(0,v.ID)((()=>(0,v.jN)(x.KC([x.re({type:x.eu("text-start"),id:x.Yj(),providerMetadata:Gt.optional()}),x.re({type:x.eu("text-delta"),id:x.Yj(),delta:x.Yj(),providerMetadata:Gt.optional()}),x.re({type:x.eu("text-end"),id:x.Yj(),providerMetadata:Gt.optional()}),x.re({type:x.eu("error"),errorText:x.Yj()}),x.re({type:x.eu("tool-input-start"),toolCallId:x.Yj(),toolName:x.Yj(),providerExecuted:x.zM().optional(),dynamic:x.zM().optional(),title:x.Yj().optional()}),x.re({type:x.eu("tool-input-delta"),toolCallId:x.Yj(),inputTextDelta:x.Yj()}),x.re({type:x.eu("tool-input-available"),toolCallId:x.Yj(),toolName:x.Yj(),input:x.L5(),providerExecuted:x.zM().optional(),providerMetadata:Gt.optional(),dynamic:x.zM().optional(),title:x.Yj().optional()}),x.re({type:x.eu("tool-input-error"),toolCallId:x.Yj(),toolName:x.Yj(),input:x.L5(),providerExecuted:x.zM().optional(),providerMetadata:Gt.optional(),dynamic:x.zM().optional(),errorText:x.Yj(),title:x.Yj().optional()}),x.re({type:x.eu("tool-approval-request"),approvalId:x.Yj(),toolCallId:x.Yj()}),x.re({type:x.eu("tool-output-available"),toolCallId:x.Yj(),output:x.L5(),providerExecuted:x.zM().optional(),dynamic:x.zM().optional(),preliminary:x.zM().optional()}),x.re({type:x.eu("tool-output-error"),toolCallId:x.Yj(),errorText:x.Yj(),providerExecuted:x.zM().optional(),dynamic:x.zM().optional()}),x.re({type:x.eu("tool-output-denied"),toolCallId:x.Yj()}),x.re({type:x.eu("reasoning-start"),id:x.Yj(),providerMetadata:Gt.optional()}),x.re({type:x.eu("reasoning-delta"),id:x.Yj(),delta:x.Yj(),providerMetadata:Gt.optional()}),x.re({type:x.eu("reasoning-end"),id:x.Yj(),providerMetadata:Gt.optional()}),x.re({type:x.eu("source-url"),sourceId:x.Yj(),url:x.Yj(),title:x.Yj().optional(),providerMetadata:Gt.optional()}),x.re({type:x.eu("source-document"),sourceId:x.Yj(),mediaType:x.Yj(),title:x.Yj(),filename:x.Yj().optional(),providerMetadata:Gt.optional()}),x.re({type:x.eu("file"),url:x.Yj(),mediaType:x.Yj(),providerMetadata:Gt.optional()}),x.re({type:x.Ie((e=>"string"==typeof e&&e.startsWith("data-")),{message:'Type must start with "data-"'}),id:x.Yj().optional(),data:x.L5(),transient:x.zM().optional()}),x.re({type:x.eu("start-step")}),x.re({type:x.eu("finish-step")}),x.re({type:x.eu("start"),messageId:x.Yj().optional(),messageMetadata:x.L5().optional()}),x.re({type:x.eu("finish"),finishReason:x.k5(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:x.L5().optional()}),x.re({type:x.eu("abort"),reason:x.Yj().optional()}),x.re({type:x.eu("message-metadata"),messageMetadata:x.L5()})]))));var Zr=(0,v.hK)({prefix:"aitxt",size:24});function zr({model:e,tools:t,toolChoice:r,system:a,prompt:s,messages:n,maxRetries:o,abortSignal:i,timeout:l,headers:u,stopWhen:c=Or(1),experimental_output:p,output:d=p,experimental_telemetry:h,prepareStep:m,providerOptions:f,experimental_activeTools:g,activeTools:v=g,experimental_repairToolCall:y,experimental_transform:x,experimental_download:E,includeRawChunks:b=!1,onChunk:I,onError:w=({error:e})=>{console.error(e)},onFinish:k,onAbort:S,onStepFinish:T,experimental_context:A,_internal:{now:C=Gr,generateId:_=Zr}={},...R}){const N=Ot(l),O=function(e){if(null!=e&&"number"!=typeof e)return e.stepMs}(l),M=function(e){if(null!=e&&"number"!=typeof e)return e.chunkMs}(l),P=null!=O?new AbortController:void 0,$=null!=M?new AbortController:void 0;return new Hr({model:Nt(e),telemetry:h,headers:u,settings:R,maxRetries:o,abortSignal:Pr(i,null!=N?AbortSignal.timeout(N):void 0,null==P?void 0:P.signal,null==$?void 0:$.signal),stepTimeoutMs:O,stepAbortController:P,chunkTimeoutMs:M,chunkAbortController:$,system:a,prompt:s,messages:n,tools:t,toolChoice:r,transforms:Yt(x),activeTools:v,repairToolCall:y,stopConditions:Yt(c),output:d,providerOptions:f,prepareStep:m,includeRawChunks:b,onChunk:I,onError:w,onFinish:k,onAbort:S,onStepFinish:T,now:C,generateId:_,experimental_context:A,download:E})}var Hr=class{constructor({model:e,telemetry:t,headers:r,settings:a,maxRetries:s,abortSignal:n,stepTimeoutMs:o,stepAbortController:i,chunkTimeoutMs:l,chunkAbortController:u,system:c,prompt:p,messages:d,tools:h,toolChoice:m,transforms:f,activeTools:g,repairToolCall:E,stopConditions:b,output:I,providerOptions:w,prepareStep:k,includeRawChunks:S,now:T,generateId:A,onChunk:C,onError:_,onFinish:R,onAbort:N,onStepFinish:O,experimental_context:M,download:P}){let $;this._totalUsage=new v.e1,this._finishReason=new v.e1,this._rawFinishReason=new v.e1,this._steps=new v.e1,this.outputSpecification=I,this.includeRawChunks=S,this.tools=h;let L=[];const j=[];let D,Y,F,V={},q=[];const U=[],B=new Map;let G,Z={},z={};const H=new TransformStream({async transform(t,r){var a,s,n,o;r.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==C?void 0:C({chunk:i})),"error"===i.type&&await _({error:or(i.error)}),"text-start"===i.type&&(Z[i.id]={type:"text",text:"",providerMetadata:i.providerMetadata},L.push(Z[i.id])),"text-delta"===i.type){const e=Z[i.id];if(null==e)return void r.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=Z[i.id];if(null==e)return void r.enqueue({part:{type:"error",error:`text part ${i.id} not found`},partialOutput:void 0});e.providerMetadata=null!=(s=i.providerMetadata)?s:e.providerMetadata,delete Z[i.id]}if("reasoning-start"===i.type&&(z[i.id]={type:"reasoning",text:"",providerMetadata:i.providerMetadata},L.push(z[i.id])),"reasoning-delta"===i.type){const e=z[i.id];if(null==e)return void r.enqueue({part:{type:"error",error:`reasoning part ${i.id} not found`},partialOutput:void 0});e.text+=i.text,e.providerMetadata=null!=(n=i.providerMetadata)?n:e.providerMetadata}if("reasoning-end"===i.type){const e=z[i.id];if(null==e)return void r.enqueue({part:{type:"error",error:`reasoning part ${i.id} not found`},partialOutput:void 0});e.providerMetadata=null!=(o=i.providerMetadata)?o:e.providerMetadata,delete z[i.id]}if("file"===i.type&&L.push({type:"file",file:i.file}),"source"===i.type&&L.push(i),"tool-call"===i.type&&L.push(i),"tool-result"!==i.type||i.preliminary||L.push(i),"tool-approval-request"===i.type&&L.push(i),"tool-error"===i.type&&L.push(i),"start-step"===i.type&&(L=[],z={},Z={},V=i.request,q=i.warnings),"finish-step"===i.type){const t=await Mr({content:L,tools:h}),r=new Nr({content:L,finishReason:i.finishReason,rawFinishReason:i.rawFinishReason,usage:i.usage,warnings:q,request:V,response:{...i.response,messages:[...j,...t]},providerMetadata:i.providerMetadata});await(null==O?void 0:O(r)),At({warnings:q,provider:e.provider,model:e.modelId}),U.push(r),j.push(...t),$.resolve()}"finish"===i.type&&(F=i.totalUsage,D=i.finishReason,Y=i.rawFinishReason)},async flush(e){try{if(0===U.length){const e=(null==n?void 0:n.aborted)?n.reason:new tt({message:"No output generated. Check the stream for errors."});return ae._finishReason.reject(e),ae._rawFinishReason.reject(e),ae._totalUsage.reject(e),void ae._steps.reject(e)}const e=null!=D?D:"other",r=null!=F?F:{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};ae._finishReason.resolve(e),ae._rawFinishReason.resolve(Y),ae._totalUsage.resolve(r),ae._steps.resolve(U);const a=U[U.length-1];await(null==R?void 0:R({finishReason:a.finishReason,rawFinishReason:a.rawFinishReason,totalUsage:r,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:U,experimental_context:M})),G.setAttributes(await hr({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":r.inputTokens,"ai.usage.outputTokens":r.outputTokens,"ai.usage.totalTokens":r.totalTokens,"ai.usage.reasoningTokens":r.reasoningTokens,"ai.usage.cachedInputTokens":r.cachedInputTokens}}))}catch(t){e.error(t)}finally{G.end()}}}),W=function(){let e=[],t=null,r=!1,a=Br();const s=()=>{r=!0,a.resolve(),e.forEach((e=>e.cancel())),e=[],null==t||t.close()},n=async()=>{if(r&&0===e.length)null==t||t.close();else{if(0===e.length)return a=Br(),await a.promise,n();try{const{value:a,done:s}=await e[0].read();s?(e.shift(),0===e.length&&r?null==t||t.close():await n()):null==t||t.enqueue(a)}catch(r){null==t||t.error(r),e.shift(),s()}}};return{stream:new ReadableStream({start(e){t=e},pull:n,async cancel(){for(const t of e)await t.cancel();e=[],r=!0}}),addStream:t=>{if(r)throw new Error("Cannot add inner stream: outer stream is closed");e.push(t.getReader()),a.resolve()},close:()=>{r=!0,a.resolve(),0===e.length&&(null==t||t.close())},terminate:s}}();this.addStream=W.addStream,this.closeStream=W.close;const K=W.stream.getReader();let X=new ReadableStream({async start(e){e.enqueue({type:"start"})},async pull(e){function t(){null==N||N({steps:U}),e.enqueue({type:"abort",...void 0!==(null==n?void 0:n.reason)?{reason:(0,y.u1)(n.reason)}:{}}),e.close()}try{const{done:r,value:a}=await K.read();if(r)return void e.close();if(null==n?void 0:n.aborted)return void t();e.enqueue(a)}catch(r){(0,v.zf)(r)&&(null==n?void 0:n.aborted)?t():e.error(r)}},cancel:e=>W.stream.cancel(e)});for(const e of f)X=X.pipeThrough(e({tools:h,stopStream(){W.terminate()}}));this.baseStream=X.pipeThrough(function(e){let t,r,a="",s="",n="";function o({controller:e,partialOutput:a}){e.enqueue({part:{type:"text-delta",id:t,text:s,providerMetadata:r},partialOutput:a}),s=""}return new TransformStream({async transform(i,l){var u;if("finish-step"===i.type&&s.length>0&&o({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 s.length>0&&o({controller:l}),void l.enqueue({part:i,partialOutput:void 0});a+=i.text,s+=i.text,r=null!=(u=i.providerMetadata)?u:r;const c=await e.parsePartialOutput({text:a});if(void 0!==c){const e=JSON.stringify(c.partial);e!==n&&(o({controller:l,partialOutput:c.partial}),n=e)}}})}(null!=I?I:kr())).pipeThrough(H);const{maxRetries:J,retry:Q}=function({maxRetries:e,abortSignal:t}){if(null!=e){if(!Number.isInteger(e))throw new Ce({parameter:"maxRetries",value:e,message:"maxRetries must be an integer"});if(e<0)throw new Ce({parameter:"maxRetries",value:e,message:"maxRetries must be >= 0"})}const r=null!=e?e:2;return{maxRetries:r,retry:vr({maxRetries:r,abortSignal:t})}}({maxRetries:s,abortSignal:n}),ee=function({isEnabled:e=!1,tracer:t}={}){return e?t||Ee.u.getTracer("ai"):lr}(t),te=function({maxOutputTokens:e,temperature:t,topP:r,topK:a,presencePenalty:s,frequencyPenalty:n,seed:o,stopSequences:i}){if(null!=e){if(!Number.isInteger(e))throw new Ce({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be an integer"});if(e<1)throw new Ce({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be >= 1"})}if(null!=t&&"number"!=typeof t)throw new Ce({parameter:"temperature",value:t,message:"temperature must be a number"});if(null!=r&&"number"!=typeof r)throw new Ce({parameter:"topP",value:r,message:"topP must be a number"});if(null!=a&&"number"!=typeof a)throw new Ce({parameter:"topK",value:a,message:"topK must be a number"});if(null!=s&&"number"!=typeof s)throw new Ce({parameter:"presencePenalty",value:s,message:"presencePenalty must be a number"});if(null!=n&&"number"!=typeof n)throw new Ce({parameter:"frequencyPenalty",value:n,message:"frequencyPenalty must be a number"});if(null!=o&&!Number.isInteger(o))throw new Ce({parameter:"seed",value:o,message:"seed must be an integer"});return{maxOutputTokens:e,temperature:t,topP:r,topK:a,presencePenalty:s,frequencyPenalty:n,stopSequences:i,seed:o}}(a),re=function({model:e,settings:t,telemetry:r,headers:a}){var s;return{"ai.model.provider":e.provider,"ai.model.id":e.modelId,...Object.entries(t).reduce(((e,[t,r])=>{if("timeout"===t){const a=Ot(r);null!=a&&(e[`ai.settings.${t}`]=a)}else e[`ai.settings.${t}`]=r;return e}),{}),...Object.entries(null!=(s=null==r?void 0:r.metadata)?s:{}).reduce(((e,[t,r])=>(e[`ai.telemetry.metadata.${t}`]=r,e)),{}),...Object.entries(null!=a?a:{}).reduce(((e,[t,r])=>(void 0!==r&&(e[`ai.request.headers.${t}`]=r),e)),{})}}({model:e,telemetry:t,headers:r,settings:{...te,maxRetries:J}}),ae=this;pr({name:"ai.streamText",attributes:hr({telemetry:t,attributes:{...ir({operationId:"ai.streamText",telemetry:t}),...re,"ai.prompt":{input:()=>JSON.stringify({system:c,prompt:p,messages:d})}}}),tracer:ee,endWhenDone:!1,fn:async a=>{G=a;const s=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&&!Yt(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 r=await(0,v.ZZ)({value:t,schema:x.YO(nr)});if(!r.success)throw new y.M3({prompt:e,message:"The messages do not match the ModelMessage[] schema.",cause:r.error});return{messages:t,system:e.system}}({system:c,prompt:p,messages:d}),f=s.messages,S=[],{approvedToolApprovals:C,deniedToolApprovals:_}=function({messages:e}){const t=e.at(-1);if("tool"!=(null==t?void 0:t.role))return{approvedToolApprovals:[],deniedToolApprovals:[]};const r={};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&&(r[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 s={};for(const e of t.content)"tool-result"===e.type&&(s[e.toolCallId]=e);const n=[],o=[],i=t.content.filter((e=>"tool-approval-response"===e.type));for(const e of i){const t=a[e.approvalId];if(null==t)throw new Pe({approvalId:e.approvalId});if(null!=s[t.toolCallId])continue;const i=r[t.toolCallId];if(null==i)throw new Be({toolCallId:t.toolCallId,approvalId:t.approvalId});const l={approvalRequest:t,approvalResponse:e,toolCall:i};e.approved?n.push(l):o.push(l)}return{approvedToolApprovals:n,deniedToolApprovals:o}}({messages:f});if(_.length>0||C.length>0){const e=[...C,..._].filter((e=>e.toolCall.providerExecuted)),r=C.filter((e=>!e.toolCall.providerExecuted)),a=_.filter((e=>!e.toolCall.providerExecuted)),s=_.filter((e=>e.toolCall.providerExecuted));let o;const i=new ReadableStream({start(e){o=e}});ae.addStream(i);try{for(const e of[...a,...s])null==o||o.enqueue({type:"tool-output-denied",toolCallId:e.toolCall.toolCallId,toolName:e.toolCall.toolName});const i=[];if(await Promise.all(r.map((async e=>{const r=await xr({toolCall:e.toolCall,tools:h,tracer:ee,telemetry:t,messages:f,abortSignal:n,experimental_context:M,onPreliminaryToolResult:e=>{null==o||o.enqueue(e)}});null!=r&&(null==o||o.enqueue(r),i.push(r))}))),e.length>0&&S.push({role:"tool",content:e.map((e=>({type:"tool-approval-response",approvalId:e.approvalResponse.approvalId,approved:e.approvalResponse.approved,reason:e.approvalResponse.reason,providerExecuted:!0})))}),i.length>0||a.length>0){const e=[];for(const t of i)e.push({type:"tool-result",toolCallId:t.toolCallId,toolName:t.toolName,output:await qt({toolCallId:t.toolCallId,input:t.input,tool:null==h?void 0:h[t.toolName],output:"tool-result"===t.type?t.output:t.error,errorMode:"tool-error"===t.type?"json":"none"})});for(const t of a)e.push({type:"tool-result",toolCallId:t.toolCall.toolCallId,toolName:t.toolCall.toolName,output:{type:"execution-denied",reason:t.approvalResponse.reason}});S.push({role:"tool",content:e})}}finally{null==o||o.close()}}j.push(...S),await async function a({currentStep:p,responseMessages:d,usage:y}){var x,S,C,_,R,N;const O=ae.includeRawChunks,L=null!=o?setTimeout((()=>i.abort()),o):void 0;let j;$=new v.e1;const D=[...f,...d],Y=await(null==k?void 0:k({model:e,steps:U,stepNumber:U.length,messages:D,experimental_context:M})),F=Nt(null!=(x=null==Y?void 0:Y.model)?x:e),V=await Ft({prompt:{system:null!=(S=null==Y?void 0:Y.system)?S:s.system,messages:null!=(C=null==Y?void 0:Y.messages)?C:D},supportedUrls:await F.supportedUrls,download:P}),{toolChoice:q,tools:G}=await async function({tools:e,toolChoice:t,activeTools:r}){if(!(null!=(a=e)&&Object.keys(a).length>0))return{tools:void 0,toolChoice:void 0};var a;const s=null!=r?Object.entries(e).filter((([e])=>r.includes(e))):Object.entries(e),n=[];for(const[e,t]of s){const r=t.type;switch(r){case void 0:case"dynamic":case"function":n.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":n.push({type:"provider",name:e,id:t.id,args:t.args});break;default:throw new Error(`Unsupported tool type: ${r}`)}}return{tools:n,toolChoice:null==t?{type:"auto"}:"string"==typeof t?{type:t}:{type:"tool",toolName:t.toolName}}}({tools:h,toolChoice:null!=(_=null==Y?void 0:Y.toolChoice)?_:m,activeTools:null!=(R=null==Y?void 0:Y.activeTools)?R:g});M=null!=(N=null==Y?void 0:Y.experimental_context)?N:M;const Z=gr(w,null==Y?void 0:Y.providerOptions),{result:{stream:z,response:H,request:W},doStreamSpan:K,startTimestampMs:X}=await Q((()=>pr({name:"ai.streamText.doStream",attributes:hr({telemetry:t,attributes:{...ir({operationId:"ai.streamText.doStream",telemetry:t}),...re,"ai.model.provider":F.provider,"ai.model.id":F.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}))}))))}(V)},"ai.prompt.tools":{input:()=>null==G?void 0:G.map((e=>JSON.stringify(e)))},"ai.prompt.toolChoice":{input:()=>null!=q?JSON.stringify(q):void 0},"gen_ai.system":F.provider,"gen_ai.request.model":F.modelId,"gen_ai.request.frequency_penalty":te.frequencyPenalty,"gen_ai.request.max_tokens":te.maxOutputTokens,"gen_ai.request.presence_penalty":te.presencePenalty,"gen_ai.request.stop_sequences":te.stopSequences,"gen_ai.request.temperature":te.temperature,"gen_ai.request.top_k":te.topK,"gen_ai.request.top_p":te.topP}}),tracer:ee,endWhenDone:!1,fn:async e=>({startTimestampMs:T(),doStreamSpan:e,result:await F.doStream({...te,tools:G,toolChoice:q,responseFormat:await(null==I?void 0:I.responseFormat),prompt:V,providerOptions:Z,abortSignal:n,headers:r,includeRawChunks:O})})}))),J=function({tools:e,generatorStream:t,tracer:r,telemetry:a,system:s,messages:n,abortSignal:o,repairToolCall:i,experimental_context:l,generateId:u}){let c=null;const p=new ReadableStream({start(e){c=e}}),d=new Set,h=new Map,m=new Map;let f,g=!1;function y(){g&&0===d.size&&(null!=f&&c.enqueue(f),c.close())}const x=new TransformStream({async transform(t,p){const g=t.type;switch(g){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 br({data:t.data,mediaType:t.mediaType})});break;case"finish":f={type:"finish",finishReason:t.finishReason.unified,rawFinishReason:t.finishReason.raw,usage:mr(t.usage),providerMetadata:t.providerMetadata};break;case"tool-approval-request":{const e=m.get(t.toolCallId);if(null==e){c.enqueue({type:"error",error:new Be({toolCallId:t.toolCallId,approvalId:t.approvalId})});break}p.enqueue({type:"tool-approval-request",approvalId:t.approvalId,toolCall:e});break}case"tool-call":try{const f=await async function({toolCall:e,tools:t,repairToolCall:r,system:a,messages:s}){var n;try{if(null==t){if(e.providerExecuted&&e.dynamic)return await _r(e);throw new ot({toolName:e.toolName})}try{return await Rr({toolCall:e,tools:t})}catch(n){if(null==r||!ot.isInstance(n)&&!Ye.isInstance(n))throw n;let o=null;try{o=await r({toolCall:e,tools:t,inputSchema:async({toolName:e})=>{const{inputSchema:r}=t[e];return await(0,v.mD)(r).jsonSchema},system:a,messages:s,error:n})}catch(e){throw new pt({cause:e,originalError:n})}if(null==o)throw n;return await Rr({toolCall:o,tools:t})}}catch(r){const a=await(0,v.N8)({text:e.input}),s=a.success?a.value:e.input;return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:s,dynamic:!0,invalid:!0,error:r,title:null==(n=null==t?void 0:t[e.toolName])?void 0:n.title,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}}}({toolCall:t,tools:e,repairToolCall:i,system:s,messages:n});if(m.set(f.toolCallId,f),p.enqueue(f),f.invalid){c.enqueue({type:"tool-error",toolCallId:f.toolCallId,toolName:f.toolName,input:f.input,error:(0,v.u1)(f.error),dynamic:!0,title:f.title});break}const g=null==e?void 0:e[f.toolName];if(null==g)break;if(null!=g.onInputAvailable&&await g.onInputAvailable({input:f.input,toolCallId:f.toolCallId,messages:n,abortSignal:o,experimental_context:l}),await async function({tool:e,toolCall:t,messages:r,experimental_context:a}){return null!=e.needsApproval&&("boolean"==typeof e.needsApproval?e.needsApproval:await e.needsApproval(t.input,{toolCallId:t.toolCallId,messages:r,experimental_context:a}))}({tool:g,toolCall:f,messages:n,experimental_context:l})){c.enqueue({type:"tool-approval-request",approvalId:u(),toolCall:f});break}if(h.set(f.toolCallId,f.input),null!=g.execute&&!0!==f.providerExecuted){const t=u();d.add(t),xr({toolCall:f,tools:e,tracer:r,telemetry:a,messages:n,abortSignal:o,experimental_context:l,onPreliminaryToolResult:e=>{c.enqueue(e)}}).then((e=>{c.enqueue(e)})).catch((e=>{c.enqueue({type:"error",error:e})})).finally((()=>{d.delete(t),y()}))}}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:h.get(t.toolCallId),providerExecuted:!0,error:t.result,dynamic:t.dynamic}):p.enqueue({type:"tool-result",toolCallId:t.toolCallId,toolName:e,input:h.get(t.toolCallId),output:t.result,providerExecuted:!0,dynamic:t.dynamic});break}default:throw new Error(`Unhandled chunk type: ${g}`)}},flush(){g=!0,y()}});return new ReadableStream({start:async e=>Promise.all([t.pipeThrough(x).pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){}})),p.pipeTo(new WritableStream({write(t){e.enqueue(t)},close(){e.close()}}))])})}({tools:h,generatorStream:z,tracer:ee,telemetry:t,system:c,messages:D,repairToolCall:E,abortSignal:n,experimental_context:M,generateId:A}),se=null!=W?W:{},ne=[],oe=[];let ie;const le={};let ue,ce,pe="other",de={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},he=!0,me={id:A(),timestamp:new Date,modelId:e.modelId},fe="";ae.addStream(J.pipeThrough(new TransformStream({async transform(e,t){var r,a,s,o,i;if(null!=l&&(null!=j&&clearTimeout(j),j=setTimeout((()=>u.abort()),l)),"stream-start"===e.type)return void(ie=e.warnings);if(he){const e=T()-X;he=!1,K.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":e}),K.setAttributes({"ai.response.msToFirstChunk":e}),t.enqueue({type:"start-step",request:se,warnings:null!=ie?ie:[]})}const c=e.type;switch(c){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}),fe+=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),ne.push(e);break;case"tool-result":t.enqueue(e),e.preliminary||oe.push(e);break;case"tool-error":t.enqueue(e),oe.push(e);break;case"response-metadata":me={id:null!=(r=e.id)?r:me.id,timestamp:null!=(a=e.timestamp)?a:me.timestamp,modelId:null!=(s=e.modelId)?s:me.modelId};break;case"finish":{de=e.usage,pe=e.finishReason,ue=e.rawFinishReason,ce=e.providerMetadata;const t=T()-X;K.addEvent("ai.stream.finish"),K.setAttributes({"ai.response.msToFinish":t,"ai.response.avgOutputTokensPerSecond":1e3*(null!=(o=de.outputTokens)?o:0)/t});break}case"tool-input-start":{le[e.id]=e.toolName;const r=null==h?void 0:h[e.toolName];null!=(null==r?void 0:r.onInputStart)&&await r.onInputStart({toolCallId:e.id,messages:D,abortSignal:n,experimental_context:M}),t.enqueue({...e,dynamic:null!=(i=e.dynamic)?i:"dynamic"===(null==r?void 0:r.type),title:null==r?void 0:r.title});break}case"tool-input-end":delete le[e.id],t.enqueue(e);break;case"tool-input-delta":{const r=le[e.id],a=null==h?void 0:h[r];null!=(null==a?void 0:a.onInputDelta)&&await a.onInputDelta({inputTextDelta:e.delta,toolCallId:e.id,messages:D,abortSignal:n,experimental_context:M}),t.enqueue(e);break}case"error":t.enqueue(e),pe="error";break;case"raw":O&&t.enqueue(e);break;default:throw new Error(`Unknown chunk type: ${c}`)}},async flush(e){const r=ne.length>0?JSON.stringify(ne):void 0;try{K.setAttributes(await hr({telemetry:t,attributes:{"ai.response.finishReason":pe,"ai.response.text":{output:()=>fe},"ai.response.toolCalls":{output:()=>r},"ai.response.id":me.id,"ai.response.model":me.modelId,"ai.response.timestamp":me.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(ce),"ai.usage.inputTokens":de.inputTokens,"ai.usage.outputTokens":de.outputTokens,"ai.usage.totalTokens":de.totalTokens,"ai.usage.reasoningTokens":de.reasoningTokens,"ai.usage.cachedInputTokens":de.cachedInputTokens,"gen_ai.response.finish_reasons":[pe],"gen_ai.response.id":me.id,"gen_ai.response.model":me.modelId,"gen_ai.usage.input_tokens":de.inputTokens,"gen_ai.usage.output_tokens":de.outputTokens}}))}catch(e){}finally{K.end()}e.enqueue({type:"finish-step",finishReason:pe,rawFinishReason:ue,usage:de,providerMetadata:ce,response:{...me,headers:null==H?void 0:H.headers}});const s=function(e,t){var r,a,s,n,o,i,l,u,c,p;return{inputTokens:fr(e.inputTokens,t.inputTokens),inputTokenDetails:{noCacheTokens:fr(null==(r=e.inputTokenDetails)?void 0:r.noCacheTokens,null==(a=t.inputTokenDetails)?void 0:a.noCacheTokens),cacheReadTokens:fr(null==(s=e.inputTokenDetails)?void 0:s.cacheReadTokens,null==(n=t.inputTokenDetails)?void 0:n.cacheReadTokens),cacheWriteTokens:fr(null==(o=e.inputTokenDetails)?void 0:o.cacheWriteTokens,null==(i=t.inputTokenDetails)?void 0:i.cacheWriteTokens)},outputTokens:fr(e.outputTokens,t.outputTokens),outputTokenDetails:{textTokens:fr(null==(l=e.outputTokenDetails)?void 0:l.textTokens,null==(u=t.outputTokenDetails)?void 0:u.textTokens),reasoningTokens:fr(null==(c=e.outputTokenDetails)?void 0:c.reasoningTokens,null==(p=t.outputTokenDetails)?void 0:p.reasoningTokens)},totalTokens:fr(e.totalTokens,t.totalTokens),reasoningTokens:fr(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:fr(e.cachedInputTokens,t.cachedInputTokens)}}(y,de);await $.promise;const n=ne.filter((e=>!0!==e.providerExecuted)),o=oe.filter((e=>!0!==e.providerExecuted));for(const e of ne){if(!0!==e.providerExecuted)continue;const t=null==h?void 0:h[e.toolName];"provider"===(null==t?void 0:t.type)&&t.supportsDeferredResults&&(oe.some((t=>"tool-result"===t.type&&t.toolCallId===e.toolCallId))||B.set(e.toolCallId,{toolName:e.toolName}))}for(const e of oe)"tool-result"===e.type&&B.delete(e.toolCallId);if(null!=L&&clearTimeout(L),null!=j&&(clearTimeout(j),j=void 0),(n.length>0&&o.length===n.length||B.size>0)&&!await async function({stopConditions:e,steps:t}){return(await Promise.all(e.map((e=>e({steps:t}))))).some((e=>e))}({stopConditions:b,steps:U})){d.push(...await Mr({content:U[U.length-1].content,tools:h}));try{await a({currentStep:p+1,responseMessages:d,usage:s})}catch(t){e.enqueue({type:"error",error:t}),ae.closeStream()}}else e.enqueue({type:"finish",finishReason:pe,rawFinishReason:ue,totalUsage:s}),ae.closeStream()}})))}({currentStep:0,responseMessages:S,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=>{ae.addStream(new ReadableStream({start(t){t.enqueue({type:"error",error:e}),t.close()}})),ae.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}get rawFinishReason(){return this.consumeStream(),this._rawFinishReason.promise}teeStream(){const[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return Ur(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){"text-delta"===e.type&&t.enqueue(e.text)}})))}get fullStream(){return Ur(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await async function({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:e}=await r.read();if(e)break}}catch(e){null==t||t(e)}finally{r.releaseLock()}}({stream:this.fullStream,onError:null==e?void 0:e.onError})}catch(r){null==(t=null==e?void 0:e.onError)||t.call(e,r)}}get experimental_partialOutputStream(){return this.partialOutputStream}get partialOutputStream(){return Ur(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:e},t){null!=e&&t.enqueue(e)}})))}get elementStream(){var e,t,r;const a=null==(e=this.outputSpecification)?void 0:e.createElementStreamTransform();if(null==a)throw new y.b8({functionality:`element streams in ${null!=(r=null==(t=this.outputSpecification)?void 0:t.name)?r:"text"} mode`});return Ur(this.teeStream().pipeThrough(a))}get output(){return this.finalStep.then((e=>{var t;return(null!=(t=this.outputSpecification)?t:kr()).parseCompleteOutput({text:e.text},{response:e.response,usage:e.usage,finishReason:e.finishReason})}))}toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:s=!0,sendSources:n=!1,sendStart:o=!0,sendFinish:i=!0,onError:l=y.u1}={}){const u=null!=t?function({originalMessages:e,responseMessageId:t}){if(null==e)return;const r=e[e.length-1];return"assistant"===(null==r?void 0:r.role)?r.id:"function"==typeof t?t():t}({originalMessages:e,responseMessageId:t}):void 0,c=e=>{var t;const r=null==(t=this.tools)?void 0:t[e.toolName];return null==r?e.dynamic:"dynamic"===(null==r?void 0:r.type)||void 0};return Ur(qr({stream:this.fullStream.pipeThrough(new TransformStream({transform:async(e,t)=>{const r=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":s&&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":n&&"url"===e.sourceType&&t.enqueue({type:"source-url",sourceId:e.id,url:e.url,title:e.title,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}),n&&"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 r=c(e);t.enqueue({type:"tool-input-start",toolCallId:e.id,toolName:e.toolName,...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=r?{dynamic:r}:{},...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 r=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!=r?{dynamic:r}:{},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!=r?{dynamic:r}:{},...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 r=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!=r?{dynamic:r}:{}});break}case"tool-error":{const r=c(e);t.enqueue({type:"tool-output-error",toolCallId:e.toolCallId,errorText:l(e.error),...null!=e.providerExecuted?{providerExecuted:e.providerExecuted}:{},...null!=r?{dynamic:r}:{}});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":o&&t.enqueue({type:"start",...null!=r?{messageMetadata:r}:{},...null!=u?{messageId:u}:{}});break;case"finish":i&&t.enqueue({type:"finish",finishReason:e.finishReason,...null!=r?{messageMetadata:r}:{}});break;case"abort":t.enqueue(e);break;case"tool-input-end":case"raw":break;default:throw new Error(`Unknown chunk type: ${p}`)}null!=r&&"start"!==p&&"finish"!==p&&t.enqueue({type:"message-metadata",messageMetadata:r})}})),messageId:null!=u?u:null==t?void 0:t(),originalMessages:e,onFinish:r,onError:l}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:r,onFinish:a,messageMetadata:s,sendReasoning:n,sendSources:o,sendFinish:i,sendStart:l,onError:u,...c}={}){!function({response:e,status:t,statusText:r,headers:a,stream:s,consumeSseStream:n}){let o=s.pipeThrough(new jr);if(n){const[e,t]=o.tee();o=e,n({stream:t})}Lr({response:e,status:t,statusText:r,headers:Object.fromEntries($r(a,Dr).entries()),stream:o.pipeThrough(new TextEncoderStream)})}({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:r,onFinish:a,messageMetadata:s,sendReasoning:n,sendSources:o,sendFinish:i,sendStart:l,onError:u}),...c})}pipeTextStreamToResponse(e,t){!function({response:e,status:t,statusText:r,headers:a,textStream:s}){Lr({response:e,status:t,statusText:r,headers:Object.fromEntries($r(a,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:s.pipeThrough(new TextEncoderStream)})}({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:s,sendSources:n,sendFinish:o,sendStart:i,onError:l,...u}={}){return function({status:e,statusText:t,headers:r,stream:a,consumeSseStream:s}){let n=a.pipeThrough(new jr);if(s){const[e,t]=n.tee();n=e,s({stream:t})}return new Response(n.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:$r(r,Dr)})}({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:s,sendSources:n,sendFinish:o,sendStart:i,onError:l}),...u})}toTextStreamResponse(e){return function({status:e,statusText:t,headers:r,textStream:a}){return new Response(a.pipeThrough(new TextEncoderStream),{status:null!=e?e:200,statusText:t,headers:$r(r,{"content-type":"text/plain; charset=utf-8"})})}({textStream:this.textStream,...e})}};(0,v.ID)((()=>(0,v.jN)(x.YO(x.Ik({id:x.Yj(),role:x.k5(["system","user","assistant"]),metadata:x.L5().optional(),parts:x.YO(x.KC([x.Ik({type:x.eu("text"),text:x.Yj(),state:x.k5(["streaming","done"]).optional(),providerMetadata:Gt.optional()}),x.Ik({type:x.eu("reasoning"),text:x.Yj(),state:x.k5(["streaming","done"]).optional(),providerMetadata:Gt.optional()}),x.Ik({type:x.eu("source-url"),sourceId:x.Yj(),url:x.Yj(),title:x.Yj().optional(),providerMetadata:Gt.optional()}),x.Ik({type:x.eu("source-document"),sourceId:x.Yj(),mediaType:x.Yj(),title:x.Yj(),filename:x.Yj().optional(),providerMetadata:Gt.optional()}),x.Ik({type:x.eu("file"),mediaType:x.Yj(),filename:x.Yj().optional(),url:x.Yj(),providerMetadata:Gt.optional()}),x.Ik({type:x.eu("step-start")}),x.Ik({type:x.Yj().startsWith("data-"),id:x.Yj().optional(),data:x.L5()}),x.Ik({type:x.eu("dynamic-tool"),toolName:x.Yj(),toolCallId:x.Yj(),state:x.eu("input-streaming"),input:x.L5().optional(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),approval:x.Zm().optional()}),x.Ik({type:x.eu("dynamic-tool"),toolName:x.Yj(),toolCallId:x.Yj(),state:x.eu("input-available"),input:x.L5(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Zm().optional()}),x.Ik({type:x.eu("dynamic-tool"),toolName:x.Yj(),toolCallId:x.Yj(),state:x.eu("approval-requested"),input:x.L5(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.Zm().optional(),reason:x.Zm().optional()})}),x.Ik({type:x.eu("dynamic-tool"),toolName:x.Yj(),toolCallId:x.Yj(),state:x.eu("approval-responded"),input:x.L5(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.zM(),reason:x.Yj().optional()})}),x.Ik({type:x.eu("dynamic-tool"),toolName:x.Yj(),toolCallId:x.Yj(),state:x.eu("output-available"),input:x.L5(),providerExecuted:x.zM().optional(),output:x.L5(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),preliminary:x.zM().optional(),approval:x.Ik({id:x.Yj(),approved:x.eu(!0),reason:x.Yj().optional()}).optional()}),x.Ik({type:x.eu("dynamic-tool"),toolName:x.Yj(),toolCallId:x.Yj(),state:x.eu("output-error"),input:x.L5(),rawInput:x.L5().optional(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Yj(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.eu(!0),reason:x.Yj().optional()}).optional()}),x.Ik({type:x.eu("dynamic-tool"),toolName:x.Yj(),toolCallId:x.Yj(),state:x.eu("output-denied"),input:x.L5(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.eu(!1),reason:x.Yj().optional()})}),x.Ik({type:x.Yj().startsWith("tool-"),toolCallId:x.Yj(),state:x.eu("input-streaming"),providerExecuted:x.zM().optional(),input:x.L5().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),approval:x.Zm().optional()}),x.Ik({type:x.Yj().startsWith("tool-"),toolCallId:x.Yj(),state:x.eu("input-available"),providerExecuted:x.zM().optional(),input:x.L5(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Zm().optional()}),x.Ik({type:x.Yj().startsWith("tool-"),toolCallId:x.Yj(),state:x.eu("approval-requested"),input:x.L5(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.Zm().optional(),reason:x.Zm().optional()})}),x.Ik({type:x.Yj().startsWith("tool-"),toolCallId:x.Yj(),state:x.eu("approval-responded"),input:x.L5(),providerExecuted:x.zM().optional(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.zM(),reason:x.Yj().optional()})}),x.Ik({type:x.Yj().startsWith("tool-"),toolCallId:x.Yj(),state:x.eu("output-available"),providerExecuted:x.zM().optional(),input:x.L5(),output:x.L5(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),preliminary:x.zM().optional(),approval:x.Ik({id:x.Yj(),approved:x.eu(!0),reason:x.Yj().optional()}).optional()}),x.Ik({type:x.Yj().startsWith("tool-"),toolCallId:x.Yj(),state:x.eu("output-error"),providerExecuted:x.zM().optional(),input:x.L5(),rawInput:x.L5().optional(),output:x.Zm().optional(),errorText:x.Yj(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.eu(!0),reason:x.Yj().optional()}).optional()}),x.Ik({type:x.Yj().startsWith("tool-"),toolCallId:x.Yj(),state:x.eu("output-denied"),providerExecuted:x.zM().optional(),input:x.L5(),output:x.Zm().optional(),errorText:x.Zm().optional(),callProviderMetadata:Gt.optional(),approval:x.Ik({id:x.Yj(),approved:x.eu(!1),reason:x.Yj().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")))),(0,v.hK)({prefix:"aiobj",size:24}),(0,v.hK)({prefix:"aiobj",size:24});var Wr=Symbol.for("vercel.ai.error.AI_NoSuchProviderError");y.eM,y.bD},38506:(e,t,r)=>{const a=r(47538);e.exports=(e,t)=>e.sort(((e,r)=>a(r,e,t)))},39044:(e,t,r)=>{const a=r(20332);e.exports=(e,t)=>new a(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},40030:(e,t,r)=>{var a=r(65994).process;Object.defineProperty(t,"__esModule",{value:!0}),t.signals=void 0,t.signals=[],t.signals.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==a.platform&&t.signals.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===a.platform&&t.signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")},40289:(e,t,r)=>{const a=r(41694);e.exports=(e,t,r)=>new a(e,r).compare(new a(t,r))},40594:e=>{const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},40811:(e,t,r)=>{var a=r(4414),s=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],n=["scalar","sequence","mapping"];e.exports=function(e,t){var r,o;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===s.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=(r=t.styleAliases||null,o={},null!==r&&Object.keys(r).forEach((function(e){r[e].forEach((function(t){o[String(t)]=e}))})),o),-1===n.indexOf(this.kind))throw new a('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},41163:(e,t,r)=>{var a;Object.defineProperty(t,"__esModule",{value:!0}),t.unload=t.load=t.onExit=t.signals=void 0;const s=r(40030);Object.defineProperty(t,"signals",{enumerable:!0,get:function(){return s.signals}});const n=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,o=Symbol.for("signal-exit emitter"),i=globalThis,l=Object.defineProperty.bind(Object);class u{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(i[o])return i[o];l(i,o,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){const r=this.listeners[e],a=r.indexOf(t);-1!==a&&(0===a&&1===r.length?r.length=0:r.splice(a,1))}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let a=!1;for(const s of this.listeners[e])a=!0===s(t,r)||a;return"exit"===e&&(a=this.emit("afterExit",t,r)||a),a}}class c{}const p=globalThis.process;var d;d=n(p)?new class extends c{#e="win32"===p.platform?"SIGINT":"SIGHUP";#t=new u;#r;#a;#s;#n={};#o=!1;constructor(e){super(),this.#r=e,this.#n={};for(const t of s.signals)this.#n[t]=()=>{const r=this.#r.listeners(t);let{count:a}=this.#t;const s=e;if("object"==typeof s.__signal_exit_emitter__&&"number"==typeof s.__signal_exit_emitter__.count&&(a+=s.__signal_exit_emitter__.count),r.length===a){this.unload();const r=this.#t.emit("exit",null,t),a="SIGHUP"===t?this.#e:t;r||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#a=e.emit}onExit(e,t){if(!n(this.#r))return()=>{};!1===this.#o&&this.load();const r=t?.alwaysLast?"afterExit":"exit";return this.#t.on(r,e),()=>{this.#t.removeListener(r,e),0===this.#t.listeners.exit.length&&0===this.#t.listeners.afterExit.length&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(const e of s.signals)try{const t=this.#n[e];t&&this.#r.on(e,t)}catch(e){}this.#r.emit=(e,...t)=>this.#i(e,...t),this.#r.reallyExit=e=>this.#l(e)}}unload(){this.#o&&(this.#o=!1,s.signals.forEach((e=>{const t=this.#n[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#r.removeListener(e,t)}catch(e){}})),this.#r.emit=this.#a,this.#r.reallyExit=this.#s,this.#t.count-=1)}#l(e){return n(this.#r)?(this.#r.exitCode=e||0,this.#t.emit("exit",this.#r.exitCode,null),this.#s.call(this.#r,this.#r.exitCode)):0}#i(e,...t){const r=this.#a;if("exit"===e&&n(this.#r)){"number"==typeof t[0]&&(this.#r.exitCode=t[0]);const a=r.call(this.#r,e,...t);return this.#t.emit("exit",this.#r.exitCode,null),a}return r.call(this.#r,e,...t)}}(p):new class extends c{onExit(){return()=>{}}load(){}unload(){}},a={onExit:(e,t)=>d.onExit(e,t),load:()=>d.load(),unload:()=>d.unload()},t.onExit=a.onExit,t.load=a.load,t.unload=a.unload},41210:(e,t,r)=>{r.d(t,{$b:()=>P,Ds:()=>Ae,G1:()=>_,GU:()=>be,ID:()=>de,N8:()=>ye,WZ:()=>N,Z9:()=>g,ZZ:()=>ve,_Z:()=>xe,ae:()=>_e,cV:()=>Ce,cb:()=>c,e1:()=>d,hK:()=>k,hd:()=>Se,jN:()=>fe,k5:()=>ge,m2:()=>u,mD:()=>me,nV:()=>w,n_:()=>v,o8:()=>Re,qs:()=>$,qx:()=>R,sl:()=>Te,u1:()=>S,wA:()=>ke,x3:()=>L,z6:()=>we,zf:()=>T});var a=r(12574),s=r(67299),n=r(21935),o=r(84340),i=r(29744),l=r(65994).process;function u(...e){return e.reduce(((e,t)=>({...e,...null!=t?t:{}})),{})}async function c(e,t){if(null==e)return Promise.resolve();const r=null==t?void 0:t.abortSignal;return new Promise(((t,a)=>{if(null==r?void 0:r.aborted)return void a(p());const s=setTimeout((()=>{n(),t()}),e),n=()=>{clearTimeout(s),null==r||r.removeEventListener("abort",o)},o=()=>{n(),a(p())};null==r||r.addEventListener("abort",o)}))}function p(){return new DOMException("Delay was aborted","AbortError")}var d=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 h(e){return Object.fromEntries([...e.headers])}var{btoa:m,atob:f}=globalThis;function g(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=f(t);return Uint8Array.from(r,(e=>e.codePointAt(0)))}function v(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return m(t)}var y,x,E="AI_DownloadError",b=`vercel.ai.error.${E}`,I=Symbol.for(b),w=class extends(x=a.bD,y=I,x){constructor({url:e,statusCode:t,statusText:r,cause:a,message:s=(null==a?`Failed to download ${e}: ${t} ${r}`:`Failed to download ${e}: ${a}`)}){super({name:E,message:s,cause:a}),this[y]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return a.bD.hasMarker(e,b)}},k=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const n=()=>{const e=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[Math.random()*e|0];return a.join("")};if(null==e)return n;if(r.includes(s))throw new a.Di({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${r}".`});return()=>`${e}${s}${n()}`};function S(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}function T(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}k();var A=["fetch failed","failed to fetch"];function C({error:e,url:t,requestBodyValues:r}){if(T(e))return e;if(e instanceof TypeError&&A.includes(e.message.toLowerCase())){const s=e.cause;if(null!=s)return new a.hL({message:`Cannot connect to API: ${s.message}`,cause:s,url:t,requestBodyValues:r,isRetryable:!0})}return e}function _(e=globalThis){var t,r,a;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(a=null==(r=e.process)?void 0:r.versions)?void 0:a.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function R(e){if(null==e)return{};const t={};if(e instanceof Headers)e.forEach(((e,r)=>{t[r.toLowerCase()]=e}));else{Array.isArray(e)||(e=Object.entries(e));for(const[r,a]of e)null!=a&&(t[r.toLowerCase()]=a)}return t}function N(e,...t){const r=new Headers(R(e)),a=r.get("user-agent")||"";return r.set("user-agent",[a,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var O="4.0.5",M=()=>globalThis.fetch,P=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:s,abortSignal:n,fetch:o=M()})=>{try{const i=await o(e,{method:"GET",headers:N(t,`ai-sdk/provider-utils/${O}`,_()),signal:n}),l=h(i);if(!i.ok){let t;try{t=await s({response:i,url:e,requestBodyValues:{}})}catch(t){if(T(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 r({response:i,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(T(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 C({error:t,url:e,requestBodyValues:{}})}};function $({mediaType:e,url:t,supportedUrls:r}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(r).map((([e,t])=>{const r=e.toLowerCase();return"*"===r||"*/*"===r?{mediaTypePrefix:"",regexes:t}:{mediaTypePrefix:r.replace(/\*/,""),regexes:t}})).filter((({mediaTypePrefix:t})=>e.startsWith(t))).flatMap((({regexes:e})=>e)).some((e=>e.test(t)))}function L({settingValue:e,environmentVariableName:t}){return"string"==typeof e||null==e&&void 0!==l&&null!=(e=l.env[t])&&"string"==typeof e?e:void 0}var j=/"__proto__"\s*:/,D=/"constructor"\s*:/;function Y(e){const t=JSON.parse(e);return null===t||"object"!=typeof t||!1===j.test(e)&&!1===D.test(e)?t:function(e){let t=[e];for(;t.length;){const e=t;t=[];for(const r of e){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const e in r){const a=r[e];a&&"object"==typeof a&&t.push(a)}}}return e}(t)}function F(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return Y(e)}try{return Y(e)}finally{Error.stackTraceLimit=t}}function V(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=q(t[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(q):q(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(q)),null!=e.allOf&&(e.allOf=e.allOf.map(q)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(q));const{definitions:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=q(t[e]);return e}function q(e){return"boolean"==typeof e?e:V(e)}var U=Symbol("Let zodToJsonSchema decide on which parser to use"),B={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 G(e,t){return ie(e.type._def,t)}function Z(e,t,r){const a=null!=r?r:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map(((r,a)=>Z(e,t,r)))};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 z(e)}}var z=e=>{const t={type:"integer",format:"unix-time"};for(const r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value}return t},H=void 0,W={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===H&&(H=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),H),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 K(e,t){const r={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"email":switch(t.emailStrategy){case"format:email":Q(r,"email",a.message,t);break;case"format:idn-email":Q(r,"idn-email",a.message,t);break;case"pattern:zod":ee(r,W.email,a.message,t)}break;case"url":Q(r,"uri",a.message,t);break;case"uuid":Q(r,"uuid",a.message,t);break;case"regex":ee(r,a.regex,a.message,t);break;case"cuid":ee(r,W.cuid,a.message,t);break;case"cuid2":ee(r,W.cuid2,a.message,t);break;case"startsWith":ee(r,RegExp(`^${X(a.value,t)}`),a.message,t);break;case"endsWith":ee(r,RegExp(`${X(a.value,t)}$`),a.message,t);break;case"datetime":Q(r,"date-time",a.message,t);break;case"date":Q(r,"date",a.message,t);break;case"time":Q(r,"time",a.message,t);break;case"duration":Q(r,"duration",a.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value;break;case"includes":ee(r,RegExp(X(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&Q(r,"ipv4",a.message,t),"v4"!==a.version&&Q(r,"ipv6",a.message,t);break;case"base64url":ee(r,W.base64url,a.message,t);break;case"jwt":ee(r,W.jwt,a.message,t);break;case"cidr":"v6"!==a.version&&ee(r,W.ipv4Cidr,a.message,t),"v4"!==a.version&&ee(r,W.ipv6Cidr,a.message,t);break;case"emoji":ee(r,W.emoji(),a.message,t);break;case"ulid":ee(r,W.ulid,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Q(r,"binary",a.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":ee(r,W.base64,a.message,t)}break;case"nanoid":ee(r,W.nanoid,a.message,t)}return r}function X(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)J.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var J=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Q(e,t,r,a){var s;e.format||(null==(s=e.anyOf)?void 0:s.some((e=>e.format)))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function ee(e,t,r,a){var s;e.pattern||(null==(s=e.allOf)?void 0:s.some((e=>e.pattern)))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:te(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=te(t,a)}function te(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),s=e.flags.includes("m"),n=e.flags.includes("s"),o=a?e.source.toLowerCase():e.source;let i="",l=!1,u=!1,c=!1;for(let e=0;e<o.length;e++)if(l)i+=o[e],l=!1;else{if(a)if(u){if(o[e].match(/[a-z]/)){c?(i+=o[e],i+=`${o[e-2]}-${o[e]}`.toUpperCase(),c=!1):"-"===o[e+1]&&(null==(r=o[e+2])?void 0:r.match(/[a-z]/))?(i+=o[e],c=!0):i+=`${o[e]}${o[e].toUpperCase()}`;continue}}else if(o[e].match(/[a-z]/)){i+=`[${o[e]}${o[e].toUpperCase()}]`;continue}if(s){if("^"===o[e]){i+="(^|(?<=[\r\n]))";continue}if("$"===o[e]){i+="($|(?=[\r\n]))";continue}}n&&"."===o[e]?i+=u?`${o[e]}\r\n`:`[${o[e]}\r\n]`:(i+=o[e],"\\"===o[e]?l=!0:u&&"]"===o[e]?u=!1:u||"["!==o[e]||(u=!0))}try{new RegExp(i)}catch(r){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 re(e,t){var r,a,s,n,i,l;const u={type:"object",additionalProperties:null!=(r=ie(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(a=e.keyType)?void 0:a._def.typeName)===o.kY.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:r,...a}=K(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(n=e.keyType)?void 0:n._def.typeName)===o.kY.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(i=e.keyType)?void 0:i._def.typeName)===o.kY.ZodBranded&&e.keyType._def.type._def.typeName===o.kY.ZodString&&(null==(l=e.keyType._def.type._def.checks)?void 0:l.length)){const{type:r,...a}=G(e.keyType._def,t);return{...u,propertyNames:a}}return u}var ae={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function se(e){try{return e.isOptional()}catch(e){return!0}}var ne=(e,t,r)=>{switch(t){case o.kY.ZodString:return K(e,r);case o.kY.ZodNumber:return function(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case o.kY.ZodObject:return function(e,t){const r={type:"object",properties:{}},a=[],s=e.shape();for(const e in s){let n=s[e];if(void 0===n||void 0===n._def)continue;const o=se(n),i=ie(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==i&&(r.properties[e]=i,o||a.push(e))}a.length&&(r.required=a);const n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return ie(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!==n&&(r.additionalProperties=n),r}(e,r);case o.kY.ZodBigInt:return function(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case o.kY.ZodBoolean:return{type:"boolean"};case o.kY.ZodDate:return Z(e,r);case o.kY.ZodUndefined:return{not:{}};case o.kY.ZodNull:return{type:"null"};case o.kY.ZodArray:return function(e,t){var r,a,s;const n={type:"array"};return(null==(r=e.type)?void 0:r._def)&&(null==(s=null==(a=e.type)?void 0:a._def)?void 0:s.typeName)!==o.kY.ZodAny&&(n.items=ie(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}(e,r);case o.kY.ZodUnion:case o.kY.ZodDiscriminatedUnion:return function(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((e=>e._def.typeName in ae&&(!e._def.checks||!e._def.checks.length)))){const e=r.reduce(((e,t)=>{const r=ae[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e}),[]);return{type:e.length>1?e:e[0]}}if(r.every((e=>"ZodLiteral"===e._def.typeName&&!e.description))){const e=r.reduce(((e,t)=>{const r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}}),[]);if(e.length===r.length){const t=e.filter(((e,t,r)=>r.indexOf(e)===t));return{type:t.length>1?t:t[0],enum:r.reduce(((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value]),[])}}}else if(r.every((e=>"ZodEnum"===e._def.typeName)))return{type:"string",enum:r.reduce(((e,t)=>[...e,...t._def.values.filter((t=>!e.includes(t)))]),[])};return((e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map(((e,r)=>ie(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]}))).filter((e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0)));return r.length?{anyOf:r}:void 0})(e,t)}(e,r);case o.kY.ZodIntersection:return function(e,t){const r=[ie(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ie(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((e=>!!e)),a=[];return r.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:r,...a}=e;t=a}a.push(t)}else a.push(...e.allOf);var t})),a.length?{allOf:a}:void 0}(e,r);case o.kY.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map(((e,r)=>ie(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[]),additionalItems:ie(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map(((e,r)=>ie(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[])}}(e,r);case o.kY.ZodRecord:return re(e,r);case o.kY.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 o.kY.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case o.kY.ZodNativeEnum:return function(e){const t=e.values,r=Object.keys(e.values).filter((e=>"number"!=typeof t[t[e]])).map((e=>t[e])),a=Array.from(new Set(r.map((e=>typeof e))));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:r}}(e);case o.kY.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:[ae[e.innerType._def.typeName],"null"]};const r=ie(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}(e,r);case o.kY.ZodOptional:return((e,t)=>{var r;if(t.currentPath.toString()===(null==(r=t.propertyPath)?void 0:r.toString()))return ie(e.innerType._def,t);const a=ie(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:{}},a]}:{}})(e,r);case o.kY.ZodMap:return function(e,t){return"record"===t.mapStrategy?re(e,t):{type:"array",maxItems:125,items:{type:"array",items:[ie(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},ie(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}(e,r);case o.kY.ZodSet:return function(e,t){const r={type:"array",uniqueItems:!0,items:ie(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}(e,r);case o.kY.ZodLazy:return()=>e.getter()._def;case o.kY.ZodPromise:return function(e,t){return ie(e.type._def,t)}(e,r);case o.kY.ZodNaN:case o.kY.ZodNever:return{not:{}};case o.kY.ZodEffects:return function(e,t){return"input"===t.effectStrategy?ie(e.schema._def,t):{}}(e,r);case o.kY.ZodAny:case o.kY.ZodUnknown:return{};case o.kY.ZodDefault:return function(e,t){return{...ie(e.innerType._def,t),default:e.defaultValue()}}(e,r);case o.kY.ZodBranded:return G(e,r);case o.kY.ZodReadonly:case o.kY.ZodCatch:return((e,t)=>ie(e.innerType._def,t))(e,r);case o.kY.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return ie(e.in._def,t);if("output"===t.pipeStrategy)return ie(e.out._def,t);const r=ie(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[r,ie(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]})].filter((e=>void 0!==e))}})(e,r);case o.kY.ZodFunction:case o.kY.ZodVoid:case o.kY.ZodSymbol:default:return}},oe=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function ie(e,t,r=!1){var a;const s=t.seen.get(e);if(t.override){const n=null==(a=t.override)?void 0:a.call(t,e,t,s,r);if(n!==U)return n}if(s&&!r){const e=le(s,t);if(void 0!==e)return e}const n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);const o=ne(e,e.typeName,t),i="function"==typeof o?ie(o(),t):o;if(i&&ue(e,t,i),t.postProcess){const r=t.postProcess(i,e,t);return n.jsonSchema=i,r}return n.jsonSchema=i,i}var le=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:oe(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(((e,r)=>t.currentPath[r]===e))?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):"seen"===t.$refStrategy?{}:void 0}},ue=(e,t,r)=>(e.description&&(r.description=e.description),r),ce=(e,t)=>{var r;const a=(e=>{const t=(e=>"string"==typeof e?{...B,name:e}:{...B,...e})(e),r=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map((([e,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}])))}})(t);let s="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce(((e,[t,r])=>{var s;return{...e,[t]:null!=(s=ie(r._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?s:{}}}),{}):void 0;const n="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,o=null!=(r=ie(e._def,void 0===n?a:{...a,currentPath:[...a.basePath,a.definitionPath,n]},!1))?r:{},i="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==i&&(o.title=i);const l=void 0===n?s?{...o,[a.definitionPath]:s}:o:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,n].join("/"),[a.definitionPath]:{...s,[n]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},pe=Symbol.for("vercel.ai.schema");function de(e){let t;return()=>(null==t&&(t=e()),t)}function he(e,{validate:t}={}){return{[pe]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function me(e){return null==e?he({properties:{},additionalProperties:!1}):"object"==typeof(r=e)&&null!==r&&pe in r&&!0===r[pe]&&"jsonSchema"in r&&"validate"in r?e:"~standard"in e?"zod"===e["~standard"].vendor?fe(e):(t=e,he((()=>V(t["~standard"].jsonSchema.input({target:"draft-07"}))),{validate:async e=>{const r=await t["~standard"].validate(e);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new a.iM({value:e,cause:r.issues})}}})):e();var t,r}function fe(e,t){return function(e){return"_zod"in e}(e)?function(e,t){var r;const a=null!=(r=null==t?void 0:t.useReferences)&&r;return he((()=>V(n.b(e,{target:"draft-7",io:"input",reused:a?"ref":"inline"}))),{validate:async t=>{const r=await s.bp(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t):function(e,t){var r;const a=null!=(r=null==t?void 0:t.useReferences)&&r;return he((()=>ce(e,{$refStrategy:a?"root":"none"})),{validate:async t=>{const r=await e.safeParseAsync(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t)}async function ge({value:e,schema:t}){const r=await ve({value:e,schema:t});if(!r.success)throw a.iM.wrap({value:e,cause:r.error});return r.value}async function ve({value:e,schema:t}){const r=me(t);try{if(null==r.validate)return{success:!0,value:e,rawValue:e};const t=await r.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 ye({text:e,schema:t}){try{const r=F(e);return null==t?{success:!0,value:r,rawValue:r}:await ve({value:r,schema:t})}catch(t){return{success:!1,error:a.u6.isInstance(t)?t:new a.u6({text:e,cause:t}),rawValue:void 0}}}function xe({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new i.Z).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await ye({text:e,schema:t}))}}))}var Ee=()=>globalThis.fetch,be=async({url:e,headers:t,body:r,failedResponseHandler:a,successfulResponseHandler:s,abortSignal:n,fetch:o})=>Ie({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:a,successfulResponseHandler:s,abortSignal:n,fetch:o}),Ie=async({url:e,headers:t={},body:r,successfulResponseHandler:s,failedResponseHandler:n,abortSignal:o,fetch:i=Ee()})=>{try{const l=await i(e,{method:"POST",headers:N(t,`ai-sdk/provider-utils/${O}`,_()),body:r.content,signal:o}),u=h(l);if(!l.ok){let t;try{t=await n({response:l,url:e,requestBodyValues:r.values})}catch(t){if(T(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:r.values})}throw t.value}try{return await s({response:l,url:e,requestBodyValues:r.values})}catch(t){if(t instanceof Error&&(T(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:r.values})}}catch(t){throw C({error:t,url:e,requestBodyValues:r.values})}};function we(e){return e}function ke({id:e,inputSchema:t,outputSchema:r,supportsDeferredResults:a}){return({execute:s,needsApproval:n,toModelOutput:o,onInputStart:i,onInputDelta:l,onInputAvailable:u,...c})=>({type:"provider",id:e,args:c,inputSchema:t,outputSchema:r,execute:s,needsApproval:n,toModelOutput:o,onInputStart:i,onInputDelta:l,onInputAvailable:u,supportsDeferredResults:a})}async function Se(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var Te=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:s,url:n,requestBodyValues:o})=>{const i=await s.text(),l=h(s);if(""===i.trim())return{responseHeaders:l,value:new a.hL({message:s.statusText,url:n,requestBodyValues:o,statusCode:s.status,responseHeaders:l,responseBody:i,isRetryable:null==r?void 0:r(s)})};try{const u=await async function({text:e,schema:t}){try{const r=F(e);return null==t?r:ge({value:r,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:n,requestBodyValues:o,statusCode:s.status,responseHeaders:l,responseBody:i,data:u,isRetryable:null==r?void 0:r(s,u)})}}catch(e){return{responseHeaders:l,value:new a.hL({message:s.statusText,url:n,requestBodyValues:o,statusCode:s.status,responseHeaders:l,responseBody:i,isRetryable:null==r?void 0:r(s)})}}},Ae=e=>async({response:t})=>{const r=h(t);if(null==t.body)throw new a.Tt({});return{responseHeaders:r,value:xe({stream:t.body,schema:e})}},Ce=e=>async({response:t,url:r,requestBodyValues:s})=>{const n=await t.text(),o=await ye({text:n,schema:e}),i=h(t);if(!o.success)throw new a.hL({message:"Invalid JSON response",cause:o.error,statusCode:t.status,responseHeaders:i,responseBody:n,url:r,requestBodyValues:s});return{responseHeaders:i,value:o.value,rawValue:o.rawValue}};function _e(e){return null==e?void 0:e.replace(/\/$/,"")}async function*Re({execute:e,input:t,options:r}){const a=e(t,r);if(null!=(s=a)&&"function"==typeof s[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 s}},41573:(e,t,r)=>{r.d(t,{Ay:()=>s});var a=r(87494);const s=a;a.MAX_DATABASE_NAME_LENGTH,a.sort},41694:(e,t,r)=>{const a=r(72082),{MAX_LENGTH:s,MAX_SAFE_INTEGER:n}=r(4292),{safeRe:o,t:i}=r(18104),l=r(8573),{compareIdentifiers:u}=r(90733);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>s)throw new TypeError(`version is longer than ${s} characters`);a("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[i.LOOSE]:o[i.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e})):this.prerelease=[],this.build=r[5]?r[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 r=this.prerelease[t],s=e.prerelease[t];if(a("prerelease compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return u(r,s)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{const r=this.build[t],s=e.build[t];if(a("build compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return u(r,s)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?o[i.PRERELEASELOOSE]:o[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,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);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(r)?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===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let a=[t,e];!1===r&&(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},41738:(e,t,r)=>{const a=r(92625),s=r(24159),n=r(48381),o=r(5286),i=r(34219),l=r(24482),u=r(10017),c=r(11420),p=r(77277),d=r(78853),h=r(74145),m=r(86506),f=r(30044),g=r(77203),v=r(36059),y=r(68716),x=r(47538),E=r(88770),b=r(38506),I=r(58809),w=r(20038),k=r(45160),S=r(25812),T=r(54506),A=r(66239),C=r(88108),_=r(13559),R=r(55141),N=r(20332),O=r(43301),M=r(39044),P=r(8999),$=r(10933),L=r(76315),j=r(15011),D=r(32910),Y=r(76130),F=r(89975),V=r(78519),q=r(18894),U=r(34335);e.exports={parse:i,valid:l,clean:u,inc:c,diff:p,major:d,minor:h,patch:m,prerelease:f,compare:g,rcompare:v,compareLoose:y,compareBuild:x,sort:E,rsort:b,gt:I,lt:w,eq:k,neq:S,gte:T,lte:A,cmp:C,coerce:_,Comparator:R,Range:N,satisfies:O,toComparators:M,maxSatisfying:P,minSatisfying:$,minVersion:L,validRange:j,outside:D,gtr:Y,ltr:F,intersects:V,simplifyRange:q,subset:U,SemVer:n,re:a.re,src:a.src,tokens:a.t,SEMVER_SPEC_VERSION:s.SEMVER_SPEC_VERSION,RELEASE_TYPES:s.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},41755: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}},42945:(e,t,r)=>{const a=r(87391);e.exports=(e,t)=>e.sort(((e,r)=>a(e,r,t)))},43301:(e,t,r)=>{const a=r(20332);e.exports=(e,t,r)=>{try{t=new a(t,r)}catch(e){return!1}return t.test(e)}},43334:(e,t,r)=>{const a=r(40289);e.exports=(e,t,r)=>a(e,t,r)>0},44016:(e,t,r)=>{const a=r(41694),s=r(71333);e.exports=(e,t,r)=>{let n=null,o=null,i=null;try{i=new s(t,r)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(n&&1!==o.compare(e)||(n=e,o=new a(n,r)))})),n}},44490:(e,t,r)=>{var a=r(99174),s=r(40811),n=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))$"),o=/^[-+]?[0-9]+e/;e.exports=new s("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!n.test(e)||"_"===e[e.length-1])},construct:function(e){var t,r,a,s;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,s=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach((function(e){s.unshift(parseFloat(e,10))})),t=0,a=1,s.forEach((function(e){t+=e*a,a*=60})),r*t):r*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 r;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 r=e.toString(10),o.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"})},45160:(e,t,r)=>{const a=r(77203);e.exports=(e,t,r)=>0===a(e,t,r)},45848:(e,t,r)=>{var a=r(40811);e.exports=new a("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},46526:(e,t,r)=>{const a=r(98855);e.exports=(e,t)=>{const r=a(e,t);return r?r.version:null}},47384:(e,t,r)=>{const a=r(88825);e.exports=(e,t,r,s,n)=>{"string"==typeof r&&(n=s,s=r,r=void 0);try{return new a(e instanceof a?e.version:e,r).inc(t,s,n).version}catch(e){return null}}},47538:(e,t,r)=>{const a=r(48381);e.exports=(e,t,r)=>{const s=new a(e,r),n=new a(t,r);return s.compare(n)||s.compareBuild(n)}},47544:(e,t,r)=>{const a=r(20360);e.exports=(e,t)=>new a(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},47775:(e,t,r)=>{const a=r(40289);e.exports=(e,t,r)=>a(e,t,r)>=0},48013:(e,t,r)=>{var a=r(99174),s=r(40811);function n(e){return 48<=e&&e<=55}function o(e){return 48<=e&&e<=57}e.exports=new s("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,a=e.length,s=0,i=!1;if(!a)return!1;if("-"!==(t=e[s])&&"+"!==t||(t=e[++s]),"0"===t){if(s+1===a)return!0;if("b"===(t=e[++s])){for(s++;s<a;s++)if("_"!==(t=e[s])){if("0"!==t&&"1"!==t)return!1;i=!0}return i&&"_"!==t}if("x"===t){for(s++;s<a;s++)if("_"!==(t=e[s])){if(!(48<=(r=e.charCodeAt(s))&&r<=57||65<=r&&r<=70||97<=r&&r<=102))return!1;i=!0}return i&&"_"!==t}for(;s<a;s++)if("_"!==(t=e[s])){if(!n(e.charCodeAt(s)))return!1;i=!0}return i&&"_"!==t}if("_"===t)return!1;for(;s<a;s++)if("_"!==(t=e[s])){if(":"===t)break;if(!o(e.charCodeAt(s)))return!1;i=!0}return!(!i||"_"===t)&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(s)))},construct:function(e){var t,r,a=e,s=1,n=[];return-1!==a.indexOf("_")&&(a=a.replace(/_/g,"")),"-"!==(t=a[0])&&"+"!==t||("-"===t&&(s=-1),t=(a=a.slice(1))[0]),"0"===a?0:"0"===t?"b"===a[1]?s*parseInt(a.slice(2),2):"x"===a[1]?s*parseInt(a,16):s*parseInt(a,8):-1!==a.indexOf(":")?(a.split(":").forEach((function(e){n.unshift(parseInt(e,10))})),a=0,r=1,n.forEach((function(e){a+=e*r,r*=60})),s*a):s*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"]}})},48381:(e,t,r)=>{const a=r(29385),{MAX_LENGTH:s,MAX_SAFE_INTEGER:n}=r(24159),{safeRe:o,t:i}=r(92625),l=r(83214),{compareIdentifiers:u}=r(5286);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>s)throw new TypeError(`version is longer than ${s} characters`);a("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[i.LOOSE]:o[i.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e})):this.prerelease=[],this.build=r[5]?r[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 r=this.prerelease[t],s=e.prerelease[t];if(a("prerelease compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return u(r,s)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{const r=this.build[t],s=e.build[t];if(a("build compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return u(r,s)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?o[i.PRERELEASELOOSE]:o[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,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);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(r)?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===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let a=[t,e];!1===r&&(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},51138:(e,t,r)=>{var a=r(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,r)=>{var a=r(40811),s=Object.prototype.hasOwnProperty;e.exports=new a("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,r=e;for(t in r)if(s.call(r,t)&&null!==r[t])return!1;return!0},construct:function(e){return null!==e?e:{}}})},51269:(e,t,r)=>{const a=r(25583);e.exports=(e,t,r)=>a(e,t,r)>0},52539:(e,t,r)=>{const a=r(88825),s=r(98855),{safeRe:n,t:o}=r(36165);e.exports=(e,t)=>{if(e instanceof a)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const a=t.includePrerelease?n[o.COERCERTLFULL]:n[o.COERCERTL];let s;for(;(s=a.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),a.lastIndex=s.index+s[1].length+s[2].length;a.lastIndex=-1}else r=e.match(t.includePrerelease?n[o.COERCEFULL]:n[o.COERCE]);if(null===r)return null;const i=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",p=t.includePrerelease&&r[6]?`+${r[6]}`:"";return s(`${i}.${l}.${u}${c}${p}`,t)}},52711:(e,t,r)=>{var a;try{a=r(67787).Buffer}catch(e){}var s=r(40811),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,a=0,s=e.length,o=n;for(r=0;r<s;r++)if(!((t=o.indexOf(e.charAt(r)))>64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,r,s=e.replace(/[\r\n=]/g,""),o=s.length,i=n,l=0,u=[];for(t=0;t<o;t++)t%4==0&&t&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|i.indexOf(s.charAt(t));return 0==(r=o%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===r?(u.push(l>>10&255),u.push(l>>2&255)):12===r&&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,r,a="",s=0,o=e.length,i=n;for(t=0;t<o;t++)t%3==0&&t&&(a+=i[s>>18&63],a+=i[s>>12&63],a+=i[s>>6&63],a+=i[63&s]),s=(s<<8)+e[t];return 0==(r=o%3)?(a+=i[s>>18&63],a+=i[s>>12&63],a+=i[s>>6&63],a+=i[63&s]):2===r?(a+=i[s>>10&63],a+=i[s>>4&63],a+=i[s<<2&63],a+=i[64]):1===r&&(a+=i[s>>2&63],a+=i[s<<4&63],a+=i[64],a+=i[64]),a}})},54420:(e,t,r)=>{var a=r(99174),s=r(4414),n=r(40811);function o(e,t,r){var a=[];return e.include.forEach((function(e){r=o(e,t,r)})),e[t].forEach((function(e){r.forEach((function(t,r){t.tag===e.tag&&t.kind===e.kind&&a.push(r)})),r.push(e)})),r.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 s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=o(this,"implicit",[]),this.compiledExplicit=o(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,r={scalar:{},sequence:{},mapping:{},fallback:{}};function a(e){r[e.kind][e.tag]=r.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(a);return r}(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 s("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 s("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every((function(e){return e instanceof n})))throw new s("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},54506:(e,t,r)=>{const a=r(77203);e.exports=(e,t,r)=>a(e,t,r)>=0},54597:(e,t,r)=>{const a=r(40289);e.exports=(e,t)=>a(e,t,!0)},54838:(e,t,r)=>{const a=r(25583);e.exports=(e,t,r)=>a(e,t,r)>=0},55141:(e,t,r)=>{const a=Symbol("SemVer ANY");class s{static get ANY(){return a}constructor(e,t){if(t=n(t),e instanceof s){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?o[i.COMPARATORLOOSE]:o[i.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[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 s))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=n(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=s;const n=r(83214),{safeRe:o,t:i}=r(92625),l=r(88108),u=r(29385),c=r(48381),p=r(20332)},56206:(e,t,r)=>{const a=r(88825);e.exports=(e,t,r)=>{const s=new a(e,r),n=new a(t,r);return s.compare(n)||s.compareBuild(n)}},56565:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t),t}},56741:(e,t,r)=>{const a=r(71333);e.exports=(e,t)=>new a(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},57116:(e,t,r)=>{var a=r(54420);e.exports=a.DEFAULT=new a({include:[r(18184)],explicit:[r(51138),r(14753),r(10560)]})},58809:(e,t,r)=>{const a=r(77203);e.exports=(e,t,r)=>a(e,t,r)>0},59025:(e,t,r)=>{const a=r(99385);e.exports=(e,t,r)=>a(e,t,">",r)},59591:(e,t,r)=>{const a=r(18104),s=r(4292),n=r(41694),o=r(90733),i=r(83586),l=r(20903),u=r(15144),c=r(89065),p=r(76654),d=r(86912),h=r(32924),m=r(65011),f=r(30403),g=r(40289),v=r(19896),y=r(54597),x=r(87391),E=r(42945),b=r(37359),I=r(43334),w=r(3449),k=r(94463),S=r(36749),T=r(47775),A=r(9418),C=r(94706),_=r(65816),R=r(96082),N=r(71333),O=r(9480),M=r(56741),P=r(34218),$=r(44016),L=r(77467),j=r(37276),D=r(99385),Y=r(59025),F=r(5992),V=r(73634),q=r(96775),U=r(36582);e.exports={parse:i,valid:l,clean:u,inc:c,diff:p,major:d,minor:h,patch:m,prerelease:f,compare:g,rcompare:v,compareLoose:y,compareBuild:x,sort:E,rsort:b,gt:I,lt:w,eq:k,neq:S,gte:T,lte:A,cmp:C,coerce:_,Comparator:R,Range:N,satisfies:O,toComparators:M,maxSatisfying:P,minSatisfying:$,minVersion:L,validRange:j,outside:D,gtr:Y,ltr:F,intersects:V,simplifyRange:q,subset:U,SemVer:n,re:a.re,src:a.src,tokens:a.t,SEMVER_SPEC_VERSION:s.SEMVER_SPEC_VERSION,RELEASE_TYPES:s.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},64279:e=>{const{AbortController:t,AbortSignal:r}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=r,e.exports.default=t},65011:(e,t,r)=>{const a=r(41694);e.exports=(e,t)=>new a(e,t).patch},65789:(e,t,r)=>{const a=r(98855);e.exports=(e,t)=>{const r=a(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},65816:(e,t,r)=>{const a=r(41694),s=r(83586),{safeRe:n,t:o}=r(18104);e.exports=(e,t)=>{if(e instanceof a)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const a=t.includePrerelease?n[o.COERCERTLFULL]:n[o.COERCERTL];let s;for(;(s=a.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),a.lastIndex=s.index+s[1].length+s[2].length;a.lastIndex=-1}else r=e.match(t.includePrerelease?n[o.COERCEFULL]:n[o.COERCE]);if(null===r)return null;const i=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",p=t.includePrerelease&&r[6]?`+${r[6]}`:"";return s(`${i}.${l}.${u}${c}${p}`,t)}},66239:(e,t,r)=>{const a=r(77203);e.exports=(e,t,r)=>a(e,t,r)<=0},67105:(e,t,r)=>{const a=Symbol("SemVer ANY");class s{static get ANY(){return a}constructor(e,t){if(t=n(t),e instanceof s){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?o[i.COMPARATORLOOSE]:o[i.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[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 s))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=n(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=s;const n=r(40594),{safeRe:o,t:i}=r(36165),l=r(5544),u=r(95869),c=r(88825),p=r(20360)},67274:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const a=t.test(e),s=t.test(r);return a&&s&&(e=+e,r=+r),e===r?0:a&&!s?-1:s&&!a?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},68716:(e,t,r)=>{const a=r(77203);e.exports=(e,t)=>a(e,t,!0)},69316:(e,t,r)=>{var a=r(99174),s=r(4414),n=r(11710),o=r(18184),i=r(57116),l=Object.prototype.hasOwnProperty,u=1,c=2,p=3,d=4,h=1,m=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=/[,\[\]\{\}]/,x=/^(?:!|!!|![a-z\-]+!)$/i,E=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function b(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 S(e){return 44===e||91===e||93===e||123===e||125===e}function T(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function A(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 C(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var _=new Array(256),R=new Array(256),N=0;N<256;N++)_[N]=A(N)?1:0,R[N]=A(N);function O(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 M(e,t){return new s(t,new n(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function P(e,t){throw M(e,t)}function $(e,t){e.onWarning&&e.onWarning.call(null,M(e,t))}var L={YAML:function(e,t,r){var a,s,n;null!==e.version&&P(e,"duplication of %YAML directive"),1!==r.length&&P(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&P(e,"ill-formed argument of the YAML directive"),s=parseInt(a[1],10),n=parseInt(a[2],10),1!==s&&P(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=n<2,1!==n&&2!==n&&$(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var a,s;2!==r.length&&P(e,"TAG directive accepts exactly two arguments"),a=r[0],s=r[1],x.test(a)||P(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,a)&&P(e,'there is a previously declared suffix for "'+a+'" tag handle'),E.test(s)||P(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[a]=s}};function j(e,t,r,a){var s,n,o,i;if(t<r){if(i=e.input.slice(t,r),a)for(s=0,n=i.length;s<n;s+=1)9===(o=i.charCodeAt(s))||32<=o&&o<=1114111||P(e,"expected valid JSON character");else g.test(i)&&P(e,"the stream contains non-printable characters");e.result+=i}}function D(e,t,r,s){var n,o,i,u;for(a.isObject(r)||P(e,"cannot merge mappings; the provided source object is unacceptable"),i=0,u=(n=Object.keys(r)).length;i<u;i+=1)o=n[i],l.call(t,o)||(t[o]=r[o],s[o]=!0)}function Y(e,t,r,a,s,n,o,i){var u,c;if(Array.isArray(s))for(u=0,c=(s=Array.prototype.slice.call(s)).length;u<c;u+=1)Array.isArray(s[u])&&P(e,"nested arrays are not supported inside keys"),"object"==typeof s&&"[object Object]"===b(s[u])&&(s[u]="[object Object]");if("object"==typeof s&&"[object Object]"===b(s)&&(s="[object Object]"),s=String(s),null===t&&(t={}),"tag:yaml.org,2002:merge"===a)if(Array.isArray(n))for(u=0,c=n.length;u<c;u+=1)D(e,t,n[u],r);else D(e,t,n,r);else e.json||l.call(r,s)||!l.call(t,s)||(e.line=o||e.line,e.position=i||e.position,P(e,"duplicated mapping key")),t[s]=n,delete r[s];return t}function F(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):P(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function V(e,t,r){for(var a=0,s=e.input.charCodeAt(e.position);0!==s;){for(;w(s);)s=e.input.charCodeAt(++e.position);if(t&&35===s)do{s=e.input.charCodeAt(++e.position)}while(10!==s&&13!==s&&0!==s);if(!I(s))break;for(F(e),s=e.input.charCodeAt(e.position),a++,e.lineIndent=0;32===s;)e.lineIndent++,s=e.input.charCodeAt(++e.position)}return-1!==r&&0!==a&&e.lineIndent<r&&$(e,"deficient indentation"),a}function q(e){var t,r=e.position;return!(45!==(t=e.input.charCodeAt(r))&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||(r+=3,0!==(t=e.input.charCodeAt(r))&&!k(t)))}function U(e,t){1===t?e.result+=" ":t>1&&(e.result+=a.repeat("\n",t-1))}function B(e,t){var r,a,s=e.tag,n=e.anchor,o=[],i=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&45===a&&k(e.input.charCodeAt(e.position+1));)if(i=!0,e.position++,V(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(r=e.line,z(e,t,p,!1,!0),o.push(e.result),V(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==a)P(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!i&&(e.tag=s,e.anchor=n,e.kind="sequence",e.result=o,!0)}function G(e){var t,r,a,s,n=!1,o=!1;if(33!==(s=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&P(e,"duplication of a tag property"),60===(s=e.input.charCodeAt(++e.position))?(n=!0,s=e.input.charCodeAt(++e.position)):33===s?(o=!0,r="!!",s=e.input.charCodeAt(++e.position)):r="!",t=e.position,n){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&62!==s);e.position<e.length?(a=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):P(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==s&&!k(s);)33===s&&(o?P(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),x.test(r)||P(e,"named tag handle cannot contain such characters"),o=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),y.test(a)&&P(e,"tag suffix cannot contain flow indicator characters")}return a&&!E.test(a)&&P(e,"tag name cannot contain such characters: "+a),n?e.tag=a:l.call(e.tagMap,r)?e.tag=e.tagMap[r]+a:"!"===r?e.tag="!"+a:"!!"===r?e.tag="tag:yaml.org,2002:"+a:P(e,'undeclared tag handle "'+r+'"'),!0}function Z(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&P(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!k(r)&&!S(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&P(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function z(e,t,r,s,n){var o,i,g,v,y,x,E,b,A=1,N=!1,O=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=i=g=d===r||p===r,s&&V(e,!0,-1)&&(N=!0,e.lineIndent>t?A=1:e.lineIndent===t?A=0:e.lineIndent<t&&(A=-1)),1===A)for(;G(e)||Z(e);)V(e,!0,-1)?(N=!0,g=o,e.lineIndent>t?A=1:e.lineIndent===t?A=0:e.lineIndent<t&&(A=-1)):g=!1;if(g&&(g=N||n),1!==A&&d!==r||(E=u===r||c===r?t:t+1,b=e.position-e.lineStart,1===A?g&&(B(e,b)||function(e,t,r){var a,s,n,o,i,l=e.tag,u=e.anchor,p={},h={},m=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),n=e.line,o=e.position,63!==i&&58!==i||!k(a)){if(!z(e,r,c,!1,!0))break;if(e.line===n){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))||P(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(Y(e,p,h,m,f,null),m=f=g=null),y=!0,v=!1,s=!1,m=e.tag,f=e.result;else{if(!y)return e.tag=l,e.anchor=u,!0;P(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=l,e.anchor=u,!0;P(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===i?(v&&(Y(e,p,h,m,f,null),m=f=g=null),y=!0,v=!0,s=!0):v?(v=!1,s=!0):P(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===n||e.lineIndent>t)&&(z(e,t,d,!0,s)&&(v?f=e.result:g=e.result),v||(Y(e,p,h,m,f,g,n,o),m=f=g=null),V(e,!0,-1),i=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==i)P(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&Y(e,p,h,m,f,null),y&&(e.tag=l,e.anchor=u,e.kind="mapping",e.result=p),y}(e,b,E))||function(e,t){var r,a,s,n,o,i,l,c,p,d,h=!0,m=e.tag,f=e.anchor,g={};if(91===(d=e.input.charCodeAt(e.position)))s=93,i=!1,a=[];else{if(123!==d)return!1;s=125,i=!0,a={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),d=e.input.charCodeAt(++e.position);0!==d;){if(V(e,!0,t),(d=e.input.charCodeAt(e.position))===s)return e.position++,e.tag=m,e.anchor=f,e.kind=i?"mapping":"sequence",e.result=a,!0;h||P(e,"missed comma between flow collection entries"),p=null,n=o=!1,63===d&&k(e.input.charCodeAt(e.position+1))&&(n=o=!0,e.position++,V(e,!0,t)),r=e.line,z(e,t,u,!1,!0),c=e.tag,l=e.result,V(e,!0,t),d=e.input.charCodeAt(e.position),!o&&e.line!==r||58!==d||(n=!0,d=e.input.charCodeAt(++e.position),V(e,!0,t),z(e,t,u,!1,!0),p=e.result),i?Y(e,a,g,c,l,p):n?a.push(Y(e,null,g,c,l,p)):a.push(l),V(e,!0,t),44===(d=e.input.charCodeAt(e.position))?(h=!0,d=e.input.charCodeAt(++e.position)):h=!1}P(e,"unexpected end of the stream within a flow collection")}(e,E)?O=!0:(i&&function(e,t){var r,s,n,o,i,l=h,u=!1,c=!1,p=t,d=0,g=!1;if(124===(o=e.input.charCodeAt(e.position)))s=!1;else{if(62!==o)return!1;s=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)h===l?l=43===o?f:m:P(e,"repeat of a chomping mode identifier");else{if(!((n=48<=(i=o)&&i<=57?i-48:-1)>=0))break;0===n?P(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?P(e,"repeat of an indentation width identifier"):(p=t+n-1,c=!0)}if(w(o)){do{o=e.input.charCodeAt(++e.position)}while(w(o));if(35===o)do{o=e.input.charCodeAt(++e.position)}while(!I(o)&&0!==o)}for(;0!==o;){for(F(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!c||e.lineIndent<p)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>p&&(p=e.lineIndent),I(o))d++;else{if(e.lineIndent<p){l===f?e.result+=a.repeat("\n",u?1+d:d):l===h&&u&&(e.result+="\n");break}for(s?w(o)?(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,r=e.position;!I(o)&&0!==o;)o=e.input.charCodeAt(++e.position);j(e,r,e.position,!1)}}return!0}(e,E)||function(e,t){var r,a,s;if(39!==(r=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,a=s=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(j(e,a,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;a=e.position,e.position++,s=e.position}else I(r)?(j(e,a,s,!0),U(e,V(e,!1,t)),a=s=e.position):e.position===e.lineStart&&q(e)?P(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);P(e,"unexpected end of the stream within a single quoted scalar")}(e,E)||function(e,t){var r,a,s,n,o,i,l;if(34!==(i=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=a=e.position;0!==(i=e.input.charCodeAt(e.position));){if(34===i)return j(e,r,e.position,!0),e.position++,!0;if(92===i){if(j(e,r,e.position,!0),I(i=e.input.charCodeAt(++e.position)))V(e,!1,t);else if(i<256&&_[i])e.result+=R[i],e.position++;else if((o=120===(l=i)?2:117===l?4:85===l?8:0)>0){for(s=o,n=0;s>0;s--)(o=T(i=e.input.charCodeAt(++e.position)))>=0?n=(n<<4)+o:P(e,"expected hexadecimal character");e.result+=C(n),e.position++}else P(e,"unknown escape sequence");r=a=e.position}else I(i)?(j(e,r,a,!0),U(e,V(e,!1,t)),r=a=e.position):e.position===e.lineStart&&q(e)?P(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}P(e,"unexpected end of the stream within a double quoted scalar")}(e,E)?O=!0:function(e){var t,r,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)&&!S(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&P(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),l.call(e.anchorMap,r)||P(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],V(e,!0,-1),!0}(e)?(O=!0,null===e.tag&&null===e.anchor||P(e,"alias node should not have any properties")):function(e,t,r){var a,s,n,o,i,l,u,c,p=e.kind,d=e.result;if(k(c=e.input.charCodeAt(e.position))||S(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))||r&&S(a)))return!1;for(e.kind="scalar",e.result="",s=n=e.position,o=!1;0!==c;){if(58===c){if(k(a=e.input.charCodeAt(e.position+1))||r&&S(a))break}else if(35===c){if(k(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&q(e)||r&&S(c))break;if(I(c)){if(i=e.line,l=e.lineStart,u=e.lineIndent,V(e,!1,-1),e.lineIndent>=t){o=!0,c=e.input.charCodeAt(e.position);continue}e.position=n,e.line=i,e.lineStart=l,e.lineIndent=u;break}}o&&(j(e,s,n,!1),U(e,e.line-i),s=n=e.position,o=!1),w(c)||(n=e.position+1),c=e.input.charCodeAt(++e.position)}return j(e,s,n,!1),!!e.result||(e.kind=p,e.result=d,!1)}(e,E,u===r)&&(O=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===A&&(O=g&&B(e,b))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&P(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),v=0,y=e.implicitTypes.length;v<y;v+=1)if((x=e.implicitTypes[v]).resolve(e.result)){e.result=x.construct(e.result),e.tag=x.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else l.call(e.typeMap[e.kind||"fallback"],e.tag)?(x=e.typeMap[e.kind||"fallback"][e.tag],null!==e.result&&x.kind!==e.kind&&P(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+x.kind+'", not "'+e.kind+'"'),x.resolve(e.result)?(e.result=x.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):P(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):P(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||O}function H(e){var t,r,a,s,n=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(s=e.input.charCodeAt(e.position))&&(V(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(o=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!k(s);)s=e.input.charCodeAt(++e.position);for(a=[],(r=e.input.slice(t,e.position)).length<1&&P(e,"directive name must not be less than one character in length");0!==s;){for(;w(s);)s=e.input.charCodeAt(++e.position);if(35===s){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&!I(s));break}if(I(s))break;for(t=e.position;0!==s&&!k(s);)s=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==s&&F(e),l.call(L,r)?L[r](e,r,a):$(e,'unknown document directive "'+r+'"')}V(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,V(e,!0,-1)):o&&P(e,"directives end mark is expected"),z(e,e.lineIndent-1,d,!1,!0),V(e,!0,-1),e.checkLineBreaks&&v.test(e.input.slice(n,e.position))&&$(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,V(e,!0,-1)):e.position<e.length-1&&P(e,"end of the stream or a document separator is expected")}function W(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 r=new O(e,t),a=e.indexOf("\0");for(-1!==a&&(r.position=a,P(r,"null byte is not allowed in input")),r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)H(r);return r.documents}function K(e,t,r){null!==t&&"object"==typeof t&&void 0===r&&(r=t,t=null);var a=W(e,r);if("function"!=typeof t)return a;for(var s=0,n=a.length;s<n;s+=1)t(a[s])}function X(e,t){var r=W(e,t);if(0!==r.length){if(1===r.length)return r[0];throw new s("expected a single document in the stream, but found more")}}e.exports.loadAll=K,e.exports.load=X,e.exports.safeLoadAll=function(e,t,r){return"object"==typeof t&&null!==t&&void 0===r&&(r=t,t=null),K(e,t,a.extend({schema:o},r))},e.exports.safeLoad=function(e,t){return X(e,a.extend({schema:o},t))}},70545:(e,t,r)=>{var a=r(65994).process;e.exports=async function(e,t,r,n){r instanceof Function&&(n=r,r={});const c=async function(e,t,r={}){let n,c;"string"==typeof r&&(r={encoding:r});const p=o(h((()=>c))),f=i.resolve(e);try{await function(e){return new Promise((t=>{u[e]||(u[e]=[]),u[e].push(t),1===u[e].length&&t()}))}(f);const o=await l(s.realpath)(e).catch((()=>e));if(c=d(o),!r.mode||!r.chown){const e=await l(s.stat)(o).catch((()=>{}));e&&(null==r.mode&&(r.mode=e.mode),null==r.chown&&a.getuid&&(r.chown={uid:e.uid,gid:e.gid}))}n=await l(s.open)(c,"w",r.mode),r.tmpfileCreated&&await r.tmpfileCreated(c),ArrayBuffer.isView(t)?await l(s.write)(n,t,0,t.length,0):null!=t&&await l(s.write)(n,String(t),0,String(r.encoding||"utf8")),!1!==r.fsync&&await l(s.fsync)(n),await l(s.close)(n),n=null,r.chown&&await l(s.chown)(c,r.chown.uid,r.chown.gid).catch((e=>{if(!m(e))throw e})),r.mode&&await l(s.chmod)(c,r.mode).catch((e=>{if(!m(e))throw e})),await l(s.rename)(c,o)}finally{n&&await l(s.close)(n).catch((()=>{})),p(),await l(s.unlink)(c).catch((()=>{})),u[f].shift(),u[f].length>0?u[f][0]():delete u[f]}}(e,t,r);if(n)try{return n(await c)}catch(e){return n(e)}return c},e.exports.sync=function(e,t,r){"string"==typeof r?r={encoding:r}:r||(r={});try{e=s.realpathSync(e)}catch(e){}const n=d(e);if(!r.mode||!r.chown)try{const t=s.statSync(e);(r=Object.assign({},r)).mode||(r.mode=t.mode),!r.chown&&a.getuid&&(r.chown={uid:t.uid,gid:t.gid})}catch(e){}let i;const l=h(n),u=o(l);let c=!0;try{if(i=s.openSync(n,"w",r.mode||438),r.tmpfileCreated&&r.tmpfileCreated(n),ArrayBuffer.isView(t)?s.writeSync(i,t,0,t.length,0):null!=t&&s.writeSync(i,String(t),0,String(r.encoding||"utf8")),!1!==r.fsync&&s.fsyncSync(i),s.closeSync(i),i=null,r.chown)try{s.chownSync(n,r.chown.uid,r.chown.gid)}catch(e){if(!m(e))throw e}if(r.mode)try{s.chmodSync(n,r.mode)}catch(e){if(!m(e))throw e}s.renameSync(n,e),c=!1}finally{if(i)try{s.closeSync(i)}catch(e){}u(),c&&l()}},e.exports._getTmpname=d,e.exports._cleanupOnExit=h;const s=r(36374),n=r(88906),{onExit:o}=r(41163),i=r(17642),{promisify:l}=r(98437),u={},c=function(){try{return r(86983).threadId}catch(e){return 0}}();let p=0;function d(e){return e+"."+n("/index.js").hash(String(a.pid)).hash(String(c)).hash(String(++p)).result()}function h(e){return()=>{try{s.unlinkSync("function"==typeof e?e():e)}catch{}}}function m(e){return"ENOSYS"===e.code||!(a.getuid&&0===a.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code)}},71333:(e,t,r)=>{const a=/\s+/g;class s{constructor(e,t){if(t=o(t),e instanceof s)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new s(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,r=n.get(t);if(r)return r;const a=this.options.loose,s=a?c[p.HYPHENRANGELOOSE]:c[p.HYPHENRANGE];e=e.replace(s,R(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(c[p.COMPARATORTRIM],d),l("comparator trim",e),e=e.replace(c[p.TILDETRIM],h),l("tilde trim",e),e=e.replace(c[p.CARETTRIM],m),l("caret trim",e);let o=e.split(" ").map((e=>E(e,this.options))).join(" ").split(/\s+/).map((e=>_(e,this.options)));a&&(o=o.filter((e=>(l("loose invalid filter",e,this.options),!!e.match(c[p.COMPARATORLOOSE]))))),l("range list",o);const u=new Map,y=o.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 x=[...u.values()];return n.set(t,x),x}intersects(e,t){if(!(e instanceof s))throw new TypeError("a Range is required");return this.set.some((r=>x(r,t)&&e.set.some((e=>x(e,t)&&r.every((r=>e.every((e=>r.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(N(this.set[t],e,this.options))return!0;return!1}}e.exports=s;const n=new(r(21212)),o=r(8573),i=r(96082),l=r(72082),u=r(41694),{safeRe:c,t:p,comparatorTrimReplace:d,tildeTrimReplace:h,caretTrimReplace:m}=r(18104),{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:g}=r(4292),v=e=>"<0.0.0-0"===e.value,y=e=>""===e.value,x=(e,t)=>{let r=!0;const a=e.slice();let s=a.pop();for(;r&&a.length;)r=a.every((e=>s.intersects(e,t))),s=a.pop();return r},E=(e,t)=>(l("comp",e,t),e=k(e,t),l("caret",e),e=I(e,t),l("tildes",e),e=T(e,t),l("xrange",e),e=C(e,t),l("stars",e),e),b=e=>!e||"x"===e.toLowerCase()||"*"===e,I=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const r=t.loose?c[p.TILDELOOSE]:c[p.TILDE];return e.replace(r,((t,r,a,s,n)=>{let o;return l("tilde",e,t,r,a,s,n),b(r)?o="":b(a)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:b(s)?o=`>=${r}.${a}.0 <${r}.${+a+1}.0-0`:n?(l("replaceTilde pr",n),o=`>=${r}.${a}.${s}-${n} <${r}.${+a+1}.0-0`):o=`>=${r}.${a}.${s} <${r}.${+a+1}.0-0`,l("tilde return",o),o}))},k=(e,t)=>e.trim().split(/\s+/).map((e=>S(e,t))).join(" "),S=(e,t)=>{l("caret",e,t);const r=t.loose?c[p.CARETLOOSE]:c[p.CARET],a=t.includePrerelease?"-0":"";return e.replace(r,((t,r,s,n,o)=>{let i;return l("caret",e,t,r,s,n,o),b(r)?i="":b(s)?i=`>=${r}.0.0${a} <${+r+1}.0.0-0`:b(n)?i="0"===r?`>=${r}.${s}.0${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.0${a} <${+r+1}.0.0-0`:o?(l("replaceCaret pr",o),i="0"===r?"0"===s?`>=${r}.${s}.${n}-${o} <${r}.${s}.${+n+1}-0`:`>=${r}.${s}.${n}-${o} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${n}-${o} <${+r+1}.0.0-0`):(l("no pr"),i="0"===r?"0"===s?`>=${r}.${s}.${n}${a} <${r}.${s}.${+n+1}-0`:`>=${r}.${s}.${n}${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${n} <${+r+1}.0.0-0`),l("caret return",i),i}))},T=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map((e=>A(e,t))).join(" ")),A=(e,t)=>{e=e.trim();const r=t.loose?c[p.XRANGELOOSE]:c[p.XRANGE];return e.replace(r,((r,a,s,n,o,i)=>{l("xRange",e,r,a,s,n,o,i);const u=b(s),c=u||b(n),p=c||b(o),d=p;return"="===a&&d&&(a=""),i=t.includePrerelease?"-0":"",u?r=">"===a||"<"===a?"<0.0.0-0":"*":a&&d?(c&&(n=0),o=0,">"===a?(a=">=",c?(s=+s+1,n=0,o=0):(n=+n+1,o=0)):"<="===a&&(a="<",c?s=+s+1:n=+n+1),"<"===a&&(i="-0"),r=`${a+s}.${n}.${o}${i}`):c?r=`>=${s}.0.0${i} <${+s+1}.0.0-0`:p&&(r=`>=${s}.${n}.0${i} <${s}.${+n+1}.0-0`),l("xRange return",r),r}))},C=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[p.STAR],"")),_=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),R=e=>(t,r,a,s,n,o,i,l,u,c,p,d)=>`${r=b(a)?"":b(s)?`>=${a}.0.0${e?"-0":""}`:b(n)?`>=${a}.${s}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=b(u)?"":b(c)?`<${+u+1}.0.0-0`:b(p)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${p}-${d}`:e?`<${u}.${c}.${+p+1}-0`:`<=${l}`}`.trim(),N=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==i.ANY&&e[r].semver.prerelease.length>0){const a=e[r].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0}},71851:(e,t,r)=>{const a=r(25583);e.exports=(e,t,r)=>a(e,t,r)<=0},72082:(e,t,r)=>{var a=r(65994).process;const s="object"==typeof a&&a.env&&a.env.NODE_DEBUG&&/\bsemver\b/i.test(a.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=s},72849:(e,t,r)=>{const a=r(20360);e.exports=(e,t,r)=>{try{t=new a(t,r)}catch(e){return!1}return t.test(e)}},73634:(e,t,r)=>{const a=r(71333);e.exports=(e,t,r)=>(e=new a(e,r),t=new a(t,r),e.intersects(t,r))},74145:(e,t,r)=>{const a=r(48381);e.exports=(e,t)=>new a(e,t).minor},75459:(e,t,r)=>{var a=r(40811);e.exports=new a("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},75982:(e,t,r)=>{const a=r(36165),s=r(41755),n=r(88825),o=r(67274),i=r(98855),l=r(46526),u=r(65789),c=r(47384),p=r(4113),d=r(12169),h=r(9357),m=r(29478),f=r(160),g=r(25583),v=r(24975),y=r(98736),x=r(56206),E=r(9982),b=r(81521),I=r(51269),w=r(18082),k=r(26620),S=r(32056),T=r(54838),A=r(71851),C=r(5544),_=r(52539),R=r(67105),N=r(20360),O=r(72849),M=r(47544),P=r(79779),$=r(38185),L=r(23252),j=r(78767),D=r(87866),Y=r(22038),F=r(4827),V=r(27995),q=r(88834),U=r(99571);e.exports={parse:i,valid:l,clean:u,inc:c,diff:p,major:d,minor:h,patch:m,prerelease:f,compare:g,rcompare:v,compareLoose:y,compareBuild:x,sort:E,rsort:b,gt:I,lt:w,eq:k,neq:S,gte:T,lte:A,cmp:C,coerce:_,Comparator:R,Range:N,satisfies:O,toComparators:M,maxSatisfying:P,minSatisfying:$,minVersion:L,validRange:j,outside:D,gtr:Y,ltr:F,intersects:V,simplifyRange:q,subset:U,SemVer:n,re:a.re,src:a.src,tokens:a.t,SEMVER_SPEC_VERSION:s.SEMVER_SPEC_VERSION,RELEASE_TYPES:s.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},76130:(e,t,r)=>{const a=r(32910);e.exports=(e,t,r)=>a(e,t,">",r)},76315:(e,t,r)=>{const a=r(48381),s=r(20332),n=r(58809);e.exports=(e,t)=>{e=new s(e,t);let r=new a("0.0.0");if(e.test(r))return r;if(r=new a("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const s=e.set[t];let o=null;s.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">=":o&&!n(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!n(r,o)||(r=o)}return r&&e.test(r)?r:null}},76462:(e,t,r)=>{var a=r(99174),s=r(4414),n=r(57116),o=r(18184),i=Object.prototype.toString,l=Object.prototype.hasOwnProperty,u=9,c=10,p=13,d=32,h=33,m=34,f=35,g=37,v=38,y=39,x=42,E=44,b=45,I=58,w=61,k=62,S=63,T=64,A=91,C=93,_=96,R=123,N=124,O=125,M={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"},P=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function $(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else{if(!(e<=4294967295))throw new s("code point within a string may not be greater than 0xFFFFFFFF");r="U",n=8}return"\\"+r+a.repeat("0",n-t.length)+t}function L(e){this.schema=e.schema||n,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 r,a,s,n,o,i,u;if(null===t)return{};for(r={},s=0,n=(a=Object.keys(t)).length;s<n;s+=1)o=a[s],i=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(u=e.compiledTypeMap.fallback[o])&&l.call(u.styleAliases,i)&&(i=u.styleAliases[i]),r[o]=i;return r}(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 j(e,t){for(var r,s=a.repeat(" ",t),n=0,o=-1,i="",l=e.length;n<l;)-1===(o=e.indexOf("\n",n))?(r=e.slice(n),n=l):(r=e.slice(n,o+1),n=o+1),r.length&&"\n"!==r&&(i+=s),i+=r;return i}function D(e,t){return"\n"+a.repeat(" ",e.indent*t)}function Y(e){return e===d||e===u}function F(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 V(e,t){return F(e)&&65279!==e&&e!==E&&e!==A&&e!==C&&e!==R&&e!==O&&e!==I&&(e!==f||t&&function(e){return F(e)&&!Y(e)&&65279!==e&&e!==p&&e!==c}(t))}function q(e){return/^\n* /.test(e)}var U=1,B=2,G=3,Z=4,z=5;function H(e,t,r,a){e.dump=function(){if(0===t.length)return"''";if(!e.noCompatMode&&-1!==P.indexOf(t))return"'"+t+"'";var n=e.indent*Math.max(1,r),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-n),i=a||e.flowLevel>-1&&r>=e.flowLevel;switch(function(e,t,r,a,s){var n,o,i,l,u=!1,p=!1,d=-1!==a,M=-1,P=F(l=e.charCodeAt(0))&&65279!==l&&!Y(l)&&l!==b&&l!==S&&l!==I&&l!==E&&l!==A&&l!==C&&l!==R&&l!==O&&l!==f&&l!==v&&l!==x&&l!==h&&l!==N&&l!==w&&l!==k&&l!==y&&l!==m&&l!==g&&l!==T&&l!==_&&!Y(e.charCodeAt(e.length-1));if(t)for(n=0;n<e.length;n++){if(!F(o=e.charCodeAt(n)))return z;i=n>0?e.charCodeAt(n-1):null,P=P&&V(o,i)}else{for(n=0;n<e.length;n++){if((o=e.charCodeAt(n))===c)u=!0,d&&(p=p||n-M-1>a&&" "!==e[M+1],M=n);else if(!F(o))return z;i=n>0?e.charCodeAt(n-1):null,P=P&&V(o,i)}p=p||d&&n-M-1>a&&" "!==e[M+1]}return u||p?r>9&&q(e)?z:p?Z:G:P&&!s(e)?U:B}(t,i,e.indent,o,(function(t){return function(e,t){var r,a;for(r=0,a=e.implicitTypes.length;r<a;r+=1)if(e.implicitTypes[r].resolve(t))return!0;return!1}(e,t)}))){case U:return t;case B:return"'"+t.replace(/'/g,"''")+"'";case G:return"|"+W(t,e.indent)+K(j(t,n));case Z:return">"+W(t,e.indent)+K(j(function(e,t){for(var r,a,s,n=/(\n+)([^\n]*)/g,o=(s=-1!==(s=e.indexOf("\n"))?s:e.length,n.lastIndex=s,X(e.slice(0,s),t)),i="\n"===e[0]||" "===e[0];a=n.exec(e);){var l=a[1],u=a[2];r=" "===u[0],o+=l+(i||r||""===u?"":"\n")+X(u,t),i=r}return o}(t,o),n));case z:return'"'+function(e){for(var t,r,a,s="",n=0;n<e.length;n++)(t=e.charCodeAt(n))>=55296&&t<=56319&&(r=e.charCodeAt(n+1))>=56320&&r<=57343?(s+=$(1024*(t-55296)+r-56320+65536),n++):s+=!(a=M[t])&&F(t)?e[n]:a||$(t);return s}(t)+'"';default:throw new s("impossible error: invalid scalar style")}}()}function W(e,t){var r=q(e)?String(t):"",a="\n"===e[e.length-1];return r+(!a||"\n"!==e[e.length-2]&&"\n"!==e?a?"":"-":"+")+"\n"}function K(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function X(e,t){if(""===e||" "===e[0])return e;for(var r,a,s=/ [^ ]/g,n=0,o=0,i=0,l="";r=s.exec(e);)(i=r.index)-n>t&&(a=o>n?o:i,l+="\n"+e.slice(n,a),n=a+1),o=i;return l+="\n",e.length-n>t&&o>n?l+=e.slice(n,o)+"\n"+e.slice(o+1):l+=e.slice(n),l.slice(1)}function J(e,t,r){var a,n,o,u,c,p;for(o=0,u=(n=r?e.explicitTypes:e.implicitTypes).length;o<u;o+=1)if(((c=n[o]).instanceOf||c.predicate)&&(!c.instanceOf||"object"==typeof t&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(e.tag=r?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 s("!<"+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,r,a,n,o){e.tag=null,e.dump=r,J(e,r,!1)||J(e,r,!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(r))),(null!==e.tag&&"?"!==e.tag||p||2!==e.indent&&t>0)&&(n=!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,r,a){var n,o,i,l,u,p,d="",h=e.tag,m=Object.keys(r);if(!0===e.sortKeys)m.sort();else if("function"==typeof e.sortKeys)m.sort(e.sortKeys);else if(e.sortKeys)throw new s("sortKeys must be a boolean or a function");for(n=0,o=m.length;n<o;n+=1)p="",a&&0===n||(p+=D(e,t)),l=r[i=m[n]],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+=D(e,t)),Q(e,t+1,l,!0,u)&&(e.dump&&c===e.dump.charCodeAt(0)?p+=":":p+=": ",d+=p+=e.dump));e.tag=h,e.dump=d||"{}"}(e,t,e.dump,n),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,r){var a,s,n,o,i,l="",u=e.tag,c=Object.keys(r);for(a=0,s=c.length;a<s;a+=1)i="",0!==a&&(i+=", "),e.condenseFlow&&(i+='"'),o=r[n=c[a]],Q(e,t,n,!1,!1)&&(e.dump.length>1024&&(i+="? "),i+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Q(e,t,o,!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 h=e.noArrayIndent&&t>0?t-1:t;a&&0!==e.dump.length?(function(e,t,r,a){var s,n,o="",i=e.tag;for(s=0,n=r.length;s<n;s+=1)Q(e,t+1,r[s],!0,!0)&&(a&&0===s||(o+=D(e,t)),e.dump&&c===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=i,e.dump=o||"[]"}(e,h,e.dump,n),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,r){var a,s,n="",o=e.tag;for(a=0,s=r.length;a<s;a+=1)Q(e,t,r[a],!1,!1)&&(0!==a&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=o,e.dump="["+n+"]"}(e,h,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump))}else{if("[object String]"!==l){if(e.skipInvalid)return!1;throw new s("unacceptable kind of an object to dump "+l)}"?"!==e.tag&&H(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function ee(e,t){var r,a,s=[],n=[];for(te(e,s,n),r=0,a=n.length;r<a;r+=1)t.duplicates.push(s[n[r]]);t.usedDuplicates=new Array(a)}function te(e,t,r){var a,s,n;if(null!==e&&"object"==typeof e)if(-1!==(s=t.indexOf(e)))-1===r.indexOf(s)&&r.push(s);else if(t.push(e),Array.isArray(e))for(s=0,n=e.length;s<n;s+=1)te(e[s],t,r);else for(s=0,n=(a=Object.keys(e)).length;s<n;s+=1)te(e[a[s]],t,r)}function re(e,t){var r=new L(t=t||{});return r.noRefs||ee(e,r),Q(r,0,e,!0,!0)?r.dump+"\n":""}e.exports.dump=re,e.exports.safeDump=function(e,t){return re(e,a.extend({schema:o},t))}},76654:(e,t,r)=>{const a=r(83586);e.exports=(e,t)=>{const r=a(e,null,!0),s=a(t,null,!0),n=r.compare(s);if(0===n)return null;const o=n>0,i=o?r:s,l=o?s:r,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 r.major!==s.major?c+"major":r.minor!==s.minor?c+"minor":r.patch!==s.patch?c+"patch":"prerelease"}},77203:(e,t,r)=>{const a=r(48381);e.exports=(e,t,r)=>new a(e,r).compare(new a(t,r))},77277:(e,t,r)=>{const a=r(34219);e.exports=(e,t)=>{const r=a(e,null,!0),s=a(t,null,!0),n=r.compare(s);if(0===n)return null;const o=n>0,i=o?r:s,l=o?s:r,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 r.major!==s.major?c+"major":r.minor!==s.minor?c+"minor":r.patch!==s.patch?c+"patch":"prerelease"}},77467:(e,t,r)=>{const a=r(41694),s=r(71333),n=r(43334);e.exports=(e,t)=>{e=new s(e,t);let r=new a("0.0.0");if(e.test(r))return r;if(r=new a("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const s=e.set[t];let o=null;s.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">=":o&&!n(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!n(r,o)||(r=o)}return r&&e.test(r)?r:null}},78316:(e,t,r)=>{var a=r(40811),s=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),n=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!==s.exec(e)||null!==n.exec(e))},construct:function(e){var t,r,a,o,i,l,u,c,p=0,d=null;if(null===(t=s.exec(e))&&(t=n.exec(e)),null===t)throw new Error("Date resolve error");if(r=+t[1],a=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(r,a,o));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(r,a,o,i,l,u,p)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},78519:(e,t,r)=>{const a=r(20332);e.exports=(e,t,r)=>(e=new a(e,r),t=new a(t,r),e.intersects(t,r))},78767:(e,t,r)=>{const a=r(20360);e.exports=(e,t)=>{try{return new a(e,t).range||"*"}catch(e){return null}}},78853:(e,t,r)=>{const a=r(48381);e.exports=(e,t)=>new a(e,t).major},79779:(e,t,r)=>{const a=r(88825),s=r(20360);e.exports=(e,t,r)=>{let n=null,o=null,i=null;try{i=new s(t,r)}catch(e){return null}return e.forEach((e=>{i.test(e)&&(n&&-1!==o.compare(e)||(n=e,o=new a(n,r)))})),n}},81521:(e,t,r)=>{const a=r(56206);e.exports=(e,t)=>e.sort(((e,r)=>a(r,e,t)))},81602:(e,t,r)=>{var a=r(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"})},83214:e=>{const t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},83586:(e,t,r)=>{const a=r(41694);e.exports=(e,t,r=!1)=>{if(e instanceof a)return e;try{return new a(e,t)}catch(e){if(!r)return null;throw e}}},84537:function(e,t){!function(e){var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],r=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],a="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",s={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},n="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",o={5:n,"5module":n+" export import",6:n+" const class extends export import super"},i=/^in(stanceof)?$/,l=new RegExp("["+a+"]"),u=new RegExp("["+a+"‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");function c(e,t){for(var r=65536,a=0;a<t.length;a+=2){if((r+=t[a])>e)return!1;if((r+=t[a+1])>=e)return!0}return!1}function p(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&l.test(String.fromCharCode(e)):!1!==t&&c(e,r)))}function d(e,a){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&u.test(String.fromCharCode(e)):!1!==a&&(c(e,r)||c(e,t)))))}var h=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function m(e,t){return new h(e,{beforeExpr:!0,binop:t})}var f={beforeExpr:!0},g={startsExpr:!0},v={};function y(e,t){return void 0===t&&(t={}),t.keyword=e,v[e]=new h(e,t)}var x={num:new h("num",g),regexp:new h("regexp",g),string:new h("string",g),name:new h("name",g),privateId:new h("privateId",g),eof:new h("eof"),bracketL:new h("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new h("]"),braceL:new h("{",{beforeExpr:!0,startsExpr:!0}),braceR:new h("}"),parenL:new h("(",{beforeExpr:!0,startsExpr:!0}),parenR:new h(")"),comma:new h(",",f),semi:new h(";",f),colon:new h(":",f),dot:new h("."),question:new h("?",f),questionDot:new h("?."),arrow:new h("=>",f),template:new h("template"),invalidTemplate:new h("invalidTemplate"),ellipsis:new h("...",f),backQuote:new h("`",g),dollarBraceL:new h("${",{beforeExpr:!0,startsExpr:!0}),eq:new h("=",{beforeExpr:!0,isAssign:!0}),assign:new h("_=",{beforeExpr:!0,isAssign:!0}),incDec:new h("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new h("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:m("||",1),logicalAND:m("&&",2),bitwiseOR:m("|",3),bitwiseXOR:m("^",4),bitwiseAND:m("&",5),equality:m("==/!=/===/!==",6),relational:m("</>/<=/>=",7),bitShift:m("<</>>/>>>",8),plusMin:new h("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:m("%",10),star:m("*",10),slash:m("/",10),starstar:new h("**",{beforeExpr:!0}),coalesce:m("??",1),_break:y("break"),_case:y("case",f),_catch:y("catch"),_continue:y("continue"),_debugger:y("debugger"),_default:y("default",f),_do:y("do",{isLoop:!0,beforeExpr:!0}),_else:y("else",f),_finally:y("finally"),_for:y("for",{isLoop:!0}),_function:y("function",g),_if:y("if"),_return:y("return",f),_switch:y("switch"),_throw:y("throw",f),_try:y("try"),_var:y("var"),_const:y("const"),_while:y("while",{isLoop:!0}),_with:y("with"),_new:y("new",{beforeExpr:!0,startsExpr:!0}),_this:y("this",g),_super:y("super",g),_class:y("class",g),_extends:y("extends",f),_export:y("export"),_import:y("import",g),_null:y("null",g),_true:y("true",g),_false:y("false",g),_in:y("in",{beforeExpr:!0,binop:7}),_instanceof:y("instanceof",{beforeExpr:!0,binop:7}),_typeof:y("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:y("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:y("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},E=/\r\n?|\n|\u2028|\u2029/,b=new RegExp(E.source,"g");function I(e){return 10===e||13===e||8232===e||8233===e}function w(e,t,r){void 0===r&&(r=e.length);for(var a=t;a<r;a++){var s=e.charCodeAt(a);if(I(s))return a<r-1&&13===s&&10===e.charCodeAt(a+1)?a+2:a+1}return-1}var k=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,S=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,T=Object.prototype,A=T.hasOwnProperty,C=T.toString,_=Object.hasOwn||function(e,t){return A.call(e,t)},R=Array.isArray||function(e){return"[object Array]"===C.call(e)},N=Object.create(null);function O(e){return N[e]||(N[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function M(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var P=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,$=function(e,t){this.line=e,this.column=t};$.prototype.offset=function(e){return new $(this.line,this.column+e)};var L=function(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)};function j(e,t){for(var r=1,a=0;;){var s=w(e,a,t);if(s<0)return new $(r,t-a);++r,a=s}}var D={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Y=!1;function F(e){var t={};for(var r in D)t[r]=e&&_(e,r)?e[r]:D[r];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Y&&"object"==typeof console&&console.warn&&(Y=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),e&&null!=e.allowHashBang||(t.allowHashBang=t.ecmaVersion>=14),R(t.onToken)){var a=t.onToken;t.onToken=function(e){return a.push(e)}}return R(t.onComment)&&(t.onComment=function(e,t){return function(r,a,s,n,o,i){var l={type:r?"Block":"Line",value:a,start:s,end:n};e.locations&&(l.loc=new L(this,o,i)),e.ranges&&(l.range=[s,n]),t.push(l)}}(t,t.onComment)),t}var V=256,q=259;function U(e,t){return 2|(e?4:0)|(t?8:0)}var B=function(e,t,r){this.options=e=F(e),this.sourceFile=e.sourceFile,this.keywords=O(o[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var a="";!0!==e.allowReserved&&(a=s[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(a+=" await")),this.reservedWords=O(a);var n=(a?a+" ":"")+s.strict;this.reservedWordsStrict=O(n),this.reservedWordsStrictBind=O(n+" "+s.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(E).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=x.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},G={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};B.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},G.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},G.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0},G.inAsync.get=function(){return(4&this.currentVarScope().flags)>0},G.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t)return!1;if(2&t)return(4&t)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},G.allowSuper.get=function(){return(64&this.currentThisScope().flags)>0||this.options.allowSuperOutsideMethod},G.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},G.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},G.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t||2&t&&!(16&t))return!0}return!1},G.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&V)>0},B.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,a=0;a<e.length;a++)r=e[a](r);return r},B.parse=function(e,t){return new this(t,e).parse()},B.parseExpressionAt=function(e,t,r){var a=new this(r,e,t);return a.nextToken(),a.parseExpression()},B.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(B.prototype,G);var Z=B.prototype,z=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Z.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){S.lastIndex=e,e+=S.exec(this.input)[0].length;var t=z.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){S.lastIndex=e+t[0].length;var r=S.exec(this.input),a=r.index+r[0].length,s=this.input.charAt(a);return";"===s||"}"===s||E.test(r[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||"!"===s&&"="===this.input.charAt(a+1))}e+=t[0].length,S.lastIndex=e,e+=S.exec(this.input)[0].length,";"===this.input[e]&&e++}},Z.eat=function(e){return this.type===e&&(this.next(),!0)},Z.isContextual=function(e){return this.type===x.name&&this.value===e&&!this.containsEsc},Z.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},Z.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Z.canInsertSemicolon=function(){return this.type===x.eof||this.type===x.braceR||E.test(this.input.slice(this.lastTokEnd,this.start))},Z.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Z.semicolon=function(){this.eat(x.semi)||this.insertSemicolon()||this.unexpected()},Z.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Z.expect=function(e){this.eat(e)||this.unexpected()},Z.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var H=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Z.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}},Z.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,a=e.doubleProto;if(!t)return r>=0||a>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),a>=0&&this.raiseRecoverable(a,"Redefinition of __proto__ property")},Z.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Z.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var W=B.prototype;W.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==x.eof;){var r=this.parseStatement(null,!0,t);e.body.push(r)}if(this.inModule)for(var a=0,s=Object.keys(this.undefinedExports);a<s.length;a+=1){var n=s[a];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var K={kind:"loop"},X={kind:"switch"};W.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;S.lastIndex=this.pos;var t=S.exec(this.input),r=this.pos+t[0].length,a=this.input.charCodeAt(r);if(91===a||92===a)return!0;if(e)return!1;if(123===a||a>55295&&a<56320)return!0;if(p(a,!0)){for(var s=r+1;d(a=this.input.charCodeAt(s),!0);)++s;if(92===a||a>55295&&a<56320)return!0;var n=this.input.slice(r,s);if(!i.test(n))return!0}return!1},W.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;S.lastIndex=this.pos;var e,t=S.exec(this.input),r=this.pos+t[0].length;return!(E.test(this.input.slice(this.pos,r))||"function"!==this.input.slice(r,r+8)||r+8!==this.input.length&&(d(e=this.input.charCodeAt(r+8))||e>55295&&e<56320))},W.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;S.lastIndex=this.pos;var r=S.exec(this.input),a=this.pos+r[0].length;if(E.test(this.input.slice(this.pos,a)))return!1;if(e){var s,n=a+5;if("using"!==this.input.slice(a,n)||n===this.input.length||d(s=this.input.charCodeAt(n))||s>55295&&s<56320)return!1;S.lastIndex=n;var o=S.exec(this.input);if(o&&E.test(this.input.slice(n,n+o[0].length)))return!1}if(t){var i,l=a+2;if(!("of"!==this.input.slice(a,l)||l!==this.input.length&&(d(i=this.input.charCodeAt(l))||i>55295&&i<56320)))return!1}var u=this.input.charCodeAt(a);return p(u,!0)||92===u},W.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},W.isUsing=function(e){return this.isUsingKeyword(!1,e)},W.parseStatement=function(e,t,r){var a,s=this.type,n=this.startNode();switch(this.isLet(e)&&(s=x._var,a="let"),s){case x._break:case x._continue:return this.parseBreakContinueStatement(n,s.keyword);case x._debugger:return this.parseDebuggerStatement(n);case x._do:return this.parseDoStatement(n);case x._for:return this.parseForStatement(n);case x._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case x._class:return e&&this.unexpected(),this.parseClass(n,!0);case x._if:return this.parseIfStatement(n);case x._return:return this.parseReturnStatement(n);case x._switch:return this.parseSwitchStatement(n);case x._throw:return this.parseThrowStatement(n);case x._try:return this.parseTryStatement(n);case x._const:case x._var:return a=a||this.value,e&&"var"!==a&&this.unexpected(),this.parseVarStatement(n,a);case x._while:return this.parseWhileStatement(n);case x._with:return this.parseWithStatement(n);case x.braceL:return this.parseBlock(!0,n);case x.semi:return this.parseEmptyStatement(n);case x._export:case x._import:if(this.options.ecmaVersion>10&&s===x._import){S.lastIndex=this.pos;var o=S.exec(this.input),i=this.pos+o[0].length,l=this.input.charCodeAt(i);if(40===l||46===l)return this.parseExpressionStatement(n,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===x._import?this.parseImport(n):this.parseExport(n,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var u=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(u)return t&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===u&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(n,!1,u),this.semicolon(),this.finishNode(n,"VariableDeclaration");var c=this.value,p=this.parseExpression();return s===x.name&&"Identifier"===p.type&&this.eat(x.colon)?this.parseLabeledStatement(n,c,p,e):this.parseExpressionStatement(n,p)}},W.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(x.semi)||this.insertSemicolon()?e.label=null:this.type!==x.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var a=0;a<this.labels.length;++a){var s=this.labels[a];if(null==e.label||s.name===e.label.name){if(null!=s.kind&&(r||"loop"===s.kind))break;if(e.label&&r)break}}return a===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},W.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},W.parseDoStatement=function(e){return this.next(),this.labels.push(K),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(x._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(x.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},W.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(K),this.enterScope(0),this.expect(x.parenL),this.type===x.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===x._var||this.type===x._const||r){var a=this.startNode(),s=r?"let":this.value;return this.next(),this.parseVar(a,!0,s),this.finishNode(a,"VariableDeclaration"),this.parseForAfterInit(e,a,t)}var n=this.isContextual("let"),o=!1,i=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(i){var l=this.startNode();return this.next(),"await using"===i&&this.next(),this.parseVar(l,!0,i),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(e,l,t)}var u=this.containsEsc,c=new H,p=this.start,d=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===x._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===x._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(d.start!==p||u||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),n&&o&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,c),this.checkLValPattern(d),this.parseForIn(e,d)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,d))},W.parseForAfterInit=function(e,t,r){return(this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.options.ecmaVersion>=9&&(this.type===x._in?r>-1&&this.unexpected(r):e.await=r>-1),this.parseForIn(e,t)):(r>-1&&this.unexpected(r),this.parseFor(e,t))},W.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,Q|(r?0:ee),!1,t)},W.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(x._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},W.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(x.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},W.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(x.braceL),this.labels.push(X),this.enterScope(0);for(var r=!1;this.type!==x.braceR;)if(this.type===x._case||this.type===x._default){var a=this.type===x._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),a?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(x.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},W.parseThrowStatement=function(e){return this.next(),E.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var J=[];W.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(x.parenR),e},W.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===x._catch){var t=this.startNode();this.next(),this.eat(x.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(x._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},W.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")},W.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(K),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},W.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},W.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},W.parseLabeledStatement=function(e,t,r,a){for(var s=0,n=this.labels;s<n.length;s+=1)n[s].name===t&&this.raise(r.start,"Label '"+t+"' is already declared");for(var o=this.type.isLoop?"loop":this.type===x._switch?"switch":null,i=this.labels.length-1;i>=0;i--){var l=this.labels[i];if(l.statementStart!==e.start)break;l.statementStart=this.start,l.kind=o}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(a?-1===a.indexOf("label")?a+"label":a:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},W.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},W.parseBlock=function(e,t,r){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(x.braceL),e&&this.enterScope(0);this.type!==x.braceR;){var a=this.parseStatement(null);t.body.push(a)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},W.parseFor=function(e,t){return e.init=t,this.expect(x.semi),e.test=this.type===x.semi?null:this.parseExpression(),this.expect(x.semi),e.update=this.type===x.parenR?null:this.parseExpression(),this.expect(x.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},W.parseForIn=function(e,t){var r=this.type===x._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!r||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(x.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")},W.parseVar=function(e,t,r,a){for(e.declarations=[],e.kind=r;;){var s=this.startNode();if(this.parseVarId(s,r),this.eat(x.eq)?s.init=this.parseMaybeAssign(t):a||"const"!==r||this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual("of")?a||"using"!==r&&"await using"!==r||!(this.options.ecmaVersion>=17)||this.type===x._in||this.isContextual("of")?a||"Identifier"===s.id.type||t&&(this.type===x._in||this.isContextual("of"))?s.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+r+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(x.comma))break}return e},W.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?1:2,!1)};var Q=1,ee=2;function te(e,t){var r=t.key.name,a=e[r],s="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(s=(t.static?"s":"i")+t.kind),"iget"===a&&"iset"===s||"iset"===a&&"iget"===s||"sget"===a&&"sset"===s||"sset"===a&&"sget"===s?(e[r]="true",!1):!!a||(e[r]=s,!1)}function re(e,t){var r=e.computed,a=e.key;return!r&&("Identifier"===a.type&&a.name===t||"Literal"===a.type&&a.value===t)}W.parseFunction=function(e,t,r,a,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!a)&&(this.type===x.star&&t&ee&&this.unexpected(),e.generator=this.eat(x.star)),this.options.ecmaVersion>=8&&(e.async=!!a),t&Q&&(e.id=4&t&&this.type!==x.name?null:this.parseIdent(),!e.id||t&ee||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?1:2:3));var n=this.yieldPos,o=this.awaitPos,i=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(U(e.async,e.generator)),t&Q||(e.id=this.type===x.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,s),this.yieldPos=n,this.awaitPos=o,this.awaitIdentPos=i,this.finishNode(e,t&Q?"FunctionDeclaration":"FunctionExpression")},W.parseFunctionParams=function(e){this.expect(x.parenL),e.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},W.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var a=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(x.braceL);this.type!==x.braceR;){var o=this.parseClassElement(null!==e.superClass);o&&(s.body.push(o),"MethodDefinition"===o.type&&"constructor"===o.kind?(n&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),n=!0):o.key&&"PrivateIdentifier"===o.key.type&&te(a,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},W.parseClassElement=function(e){if(this.eat(x.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),a="",s=!1,n=!1,o="method",i=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(x.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===x.star?i=!0:a="static"}if(r.static=i,!a&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==x.star||this.canInsertSemicolon()?a="async":n=!0),!a&&(t>=9||!n)&&this.eat(x.star)&&(s=!0),!a&&!n&&!s){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=l:a=l)}if(a?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=a,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===x.parenL||"method"!==o||s||n){var u=!r.static&&re(r,"constructor"),c=u&&e;u&&"method"!==o&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=u?"constructor":o,this.parseClassMethod(r,s,n,c)}else this.parseClassField(r);return r},W.isClassElementNameStart=function(){return this.type===x.name||this.type===x.privateId||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword},W.parseClassElementName=function(e){this.type===x.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},W.parseClassMethod=function(e,t,r,a){var s=e.key;"constructor"===e.kind?(t&&this.raise(s.start,"Constructor can't be a generator"),r&&this.raise(s.start,"Constructor can't be an async method")):e.static&&re(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,r,a);return"get"===e.kind&&0!==n.params.length&&this.raiseRecoverable(n.start,"getter should have no params"),"set"===e.kind&&1!==n.params.length&&this.raiseRecoverable(n.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===n.params[0].type&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},W.parseClassField=function(e){return re(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&re(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(x.eq)?(this.enterScope(576),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},W.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==x.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},W.parseClassId=function(e,t){this.type===x.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},W.parseClassSuper=function(e){e.superClass=this.eat(x._extends)?this.parseExprSubscripts(null,!1):null},W.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},W.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(this.options.checkPrivateFields)for(var a=this.privateNameStack.length,s=0===a?null:this.privateNameStack[a-1],n=0;n<r.length;++n){var o=r[n];_(t,o.name)||(s?s.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}},W.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},W.parseExport=function(e,t){if(this.next(),this.eat(x.star))return this.parseExportAllDeclaration(e,t);if(this.eat(x._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var r=0,a=e.specifiers;r<a.length;r+=1){var s=a[r];this.checkUnreserved(s.local),this.checkLocalExport(s.local),"Literal"===s.local.type&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},W.parseExportDeclaration=function(e){return this.parseStatement(null)},W.parseExportDefaultDeclaration=function(){var e;if(this.type===x._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Q,!1,e)}if(this.type===x._class){var r=this.startNode();return this.parseClass(r,"nullableID")}var a=this.parseMaybeAssign();return this.semicolon(),a},W.checkExport=function(e,t,r){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),_(e,t)&&this.raiseRecoverable(r,"Duplicate export '"+t+"'"),e[t]=!0)},W.checkPatternExport=function(e,t){var r=t.type;if("Identifier"===r)this.checkExport(e,t,t.start);else if("ObjectPattern"===r)for(var a=0,s=t.properties;a<s.length;a+=1){var n=s[a];this.checkPatternExport(e,n)}else if("ArrayPattern"===r)for(var o=0,i=t.elements;o<i.length;o+=1){var l=i[o];l&&this.checkPatternExport(e,l)}else"Property"===r?this.checkPatternExport(e,t.value):"AssignmentPattern"===r?this.checkPatternExport(e,t.left):"RestElement"===r&&this.checkPatternExport(e,t.argument)},W.checkVariableExport=function(e,t){if(e)for(var r=0,a=t;r<a.length;r+=1){var s=a[r];this.checkPatternExport(e,s.id)}},W.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},W.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},W.parseExportSpecifiers=function(e){var t=[],r=!0;for(this.expect(x.braceL);!this.eat(x.braceR);){if(r)r=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;t.push(this.parseExportSpecifier(e))}return t},W.parseImport=function(e){return this.next(),this.type===x.string?(e.specifiers=J,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===x.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},W.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportSpecifier")},W.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportDefaultSpecifier")},W.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportNamespaceSpecifier")},W.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===x.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(x.comma)))return e;if(this.type===x.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(x.braceL);!this.eat(x.braceR);){if(t)t=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;e.push(this.parseImportSpecifier())}return e},W.parseWithClause=function(){var e=[];if(!this.eat(x._with))return e;this.expect(x.braceL);for(var t={},r=!0;!this.eat(x.braceR);){if(r)r=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;var a=this.parseImportAttribute(),s="Identifier"===a.key.type?a.key.name:a.key.value;_(t,s)&&this.raiseRecoverable(a.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(a)}return e},W.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===x.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(x.colon),this.type!==x.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},W.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===x.string){var e=this.parseLiteral(this.value);return P.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},W.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},W.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var ae=B.prototype;ae.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var a=0,s=e.properties;a<s.length;a+=1){var n=s[a];this.toAssignable(n,t),"RestElement"!==n.type||"ArrayPattern"!==n.argument.type&&"ObjectPattern"!==n.argument.type||this.raise(n.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",r&&this.checkPatternErrors(r,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,r);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else r&&this.checkPatternErrors(r,!0);return e},ae.toAssignableList=function(e,t){for(var r=e.length,a=0;a<r;a++){var s=e[a];s&&this.toAssignable(s,t)}if(r){var n=e[r-1];6===this.options.ecmaVersion&&t&&n&&"RestElement"===n.type&&"Identifier"!==n.argument.type&&this.unexpected(n.argument.start)}return e},ae.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ae.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==x.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ae.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case x.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(x.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case x.braceL:return this.parseObj(!0)}return this.parseIdent()},ae.parseBindingList=function(e,t,r,a){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(x.comma),t&&this.type===x.comma)s.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===x.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),s.push(o),this.type===x.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}s.push(this.parseAssignableListItem(a))}return s},ae.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ae.parseBindingListItem=function(e){return e},ae.parseMaybeDefault=function(e,t,r){if(r=r||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(x.eq))return r;var a=this.startNodeAt(e,t);return a.left=r,a.right=this.parseMaybeAssign(),this.finishNode(a,"AssignmentPattern")},ae.checkLValSimple=function(e,t,r){void 0===t&&(t=0);var a=0!==t;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(a?"Binding ":"Assigning to ")+e.name+" in strict mode"),a&&(2===t&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),r&&(_(r,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),r[e.name]=!0),5!==t&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":a&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return a&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,r);default:this.raise(e.start,(a?"Binding":"Assigning to")+" rvalue")}},ae.checkLValPattern=function(e,t,r){switch(void 0===t&&(t=0),e.type){case"ObjectPattern":for(var a=0,s=e.properties;a<s.length;a+=1){var n=s[a];this.checkLValInnerPattern(n,t,r)}break;case"ArrayPattern":for(var o=0,i=e.elements;o<i.length;o+=1){var l=i[o];l&&this.checkLValInnerPattern(l,t,r)}break;default:this.checkLValSimple(e,t,r)}},ae.checkLValInnerPattern=function(e,t,r){switch(void 0===t&&(t=0),e.type){case"Property":this.checkLValInnerPattern(e.value,t,r);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,r);break;case"RestElement":this.checkLValPattern(e.argument,t,r);break;default:this.checkLValPattern(e,t,r)}};var se=function(e,t,r,a,s){this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=a,this.generator=!!s},ne={b_stat:new se("{",!1),b_expr:new se("{",!0),b_tmpl:new se("${",!1),p_stat:new se("(",!1),p_expr:new se("(",!0),q_tmpl:new se("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new se("function",!1),f_expr:new se("function",!0),f_expr_gen:new se("function",!0,!1,null,!0),f_gen:new se("function",!1,!1,null,!0)},oe=B.prototype;oe.initialContext=function(){return[ne.b_stat]},oe.curContext=function(){return this.context[this.context.length-1]},oe.braceIsBlock=function(e){var t=this.curContext();return t===ne.f_expr||t===ne.f_stat||(e!==x.colon||t!==ne.b_stat&&t!==ne.b_expr?e===x._return||e===x.name&&this.exprAllowed?E.test(this.input.slice(this.lastTokEnd,this.start)):e===x._else||e===x.semi||e===x.eof||e===x.parenR||e===x.arrow||(e===x.braceL?t===ne.b_stat:e!==x._var&&e!==x._const&&e!==x.name&&!this.exprAllowed):!t.isExpr)},oe.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},oe.updateContext=function(e){var t,r=this.type;r.keyword&&e===x.dot?this.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.exprAllowed=r.beforeExpr},oe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},x.parenR.updateContext=x.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===ne.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},x.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?ne.b_stat:ne.b_expr),this.exprAllowed=!0},x.dollarBraceL.updateContext=function(){this.context.push(ne.b_tmpl),this.exprAllowed=!0},x.parenL.updateContext=function(e){var t=e===x._if||e===x._for||e===x._with||e===x._while;this.context.push(t?ne.p_stat:ne.p_expr),this.exprAllowed=!0},x.incDec.updateContext=function(){},x._function.updateContext=x._class.updateContext=function(e){!e.beforeExpr||e===x._else||e===x.semi&&this.curContext()!==ne.p_stat||e===x._return&&E.test(this.input.slice(this.lastTokEnd,this.start))||(e===x.colon||e===x.braceL)&&this.curContext()===ne.b_stat?this.context.push(ne.f_stat):this.context.push(ne.f_expr),this.exprAllowed=!1},x.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},x.backQuote.updateContext=function(){this.curContext()===ne.q_tmpl?this.context.pop():this.context.push(ne.q_tmpl),this.exprAllowed=!1},x.star.updateContext=function(e){if(e===x._function){var t=this.context.length-1;this.context[t]===ne.f_expr?this.context[t]=ne.f_expr_gen:this.context[t]=ne.f_gen}this.exprAllowed=!0},x.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==x.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var ie=B.prototype;function le(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&le(e.expression)}function ue(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&ue(e.expression)||"ParenthesizedExpression"===e.type&&ue(e.expression)}ie.checkPropClash=function(e,t,r){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var a,s=e.key;switch(s.type){case"Identifier":a=s.name;break;case"Literal":a=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===a&&"init"===n&&(t.proto&&(r?r.doubleProto<0&&(r.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);else{var o=t[a="$"+a];o?("init"===n?this.strict&&o.init||o.get||o.set:o.init||o[n])&&this.raiseRecoverable(s.start,"Redefinition of property"):o=t[a]={init:!1,get:!1,set:!1},o[n]=!0}}},ie.parseExpression=function(e,t){var r=this.start,a=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===x.comma){var n=this.startNodeAt(r,a);for(n.expressions=[s];this.eat(x.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s},ie.parseMaybeAssign=function(e,t,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var a=!1,s=-1,n=-1,o=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new H,a=!0);var i=this.start,l=this.startLoc;this.type!==x.parenL&&this.type!==x.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var u=this.parseMaybeConditional(e,t);if(r&&(u=r.call(this,u,i,l)),this.type.isAssign){var c=this.startNodeAt(i,l);return c.operator=this.value,this.type===x.eq&&(u=this.toAssignable(u,!1,t)),a||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===x.eq?this.checkLValPattern(u):this.checkLValSimple(u),c.left=u,this.next(),c.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(c,"AssignmentExpression")}return a&&this.checkExpressionErrors(t,!0),s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),u},ie.parseMaybeConditional=function(e,t){var r=this.start,a=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(x.question)){var n=this.startNodeAt(r,a);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(x.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s},ie.parseExprOps=function(e,t){var r=this.start,a=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===r&&"ArrowFunctionExpression"===s.type?s:this.parseExprOp(s,r,a,-1,e)},ie.parseExprOp=function(e,t,r,a,s){var n=this.type.binop;if(null!=n&&(!s||this.type!==x._in)&&n>a){var o=this.type===x.logicalOR||this.type===x.logicalAND,i=this.type===x.coalesce;i&&(n=x.logicalAND.binop);var l=this.value;this.next();var u=this.start,c=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),u,c,n,s),d=this.buildBinary(t,r,e,p,l,o||i);return(o&&this.type===x.coalesce||i&&(this.type===x.logicalOR||this.type===x.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,r,a,s)}return e},ie.buildBinary=function(e,t,r,a,s,n){"PrivateIdentifier"===a.type&&this.raise(a.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=r,o.operator=s,o.right=a,this.finishNode(o,n?"LogicalExpression":"BinaryExpression")},ie.parseMaybeUnary=function(e,t,r,a){var s,n=this.start,o=this.startLoc;if(this.isContextual("await")&&this.canAwait)s=this.parseAwait(a),t=!0;else if(this.type.prefix){var i=this.startNode(),l=this.type===x.incDec;i.operator=this.value,i.prefix=!0,this.next(),i.argument=this.parseMaybeUnary(null,!0,l,a),this.checkExpressionErrors(e,!0),l?this.checkLValSimple(i.argument):this.strict&&"delete"===i.operator&&le(i.argument)?this.raiseRecoverable(i.start,"Deleting local variable in strict mode"):"delete"===i.operator&&ue(i.argument)?this.raiseRecoverable(i.start,"Private fields can not be deleted"):t=!0,s=this.finishNode(i,l?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==x.privateId){if(s=this.parseExprSubscripts(e,a),this.checkExpressionErrors(e))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(n,o);u.operator=this.value,u.prefix=!1,u.argument=s,this.checkLValSimple(s),this.next(),s=this.finishNode(u,"UpdateExpression")}}else(a||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==x._in&&this.unexpected();return r||!this.eat(x.starstar)?s:t?void this.unexpected(this.lastTokStart):this.buildBinary(n,o,s,this.parseMaybeUnary(null,!1,!1,a),"**",!1)},ie.parseExprSubscripts=function(e,t){var r=this.start,a=this.startLoc,s=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===s.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return s;var n=this.parseSubscripts(s,r,a,!1,t);return e&&"MemberExpression"===n.type&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n},ie.parseSubscripts=function(e,t,r,a,s){for(var n=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start==5&&this.potentialArrowAt===e.start,o=!1;;){var i=this.parseSubscript(e,t,r,a,n,o,s);if(i.optional&&(o=!0),i===e||"ArrowFunctionExpression"===i.type){if(o){var l=this.startNodeAt(t,r);l.expression=i,i=this.finishNode(l,"ChainExpression")}return i}e=i}},ie.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(x.arrow)},ie.parseSubscriptAsyncArrow=function(e,t,r,a){return this.parseArrowExpression(this.startNodeAt(e,t),r,!0,a)},ie.parseSubscript=function(e,t,r,a,s,n,o){var i=this.options.ecmaVersion>=11,l=i&&this.eat(x.questionDot);a&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(x.bracketL);if(u||l&&this.type!==x.parenL&&this.type!==x.backQuote||this.eat(x.dot)){var c=this.startNodeAt(t,r);c.object=e,u?(c.property=this.parseExpression(),this.expect(x.bracketR)):this.type===x.privateId&&"Super"!==e.type?c.property=this.parsePrivateIdent():c.property=this.parseIdent("never"!==this.options.allowReserved),c.computed=!!u,i&&(c.optional=l),e=this.finishNode(c,"MemberExpression")}else if(!a&&this.eat(x.parenL)){var p=new H,d=this.yieldPos,h=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var f=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1,p);if(s&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=h,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,r,f,o);this.checkExpressionErrors(p,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=h||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,r);g.callee=e,g.arguments=f,i&&(g.optional=l),e=this.finishNode(g,"CallExpression")}else if(this.type===x.backQuote){(l||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var v=this.startNodeAt(t,r);v.tag=e,v.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(v,"TaggedTemplateExpression")}return e},ie.parseExprAtom=function(e,t,r){this.type===x.slash&&this.readRegexp();var a,s=this.potentialArrowAt===this.start;switch(this.type){case x._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),a=this.startNode(),this.next(),this.type!==x.parenL||this.allowDirectSuper||this.raise(a.start,"super() call outside constructor of a subclass"),this.type!==x.dot&&this.type!==x.bracketL&&this.type!==x.parenL&&this.unexpected(),this.finishNode(a,"Super");case x._this:return a=this.startNode(),this.next(),this.finishNode(a,"ThisExpression");case x.name:var n=this.start,o=this.startLoc,i=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!i&&"async"===l.name&&!this.canInsertSemicolon()&&this.eat(x._function))return this.overrideContext(ne.f_expr),this.parseFunction(this.startNodeAt(n,o),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(x.arrow))return this.parseArrowExpression(this.startNodeAt(n,o),[l],!1,t);if(this.options.ecmaVersion>=8&&"async"===l.name&&this.type===x.name&&!i&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return l=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(x.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,o),[l],!0,t)}return l;case x.regexp:var u=this.value;return(a=this.parseLiteral(u.value)).regex={pattern:u.pattern,flags:u.flags},a;case x.num:case x.string:return this.parseLiteral(this.value);case x._null:case x._true:case x._false:return(a=this.startNode()).value=this.type===x._null?null:this.type===x._true,a.raw=this.type.keyword,this.next(),this.finishNode(a,"Literal");case x.parenL:var c=this.start,p=this.parseParenAndDistinguishExpression(s,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(p)&&(e.parenthesizedAssign=c),e.parenthesizedBind<0&&(e.parenthesizedBind=c)),p;case x.bracketL:return a=this.startNode(),this.next(),a.elements=this.parseExprList(x.bracketR,!0,!0,e),this.finishNode(a,"ArrayExpression");case x.braceL:return this.overrideContext(ne.b_expr),this.parseObj(!1,e);case x._function:return a=this.startNode(),this.next(),this.parseFunction(a,0);case x._class:return this.parseClass(this.startNode(),!1);case x._new:return this.parseNew();case x.backQuote:return this.parseTemplate();case x._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}},ie.parseExprAtomDefault=function(){this.unexpected()},ie.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===x.parenL&&!e)return this.parseDynamicImport(t);if(this.type===x.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}this.unexpected()},ie.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(x.parenR)?e.options=null:(this.expect(x.comma),this.afterTrailingComma(x.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(x.parenR)||(this.expect(x.comma),this.afterTrailingComma(x.parenR)||this.unexpected())));else if(!this.eat(x.parenR)){var t=this.start;this.eat(x.comma)&&this.eat(x.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},ie.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},ie.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=null!=t.value?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},ie.parseParenExpression=function(){this.expect(x.parenL);var e=this.parseExpression();return this.expect(x.parenR),e},ie.shouldParseArrow=function(e){return!this.canInsertSemicolon()},ie.parseParenAndDistinguishExpression=function(e,t){var r,a=this.start,s=this.startLoc,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o,i=this.start,l=this.startLoc,u=[],c=!0,p=!1,d=new H,h=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==x.parenR;){if(c?c=!1:this.expect(x.comma),n&&this.afterTrailingComma(x.parenR,!0)){p=!0;break}if(this.type===x.ellipsis){o=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===x.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}u.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var f=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(x.parenR),e&&this.shouldParseArrow(u)&&this.eat(x.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=h,this.awaitPos=m,this.parseParenArrowList(a,s,u,t);u.length&&!p||this.unexpected(this.lastTokStart),o&&this.unexpected(o),this.checkExpressionErrors(d,!0),this.yieldPos=h||this.yieldPos,this.awaitPos=m||this.awaitPos,u.length>1?((r=this.startNodeAt(i,l)).expressions=u,this.finishNodeAt(r,"SequenceExpression",f,g)):r=u[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(a,s);return v.expression=r,this.finishNode(v,"ParenthesizedExpression")}return r},ie.parseParenItem=function(e){return e},ie.parseParenArrowList=function(e,t,r,a){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,a)};var ce=[];ie.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===x.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var a=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),a,s,!0,!1),this.eat(x.parenL)?e.arguments=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1):e.arguments=ce,this.finishNode(e,"NewExpression")},ie.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===x.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),r.tail=this.type===x.backQuote,this.finishNode(r,"TemplateElement")},ie.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var a=this.parseTemplateElement({isTagged:t});for(r.quasis=[a];!a.tail;)this.type===x.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(x.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(x.braceR),r.quasis.push(a=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")},ie.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===x.name||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===x.star)&&!E.test(this.input.slice(this.lastTokEnd,this.start))},ie.parseObj=function(e,t){var r=this.startNode(),a=!0,s={};for(r.properties=[],this.next();!this.eat(x.braceR);){if(a)a=!1;else if(this.expect(x.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(x.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),r.properties.push(n)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},ie.parseProperty=function(e,t){var r,a,s,n,o=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(x.ellipsis))return e?(o.argument=this.parseIdent(!1),this.type===x.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(o,"RestElement")):(o.argument=this.parseMaybeAssign(!1,t),this.type===x.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(o,"SpreadElement"));this.options.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||t)&&(s=this.start,n=this.startLoc),e||(r=this.eat(x.star)));var i=this.containsEsc;return this.parsePropertyName(o),!e&&!i&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(o)?(a=!0,r=this.options.ecmaVersion>=9&&this.eat(x.star),this.parsePropertyName(o)):a=!1,this.parsePropertyValue(o,e,r,a,s,n,t,i),this.finishNode(o,"Property")},ie.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var r="get"===e.kind?0:1;if(e.value.params.length!==r){var a=e.value.start;"get"===e.kind?this.raiseRecoverable(a,"getter should have no params"):this.raiseRecoverable(a,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},ie.parsePropertyValue=function(e,t,r,a,s,n,o,i){(r||a)&&this.type===x.colon&&this.unexpected(),this.eat(x.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===x.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(r,a),e.kind="init"):t||i||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===x.comma||this.type===x.braceR||this.type===x.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((r||a)&&this.unexpected(),this.checkUnreserved(e.key),"await"!==e.key.name||this.awaitIdentPos||(this.awaitIdentPos=s),t?e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key)):this.type===x.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected():((r||a)&&this.unexpected(),this.parseGetterSetter(e))},ie.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(x.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(x.bracketR),e.key;e.computed=!1}return e.key=this.type===x.num||this.type===x.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},ie.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},ie.parseMethod=function(e,t,r){var a=this.startNode(),s=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(a),this.options.ecmaVersion>=6&&(a.generator=e),this.options.ecmaVersion>=8&&(a.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|U(t,a.generator)|(r?128:0)),this.expect(x.parenL),a.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(a,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(a,"FunctionExpression")},ie.parseArrowExpression=function(e,t,r,a){var s=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(16|U(r,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,a),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")},ie.parseFunctionBody=function(e,t,r,a){var s=t&&this.type!==x.braceL,n=this.strict,o=!1;if(s)e.body=this.parseMaybeAssign(a),e.expression=!0,this.checkParams(e,!1);else{var i=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);n&&!i||(o=this.strictDirective(this.end))&&i&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var l=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!n&&!o&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,5),e.body=this.parseBlock(!1,void 0,o&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()},ie.isSimpleParamList=function(e){for(var t=0,r=e;t<r.length;t+=1)if("Identifier"!==r[t].type)return!1;return!0},ie.checkParams=function(e,t){for(var r=Object.create(null),a=0,s=e.params;a<s.length;a+=1){var n=s[a];this.checkLValInnerPattern(n,1,t?null:r)}},ie.parseExprList=function(e,t,r,a){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(x.comma),t&&this.afterTrailingComma(e))break;var o=void 0;r&&this.type===x.comma?o=null:this.type===x.ellipsis?(o=this.parseSpread(a),a&&this.type===x.comma&&a.trailingComma<0&&(a.trailingComma=this.start)):o=this.parseMaybeAssign(!1,a),s.push(o)}return s},ie.checkUnreserved=function(e){var t=e.start,r=e.end,a=e.name;this.inGenerator&&"yield"===a&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===a&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().flags&q||"arguments"!==a||this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==a&&"await"!==a||this.raise(t,"Cannot use "+a+" in class static initialization block"),this.keywords.test(a)&&this.raise(t,"Unexpected keyword '"+a+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,r).indexOf("\\")||(this.strict?this.reservedWordsStrict:this.reservedWords).test(a)&&(this.inAsync||"await"!==a||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+a+"' is reserved"))},ie.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"!==t.name||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},ie.parseIdentNode=function(){var e=this.startNode();return this.type===x.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,"class"!==e.name&&"function"!==e.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=x.name):this.unexpected(),e},ie.parsePrivateIdent=function(){var e=this.startNode();return this.type===x.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},ie.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===x.semi||this.canInsertSemicolon()||this.type!==x.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(x.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},ie.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var pe=B.prototype;pe.raise=function(e,t){var r=j(this.input,e);t+=" ("+r.line+":"+r.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var a=new SyntaxError(t);throw a.pos=e,a.loc=r,a.raisedAt=this.pos,a},pe.raiseRecoverable=pe.raise,pe.curPosition=function(){if(this.options.locations)return new $(this.curLine,this.pos-this.lineStart)};var de=B.prototype,he=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};de.enterScope=function(e){this.scopeStack.push(new he(e))},de.exitScope=function(){this.scopeStack.pop()},de.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},de.declareName=function(e,t,r){var a=!1;if(2===t){var s=this.currentScope();a=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&1&s.flags&&delete this.undefinedExports[e]}else if(4===t)this.currentScope().lexical.push(e);else if(3===t){var n=this.currentScope();a=this.treatFunctionsAsVar?n.lexical.indexOf(e)>-1:n.lexical.indexOf(e)>-1||n.var.indexOf(e)>-1,n.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var i=this.scopeStack[o];if(i.lexical.indexOf(e)>-1&&!(32&i.flags&&i.lexical[0]===e)||!this.treatFunctionsAsVarInScope(i)&&i.functions.indexOf(e)>-1){a=!0;break}if(i.var.push(e),this.inModule&&1&i.flags&&delete this.undefinedExports[e],i.flags&q)break}a&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")},de.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},de.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},de.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags)return t}},de.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags&&!(16&t.flags))return t}};var me=function(e,t,r){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new L(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},fe=B.prototype;function ge(e,t,r,a){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=a),this.options.ranges&&(e.range[1]=r),e}fe.startNode=function(){return new me(this,this.start,this.startLoc)},fe.startNodeAt=function(e,t){return new me(this,e,t)},fe.finishNode=function(e,t){return ge.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},fe.finishNodeAt=function(e,t,r,a){return ge.call(this,e,t,r,a)},fe.copyNode=function(e){var t=new me(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var ve,ye,xe="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Ee=xe+" Extended_Pictographic",be=Ee+" EBase EComp EMod EPres ExtPict",Ie={9:xe,10:Ee,11:Ee,12:be,13:be,14:be},we={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},ke="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Se="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Te=Se+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ae=Te+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ce=Ae+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",_e=Ce+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Re={9:Se,10:Te,11:Ae,12:Ce,13:_e,14:_e+" Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"},Ne={};for(var Oe=0,Me=[9,10,11,12,13,14];Oe<Me.length;Oe+=1)ye=void 0,(ye=Ne[ve=Me[Oe]]={binary:O(Ie[ve]+" "+ke),binaryOfStrings:O(we[ve]),nonBinary:{General_Category:O(ke),Script:O(Re[ve])}}).nonBinary.Script_Extensions=ye.nonBinary.Script,ye.nonBinary.gc=ye.nonBinary.General_Category,ye.nonBinary.sc=ye.nonBinary.Script,ye.nonBinary.scx=ye.nonBinary.Script_Extensions;var Pe=B.prototype,$e=function(e,t){this.parent=e,this.base=t||this};$e.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var r=e;r;r=r.parent)if(t.base===r.base&&t!==r)return!0;return!1},$e.prototype.sibling=function(){return new $e(this.parent,this.base)};var Le=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ne[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function je(e){return 105===e||109===e||115===e}function De(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Ye(e){return e>=65&&e<=90||e>=97&&e<=122}Le.prototype.reset=function(e,t,r){var a=-1!==r.indexOf("v"),s=-1!==r.indexOf("u");this.start=0|e,this.source=t+"",this.flags=r,a&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=s&&this.parser.options.ecmaVersion>=9)},Le.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},Le.prototype.at=function(e,t){void 0===t&&(t=!1);var r=this.source,a=r.length;if(e>=a)return-1;var s=r.charCodeAt(e);if(!t&&!this.switchU||s<=55295||s>=57344||e+1>=a)return s;var n=r.charCodeAt(e+1);return n>=56320&&n<=57343?(s<<10)+n-56613888:s},Le.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var r=this.source,a=r.length;if(e>=a)return a;var s,n=r.charCodeAt(e);return!t&&!this.switchU||n<=55295||n>=57344||e+1>=a||(s=r.charCodeAt(e+1))<56320||s>57343?e+1:e+2},Le.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},Le.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Le.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Le.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Le.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var r=this.pos,a=0,s=e;a<s.length;a+=1){var n=s[a],o=this.at(r,t);if(-1===o||o!==n)return!1;r=this.nextIndex(r,t)}return this.pos=r,!0},Pe.validateRegExpFlags=function(e){for(var t=e.validFlags,r=e.flags,a=!1,s=!1,n=0;n<r.length;n++){var o=r.charAt(n);-1===t.indexOf(o)&&this.raise(e.start,"Invalid regular expression flag"),r.indexOf(o,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===o&&(a=!0),"v"===o&&(s=!0)}this.options.ecmaVersion>=15&&a&&s&&this.raise(e.start,"Invalid regular expression flag")},Pe.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&function(e){for(var t in e)return!0;return!1}(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},Pe.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t<r.length;t+=1){var a=r[t];e.groupNames[a]||e.raise("Invalid named capture referenced")}},Pe.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new $e(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},Pe.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},Pe.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},Pe.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var r=!1;if(this.options.ecmaVersion>=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1},Pe.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},Pe.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},Pe.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var a=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(a=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return-1!==s&&s<a&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=r}return!1},Pe.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},Pe.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},Pe.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var r=this.regexp_eatModifiers(e),a=e.eat(45);if(r||a){for(var s=0;s<r.length;s++){var n=r.charAt(s);r.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(a){var o=this.regexp_eatModifiers(e);r||o||58!==e.current()||e.raise("Invalid regular expression modifiers");for(var i=0;i<o.length;i++){var l=o.charAt(i);(o.indexOf(l,i+1)>-1||r.indexOf(l)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},Pe.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},Pe.regexp_eatModifiers=function(e){for(var t="",r=0;-1!==(r=e.current())&&je(r);)t+=M(r),e.advance();return t},Pe.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},Pe.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},Pe.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!De(t)&&(e.lastIntValue=t,e.advance(),!0)},Pe.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;-1!==(r=e.current())&&!De(r);)e.advance();return e.pos!==t},Pe.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t||(e.advance(),0))},Pe.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,r=e.groupNames[e.lastStringValue];if(r)if(t)for(var a=0,s=r;a<s.length;a+=1)s[a].separatedFrom(e.branchID)||e.raise("Duplicate capture group name");else e.raise("Duplicate capture group name");t?(r||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},Pe.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},Pe.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=M(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=M(e.lastIntValue);return!0}return!1},Pe.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,a=e.current(r);return e.advance(r),92===a&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(a=e.lastIntValue),function(e){return p(e,!0)||36===e||95===e}(a)?(e.lastIntValue=a,!0):(e.pos=t,!1)},Pe.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,a=e.current(r);return e.advance(r),92===a&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(a=e.lastIntValue),function(e){return d(e,!0)||36===e||95===e||8204===e||8205===e}(a)?(e.lastIntValue=a,!0):(e.pos=t,!1)},Pe.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},Pe.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1},Pe.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},Pe.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},Pe.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},Pe.regexp_eatZero=function(e){return 48===e.current()&&!qe(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},Pe.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},Pe.regexp_eatControlLetter=function(e){var t=e.current();return!!Ye(t)&&(e.lastIntValue=t%32,e.advance(),!0)},Pe.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var r,a=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var n=e.lastIntValue;if(s&&n>=55296&&n<=56319){var o=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(i>=56320&&i<=57343)return e.lastIntValue=1024*(n-55296)+(i-56320)+65536,!0}e.pos=o,e.lastIntValue=n}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&((r=e.lastIntValue)>=0&&r<=1114111))return!0;s&&e.raise("Invalid unicode escape"),e.pos=a}return!1},Pe.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t||(e.lastIntValue=t,e.advance(),0))},Pe.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};function Fe(e){return Ye(e)||95===e}function Ve(e){return Fe(e)||qe(e)}function qe(e){return e>=48&&e<=57}function Ue(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Be(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Ge(e){return e>=48&&e<=55}Pe.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(function(e){return 100===e||68===e||115===e||83===e||119===e||87===e}(t))return e.lastIntValue=-1,e.advance(),1;var r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=80===t)||112===t)){var a;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(a=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&2===a&&e.raise("Invalid property name"),a;e.raise("Invalid property name")}return 0},Pe.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var a=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,a),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return 0},Pe.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){_(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")},Pe.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise("Invalid property name")},Pe.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Fe(t=e.current());)e.lastStringValue+=M(t),e.advance();return""!==e.lastStringValue},Pe.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Ve(t=e.current());)e.lastStringValue+=M(t),e.advance();return""!==e.lastStringValue},Pe.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},Pe.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&2===r&&e.raise("Negated character class may contain strings"),!0}return!1},Pe.regexp_classContents=function(e){return 93===e.current()?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},Pe.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;!e.switchU||-1!==t&&-1!==r||e.raise("Invalid character class"),-1!==t&&-1!==r&&t>r&&e.raise("Range out of order in character class")}}},Pe.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(99===r||Ge(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var a=e.current();return 93!==a&&(e.lastIntValue=a,e.advance(),!0)},Pe.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},Pe.regexp_classSetExpression=function(e){var t,r=1;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){2===t&&(r=2);for(var a=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?2!==t&&(r=1):e.raise("Invalid character in character class");if(a!==e.pos)return r;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(a!==e.pos)return r}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return r;2===t&&(r=2)}},Pe.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var a=e.lastIntValue;return-1!==r&&-1!==a&&r>a&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},Pe.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},Pe.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),a=this.regexp_classContents(e);if(e.eat(93))return r&&2===a&&e.raise("Negated character class may contain strings"),a;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null},Pe.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null},Pe.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)2===this.regexp_classString(e)&&(t=2);return t},Pe.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?1:2},Pe.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e)&&(e.eat(98)?(e.lastIntValue=8,0):(e.pos=t,1)));var r=e.current();return!(r<0||r===e.lookahead()&&function(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}(r)||function(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}(r)||(e.advance(),e.lastIntValue=r,0))},Pe.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!function(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}(t)&&(e.lastIntValue=t,e.advance(),!0)},Pe.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!qe(t)&&95!==t||(e.lastIntValue=t%32,e.advance(),0))},Pe.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},Pe.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;qe(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t},Pe.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Ue(r=e.current());)e.lastIntValue=16*e.lastIntValue+Be(r),e.advance();return e.pos!==t},Pe.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*r+e.lastIntValue:e.lastIntValue=8*t+r}else e.lastIntValue=t;return!0}return!1},Pe.regexp_eatOctalDigit=function(e){var t=e.current();return Ge(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},Pe.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var a=0;a<t;++a){var s=e.current();if(!Ue(s))return e.pos=r,!1;e.lastIntValue=16*e.lastIntValue+Be(s),e.advance()}return!0};var Ze=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new L(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},ze=B.prototype;function He(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}ze.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ze(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},ze.getToken=function(){return this.next(),new Ze(this)},"undefined"!=typeof Symbol&&(ze[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===x.eof,value:t}}}}),ze.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(x.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},ze.readToken=function(e){return p(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},ze.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},ze.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var a=void 0,s=t;(a=w(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=a;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())},ze.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),a=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!I(a);)a=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,r,this.curPosition())},ze.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&k.test(String.fromCharCode(e))))break e;++this.pos}}},ze.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)},ze.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(x.ellipsis)):(++this.pos,this.finishToken(x.dot))},ze.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(x.assign,2):this.finishOp(x.slash,1)},ze.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,a=42===e?x.star:x.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++r,a=x.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(x.assign,r+1):this.finishOp(a,r)},ze.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(x.assign,3):this.finishOp(124===e?x.logicalOR:x.logicalAND,2):61===t?this.finishOp(x.assign,2):this.finishOp(124===e?x.bitwiseOR:x.bitwiseAND,1)},ze.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(x.assign,2):this.finishOp(x.bitwiseXOR,1)},ze.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!E.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(x.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(x.assign,2):this.finishOp(x.plusMin,1)},ze.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+r)?this.finishOp(x.assign,r+1):this.finishOp(x.bitShift,r)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(r=2),this.finishOp(x.relational,r)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},ze.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(x.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(x.arrow)):this.finishOp(61===e?x.eq:x.prefix,1)},ze.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(x.questionDot,2)}if(63===t)return e>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(x.assign,3):this.finishOp(x.coalesce,2)}return this.finishOp(x.question,1)},ze.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,p(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(x.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+M(e)+"'")},ze.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(x.parenL);case 41:return++this.pos,this.finishToken(x.parenR);case 59:return++this.pos,this.finishToken(x.semi);case 44:return++this.pos,this.finishToken(x.comma);case 91:return++this.pos,this.finishToken(x.bracketL);case 93:return++this.pos,this.finishToken(x.bracketR);case 123:return++this.pos,this.finishToken(x.braceL);case 125:return++this.pos,this.finishToken(x.braceR);case 58:return++this.pos,this.finishToken(x.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(x.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(x.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+M(e)+"'")},ze.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)},ze.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var a=this.input.charAt(this.pos);if(E.test(a)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===a)t=!0;else if("]"===a&&t)t=!1;else if("/"===a&&!t)break;e="\\"===a}++this.pos}var s=this.input.slice(r,this.pos);++this.pos;var n=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(n);var i=this.regexpState||(this.regexpState=new Le(this));i.reset(r,s,o),this.validateRegExpFlags(i),this.validateRegExpPattern(i);var l=null;try{l=new RegExp(s,o)}catch(e){}return this.finishToken(x.regexp,{pattern:s,flags:o,value:l})},ze.readInt=function(e,t,r){for(var a=this.options.ecmaVersion>=12&&void 0===t,s=r&&48===this.input.charCodeAt(this.pos),n=this.pos,o=0,i=0,l=0,u=null==t?1/0:t;l<u;++l,++this.pos){var c=this.input.charCodeAt(this.pos),p=void 0;if(a&&95===c)s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===i&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===l&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),i=c;else{if((p=c>=97?c-97+10:c>=65?c-65+10:c>=48&&c<=57?c-48:1/0)>=e)break;i=c,o=o*e+p}}return a&&95===i&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||null!=t&&this.pos-n!==t?null:o},ze.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return null==r&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(r=He(this.input.slice(t,this.pos)),++this.pos):p(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(x.num,r)},ze.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var r=this.pos-t>=2&&48===this.input.charCodeAt(t);r&&this.strict&&this.raise(t,"Invalid number");var a=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&110===a){var s=He(this.input.slice(t,this.pos));return++this.pos,p(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(x.num,s)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),46!==a||r||(++this.pos,this.readInt(10),a=this.input.charCodeAt(this.pos)),69!==a&&101!==a||r||(43!==(a=this.input.charCodeAt(++this.pos))&&45!==a||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),p(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n,o=(n=this.input.slice(t,this.pos),r?parseInt(n,8):parseFloat(n.replace(/_/g,"")));return this.finishToken(x.num,o)},ze.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},ze.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var a=this.input.charCodeAt(this.pos);if(a===e)break;92===a?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):8232===a||8233===a?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(I(a)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(x.string,t)};var We={};ze.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==We)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},ze.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw We;this.raise(e,t)},ze.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==x.template&&this.type!==x.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(x.template,e)):36===r?(this.pos+=2,this.finishToken(x.dollarBraceL)):(++this.pos,this.finishToken(x.backQuote));if(92===r)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(I(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},ze.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(x.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},ze.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return M(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var r=this.pos-1;this.invalidStringToken(r,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var a=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(a,8);return s>255&&(a=a.slice(0,-1),s=parseInt(a,8)),this.pos+=a.length-1,t=this.input.charCodeAt(this.pos),"0"===a&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-a.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return I(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},ze.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return null===r&&this.invalidStringToken(t,"Bad character escape sequence"),r},ze.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,a=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(d(s,a))this.pos+=s<=65535?1:2;else{if(92!==s)break;this.containsEsc=!0,e+=this.input.slice(r,this.pos);var n=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var o=this.readCodePoint();(t?p:d)(o,a)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=M(o),r=this.pos}t=!1}return e+this.input.slice(r,this.pos)},ze.readWord=function(){var e=this.readWord1(),t=x.name;return this.keywords.test(e)&&(t=v[e]),this.finishToken(t,e)};var Ke="8.15.0";B.acorn={Parser:B,version:Ke,defaultOptions:D,Position:$,SourceLocation:L,getLineInfo:j,Node:me,TokenType:h,tokTypes:x,keywordTypes:v,TokContext:se,tokContexts:ne,isIdentifierChar:d,isIdentifierStart:p,Token:Ze,isNewLine:I,lineBreak:E,lineBreakG:b,nonASCIIwhitespace:k},e.Node=me,e.Parser=B,e.Position=$,e.SourceLocation=L,e.TokContext=se,e.Token=Ze,e.TokenType=h,e.defaultOptions=D,e.getLineInfo=j,e.isIdentifierChar=d,e.isIdentifierStart=p,e.isNewLine=I,e.keywordTypes=v,e.lineBreak=E,e.lineBreakG=b,e.nonASCIIwhitespace=k,e.parse=function(e,t){return B.parse(e,t)},e.parseExpressionAt=function(e,t,r){return B.parseExpressionAt(e,t,r)},e.tokContexts=ne,e.tokTypes=x,e.tokenizer=function(e,t){return B.tokenizer(e,t)},e.version=Ke}(t)},86506:(e,t,r)=>{const a=r(48381);e.exports=(e,t)=>new a(e,t).patch},86912:(e,t,r)=>{const a=r(41694);e.exports=(e,t)=>new a(e,t).major},87391:(e,t,r)=>{const a=r(41694);e.exports=(e,t,r)=>{const s=new a(e,r),n=new a(t,r);return s.compare(n)||s.compareBuild(n)}},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,r){return new t(e).specialish&&new t(r).specialish?0:new t(e).specialish&&!new t(r).specialish?1:!new t(e).specialish&&new t(r).specialish?-1:e>r?1:-1})),e},e.exports=t},87866:(e,t,r)=>{const a=r(88825),s=r(67105),{ANY:n}=s,o=r(20360),i=r(72849),l=r(51269),u=r(18082),c=r(71851),p=r(54838);e.exports=(e,t,r,d)=>{let h,m,f,g,v;switch(e=new a(e,d),t=new o(t,d),r){case">":h=l,m=c,f=u,g=">",v=">=";break;case"<":h=u,m=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 r=0;r<t.set.length;++r){const a=t.set[r];let o=null,i=null;if(a.forEach((e=>{e.semver===n&&(e=new s(">=0.0.0")),o=o||e,i=i||e,h(e.semver,o.semver,d)?o=e:f(e.semver,i.semver,d)&&(i=e)})),o.operator===g||o.operator===v)return!1;if((!i.operator||i.operator===g)&&m(e,i.semver))return!1;if(i.operator===v&&f(e,i.semver))return!1}return!0}},88108:(e,t,r)=>{const a=r(45160),s=r(25812),n=r(58809),o=r(54506),i=r(20038),l=r(66239);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return a(e,r,u);case"!=":return s(e,r,u);case">":return n(e,r,u);case">=":return o(e,r,u);case"<":return i(e,r,u);case"<=":return l(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},88770:(e,t,r)=>{const a=r(47538);e.exports=(e,t)=>e.sort(((e,r)=>a(e,r,t)))},88825:(e,t,r)=>{const a=r(95869),{MAX_LENGTH:s,MAX_SAFE_INTEGER:n}=r(41755),{safeRe:o,t:i}=r(36165),l=r(40594),{compareIdentifiers:u}=r(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>s)throw new TypeError(`version is longer than ${s} characters`);a("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[i.LOOSE]:o[i.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e})):this.prerelease=[],this.build=r[5]?r[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 r=this.prerelease[t],s=e.prerelease[t];if(a("prerelease compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return u(r,s)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{const r=this.build[t],s=e.build[t];if(a("build compare",t,r,s),void 0===r&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===r)return-1;if(r!==s)return u(r,s)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?o[i.PRERELEASELOOSE]:o[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,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);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(r)?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===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let a=[t,e];!1===r&&(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,r)=>{const a=r(72849),s=r(25583);e.exports=(e,t,r)=>{const n=[];let o=null,i=null;const l=e.sort(((e,t)=>s(e,t,r)));for(const e of l)a(e,t,r)?(i=e,o||(o=e)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);const u=[];for(const[e,t]of n)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}},89065:(e,t,r)=>{const a=r(41694);e.exports=(e,t,r,s,n)=>{"string"==typeof r&&(n=s,s=r,r=void 0);try{return new a(e instanceof a?e.version:e,r).inc(t,s,n).version}catch(e){return null}}},89295:(e,t,r)=>{var a=r(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"})},89975:(e,t,r)=>{const a=r(32910);e.exports=(e,t,r)=>a(e,t,"<",r)},90733:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const a=t.test(e),s=t.test(r);return a&&s&&(e=+e,r=+r),e===r?0:a&&!s?-1:s&&!a?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},91714:(e,t,r)=>{var a=r(54420);e.exports=new a({explicit:[r(75459),r(98727),r(1726)]})},92625:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:n}=r(24159),o=r(29385),i=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],p=t.t={};let d=0;const h="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",n],[h,s]],f=(e,t,r)=>{const a=(e=>{for(const[t,r]of m)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),s=d++;o(e,s,t),p[e]=s,u[s]=t,c[s]=a,i[s]=new RegExp(t,r?"g":void 0),l[s]=new RegExp(a,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),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",`${h}+`),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*$")},92721: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}}},92926:e=>{e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(r){!function(e,t,r){var a=r.css,s=r.media,n=r.sourceMap;s?e.setAttribute("media",s):e.removeAttribute("media"),n&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(n))))," */")),t.styleTagTransform(a,e)}(t,e,r)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},94463:(e,t,r)=>{const a=r(40289);e.exports=(e,t,r)=>0===a(e,t,r)},94706:(e,t,r)=>{const a=r(94463),s=r(36749),n=r(43334),o=r(47775),i=r(3449),l=r(9418);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return a(e,r,u);case"!=":return s(e,r,u);case">":return n(e,r,u);case">=":return o(e,r,u);case"<":return i(e,r,u);case"<=":return l(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},95593:e=>{var t=[];function r(e){for(var r=-1,a=0;a<t.length;a++)if(t[a].identifier===e){r=a;break}return r}function a(e,a){for(var n={},o=[],i=0;i<e.length;i++){var l=e[i],u=a.base?l[0]+a.base:l[0],c=n[u]||0,p="".concat(u," ").concat(c);n[u]=c+1;var d=r(p),h={css:l[1],media:l[2],sourceMap:l[3]};-1!==d?(t[d].references++,t[d].updater(h)):t.push({identifier:p,updater:s(h,a),references:1}),o.push(p)}return o}function s(e,t){var r=t.domAPI(t);return r.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r.update(e=t)}else r.remove()}}e.exports=function(e,s){var n=a(e=e||[],s=s||{});return function(e){e=e||[];for(var o=0;o<n.length;o++){var i=r(n[o]);t[i].references--}for(var l=a(e,s),u=0;u<n.length;u++){var c=r(n[u]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}n=l}}},95869:(e,t,r)=>{var a=r(65994).process;const s="object"==typeof a&&a.env&&a.env.NODE_DEBUG&&/\bsemver\b/i.test(a.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=s},96082:(e,t,r)=>{const a=Symbol("SemVer ANY");class s{static get ANY(){return a}constructor(e,t){if(t=n(t),e instanceof s){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?o[i.COMPARATORLOOSE]:o[i.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[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 s))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=n(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=s;const n=r(8573),{safeRe:o,t:i}=r(18104),l=r(94706),u=r(72082),c=r(41694),p=r(71333)},96775:(e,t,r)=>{const a=r(9480),s=r(40289);e.exports=(e,t,r)=>{const n=[];let o=null,i=null;const l=e.sort(((e,t)=>s(e,t,r)));for(const e of l)a(e,t,r)?(i=e,o||(o=e)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);const u=[];for(const[e,t]of n)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}},98727:(e,t,r)=>{var a=r(40811);e.exports=new a("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},98736:(e,t,r)=>{const a=r(25583);e.exports=(e,t)=>a(e,t,!0)},98855:(e,t,r)=>{const a=r(88825);e.exports=(e,t,r=!1)=>{if(e instanceof a)return e;try{return new a(e,t)}catch(e){if(!r)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 r,a="";for(r=0;r<t;r+=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 r,a,s,n;if(t)for(r=0,a=(n=Object.keys(t)).length;r<a;r+=1)e[s=n[r]]=t[s];return e}},99385:(e,t,r)=>{const a=r(41694),s=r(96082),{ANY:n}=s,o=r(71333),i=r(9480),l=r(43334),u=r(3449),c=r(9418),p=r(47775);e.exports=(e,t,r,d)=>{let h,m,f,g,v;switch(e=new a(e,d),t=new o(t,d),r){case">":h=l,m=c,f=u,g=">",v=">=";break;case"<":h=u,m=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 r=0;r<t.set.length;++r){const a=t.set[r];let o=null,i=null;if(a.forEach((e=>{e.semver===n&&(e=new s(">=0.0.0")),o=o||e,i=i||e,h(e.semver,o.semver,d)?o=e:f(e.semver,i.semver,d)&&(i=e)})),o.operator===g||o.operator===v)return!1;if((!i.operator||i.operator===g)&&m(e,i.semver))return!1;if(i.operator===v&&f(e,i.semver))return!1}return!0}},99571:(e,t,r)=>{const a=r(20360),s=r(67105),{ANY:n}=s,o=r(72849),i=r(25583),l=[new s(">=0.0.0-0")],u=[new s(">=0.0.0")],c=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===n){if(1===t.length&&t[0].semver===n)return!0;e=r.includePrerelease?l:u}if(1===t.length&&t[0].semver===n){if(r.includePrerelease)return!0;t=u}const a=new Set;let s,c,h,m,f,g,v;for(const t of e)">"===t.operator||">="===t.operator?s=p(s,t,r):"<"===t.operator||"<="===t.operator?c=d(c,t,r):a.add(t.semver);if(a.size>1)return null;if(s&&c){if(h=i(s.semver,c.semver,r),h>0)return null;if(0===h&&(">="!==s.operator||"<="!==c.operator))return null}for(const e of a){if(s&&!o(e,String(s),r))return null;if(c&&!o(e,String(c),r))return null;for(const a of t)if(!o(e,String(a),r))return!1;return!0}let y=!(!c||r.includePrerelease||!c.semver.prerelease.length)&&c.semver,x=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.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,s)if(x&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===x.major&&e.semver.minor===x.minor&&e.semver.patch===x.patch&&(x=!1),">"===e.operator||">="===e.operator){if(m=p(s,e,r),m===e&&m!==s)return!1}else if(">="===s.operator&&!o(s.semver,String(e),r))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,r),f===e&&f!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),r))return!1;if(!e.operator&&(c||s)&&0!==h)return!1}return!(s&&g&&!c&&0!==h||c&&v&&!s&&0!==h||x||y)},p=(e,t,r)=>{if(!e)return t;const a=i(e.semver,t.semver,r);return a>0?e:a<0||">"===t.operator&&">="===e.operator?t:e},d=(e,t,r)=>{if(!e)return t;const a=i(e.semver,t.semver,r);return a<0?e:a>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new a(e,r),t=new a(t,r);let s=!1;e:for(const a of e.set){for(const e of t.set){const t=c(a,e,r);if(s=s||null!==t,t)continue e}if(s)return!1}return!0}}};