@skyramp/testbot-core 0.13.0-v3.178 → 0.13.0-v3.179
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.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +511 -511
- package/dist/post.js +316 -316
- package/dist/runner-client.cjs +2 -2
- package/package.json +1 -1
package/dist/runner-client.cjs
CHANGED
|
@@ -42,7 +42,7 @@ ${d.toString(16)}\r
|
|
|
42
42
|
${r.count} ${r.noun} ${r.is} pending:
|
|
43
43
|
|
|
44
44
|
${e.format(n)}
|
|
45
|
-
`.trim())}};tw.exports=Uh});var da=T((c4,ow)=>{"use strict";var rw=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:fP}=pe(),mP=wi();iw()===void 0&&sw(new mP);function sw(t){if(!t||typeof t.dispatch!="function")throw new fP("Argument agent must implement Agent");Object.defineProperty(globalThis,rw,{value:t,writable:!0,enumerable:!1,configurable:!1})}o(sw,"setGlobalDispatcher");function iw(){return globalThis[rw]}o(iw,"getGlobalDispatcher");ow.exports={setGlobalDispatcher:sw,getGlobalDispatcher:iw}});var Nc=T((d4,aw)=>{"use strict";aw.exports=class{static{o(this,"DecoratorHandler")}#e;constructor(e){if(typeof e!="object"||e===null)throw new TypeError("handler must be an object");this.#e=e}onConnect(...e){return this.#e.onConnect?.(...e)}onError(...e){return this.#e.onError?.(...e)}onUpgrade(...e){return this.#e.onUpgrade?.(...e)}onResponseStarted(...e){return this.#e.onResponseStarted?.(...e)}onHeaders(...e){return this.#e.onHeaders?.(...e)}onData(...e){return this.#e.onData?.(...e)}onComplete(...e){return this.#e.onComplete?.(...e)}onBodySent(...e){return this.#e.onBodySent?.(...e)}}});var cw=T((h4,Aw)=>{"use strict";var EP=dc();Aw.exports=t=>{let e=t?.maxRedirections;return n=>o(function(s,i){let{maxRedirections:a=e,...c}=s;if(!a)return n(s,i);let l=new EP(n,a,s,i);return n(c,l)},"redirectInterceptor")}});var lw=T((f4,uw)=>{"use strict";var CP=Bc();uw.exports=t=>e=>o(function(r,s){return e(r,new CP({...r,retryOptions:{...t,...r.retryOptions}},{handler:s,dispatch:e}))},"retryInterceptor")});var gw=T((E4,dw)=>{"use strict";var IP=ue(),{InvalidArgumentError:yP,RequestAbortedError:QP}=pe(),BP=Nc(),Mh=class extends BP{static{o(this,"DumpHandler")}#e=1024*1024;#t=null;#n=!1;#s=!1;#i=0;#r=null;#o=null;constructor({maxSize:e},n){if(super(n),e!=null&&(!Number.isFinite(e)||e<1))throw new yP("maxSize must be a number greater than 0");this.#e=e??this.#e,this.#o=n}onConnect(e){this.#t=e,this.#o.onConnect(this.#a.bind(this))}#a(e){this.#s=!0,this.#r=e}onHeaders(e,n,r,s){let a=IP.parseHeaders(n)["content-length"];if(a!=null&&a>this.#e)throw new QP(`Response size (${a}) larger than maxSize (${this.#e})`);return this.#s?!0:this.#o.onHeaders(e,n,r,s)}onError(e){this.#n||(e=this.#r??e,this.#o.onError(e))}onData(e){return this.#i=this.#i+e.length,this.#i>=this.#e&&(this.#n=!0,this.#s?this.#o.onError(this.#r):this.#o.onComplete([])),!0}onComplete(e){if(!this.#n){if(this.#s){this.#o.onError(this.reason);return}this.#o.onComplete(e)}}};function wP({maxSize:t}={maxSize:1024*1024}){return e=>o(function(r,s){let{dumpMaxSize:i=t}=r,a=new Mh({maxSize:i},s);return e(r,a)},"Intercept")}o(wP,"createDumpInterceptor");dw.exports=wP});var fw=T((I4,pw)=>{"use strict";var{isIP:bP}=require("node:net"),{lookup:RP}=require("node:dns"),kP=Nc(),{InvalidArgumentError:Ni,InformationalError:SP}=pe(),hw=Math.pow(2,31)-1,Lh=class{static{o(this,"DNSInstance")}#e=0;#t=0;#n=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(e){this.#e=e.maxTTL,this.#t=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#s,this.pick=e.pick??this.#i}get full(){return this.#n.size===this.#t}runLookup(e,n,r){let s=this.#n.get(e.hostname);if(s==null&&this.full){r(null,e.origin);return}let i={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...n.dns,maxTTL:this.#e,maxItems:this.#t};if(s==null)this.lookup(e,i,(a,c)=>{if(a||c==null||c.length===0){r(a??new SP("No DNS entries found"));return}this.setRecords(e,c);let l=this.#n.get(e.hostname),d=this.pick(e,l,i.affinity),g;typeof d.port=="number"?g=`:${d.port}`:e.port!==""?g=`:${e.port}`:g="",r(null,`${e.protocol}//${d.family===6?`[${d.address}]`:d.address}${g}`)});else{let a=this.pick(e,s,i.affinity);if(a==null){this.#n.delete(e.hostname),this.runLookup(e,n,r);return}let c;typeof a.port=="number"?c=`:${a.port}`:e.port!==""?c=`:${e.port}`:c="",r(null,`${e.protocol}//${a.family===6?`[${a.address}]`:a.address}${c}`)}}#s(e,n,r){RP(e.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(s,i)=>{if(s)return r(s);let a=new Map;for(let c of i)a.set(`${c.address}:${c.family}`,c);r(null,a.values())})}#i(e,n,r){let s=null,{records:i,offset:a}=n,c;if(this.dualStack?(r==null&&(a==null||a===hw?(n.offset=0,r=4):(n.offset++,r=(n.offset&1)===1?6:4)),i[r]!=null&&i[r].ips.length>0?c=i[r]:c=i[r===4?6:4]):c=i[r],c==null||c.ips.length===0)return s;c.offset==null||c.offset===hw?c.offset=0:c.offset++;let l=c.offset%c.ips.length;return s=c.ips[l]??null,s==null?s:Date.now()-s.timestamp>s.ttl?(c.ips.splice(l,1),this.pick(e,n,r)):s}setRecords(e,n){let r=Date.now(),s={records:{4:null,6:null}};for(let i of n){i.timestamp=r,typeof i.ttl=="number"?i.ttl=Math.min(i.ttl,this.#e):i.ttl=this.#e;let a=s.records[i.family]??{ips:[]};a.ips.push(i),s.records[i.family]=a}this.#n.set(e.hostname,s)}getHandler(e,n){return new _h(this,e,n)}},_h=class extends kP{static{o(this,"DNSDispatchHandler")}#e=null;#t=null;#n=null;#s=null;#i=null;constructor(e,{origin:n,handler:r,dispatch:s},i){super(r),this.#i=n,this.#s=r,this.#t={...i},this.#e=e,this.#n=s}onError(e){switch(e.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){this.#e.runLookup(this.#i,this.#t,(n,r)=>{if(n)return this.#s.onError(n);let s={...this.#t,origin:r};this.#n(s,this)});return}this.#s.onError(e);return}case"ENOTFOUND":this.#e.deleteRecord(this.#i);default:this.#s.onError(e);break}}};pw.exports=t=>{if(t?.maxTTL!=null&&(typeof t?.maxTTL!="number"||t?.maxTTL<0))throw new Ni("Invalid maxTTL. Must be a positive number");if(t?.maxItems!=null&&(typeof t?.maxItems!="number"||t?.maxItems<1))throw new Ni("Invalid maxItems. Must be a positive number and greater than zero");if(t?.affinity!=null&&t?.affinity!==4&&t?.affinity!==6)throw new Ni("Invalid affinity. Must be either 4 or 6");if(t?.dualStack!=null&&typeof t?.dualStack!="boolean")throw new Ni("Invalid dualStack. Must be a boolean");if(t?.lookup!=null&&typeof t?.lookup!="function")throw new Ni("Invalid lookup. Must be a function");if(t?.pick!=null&&typeof t?.pick!="function")throw new Ni("Invalid pick. Must be a function");let e=t?.dualStack??!0,n;e?n=t?.affinity??null:n=t?.affinity??4;let r={maxTTL:t?.maxTTL??1e4,lookup:t?.lookup??null,pick:t?.pick??null,dualStack:e,affinity:n,maxItems:t?.maxItems??1/0},s=new Lh(r);return i=>o(function(c,l){let d=c.origin.constructor===URL?c.origin:new URL(c.origin);return bP(d.hostname)!==0?i(c,l):(s.runLookup(d,c,(g,h)=>{if(g)return l.onError(g);let f=null;f={...c,servername:d.hostname,origin:h,headers:{host:d.hostname,...c.headers}},i(f,s.getHandler({origin:d,dispatch:i,handler:l},c))}),!0)},"dnsInterceptor")}});var Is=T((Q4,Bw)=>{"use strict";var{kConstruct:vP}=ke(),{kEnumerableProperty:Fi}=ue(),{iteratorMixin:xP,isValidHeaderName:ga,isValidHeaderValue:Ew}=Qt(),{webidl:he}=je(),Ph=require("node:assert"),Fc=require("node:util"),Pe=Symbol("headers map"),Rt=Symbol("headers map sorted");function mw(t){return t===10||t===13||t===9||t===32}o(mw,"isHTTPWhiteSpaceCharCode");function Cw(t){let e=0,n=t.length;for(;n>e&&mw(t.charCodeAt(n-1));)--n;for(;n>e&&mw(t.charCodeAt(e));)++e;return e===0&&n===t.length?t:t.substring(e,n)}o(Cw,"headerValueNormalize");function Iw(t,e){if(Array.isArray(e))for(let n=0;n<e.length;++n){let r=e[n];if(r.length!==2)throw he.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});Oh(t,r[0],r[1])}else if(typeof e=="object"&&e!==null){let n=Object.keys(e);for(let r=0;r<n.length;++r)Oh(t,n[r],e[n[r]])}else throw he.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}o(Iw,"fill");function Oh(t,e,n){if(n=Cw(n),ga(e)){if(!Ew(n))throw he.errors.invalidArgument({prefix:"Headers.append",value:n,type:"header value"})}else throw he.errors.invalidArgument({prefix:"Headers.append",value:e,type:"header name"});if(Qw(t)==="immutable")throw new TypeError("immutable");return Gh(t).append(e,n,!1)}o(Oh,"appendHeader");function yw(t,e){return t[0]<e[0]?-1:1}o(yw,"compareHeaderName");var Uc=class t{static{o(this,"HeadersList")}cookies=null;constructor(e){e instanceof t?(this[Pe]=new Map(e[Pe]),this[Rt]=e[Rt],this.cookies=e.cookies===null?null:[...e.cookies]):(this[Pe]=new Map(e),this[Rt]=null)}contains(e,n){return this[Pe].has(n?e:e.toLowerCase())}clear(){this[Pe].clear(),this[Rt]=null,this.cookies=null}append(e,n,r){this[Rt]=null;let s=r?e:e.toLowerCase(),i=this[Pe].get(s);if(i){let a=s==="cookie"?"; ":", ";this[Pe].set(s,{name:i.name,value:`${i.value}${a}${n}`})}else this[Pe].set(s,{name:e,value:n});s==="set-cookie"&&(this.cookies??=[]).push(n)}set(e,n,r){this[Rt]=null;let s=r?e:e.toLowerCase();s==="set-cookie"&&(this.cookies=[n]),this[Pe].set(s,{name:e,value:n})}delete(e,n){this[Rt]=null,n||(e=e.toLowerCase()),e==="set-cookie"&&(this.cookies=null),this[Pe].delete(e)}get(e,n){return this[Pe].get(n?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:e,1:{value:n}}of this[Pe])yield[e,n]}get entries(){let e={};if(this[Pe].size!==0)for(let{name:n,value:r}of this[Pe].values())e[n]=r;return e}rawValues(){return this[Pe].values()}get entriesList(){let e=[];if(this[Pe].size!==0)for(let{0:n,1:{name:r,value:s}}of this[Pe])if(n==="set-cookie")for(let i of this.cookies)e.push([r,i]);else e.push([r,s]);return e}toSortedArray(){let e=this[Pe].size,n=new Array(e);if(e<=32){if(e===0)return n;let r=this[Pe][Symbol.iterator](),s=r.next().value;n[0]=[s[0],s[1].value],Ph(s[1].value!==null);for(let i=1,a=0,c=0,l=0,d=0,g,h;i<e;++i){for(h=r.next().value,g=n[i]=[h[0],h[1].value],Ph(g[1]!==null),l=0,c=i;l<c;)d=l+(c-l>>1),n[d][0]<=g[0]?l=d+1:c=d;if(i!==d){for(a=i;a>l;)n[a]=n[--a];n[l]=g}}if(!r.next().done)throw new TypeError("Unreachable");return n}else{let r=0;for(let{0:s,1:{value:i}}of this[Pe])n[r++]=[s,i],Ph(i!==null);return n.sort(yw)}}},tn=class t{static{o(this,"Headers")}#e;#t;constructor(e=void 0){he.util.markAsUncloneable(this),e!==vP&&(this.#t=new Uc,this.#e="none",e!==void 0&&(e=he.converters.HeadersInit(e,"Headers contructor","init"),Iw(this,e)))}append(e,n){he.brandCheck(this,t),he.argumentLengthCheck(arguments,2,"Headers.append");let r="Headers.append";return e=he.converters.ByteString(e,r,"name"),n=he.converters.ByteString(n,r,"value"),Oh(this,e,n)}delete(e){if(he.brandCheck(this,t),he.argumentLengthCheck(arguments,1,"Headers.delete"),e=he.converters.ByteString(e,"Headers.delete","name"),!ga(e))throw he.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(e,!1)&&this.#t.delete(e,!1)}get(e){he.brandCheck(this,t),he.argumentLengthCheck(arguments,1,"Headers.get");let n="Headers.get";if(e=he.converters.ByteString(e,n,"name"),!ga(e))throw he.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.get(e,!1)}has(e){he.brandCheck(this,t),he.argumentLengthCheck(arguments,1,"Headers.has");let n="Headers.has";if(e=he.converters.ByteString(e,n,"name"),!ga(e))throw he.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.contains(e,!1)}set(e,n){he.brandCheck(this,t),he.argumentLengthCheck(arguments,2,"Headers.set");let r="Headers.set";if(e=he.converters.ByteString(e,r,"name"),n=he.converters.ByteString(n,r,"value"),n=Cw(n),ga(e)){if(!Ew(n))throw he.errors.invalidArgument({prefix:r,value:n,type:"header value"})}else throw he.errors.invalidArgument({prefix:r,value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(e,n,!1)}getSetCookie(){he.brandCheck(this,t);let e=this.#t.cookies;return e?[...e]:[]}get[Rt](){if(this.#t[Rt])return this.#t[Rt];let e=[],n=this.#t.toSortedArray(),r=this.#t.cookies;if(r===null||r.length===1)return this.#t[Rt]=n;for(let s=0;s<n.length;++s){let{0:i,1:a}=n[s];if(i==="set-cookie")for(let c=0;c<r.length;++c)e.push([i,r[c]]);else e.push([i,a])}return this.#t[Rt]=e}[Fc.inspect.custom](e,n){return n.depth??=e,`Headers ${Fc.formatWithOptions(n,this.#t.entries)}`}static getHeadersGuard(e){return e.#e}static setHeadersGuard(e,n){e.#e=n}static getHeadersList(e){return e.#t}static setHeadersList(e,n){e.#t=n}},{getHeadersGuard:Qw,setHeadersGuard:DP,getHeadersList:Gh,setHeadersList:TP}=tn;Reflect.deleteProperty(tn,"getHeadersGuard");Reflect.deleteProperty(tn,"setHeadersGuard");Reflect.deleteProperty(tn,"getHeadersList");Reflect.deleteProperty(tn,"setHeadersList");xP("Headers",tn,Rt,0,1);Object.defineProperties(tn.prototype,{append:Fi,delete:Fi,get:Fi,has:Fi,set:Fi,getSetCookie:Fi,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Fc.inspect.custom]:{enumerable:!1}});he.converters.HeadersInit=function(t,e,n){if(he.util.Type(t)==="Object"){let r=Reflect.get(t,Symbol.iterator);if(!Fc.types.isProxy(t)&&r===tn.prototype.entries)try{return Gh(t).entriesList}catch{}return typeof r=="function"?he.converters["sequence<sequence<ByteString>>"](t,e,n,r.bind(t)):he.converters["record<ByteString, ByteString>"](t,e,n)}throw he.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};Bw.exports={fill:Iw,compareHeaderName:yw,Headers:tn,HeadersList:Uc,getHeadersGuard:Qw,setHeadersGuard:DP,setHeadersList:TP,getHeadersList:Gh}});var pa=T((w4,Uw)=>{"use strict";var{Headers:vw,HeadersList:ww,fill:NP,getHeadersGuard:FP,setHeadersGuard:xw,setHeadersList:Dw}=Is(),{extractBody:bw,cloneBody:UP,mixinBody:MP,hasFinalizationRegistry:Tw,streamRegistry:Nw,bodyUnusable:LP}=pi(),$h=ue(),Rw=require("node:util"),{kEnumerableProperty:kt}=$h,{isValidReasonPhrase:_P,isCancelled:PP,isAborted:OP,isBlobLike:GP,serializeJavascriptValueToJSONString:$P,isErrorLike:YP,isomorphicEncode:HP,environmentSettingsObject:VP}=Qt(),{redirectStatusSet:JP,nullBodyStatus:qP}=Lo(),{kState:ve,kHeaders:Hn}=gr(),{webidl:oe}=je(),{FormData:jP}=Yo(),{URLSerializer:kw}=gt(),{kConstruct:Lc}=ke(),Yh=require("node:assert"),{types:WP}=require("node:util"),zP=new TextEncoder("utf-8"),ys=class t{static{o(this,"Response")}static error(){return ha(_c(),"immutable")}static json(e,n={}){oe.argumentLengthCheck(arguments,1,"Response.json"),n!==null&&(n=oe.converters.ResponseInit(n));let r=zP.encode($P(e)),s=bw(r),i=ha(Ui({}),"response");return Sw(i,n,{body:s[0],type:"application/json"}),i}static redirect(e,n=302){oe.argumentLengthCheck(arguments,1,"Response.redirect"),e=oe.converters.USVString(e),n=oe.converters["unsigned short"](n);let r;try{r=new URL(e,VP.settingsObject.baseUrl)}catch(a){throw new TypeError(`Failed to parse URL from ${e}`,{cause:a})}if(!JP.has(n))throw new RangeError(`Invalid status code ${n}`);let s=ha(Ui({}),"immutable");s[ve].status=n;let i=HP(kw(r));return s[ve].headersList.append("location",i,!0),s}constructor(e=null,n={}){if(oe.util.markAsUncloneable(this),e===Lc)return;e!==null&&(e=oe.converters.BodyInit(e)),n=oe.converters.ResponseInit(n),this[ve]=Ui({}),this[Hn]=new vw(Lc),xw(this[Hn],"response"),Dw(this[Hn],this[ve].headersList);let r=null;if(e!=null){let[s,i]=bw(e);r={body:s,type:i}}Sw(this,n,r)}get type(){return oe.brandCheck(this,t),this[ve].type}get url(){oe.brandCheck(this,t);let e=this[ve].urlList,n=e[e.length-1]??null;return n===null?"":kw(n,!0)}get redirected(){return oe.brandCheck(this,t),this[ve].urlList.length>1}get status(){return oe.brandCheck(this,t),this[ve].status}get ok(){return oe.brandCheck(this,t),this[ve].status>=200&&this[ve].status<=299}get statusText(){return oe.brandCheck(this,t),this[ve].statusText}get headers(){return oe.brandCheck(this,t),this[Hn]}get body(){return oe.brandCheck(this,t),this[ve].body?this[ve].body.stream:null}get bodyUsed(){return oe.brandCheck(this,t),!!this[ve].body&&$h.isDisturbed(this[ve].body.stream)}clone(){if(oe.brandCheck(this,t),LP(this))throw oe.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=Hh(this[ve]);return Tw&&this[ve].body?.stream&&Nw.register(this,new WeakRef(this[ve].body.stream)),ha(e,FP(this[Hn]))}[Rw.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${Rw.formatWithOptions(n,r)}`}};MP(ys);Object.defineProperties(ys.prototype,{type:kt,url:kt,status:kt,ok:kt,redirected:kt,statusText:kt,headers:kt,clone:kt,body:kt,bodyUsed:kt,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(ys,{json:kt,redirect:kt,error:kt});function Hh(t){if(t.internalResponse)return Fw(Hh(t.internalResponse),t.type);let e=Ui({...t,body:null});return t.body!=null&&(e.body=UP(e,t.body)),e}o(Hh,"cloneResponse");function Ui(t){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...t,headersList:t?.headersList?new ww(t?.headersList):new ww,urlList:t?.urlList?[...t.urlList]:[]}}o(Ui,"makeResponse");function _c(t){let e=YP(t);return Ui({type:"error",status:0,error:e?t:new Error(t&&String(t)),aborted:t&&t.name==="AbortError"})}o(_c,"makeNetworkError");function ZP(t){return t.type==="error"&&t.status===0}o(ZP,"isNetworkError");function Mc(t,e){return e={internalResponse:t,...e},new Proxy(t,{get(n,r){return r in e?e[r]:n[r]},set(n,r,s){return Yh(!(r in e)),n[r]=s,!0}})}o(Mc,"makeFilteredResponse");function Fw(t,e){if(e==="basic")return Mc(t,{type:"basic",headersList:t.headersList});if(e==="cors")return Mc(t,{type:"cors",headersList:t.headersList});if(e==="opaque")return Mc(t,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(e==="opaqueredirect")return Mc(t,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});Yh(!1)}o(Fw,"filterResponse");function KP(t,e=null){return Yh(PP(t)),OP(t)?_c(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):_c(Object.assign(new DOMException("Request was cancelled."),{cause:e}))}o(KP,"makeAppropriateNetworkError");function Sw(t,e,n){if(e.status!==null&&(e.status<200||e.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in e&&e.statusText!=null&&!_P(String(e.statusText)))throw new TypeError("Invalid statusText");if("status"in e&&e.status!=null&&(t[ve].status=e.status),"statusText"in e&&e.statusText!=null&&(t[ve].statusText=e.statusText),"headers"in e&&e.headers!=null&&NP(t[Hn],e.headers),n){if(qP.includes(t.status))throw oe.errors.exception({header:"Response constructor",message:`Invalid response status code ${t.status}`});t[ve].body=n.body,n.type!=null&&!t[ve].headersList.contains("content-type",!0)&&t[ve].headersList.append("content-type",n.type,!0)}}o(Sw,"initializeResponse");function ha(t,e){let n=new ys(Lc);return n[ve]=t,n[Hn]=new vw(Lc),Dw(n[Hn],t.headersList),xw(n[Hn],e),Tw&&t.body?.stream&&Nw.register(n,new WeakRef(t.body.stream)),n}o(ha,"fromInnerResponse");oe.converters.ReadableStream=oe.interfaceConverter(ReadableStream);oe.converters.FormData=oe.interfaceConverter(jP);oe.converters.URLSearchParams=oe.interfaceConverter(URLSearchParams);oe.converters.XMLHttpRequestBodyInit=function(t,e,n){return typeof t=="string"?oe.converters.USVString(t,e,n):GP(t)?oe.converters.Blob(t,e,n,{strict:!1}):ArrayBuffer.isView(t)||WP.isArrayBuffer(t)?oe.converters.BufferSource(t,e,n):$h.isFormDataLike(t)?oe.converters.FormData(t,e,n,{strict:!1}):t instanceof URLSearchParams?oe.converters.URLSearchParams(t,e,n):oe.converters.DOMString(t,e,n)};oe.converters.BodyInit=function(t,e,n){return t instanceof ReadableStream?oe.converters.ReadableStream(t,e,n):t?.[Symbol.asyncIterator]?t:oe.converters.XMLHttpRequestBodyInit(t,e,n)};oe.converters.ResponseInit=oe.dictionaryConverter([{key:"status",converter:oe.converters["unsigned short"],defaultValue:o(()=>200,"defaultValue")},{key:"statusText",converter:oe.converters.ByteString,defaultValue:o(()=>"","defaultValue")},{key:"headers",converter:oe.converters.HeadersInit}]);Uw.exports={isNetworkError:ZP,makeNetworkError:_c,makeResponse:Ui,makeAppropriateNetworkError:KP,filterResponse:Fw,Response:ys,cloneResponse:Hh,fromInnerResponse:ha}});var Pw=T((R4,_w)=>{"use strict";var{kConnected:Mw,kSize:Lw}=ke(),Vh=class{static{o(this,"CompatWeakRef")}constructor(e){this.value=e}deref(){return this.value[Mw]===0&&this.value[Lw]===0?void 0:this.value}},Jh=class{static{o(this,"CompatFinalizer")}constructor(e){this.finalizer=e}register(e,n){e.on&&e.on("disconnect",()=>{e[Mw]===0&&e[Lw]===0&&this.finalizer(n)})}unregister(e){}};_w.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:Vh,FinalizationRegistry:Jh}):{WeakRef,FinalizationRegistry}}});var Mi=T((S4,eb)=>{"use strict";var{extractBody:XP,mixinBody:eO,cloneBody:tO,bodyUnusable:Ow}=pi(),{Headers:Ww,fill:nO,HeadersList:$c,setHeadersGuard:jh,getHeadersGuard:rO,setHeadersList:zw,getHeadersList:Gw}=Is(),{FinalizationRegistry:sO}=Pw()(),Oc=ue(),$w=require("node:util"),{isValidHTTPToken:iO,sameOrigin:Yw,environmentSettingsObject:Pc}=Qt(),{forbiddenMethodsSet:oO,corsSafeListedMethodsSet:aO,referrerPolicy:AO,requestRedirect:cO,requestMode:uO,requestCredentials:lO,requestCache:dO,requestDuplex:gO}=Lo(),{kEnumerableProperty:Oe,normalizedMethodRecordsBase:hO,normalizedMethodRecords:pO}=Oc,{kHeaders:St,kSignal:Gc,kState:Re,kDispatcher:qh}=gr(),{webidl:X}=je(),{URLSerializer:fO}=gt(),{kConstruct:Yc}=ke(),mO=require("node:assert"),{getMaxListeners:Hw,setMaxListeners:Vw,getEventListeners:EO,defaultMaxListeners:Jw}=require("node:events"),CO=Symbol("abortController"),Zw=new sO(({signal:t,abort:e})=>{t.removeEventListener("abort",e)}),Hc=new WeakMap;function qw(t){return e;function e(){let n=t.deref();if(n!==void 0){Zw.unregister(e),this.removeEventListener("abort",e),n.abort(this.reason);let r=Hc.get(n.signal);if(r!==void 0){if(r.size!==0){for(let s of r){let i=s.deref();i!==void 0&&i.abort(this.reason)}r.clear()}Hc.delete(n.signal)}}}}o(qw,"buildAbort");var jw=!1,wr=class t{static{o(this,"Request")}constructor(e,n={}){if(X.util.markAsUncloneable(this),e===Yc)return;let r="Request constructor";X.argumentLengthCheck(arguments,1,r),e=X.converters.RequestInfo(e,r,"input"),n=X.converters.RequestInit(n,r,"init");let s=null,i=null,a=Pc.settingsObject.baseUrl,c=null;if(typeof e=="string"){this[qh]=n.dispatcher;let Q;try{Q=new URL(e,a)}catch(D){throw new TypeError("Failed to parse URL from "+e,{cause:D})}if(Q.username||Q.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);s=Vc({urlList:[Q]}),i="cors"}else this[qh]=n.dispatcher||e[qh],mO(e instanceof t),s=e[Re],c=e[Gc];let l=Pc.settingsObject.origin,d="client";if(s.window?.constructor?.name==="EnvironmentSettingsObject"&&Yw(s.window,l)&&(d=s.window),n.window!=null)throw new TypeError(`'window' option '${d}' must be null`);"window"in n&&(d="no-window"),s=Vc({method:s.method,headersList:s.headersList,unsafeRequest:s.unsafeRequest,client:Pc.settingsObject,window:d,priority:s.priority,origin:s.origin,referrer:s.referrer,referrerPolicy:s.referrerPolicy,mode:s.mode,credentials:s.credentials,cache:s.cache,redirect:s.redirect,integrity:s.integrity,keepalive:s.keepalive,reloadNavigation:s.reloadNavigation,historyNavigation:s.historyNavigation,urlList:[...s.urlList]});let g=Object.keys(n).length!==0;if(g&&(s.mode==="navigate"&&(s.mode="same-origin"),s.reloadNavigation=!1,s.historyNavigation=!1,s.origin="client",s.referrer="client",s.referrerPolicy="",s.url=s.urlList[s.urlList.length-1],s.urlList=[s.url]),n.referrer!==void 0){let Q=n.referrer;if(Q==="")s.referrer="no-referrer";else{let D;try{D=new URL(Q,a)}catch(G){throw new TypeError(`Referrer "${Q}" is not a valid URL.`,{cause:G})}D.protocol==="about:"&&D.hostname==="client"||l&&!Yw(D,Pc.settingsObject.baseUrl)?s.referrer="client":s.referrer=D}}n.referrerPolicy!==void 0&&(s.referrerPolicy=n.referrerPolicy);let h;if(n.mode!==void 0?h=n.mode:h=i,h==="navigate")throw X.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(h!=null&&(s.mode=h),n.credentials!==void 0&&(s.credentials=n.credentials),n.cache!==void 0&&(s.cache=n.cache),s.cache==="only-if-cached"&&s.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(n.redirect!==void 0&&(s.redirect=n.redirect),n.integrity!=null&&(s.integrity=String(n.integrity)),n.keepalive!==void 0&&(s.keepalive=!!n.keepalive),n.method!==void 0){let Q=n.method,D=pO[Q];if(D!==void 0)s.method=D;else{if(!iO(Q))throw new TypeError(`'${Q}' is not a valid HTTP method.`);let G=Q.toUpperCase();if(oO.has(G))throw new TypeError(`'${Q}' HTTP method is unsupported.`);Q=hO[G]??Q,s.method=Q}!jw&&s.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),jw=!0)}n.signal!==void 0&&(c=n.signal),this[Re]=s;let f=new AbortController;if(this[Gc]=f.signal,c!=null){if(!c||typeof c.aborted!="boolean"||typeof c.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(c.aborted)f.abort(c.reason);else{this[CO]=f;let Q=new WeakRef(f),D=qw(Q);try{(typeof Hw=="function"&&Hw(c)===Jw||EO(c,"abort").length>=Jw)&&Vw(1500,c)}catch{}Oc.addAbortListener(c,D),Zw.register(f,{signal:c,abort:D},D)}}if(this[St]=new Ww(Yc),zw(this[St],s.headersList),jh(this[St],"request"),h==="no-cors"){if(!aO.has(s.method))throw new TypeError(`'${s.method} is unsupported in no-cors mode.`);jh(this[St],"request-no-cors")}if(g){let Q=Gw(this[St]),D=n.headers!==void 0?n.headers:new $c(Q);if(Q.clear(),D instanceof $c){for(let{name:G,value:P}of D.rawValues())Q.append(G,P,!1);Q.cookies=D.cookies}else nO(this[St],D)}let m=e instanceof t?e[Re].body:null;if((n.body!=null||m!=null)&&(s.method==="GET"||s.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let C=null;if(n.body!=null){let[Q,D]=XP(n.body,s.keepalive);C=Q,D&&!Gw(this[St]).contains("content-type",!0)&&this[St].append("content-type",D)}let y=C??m;if(y!=null&&y.source==null){if(C!=null&&n.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(s.mode!=="same-origin"&&s.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');s.useCORSPreflightFlag=!0}let v=y;if(C==null&&m!=null){if(Ow(e))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let Q=new TransformStream;m.stream.pipeThrough(Q),v={source:m.source,length:m.length,stream:Q.readable}}this[Re].body=v}get method(){return X.brandCheck(this,t),this[Re].method}get url(){return X.brandCheck(this,t),fO(this[Re].url)}get headers(){return X.brandCheck(this,t),this[St]}get destination(){return X.brandCheck(this,t),this[Re].destination}get referrer(){return X.brandCheck(this,t),this[Re].referrer==="no-referrer"?"":this[Re].referrer==="client"?"about:client":this[Re].referrer.toString()}get referrerPolicy(){return X.brandCheck(this,t),this[Re].referrerPolicy}get mode(){return X.brandCheck(this,t),this[Re].mode}get credentials(){return this[Re].credentials}get cache(){return X.brandCheck(this,t),this[Re].cache}get redirect(){return X.brandCheck(this,t),this[Re].redirect}get integrity(){return X.brandCheck(this,t),this[Re].integrity}get keepalive(){return X.brandCheck(this,t),this[Re].keepalive}get isReloadNavigation(){return X.brandCheck(this,t),this[Re].reloadNavigation}get isHistoryNavigation(){return X.brandCheck(this,t),this[Re].historyNavigation}get signal(){return X.brandCheck(this,t),this[Gc]}get body(){return X.brandCheck(this,t),this[Re].body?this[Re].body.stream:null}get bodyUsed(){return X.brandCheck(this,t),!!this[Re].body&&Oc.isDisturbed(this[Re].body.stream)}get duplex(){return X.brandCheck(this,t),"half"}clone(){if(X.brandCheck(this,t),Ow(this))throw new TypeError("unusable");let e=Kw(this[Re]),n=new AbortController;if(this.signal.aborted)n.abort(this.signal.reason);else{let r=Hc.get(this.signal);r===void 0&&(r=new Set,Hc.set(this.signal,r));let s=new WeakRef(n);r.add(s),Oc.addAbortListener(n.signal,qw(s))}return Xw(e,n.signal,rO(this[St]))}[$w.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${$w.formatWithOptions(n,r)}`}};eO(wr);function Vc(t){return{method:t.method??"GET",localURLsOnly:t.localURLsOnly??!1,unsafeRequest:t.unsafeRequest??!1,body:t.body??null,client:t.client??null,reservedClient:t.reservedClient??null,replacesClientId:t.replacesClientId??"",window:t.window??"client",keepalive:t.keepalive??!1,serviceWorkers:t.serviceWorkers??"all",initiator:t.initiator??"",destination:t.destination??"",priority:t.priority??null,origin:t.origin??"client",policyContainer:t.policyContainer??"client",referrer:t.referrer??"client",referrerPolicy:t.referrerPolicy??"",mode:t.mode??"no-cors",useCORSPreflightFlag:t.useCORSPreflightFlag??!1,credentials:t.credentials??"same-origin",useCredentials:t.useCredentials??!1,cache:t.cache??"default",redirect:t.redirect??"follow",integrity:t.integrity??"",cryptoGraphicsNonceMetadata:t.cryptoGraphicsNonceMetadata??"",parserMetadata:t.parserMetadata??"",reloadNavigation:t.reloadNavigation??!1,historyNavigation:t.historyNavigation??!1,userActivation:t.userActivation??!1,taintedOrigin:t.taintedOrigin??!1,redirectCount:t.redirectCount??0,responseTainting:t.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:t.preventNoCacheCacheControlHeaderModification??!1,done:t.done??!1,timingAllowFailed:t.timingAllowFailed??!1,urlList:t.urlList,url:t.urlList[0],headersList:t.headersList?new $c(t.headersList):new $c}}o(Vc,"makeRequest");function Kw(t){let e=Vc({...t,body:null});return t.body!=null&&(e.body=tO(e,t.body)),e}o(Kw,"cloneRequest");function Xw(t,e,n){let r=new wr(Yc);return r[Re]=t,r[Gc]=e,r[St]=new Ww(Yc),zw(r[St],t.headersList),jh(r[St],n),r}o(Xw,"fromInnerRequest");Object.defineProperties(wr.prototype,{method:Oe,url:Oe,headers:Oe,redirect:Oe,clone:Oe,signal:Oe,duplex:Oe,destination:Oe,body:Oe,bodyUsed:Oe,isHistoryNavigation:Oe,isReloadNavigation:Oe,keepalive:Oe,integrity:Oe,cache:Oe,credentials:Oe,attribute:Oe,referrerPolicy:Oe,referrer:Oe,mode:Oe,[Symbol.toStringTag]:{value:"Request",configurable:!0}});X.converters.Request=X.interfaceConverter(wr);X.converters.RequestInfo=function(t,e,n){return typeof t=="string"?X.converters.USVString(t,e,n):t instanceof wr?X.converters.Request(t,e,n):X.converters.USVString(t,e,n)};X.converters.AbortSignal=X.interfaceConverter(AbortSignal);X.converters.RequestInit=X.dictionaryConverter([{key:"method",converter:X.converters.ByteString},{key:"headers",converter:X.converters.HeadersInit},{key:"body",converter:X.nullableConverter(X.converters.BodyInit)},{key:"referrer",converter:X.converters.USVString},{key:"referrerPolicy",converter:X.converters.DOMString,allowedValues:AO},{key:"mode",converter:X.converters.DOMString,allowedValues:uO},{key:"credentials",converter:X.converters.DOMString,allowedValues:lO},{key:"cache",converter:X.converters.DOMString,allowedValues:dO},{key:"redirect",converter:X.converters.DOMString,allowedValues:cO},{key:"integrity",converter:X.converters.DOMString},{key:"keepalive",converter:X.converters.boolean},{key:"signal",converter:X.nullableConverter(t=>X.converters.AbortSignal(t,"RequestInit","signal",{strict:!1}))},{key:"window",converter:X.converters.any},{key:"duplex",converter:X.converters.DOMString,allowedValues:gO},{key:"dispatcher",converter:X.converters.any}]);eb.exports={Request:wr,makeRequest:Vc,fromInnerRequest:Xw,cloneRequest:Kw}});var ma=T((x4,pb)=>{"use strict";var{makeNetworkError:ye,makeAppropriateNetworkError:Jc,filterResponse:Wh,makeResponse:qc,fromInnerResponse:IO}=pa(),{HeadersList:tb}=Is(),{Request:yO,cloneRequest:QO}=Mi(),br=require("node:zlib"),{bytesMatch:BO,makePolicyContainer:wO,clonePolicyContainer:bO,requestBadPort:RO,TAOCheck:kO,appendRequestOriginHeader:SO,responseLocationURL:vO,requestCurrentURL:Qn,setRequestReferrerPolicyOnRedirect:xO,tryUpgradeRequestToAPotentiallyTrustworthyURL:DO,createOpaqueTimingInfo:ep,appendFetchMetadata:TO,corsCheck:NO,crossOriginResourcePolicyCheck:FO,determineRequestsReferrer:UO,coarsenedSharedCurrentTime:fa,createDeferredPromise:MO,isBlobLike:LO,sameOrigin:Xh,isCancelled:Qs,isAborted:nb,isErrorLike:_O,fullyReadBody:PO,readableStreamClose:OO,isomorphicEncode:jc,urlIsLocal:GO,urlIsHttpHttpsScheme:tp,urlHasHttpsScheme:$O,clampAndCoarsenConnectionTimingInfo:YO,simpleRangeHeaderValue:HO,buildContentRange:VO,createInflate:JO,extractMimeType:qO}=Qt(),{kState:ob,kDispatcher:jO}=gr(),Bs=require("node:assert"),{safelyExtractBody:np,extractBody:rb}=pi(),{redirectStatusSet:ab,nullBodyStatus:Ab,safeMethodsSet:WO,requestBodyHeader:zO,subresourceSet:ZO}=Lo(),KO=require("node:events"),{Readable:XO,pipeline:eG,finished:tG}=require("node:stream"),{addAbortListener:nG,isErrored:rG,isReadable:Wc,bufferToLowerCasedHeaderName:sb}=ue(),{dataURLProcessor:sG,serializeAMimeType:iG,minimizeSupportedMimeType:oG}=gt(),{getGlobalDispatcher:aG}=da(),{webidl:AG}=je(),{STATUS_CODES:cG}=require("node:http"),uG=["GET","HEAD"],lG=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",zh,zc=class extends KO{static{o(this,"Fetch")}constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){this.state==="ongoing"&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}};function dG(t){cb(t,"fetch")}o(dG,"handleFetchDone");function gG(t,e=void 0){AG.argumentLengthCheck(arguments,1,"globalThis.fetch");let n=MO(),r;try{r=new yO(t,e)}catch(g){return n.reject(g),n.promise}let s=r[ob];if(r.signal.aborted)return Zh(n,s,null,r.signal.reason),n.promise;s.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(s.serviceWorkers="none");let a=null,c=!1,l=null;return nG(r.signal,()=>{c=!0,Bs(l!=null),l.abort(r.signal.reason);let g=a?.deref();Zh(n,s,g,r.signal.reason)}),l=lb({request:s,processResponseEndOfBody:dG,processResponse:o(g=>{if(!c){if(g.aborted){Zh(n,s,a,l.serializedAbortReason);return}if(g.type==="error"){n.reject(new TypeError("fetch failed",{cause:g.error}));return}a=new WeakRef(IO(g,"immutable")),n.resolve(a.deref()),n=null}},"processResponse"),dispatcher:r[jO]}),n.promise}o(gG,"fetch");function cb(t,e="other"){if(t.type==="error"&&t.aborted||!t.urlList?.length)return;let n=t.urlList[0],r=t.timingInfo,s=t.cacheState;tp(n)&&r!==null&&(t.timingAllowPassed||(r=ep({startTime:r.startTime}),s=""),r.endTime=fa(),t.timingInfo=r,ub(r,n.href,e,globalThis,s))}o(cb,"finalizeAndReportTiming");var ub=performance.markResourceTiming;function Zh(t,e,n,r){if(t&&t.reject(r),e.body!=null&&Wc(e.body?.stream)&&e.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i}),n==null)return;let s=n[ob];s.body!=null&&Wc(s.body?.stream)&&s.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i})}o(Zh,"abortFetch");function lb({request:t,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseEndOfBody:s,processResponseConsumeBody:i,useParallelQueue:a=!1,dispatcher:c=aG()}){Bs(c);let l=null,d=!1;t.client!=null&&(l=t.client.globalObject,d=t.client.crossOriginIsolatedCapability);let g=fa(d),h=ep({startTime:g}),f={controller:new zc(c),request:t,timingInfo:h,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseConsumeBody:i,processResponseEndOfBody:s,taskDestination:l,crossOriginIsolatedCapability:d};return Bs(!t.body||t.body.stream),t.window==="client"&&(t.window=t.client?.globalObject?.constructor?.name==="Window"?t.client:"no-window"),t.origin==="client"&&(t.origin=t.client.origin),t.policyContainer==="client"&&(t.client!=null?t.policyContainer=bO(t.client.policyContainer):t.policyContainer=wO()),t.headersList.contains("accept",!0)||t.headersList.append("accept","*/*",!0),t.headersList.contains("accept-language",!0)||t.headersList.append("accept-language","*",!0),t.priority,ZO.has(t.destination),db(f).catch(m=>{f.controller.terminate(m)}),f.controller}o(lb,"fetching");async function db(t,e=!1){let n=t.request,r=null;if(n.localURLsOnly&&!GO(Qn(n))&&(r=ye("local URLs only")),DO(n),RO(n)==="blocked"&&(r=ye("bad port")),n.referrerPolicy===""&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!=="no-referrer"&&(n.referrer=UO(n)),r===null&&(r=await(async()=>{let i=Qn(n);return Xh(i,n.url)&&n.responseTainting==="basic"||i.protocol==="data:"||n.mode==="navigate"||n.mode==="websocket"?(n.responseTainting="basic",await ib(t)):n.mode==="same-origin"?ye('request mode cannot be "same-origin"'):n.mode==="no-cors"?n.redirect!=="follow"?ye('redirect mode cannot be "follow" for "no-cors" request'):(n.responseTainting="opaque",await ib(t)):tp(Qn(n))?(n.responseTainting="cors",await gb(t)):ye("URL scheme must be a HTTP(S) scheme")})()),e)return r;r.status!==0&&!r.internalResponse&&(n.responseTainting,n.responseTainting==="basic"?r=Wh(r,"basic"):n.responseTainting==="cors"?r=Wh(r,"cors"):n.responseTainting==="opaque"?r=Wh(r,"opaque"):Bs(!1));let s=r.status===0?r:r.internalResponse;if(s.urlList.length===0&&s.urlList.push(...n.urlList),n.timingAllowFailed||(r.timingAllowPassed=!0),r.type==="opaque"&&s.status===206&&s.rangeRequested&&!n.headers.contains("range",!0)&&(r=s=ye()),r.status!==0&&(n.method==="HEAD"||n.method==="CONNECT"||Ab.includes(s.status))&&(s.body=null,t.controller.dump=!0),n.integrity){let i=o(c=>Kh(t,ye(c)),"processBodyError");if(n.responseTainting==="opaque"||r.body==null){i(r.error);return}let a=o(c=>{if(!BO(c,n.integrity)){i("integrity mismatch");return}r.body=np(c)[0],Kh(t,r)},"processBody");await PO(r.body,a,i)}else Kh(t,r)}o(db,"mainFetch");function ib(t){if(Qs(t)&&t.request.redirectCount===0)return Promise.resolve(Jc(t));let{request:e}=t,{protocol:n}=Qn(e);switch(n){case"about:":return Promise.resolve(ye("about scheme is not supported"));case"blob:":{zh||(zh=require("node:buffer").resolveObjectURL);let r=Qn(e);if(r.search.length!==0)return Promise.resolve(ye("NetworkError when attempting to fetch resource."));let s=zh(r.toString());if(e.method!=="GET"||!LO(s))return Promise.resolve(ye("invalid method"));let i=qc(),a=s.size,c=jc(`${a}`),l=s.type;if(e.headersList.contains("range",!0)){i.rangeRequested=!0;let d=e.headersList.get("range",!0),g=HO(d,!0);if(g==="failure")return Promise.resolve(ye("failed to fetch the data URL"));let{rangeStartValue:h,rangeEndValue:f}=g;if(h===null)h=a-f,f=h+f-1;else{if(h>=a)return Promise.resolve(ye("Range start is greater than the blob's size."));(f===null||f>=a)&&(f=a-1)}let m=s.slice(h,f,l),C=rb(m);i.body=C[0];let y=jc(`${m.size}`),v=VO(h,f,a);i.status=206,i.statusText="Partial Content",i.headersList.set("content-length",y,!0),i.headersList.set("content-type",l,!0),i.headersList.set("content-range",v,!0)}else{let d=rb(s);i.statusText="OK",i.body=d[0],i.headersList.set("content-length",c,!0),i.headersList.set("content-type",l,!0)}return Promise.resolve(i)}case"data:":{let r=Qn(e),s=sG(r);if(s==="failure")return Promise.resolve(ye("failed to fetch the data URL"));let i=iG(s.mimeType);return Promise.resolve(qc({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:i}]],body:np(s.body)[0]}))}case"file:":return Promise.resolve(ye("not implemented... yet..."));case"http:":case"https:":return gb(t).catch(r=>ye(r));default:return Promise.resolve(ye("unknown scheme"))}}o(ib,"schemeFetch");function hG(t,e){t.request.done=!0,t.processResponseDone!=null&&queueMicrotask(()=>t.processResponseDone(e))}o(hG,"finalizeResponse");function Kh(t,e){let n=t.timingInfo,r=o(()=>{let i=Date.now();t.request.destination==="document"&&(t.controller.fullTimingInfo=n),t.controller.reportTimingSteps=()=>{if(t.request.url.protocol!=="https:")return;n.endTime=i;let c=e.cacheState,l=e.bodyInfo;e.timingAllowPassed||(n=ep(n),c="");let d=0;if(t.request.mode!=="navigator"||!e.hasCrossOriginRedirects){d=e.status;let g=qO(e.headersList);g!=="failure"&&(l.contentType=oG(g))}t.request.initiatorType!=null&&ub(n,t.request.url.href,t.request.initiatorType,globalThis,c,l,d)};let a=o(()=>{t.request.done=!0,t.processResponseEndOfBody!=null&&queueMicrotask(()=>t.processResponseEndOfBody(e)),t.request.initiatorType!=null&&t.controller.reportTimingSteps()},"processResponseEndOfBodyTask");queueMicrotask(()=>a())},"processResponseEndOfBody");t.processResponse!=null&&queueMicrotask(()=>{t.processResponse(e),t.processResponse=null});let s=e.type==="error"?e:e.internalResponse??e;s.body==null?r():tG(s.body.stream,()=>{r()})}o(Kh,"fetchFinale");async function gb(t){let e=t.request,n=null,r=null,s=t.timingInfo;if(e.serviceWorkers,n===null){if(e.redirect==="follow"&&(e.serviceWorkers="none"),r=n=await hb(t),e.responseTainting==="cors"&&NO(e,n)==="failure")return ye("cors failure");kO(e,n)==="failure"&&(e.timingAllowFailed=!0)}return(e.responseTainting==="opaque"||n.type==="opaque")&&FO(e.origin,e.client,e.destination,r)==="blocked"?ye("blocked"):(ab.has(r.status)&&(e.redirect!=="manual"&&t.controller.connection.destroy(void 0,!1),e.redirect==="error"?n=ye("unexpected redirect"):e.redirect==="manual"?n=r:e.redirect==="follow"?n=await pG(t,n):Bs(!1)),n.timingInfo=s,n)}o(gb,"httpFetch");function pG(t,e){let n=t.request,r=e.internalResponse?e.internalResponse:e,s;try{if(s=vO(r,Qn(n).hash),s==null)return e}catch(a){return Promise.resolve(ye(a))}if(!tp(s))return Promise.resolve(ye("URL scheme must be a HTTP(S) scheme"));if(n.redirectCount===20)return Promise.resolve(ye("redirect count exceeded"));if(n.redirectCount+=1,n.mode==="cors"&&(s.username||s.password)&&!Xh(n,s))return Promise.resolve(ye('cross origin not allowed for request mode "cors"'));if(n.responseTainting==="cors"&&(s.username||s.password))return Promise.resolve(ye('URL cannot contain credentials for request mode "cors"'));if(r.status!==303&&n.body!=null&&n.body.source==null)return Promise.resolve(ye());if([301,302].includes(r.status)&&n.method==="POST"||r.status===303&&!uG.includes(n.method)){n.method="GET",n.body=null;for(let a of zO)n.headersList.delete(a)}Xh(Qn(n),s)||(n.headersList.delete("authorization",!0),n.headersList.delete("proxy-authorization",!0),n.headersList.delete("cookie",!0),n.headersList.delete("host",!0)),n.body!=null&&(Bs(n.body.source!=null),n.body=np(n.body.source)[0]);let i=t.timingInfo;return i.redirectEndTime=i.postRedirectStartTime=fa(t.crossOriginIsolatedCapability),i.redirectStartTime===0&&(i.redirectStartTime=i.startTime),n.urlList.push(s),xO(n,r),db(t,!0)}o(pG,"httpRedirectFetch");async function hb(t,e=!1,n=!1){let r=t.request,s=null,i=null,a=null,c=null,l=!1;r.window==="no-window"&&r.redirect==="error"?(s=t,i=r):(i=QO(r),s={...t},s.request=i);let d=r.credentials==="include"||r.credentials==="same-origin"&&r.responseTainting==="basic",g=i.body?i.body.length:null,h=null;if(i.body==null&&["POST","PUT"].includes(i.method)&&(h="0"),g!=null&&(h=jc(`${g}`)),h!=null&&i.headersList.append("content-length",h,!0),g!=null&&i.keepalive,i.referrer instanceof URL&&i.headersList.append("referer",jc(i.referrer.href),!0),SO(i),TO(i),i.headersList.contains("user-agent",!0)||i.headersList.append("user-agent",lG),i.cache==="default"&&(i.headersList.contains("if-modified-since",!0)||i.headersList.contains("if-none-match",!0)||i.headersList.contains("if-unmodified-since",!0)||i.headersList.contains("if-match",!0)||i.headersList.contains("if-range",!0))&&(i.cache="no-store"),i.cache==="no-cache"&&!i.preventNoCacheCacheControlHeaderModification&&!i.headersList.contains("cache-control",!0)&&i.headersList.append("cache-control","max-age=0",!0),(i.cache==="no-store"||i.cache==="reload")&&(i.headersList.contains("pragma",!0)||i.headersList.append("pragma","no-cache",!0),i.headersList.contains("cache-control",!0)||i.headersList.append("cache-control","no-cache",!0)),i.headersList.contains("range",!0)&&i.headersList.append("accept-encoding","identity",!0),i.headersList.contains("accept-encoding",!0)||($O(Qn(i))?i.headersList.append("accept-encoding","br, gzip, deflate",!0):i.headersList.append("accept-encoding","gzip, deflate",!0)),i.headersList.delete("host",!0),c==null&&(i.cache="no-store"),i.cache!=="no-store"&&i.cache,a==null){if(i.cache==="only-if-cached")return ye("only if cached");let f=await fG(s,d,n);!WO.has(i.method)&&f.status>=200&&f.status<=399,l&&f.status,a==null&&(a=f)}if(a.urlList=[...i.urlList],i.headersList.contains("range",!0)&&(a.rangeRequested=!0),a.requestIncludesCredentials=d,a.status===407)return r.window==="no-window"?ye():Qs(t)?Jc(t):ye("proxy authentication required");if(a.status===421&&!n&&(r.body==null||r.body.source!=null)){if(Qs(t))return Jc(t);t.controller.connection.destroy(),a=await hb(t,e,!0)}return a}o(hb,"httpNetworkOrCacheFetch");async function fG(t,e=!1,n=!1){Bs(!t.controller.connection||t.controller.connection.destroyed),t.controller.connection={abort:null,destroyed:!1,destroy(C,y=!0){this.destroyed||(this.destroyed=!0,y&&this.abort?.(C??new DOMException("The operation was aborted.","AbortError")))}};let r=t.request,s=null,i=t.timingInfo;null==null&&(r.cache="no-store");let c=n?"yes":"no";r.mode;let l=null;if(r.body==null&&t.processRequestEndOfBody)queueMicrotask(()=>t.processRequestEndOfBody());else if(r.body!=null){let C=o(async function*(Q){Qs(t)||(yield Q,t.processRequestBodyChunkLength?.(Q.byteLength))},"processBodyChunk"),y=o(()=>{Qs(t)||t.processRequestEndOfBody&&t.processRequestEndOfBody()},"processEndOfBody"),v=o(Q=>{Qs(t)||(Q.name==="AbortError"?t.controller.abort():t.controller.terminate(Q))},"processBodyError");l=(async function*(){try{for await(let Q of r.body.stream)yield*C(Q);y()}catch(Q){v(Q)}})()}try{let{body:C,status:y,statusText:v,headersList:Q,socket:D}=await m({body:l});if(D)s=qc({status:y,statusText:v,headersList:Q,socket:D});else{let G=C[Symbol.asyncIterator]();t.controller.next=()=>G.next(),s=qc({status:y,statusText:v,headersList:Q})}}catch(C){return C.name==="AbortError"?(t.controller.connection.destroy(),Jc(t,C)):ye(C)}let d=o(async()=>{await t.controller.resume()},"pullAlgorithm"),g=o(C=>{Qs(t)||t.controller.abort(C)},"cancelAlgorithm"),h=new ReadableStream({async start(C){t.controller.controller=C},async pull(C){await d(C)},async cancel(C){await g(C)},type:"bytes"});s.body={stream:h,source:null,length:null},t.controller.resume||t.controller.on("terminated",f),t.controller.resume=async()=>{for(;;){let C,y;try{let{done:Q,value:D}=await t.controller.next();if(nb(t))break;C=Q?void 0:D}catch(Q){t.controller.ended&&!i.encodedBodySize?C=void 0:(C=Q,y=!0)}if(C===void 0){OO(t.controller.controller),hG(t,s);return}if(i.decodedBodySize+=C?.byteLength??0,y){t.controller.terminate(C);return}let v=new Uint8Array(C);if(v.byteLength&&t.controller.controller.enqueue(v),rG(h)){t.controller.terminate();return}if(t.controller.controller.desiredSize<=0)return}};function f(C){nb(t)?(s.aborted=!0,Wc(h)&&t.controller.controller.error(t.controller.serializedAbortReason)):Wc(h)&&t.controller.controller.error(new TypeError("terminated",{cause:_O(C)?C:void 0})),t.controller.connection.destroy()}return o(f,"onAborted"),s;function m({body:C}){let y=Qn(r),v=t.controller.dispatcher;return new Promise((Q,D)=>v.dispatch({path:y.pathname+y.search,origin:y.origin,method:r.method,body:v.isMockActive?r.body&&(r.body.source||r.body.stream):C,headers:r.headersList.entries,maxRedirections:0,upgrade:r.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(G){let{connection:P}=t.controller;i.finalConnectionTimingInfo=YO(void 0,i.postRedirectStartTime,t.crossOriginIsolatedCapability),P.destroyed?G(new DOMException("The operation was aborted.","AbortError")):(t.controller.on("terminated",G),this.abort=P.abort=G),i.finalNetworkRequestStartTime=fa(t.crossOriginIsolatedCapability)},onResponseStarted(){i.finalNetworkResponseStartTime=fa(t.crossOriginIsolatedCapability)},onHeaders(G,P,ae,Ee){if(G<200)return;let Ce="",De=new tb;for(let Ge=0;Ge<P.length;Ge+=2)De.append(sb(P[Ge]),P[Ge+1].toString("latin1"),!0);Ce=De.get("location",!0);let et=[],sn=Ce&&r.redirect==="follow"&&ab.has(G);if(r.method!=="HEAD"&&r.method!=="CONNECT"&&!Ab.includes(G)&&!sn){let Ge=De.get("content-encoding",!0),Tt=Ge?Ge.toLowerCase().split(","):[],xe=5;if(Tt.length>xe)return this.abort(new Error(`too many content-encodings in response: ${Tt.length}, maximum allowed is ${xe}`)),!0;for(let Nt=Tt.length-1;Nt>=0;--Nt){let $=Tt[Nt].trim();if($==="x-gzip"||$==="gzip")et.push(br.createGunzip({flush:br.constants.Z_SYNC_FLUSH,finishFlush:br.constants.Z_SYNC_FLUSH}));else if($==="deflate")et.push(JO({flush:br.constants.Z_SYNC_FLUSH,finishFlush:br.constants.Z_SYNC_FLUSH}));else if($==="br")et.push(br.createBrotliDecompress({flush:br.constants.BROTLI_OPERATION_FLUSH,finishFlush:br.constants.BROTLI_OPERATION_FLUSH}));else{et.length=0;break}}}this.body=new XO({read:ae});let At=this.onError.bind(this);return Q({status:G,statusText:Ee,headersList:De,body:et.length?eG(this.body,...et,Ge=>{Ge&&this.onError(Ge)}).on("error",At):this.body.on("error",At)}),!0},onData(G){if(t.controller.dump)return;let P=G;return i.encodedBodySize+=P.byteLength,this.body.push(P)},onComplete(){this.abort&&t.controller.off("terminated",this.abort),t.controller.ended=!0,this.body.push(null)},onError(G){this.abort&&t.controller.off("terminated",this.abort),this.body?.destroy(G),t.controller.terminate(G),D(G)},onUpgrade(G,P,ae){if(G!==101)return;let Ee=new tb;for(let Ce=0;Ce<P.length;Ce+=2)Ee.append(sb(P[Ce]),P[Ce+1].toString("latin1"),!0);return Q({status:G,statusText:cG[G],headersList:Ee,socket:ae}),!0}}))}o(m,"dispatch")}o(fG,"httpNetworkFetch");pb.exports={fetch:gG,Fetch:zc,fetching:lb,finalizeAndReportTiming:cb}});var rp=T((T4,fb)=>{"use strict";fb.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var Eb=T((N4,mb)=>{"use strict";var{webidl:vt}=je(),Zc=Symbol("ProgressEvent state"),sp=class t extends Event{static{o(this,"ProgressEvent")}constructor(e,n={}){e=vt.converters.DOMString(e,"ProgressEvent constructor","type"),n=vt.converters.ProgressEventInit(n??{}),super(e,n),this[Zc]={lengthComputable:n.lengthComputable,loaded:n.loaded,total:n.total}}get lengthComputable(){return vt.brandCheck(this,t),this[Zc].lengthComputable}get loaded(){return vt.brandCheck(this,t),this[Zc].loaded}get total(){return vt.brandCheck(this,t),this[Zc].total}};vt.converters.ProgressEventInit=vt.dictionaryConverter([{key:"lengthComputable",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"loaded",converter:vt.converters["unsigned long long"],defaultValue:o(()=>0,"defaultValue")},{key:"total",converter:vt.converters["unsigned long long"],defaultValue:o(()=>0,"defaultValue")},{key:"bubbles",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"cancelable",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"composed",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}]);mb.exports={ProgressEvent:sp}});var Ib=T((U4,Cb)=>{"use strict";function mG(t){if(!t)return"failure";switch(t.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}o(mG,"getEncoding");Cb.exports={getEncoding:mG}});var Sb=T((L4,kb)=>{"use strict";var{kState:Li,kError:ip,kResult:yb,kAborted:Ea,kLastProgressEventFired:op}=rp(),{ProgressEvent:EG}=Eb(),{getEncoding:Qb}=Ib(),{serializeAMimeType:CG,parseMIMEType:Bb}=gt(),{types:IG}=require("node:util"),{StringDecoder:wb}=require("string_decoder"),{btoa:bb}=require("node:buffer"),yG={enumerable:!0,writable:!1,configurable:!1};function QG(t,e,n,r){if(t[Li]==="loading")throw new DOMException("Invalid state","InvalidStateError");t[Li]="loading",t[yb]=null,t[ip]=null;let i=e.stream().getReader(),a=[],c=i.read(),l=!0;(async()=>{for(;!t[Ea];)try{let{done:d,value:g}=await c;if(l&&!t[Ea]&&queueMicrotask(()=>{Rr("loadstart",t)}),l=!1,!d&&IG.isUint8Array(g))a.push(g),(t[op]===void 0||Date.now()-t[op]>=50)&&!t[Ea]&&(t[op]=Date.now(),queueMicrotask(()=>{Rr("progress",t)})),c=i.read();else if(d){queueMicrotask(()=>{t[Li]="done";try{let h=BG(a,n,e.type,r);if(t[Ea])return;t[yb]=h,Rr("load",t)}catch(h){t[ip]=h,Rr("error",t)}t[Li]!=="loading"&&Rr("loadend",t)});break}}catch(d){if(t[Ea])return;queueMicrotask(()=>{t[Li]="done",t[ip]=d,Rr("error",t),t[Li]!=="loading"&&Rr("loadend",t)});break}})()}o(QG,"readOperation");function Rr(t,e){let n=new EG(t,{bubbles:!1,cancelable:!1});e.dispatchEvent(n)}o(Rr,"fireAProgressEvent");function BG(t,e,n,r){switch(e){case"DataURL":{let s="data:",i=Bb(n||"application/octet-stream");i!=="failure"&&(s+=CG(i)),s+=";base64,";let a=new wb("latin1");for(let c of t)s+=bb(a.write(c));return s+=bb(a.end()),s}case"Text":{let s="failure";if(r&&(s=Qb(r)),s==="failure"&&n){let i=Bb(n);i!=="failure"&&(s=Qb(i.parameters.get("charset")))}return s==="failure"&&(s="UTF-8"),wG(t,s)}case"ArrayBuffer":return Rb(t).buffer;case"BinaryString":{let s="",i=new wb("latin1");for(let a of t)s+=i.write(a);return s+=i.end(),s}}}o(BG,"packageData");function wG(t,e){let n=Rb(t),r=bG(n),s=0;r!==null&&(e=r,s=r==="UTF-8"?3:2);let i=n.slice(s);return new TextDecoder(e).decode(i)}o(wG,"decode");function bG(t){let[e,n,r]=t;return e===239&&n===187&&r===191?"UTF-8":e===254&&n===255?"UTF-16BE":e===255&&n===254?"UTF-16LE":null}o(bG,"BOMSniffing");function Rb(t){let e=t.reduce((r,s)=>r+s.byteLength,0),n=0;return t.reduce((r,s)=>(r.set(s,n),n+=s.byteLength,r),new Uint8Array(e))}o(Rb,"combineByteSequences");kb.exports={staticPropertyDescriptors:yG,readOperation:QG,fireAProgressEvent:Rr}});var Tb=T((P4,Db)=>{"use strict";var{staticPropertyDescriptors:_i,readOperation:Kc,fireAProgressEvent:vb}=Sb(),{kState:ws,kError:xb,kResult:Xc,kEvents:fe,kAborted:RG}=rp(),{webidl:Be}=je(),{kEnumerableProperty:ft}=ue(),nn=class t extends EventTarget{static{o(this,"FileReader")}constructor(){super(),this[ws]="empty",this[Xc]=null,this[xb]=null,this[fe]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),e=Be.converters.Blob(e,{strict:!1}),Kc(this,e,"ArrayBuffer")}readAsBinaryString(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),e=Be.converters.Blob(e,{strict:!1}),Kc(this,e,"BinaryString")}readAsText(e,n=void 0){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsText"),e=Be.converters.Blob(e,{strict:!1}),n!==void 0&&(n=Be.converters.DOMString(n,"FileReader.readAsText","encoding")),Kc(this,e,"Text",n)}readAsDataURL(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),e=Be.converters.Blob(e,{strict:!1}),Kc(this,e,"DataURL")}abort(){if(this[ws]==="empty"||this[ws]==="done"){this[Xc]=null;return}this[ws]==="loading"&&(this[ws]="done",this[Xc]=null),this[RG]=!0,vb("abort",this),this[ws]!=="loading"&&vb("loadend",this)}get readyState(){switch(Be.brandCheck(this,t),this[ws]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return Be.brandCheck(this,t),this[Xc]}get error(){return Be.brandCheck(this,t),this[xb]}get onloadend(){return Be.brandCheck(this,t),this[fe].loadend}set onloadend(e){Be.brandCheck(this,t),this[fe].loadend&&this.removeEventListener("loadend",this[fe].loadend),typeof e=="function"?(this[fe].loadend=e,this.addEventListener("loadend",e)):this[fe].loadend=null}get onerror(){return Be.brandCheck(this,t),this[fe].error}set onerror(e){Be.brandCheck(this,t),this[fe].error&&this.removeEventListener("error",this[fe].error),typeof e=="function"?(this[fe].error=e,this.addEventListener("error",e)):this[fe].error=null}get onloadstart(){return Be.brandCheck(this,t),this[fe].loadstart}set onloadstart(e){Be.brandCheck(this,t),this[fe].loadstart&&this.removeEventListener("loadstart",this[fe].loadstart),typeof e=="function"?(this[fe].loadstart=e,this.addEventListener("loadstart",e)):this[fe].loadstart=null}get onprogress(){return Be.brandCheck(this,t),this[fe].progress}set onprogress(e){Be.brandCheck(this,t),this[fe].progress&&this.removeEventListener("progress",this[fe].progress),typeof e=="function"?(this[fe].progress=e,this.addEventListener("progress",e)):this[fe].progress=null}get onload(){return Be.brandCheck(this,t),this[fe].load}set onload(e){Be.brandCheck(this,t),this[fe].load&&this.removeEventListener("load",this[fe].load),typeof e=="function"?(this[fe].load=e,this.addEventListener("load",e)):this[fe].load=null}get onabort(){return Be.brandCheck(this,t),this[fe].abort}set onabort(e){Be.brandCheck(this,t),this[fe].abort&&this.removeEventListener("abort",this[fe].abort),typeof e=="function"?(this[fe].abort=e,this.addEventListener("abort",e)):this[fe].abort=null}};nn.EMPTY=nn.prototype.EMPTY=0;nn.LOADING=nn.prototype.LOADING=1;nn.DONE=nn.prototype.DONE=2;Object.defineProperties(nn.prototype,{EMPTY:_i,LOADING:_i,DONE:_i,readAsArrayBuffer:ft,readAsBinaryString:ft,readAsText:ft,readAsDataURL:ft,abort:ft,readyState:ft,result:ft,error:ft,onloadstart:ft,onprogress:ft,onload:ft,onabort:ft,onerror:ft,onloadend:ft,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(nn,{EMPTY:_i,LOADING:_i,DONE:_i});Db.exports={FileReader:nn}});var eu=T((G4,Nb)=>{"use strict";Nb.exports={kConstruct:ke().kConstruct}});var Mb=T(($4,Ub)=>{"use strict";var kG=require("node:assert"),{URLSerializer:Fb}=gt(),{isValidHeaderName:SG}=Qt();function vG(t,e,n=!1){let r=Fb(t,n),s=Fb(e,n);return r===s}o(vG,"urlEquals");function xG(t){kG(t!==null);let e=[];for(let n of t.split(","))n=n.trim(),SG(n)&&e.push(n);return e}o(xG,"getFieldValues");Ub.exports={urlEquals:vG,getFieldValues:xG}});var Pb=T((H4,_b)=>{"use strict";var{kConstruct:DG}=eu(),{urlEquals:TG,getFieldValues:ap}=Mb(),{kEnumerableProperty:bs,isDisturbed:NG}=ue(),{webidl:q}=je(),{Response:FG,cloneResponse:UG,fromInnerResponse:MG}=pa(),{Request:Vn,fromInnerRequest:LG}=Mi(),{kState:rn}=gr(),{fetching:_G}=ma(),{urlIsHttpHttpsScheme:tu,createDeferredPromise:Pi,readAllBytes:PG}=Qt(),Ap=require("node:assert"),nu=class t{static{o(this,"Cache")}#e;constructor(){arguments[0]!==DG&&q.illegalConstructor(),q.util.markAsUncloneable(this),this.#e=arguments[1]}async match(e,n={}){q.brandCheck(this,t);let r="Cache.match";q.argumentLengthCheck(arguments,1,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.CacheQueryOptions(n,r,"options");let s=this.#i(e,n,1);if(s.length!==0)return s[0]}async matchAll(e=void 0,n={}){q.brandCheck(this,t);let r="Cache.matchAll";return e!==void 0&&(e=q.converters.RequestInfo(e,r,"request")),n=q.converters.CacheQueryOptions(n,r,"options"),this.#i(e,n)}async add(e){q.brandCheck(this,t);let n="Cache.add";q.argumentLengthCheck(arguments,1,n),e=q.converters.RequestInfo(e,n,"request");let r=[e];return await this.addAll(r)}async addAll(e){q.brandCheck(this,t);let n="Cache.addAll";q.argumentLengthCheck(arguments,1,n);let r=[],s=[];for(let f of e){if(f===void 0)throw q.errors.conversionFailed({prefix:n,argument:"Argument 1",types:["undefined is not allowed"]});if(f=q.converters.RequestInfo(f),typeof f=="string")continue;let m=f[rn];if(!tu(m.url)||m.method!=="GET")throw q.errors.exception({header:n,message:"Expected http/s scheme when method is not GET."})}let i=[];for(let f of e){let m=new Vn(f)[rn];if(!tu(m.url))throw q.errors.exception({header:n,message:"Expected http/s scheme."});m.initiator="fetch",m.destination="subresource",s.push(m);let C=Pi();i.push(_G({request:m,processResponse(y){if(y.type==="error"||y.status===206||y.status<200||y.status>299)C.reject(q.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(y.headersList.contains("vary")){let v=ap(y.headersList.get("vary"));for(let Q of v)if(Q==="*"){C.reject(q.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let D of i)D.abort();return}}},processResponseEndOfBody(y){if(y.aborted){C.reject(new DOMException("aborted","AbortError"));return}C.resolve(y)}})),r.push(C.promise)}let c=await Promise.all(r),l=[],d=0;for(let f of c){let m={type:"put",request:s[d],response:f};l.push(m),d++}let g=Pi(),h=null;try{this.#t(l)}catch(f){h=f}return queueMicrotask(()=>{h===null?g.resolve(void 0):g.reject(h)}),g.promise}async put(e,n){q.brandCheck(this,t);let r="Cache.put";q.argumentLengthCheck(arguments,2,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.Response(n,r,"response");let s=null;if(e instanceof Vn?s=e[rn]:s=new Vn(e)[rn],!tu(s.url)||s.method!=="GET")throw q.errors.exception({header:r,message:"Expected an http/s scheme when method is not GET"});let i=n[rn];if(i.status===206)throw q.errors.exception({header:r,message:"Got 206 status"});if(i.headersList.contains("vary")){let m=ap(i.headersList.get("vary"));for(let C of m)if(C==="*")throw q.errors.exception({header:r,message:"Got * vary field value"})}if(i.body&&(NG(i.body.stream)||i.body.stream.locked))throw q.errors.exception({header:r,message:"Response body is locked or disturbed"});let a=UG(i),c=Pi();if(i.body!=null){let C=i.body.stream.getReader();PG(C).then(c.resolve,c.reject)}else c.resolve(void 0);let l=[],d={type:"put",request:s,response:a};l.push(d);let g=await c.promise;a.body!=null&&(a.body.source=g);let h=Pi(),f=null;try{this.#t(l)}catch(m){f=m}return queueMicrotask(()=>{f===null?h.resolve():h.reject(f)}),h.promise}async delete(e,n={}){q.brandCheck(this,t);let r="Cache.delete";q.argumentLengthCheck(arguments,1,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.CacheQueryOptions(n,r,"options");let s=null;if(e instanceof Vn){if(s=e[rn],s.method!=="GET"&&!n.ignoreMethod)return!1}else Ap(typeof e=="string"),s=new Vn(e)[rn];let i=[],a={type:"delete",request:s,options:n};i.push(a);let c=Pi(),l=null,d;try{d=this.#t(i)}catch(g){l=g}return queueMicrotask(()=>{l===null?c.resolve(!!d?.length):c.reject(l)}),c.promise}async keys(e=void 0,n={}){q.brandCheck(this,t);let r="Cache.keys";e!==void 0&&(e=q.converters.RequestInfo(e,r,"request")),n=q.converters.CacheQueryOptions(n,r,"options");let s=null;if(e!==void 0)if(e instanceof Vn){if(s=e[rn],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Vn(e)[rn]);let i=Pi(),a=[];if(e===void 0)for(let c of this.#e)a.push(c[0]);else{let c=this.#n(s,n);for(let l of c)a.push(l[0])}return queueMicrotask(()=>{let c=[];for(let l of a){let d=LG(l,new AbortController().signal,"immutable");c.push(d)}i.resolve(Object.freeze(c))}),i.promise}#t(e){let n=this.#e,r=[...n],s=[],i=[];try{for(let a of e){if(a.type!=="delete"&&a.type!=="put")throw q.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(a.type==="delete"&&a.response!=null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#n(a.request,a.options,s).length)throw new DOMException("???","InvalidStateError");let c;if(a.type==="delete"){if(c=this.#n(a.request,a.options),c.length===0)return[];for(let l of c){let d=n.indexOf(l);Ap(d!==-1),n.splice(d,1)}}else if(a.type==="put"){if(a.response==null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let l=a.request;if(!tu(l.url))throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(l.method!=="GET")throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(a.options!=null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});c=this.#n(a.request);for(let d of c){let g=n.indexOf(d);Ap(g!==-1),n.splice(g,1)}n.push([a.request,a.response]),s.push([a.request,a.response])}i.push([a.request,a.response])}return i}catch(a){throw this.#e.length=0,this.#e=r,a}}#n(e,n,r){let s=[],i=r??this.#e;for(let a of i){let[c,l]=a;this.#s(e,c,l,n)&&s.push(a)}return s}#s(e,n,r=null,s){let i=new URL(e.url),a=new URL(n.url);if(s?.ignoreSearch&&(a.search="",i.search=""),!TG(i,a,!0))return!1;if(r==null||s?.ignoreVary||!r.headersList.contains("vary"))return!0;let c=ap(r.headersList.get("vary"));for(let l of c){if(l==="*")return!1;let d=n.headersList.get(l),g=e.headersList.get(l);if(d!==g)return!1}return!0}#i(e,n,r=1/0){let s=null;if(e!==void 0)if(e instanceof Vn){if(s=e[rn],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Vn(e)[rn]);let i=[];if(e===void 0)for(let c of this.#e)i.push(c[1]);else{let c=this.#n(s,n);for(let l of c)i.push(l[1])}let a=[];for(let c of i){let l=MG(c,"immutable");if(a.push(l.clone()),a.length>=r)break}return Object.freeze(a)}};Object.defineProperties(nu.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:bs,matchAll:bs,add:bs,addAll:bs,put:bs,delete:bs,keys:bs});var Lb=[{key:"ignoreSearch",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"ignoreMethod",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"ignoreVary",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}];q.converters.CacheQueryOptions=q.dictionaryConverter(Lb);q.converters.MultiCacheQueryOptions=q.dictionaryConverter([...Lb,{key:"cacheName",converter:q.converters.DOMString}]);q.converters.Response=q.interfaceConverter(FG);q.converters["sequence<RequestInfo>"]=q.sequenceConverter(q.converters.RequestInfo);_b.exports={Cache:nu}});var Gb=T((J4,Ob)=>{"use strict";var{kConstruct:Ca}=eu(),{Cache:ru}=Pb(),{webidl:Xe}=je(),{kEnumerableProperty:Ia}=ue(),su=class t{static{o(this,"CacheStorage")}#e=new Map;constructor(){arguments[0]!==Ca&&Xe.illegalConstructor(),Xe.util.markAsUncloneable(this)}async match(e,n={}){if(Xe.brandCheck(this,t),Xe.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=Xe.converters.RequestInfo(e),n=Xe.converters.MultiCacheQueryOptions(n),n.cacheName!=null){if(this.#e.has(n.cacheName)){let r=this.#e.get(n.cacheName);return await new ru(Ca,r).match(e,n)}}else for(let r of this.#e.values()){let i=await new ru(Ca,r).match(e,n);if(i!==void 0)return i}}async has(e){Xe.brandCheck(this,t);let n="CacheStorage.has";return Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.has(e)}async open(e){Xe.brandCheck(this,t);let n="CacheStorage.open";if(Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.has(e)){let s=this.#e.get(e);return new ru(Ca,s)}let r=[];return this.#e.set(e,r),new ru(Ca,r)}async delete(e){Xe.brandCheck(this,t);let n="CacheStorage.delete";return Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.delete(e)}async keys(){return Xe.brandCheck(this,t),[...this.#e.keys()]}};Object.defineProperties(su.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Ia,has:Ia,open:Ia,delete:Ia,keys:Ia});Ob.exports={CacheStorage:su}});var Yb=T((j4,$b)=>{"use strict";$b.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var lp=T((W4,qb)=>{"use strict";function OG(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n>=0&&n<=8||n>=10&&n<=31||n===127)return!0}return!1}o(OG,"isCTLExcludingHtab");function cp(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===60||n===62||n===64||n===44||n===59||n===58||n===92||n===47||n===91||n===93||n===63||n===61||n===123||n===125)throw new Error("Invalid cookie name")}}o(cp,"validateCookieName");function up(t){let e=t.length,n=0;if(t[0]==='"'){if(e===1||t[e-1]!=='"')throw new Error("Invalid cookie value");--e,++n}for(;n<e;){let r=t.charCodeAt(n++);if(r<33||r>126||r===34||r===44||r===59||r===92)throw new Error("Invalid cookie value")}}o(up,"validateCookieValue");function Vb(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<32||n>126||n===59)throw new Error("Invalid cookie path")}}o(Vb,"validateCookiePath");function Hb(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}o(Hb,"isLetterOrDigit");function GG(t){if(t===" ")return;if(t.length>255)throw new Error("Invalid cookie domain");let e=0;for(let n=0;n<t.length;++n){let r=t.charCodeAt(n);if(r===46){if(e===0)throw new Error("Invalid cookie domain");if(t.charCodeAt(n-1)===45)throw new Error("Invalid cookie domain");e=0;continue}if(e===0&&!Hb(r))throw new Error("Invalid cookie domain");if(!Hb(r)&&r!==45)throw new Error("Invalid cookie domain");if(++e>63)throw new Error("Invalid cookie domain")}if(e===0||t.charCodeAt(t.length-1)===45)throw new Error("Invalid cookie domain")}o(GG,"validateCookieDomain");var $G=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],YG=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],iu=Array(61).fill(0).map((t,e)=>e.toString().padStart(2,"0"));function Jb(t){return typeof t=="number"&&(t=new Date(t)),`${$G[t.getUTCDay()]}, ${iu[t.getUTCDate()]} ${YG[t.getUTCMonth()]} ${t.getUTCFullYear()} ${iu[t.getUTCHours()]}:${iu[t.getUTCMinutes()]}:${iu[t.getUTCSeconds()]} GMT`}o(Jb,"toIMFDate");function HG(t){if(t<0)throw new Error("Invalid cookie max-age")}o(HG,"validateCookieMaxAge");function VG(t){if(t.name.length===0)return null;cp(t.name),up(t.value);let e=[`${t.name}=${t.value}`];t.name.startsWith("__Secure-")&&(t.secure=!0),t.name.startsWith("__Host-")&&(t.secure=!0,t.domain=null,t.path="/"),t.secure&&e.push("Secure"),t.httpOnly&&e.push("HttpOnly"),typeof t.maxAge=="number"&&(HG(t.maxAge),e.push(`Max-Age=${t.maxAge}`)),t.domain&&(GG(t.domain),e.push(`Domain=${t.domain}`)),t.path&&(Vb(t.path),e.push(`Path=${t.path}`)),t.expires&&t.expires.toString()!=="Invalid Date"&&e.push(`Expires=${Jb(t.expires)}`),t.sameSite&&e.push(`SameSite=${t.sameSite}`);for(let n of t.unparsed){if(!n.includes("="))throw new Error("Invalid unparsed");let[r,...s]=n.split("="),i=r.trim(),a=s.join("=");cp(i),up(a),e.push(`${i}=${a}`)}return e.join("; ")}o(VG,"stringify");qb.exports={isCTLExcludingHtab:OG,validateCookieName:cp,validateCookiePath:Vb,validateCookieValue:up,toIMFDate:Jb,stringify:VG}});var Wb=T((Z4,jb)=>{"use strict";var{maxNameValuePairSize:JG,maxAttributeValueSize:qG}=Yb(),{isCTLExcludingHtab:jG}=lp(),{collectASequenceOfCodePointsFast:ou}=gt(),WG=require("node:assert");function zG(t){if(jG(t))return null;let e="",n="",r="",s="";if(t.includes(";")){let i={position:0};e=ou(";",t,i),n=t.slice(i.position)}else e=t;if(!e.includes("="))s=e;else{let i={position:0};r=ou("=",e,i),s=e.slice(i.position+1)}return r=r.trim(),s=s.trim(),r.length+s.length>JG?null:{name:r,value:s,...Oi(n)}}o(zG,"parseSetCookie");function Oi(t,e={}){if(t.length===0)return e;WG(t[0]===";"),t=t.slice(1);let n="";t.includes(";")?(n=ou(";",t,{position:0}),t=t.slice(n.length)):(n=t,t="");let r="",s="";if(n.includes("=")){let a={position:0};r=ou("=",n,a),s=n.slice(a.position+1)}else r=n;if(r=r.trim(),s=s.trim(),s.length>qG)return Oi(t,e);let i=r.toLowerCase();if(i==="expires"){let a=new Date(s);e.expires=a}else if(i==="max-age"){let a=s.charCodeAt(0);if((a<48||a>57)&&s[0]!=="-"||!/^\d+$/.test(s))return Oi(t,e);let c=Number(s);e.maxAge=c}else if(i==="domain"){let a=s;a[0]==="."&&(a=a.slice(1)),a=a.toLowerCase(),e.domain=a}else if(i==="path"){let a="";s.length===0||s[0]!=="/"?a="/":a=s,e.path=a}else if(i==="secure")e.secure=!0;else if(i==="httponly")e.httpOnly=!0;else if(i==="samesite"){let a=s.toLowerCase();a==="none"?e.sameSite="None":a==="strict"?e.sameSite="Strict":a==="lax"&&(e.sameSite="Lax")}else e.unparsed??=[],e.unparsed.push(`${r}=${s}`);return Oi(t,e)}o(Oi,"parseUnparsedAttributes");jb.exports={parseSetCookie:zG,parseUnparsedAttributes:Oi}});var Kb=T((X4,Zb)=>{"use strict";var{parseSetCookie:ZG}=Wb(),{stringify:KG}=lp(),{webidl:ge}=je(),{Headers:au}=Is();function XG(t){ge.argumentLengthCheck(arguments,1,"getCookies"),ge.brandCheck(t,au,{strict:!1});let e=t.get("cookie"),n={};if(!e)return n;for(let r of e.split(";")){let[s,...i]=r.split("=");n[s.trim()]=i.join("=")}return n}o(XG,"getCookies");function e1(t,e,n){ge.brandCheck(t,au,{strict:!1});let r="deleteCookie";ge.argumentLengthCheck(arguments,2,r),e=ge.converters.DOMString(e,r,"name"),n=ge.converters.DeleteCookieAttributes(n),zb(t,{name:e,value:"",expires:new Date(0),...n})}o(e1,"deleteCookie");function t1(t){ge.argumentLengthCheck(arguments,1,"getSetCookies"),ge.brandCheck(t,au,{strict:!1});let e=t.getSetCookie();return e?e.map(n=>ZG(n)):[]}o(t1,"getSetCookies");function zb(t,e){ge.argumentLengthCheck(arguments,2,"setCookie"),ge.brandCheck(t,au,{strict:!1}),e=ge.converters.Cookie(e);let n=KG(e);n&&t.append("Set-Cookie",n)}o(zb,"setCookie");ge.converters.DeleteCookieAttributes=ge.dictionaryConverter([{converter:ge.nullableConverter(ge.converters.DOMString),key:"path",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.DOMString),key:"domain",defaultValue:o(()=>null,"defaultValue")}]);ge.converters.Cookie=ge.dictionaryConverter([{converter:ge.converters.DOMString,key:"name"},{converter:ge.converters.DOMString,key:"value"},{converter:ge.nullableConverter(t=>typeof t=="number"?ge.converters["unsigned long long"](t):new Date(t)),key:"expires",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters["long long"]),key:"maxAge",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.DOMString),key:"domain",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.DOMString),key:"path",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.boolean),key:"secure",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.boolean),key:"httpOnly",defaultValue:o(()=>null,"defaultValue")},{converter:ge.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:ge.sequenceConverter(ge.converters.DOMString),key:"unparsed",defaultValue:o(()=>new Array(0),"defaultValue")}]);Zb.exports={getCookies:XG,deleteCookie:e1,getSetCookies:t1,setCookie:zb}});var $i=T((t3,eR)=>{"use strict";var{webidl:V}=je(),{kEnumerableProperty:mt}=ue(),{kConstruct:Xb}=ke(),{MessagePort:n1}=require("node:worker_threads"),Gi=class t extends Event{static{o(this,"MessageEvent")}#e;constructor(e,n={}){if(e===Xb){super(arguments[1],arguments[2]),V.util.markAsUncloneable(this);return}let r="MessageEvent constructor";V.argumentLengthCheck(arguments,1,r),e=V.converters.DOMString(e,r,"type"),n=V.converters.MessageEventInit(n,r,"eventInitDict"),super(e,n),this.#e=n,V.util.markAsUncloneable(this)}get data(){return V.brandCheck(this,t),this.#e.data}get origin(){return V.brandCheck(this,t),this.#e.origin}get lastEventId(){return V.brandCheck(this,t),this.#e.lastEventId}get source(){return V.brandCheck(this,t),this.#e.source}get ports(){return V.brandCheck(this,t),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(e,n=!1,r=!1,s=null,i="",a="",c=null,l=[]){return V.brandCheck(this,t),V.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new t(e,{bubbles:n,cancelable:r,data:s,origin:i,lastEventId:a,source:c,ports:l})}static createFastMessageEvent(e,n){let r=new t(Xb,e,n);return r.#e=n,r.#e.data??=null,r.#e.origin??="",r.#e.lastEventId??="",r.#e.source??=null,r.#e.ports??=[],r}},{createFastMessageEvent:r1}=Gi;delete Gi.createFastMessageEvent;var Au=class t extends Event{static{o(this,"CloseEvent")}#e;constructor(e,n={}){let r="CloseEvent constructor";V.argumentLengthCheck(arguments,1,r),e=V.converters.DOMString(e,r,"type"),n=V.converters.CloseEventInit(n),super(e,n),this.#e=n,V.util.markAsUncloneable(this)}get wasClean(){return V.brandCheck(this,t),this.#e.wasClean}get code(){return V.brandCheck(this,t),this.#e.code}get reason(){return V.brandCheck(this,t),this.#e.reason}},cu=class t extends Event{static{o(this,"ErrorEvent")}#e;constructor(e,n){let r="ErrorEvent constructor";V.argumentLengthCheck(arguments,1,r),super(e,n),V.util.markAsUncloneable(this),e=V.converters.DOMString(e,r,"type"),n=V.converters.ErrorEventInit(n??{}),this.#e=n}get message(){return V.brandCheck(this,t),this.#e.message}get filename(){return V.brandCheck(this,t),this.#e.filename}get lineno(){return V.brandCheck(this,t),this.#e.lineno}get colno(){return V.brandCheck(this,t),this.#e.colno}get error(){return V.brandCheck(this,t),this.#e.error}};Object.defineProperties(Gi.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:mt,origin:mt,lastEventId:mt,source:mt,ports:mt,initMessageEvent:mt});Object.defineProperties(Au.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:mt,code:mt,wasClean:mt});Object.defineProperties(cu.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:mt,filename:mt,lineno:mt,colno:mt,error:mt});V.converters.MessagePort=V.interfaceConverter(n1);V.converters["sequence<MessagePort>"]=V.sequenceConverter(V.converters.MessagePort);var dp=[{key:"bubbles",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"cancelable",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"composed",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}];V.converters.MessageEventInit=V.dictionaryConverter([...dp,{key:"data",converter:V.converters.any,defaultValue:o(()=>null,"defaultValue")},{key:"origin",converter:V.converters.USVString,defaultValue:o(()=>"","defaultValue")},{key:"lastEventId",converter:V.converters.DOMString,defaultValue:o(()=>"","defaultValue")},{key:"source",converter:V.nullableConverter(V.converters.MessagePort),defaultValue:o(()=>null,"defaultValue")},{key:"ports",converter:V.converters["sequence<MessagePort>"],defaultValue:o(()=>new Array(0),"defaultValue")}]);V.converters.CloseEventInit=V.dictionaryConverter([...dp,{key:"wasClean",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"code",converter:V.converters["unsigned short"],defaultValue:o(()=>0,"defaultValue")},{key:"reason",converter:V.converters.USVString,defaultValue:o(()=>"","defaultValue")}]);V.converters.ErrorEventInit=V.dictionaryConverter([...dp,{key:"message",converter:V.converters.DOMString,defaultValue:o(()=>"","defaultValue")},{key:"filename",converter:V.converters.USVString,defaultValue:o(()=>"","defaultValue")},{key:"lineno",converter:V.converters["unsigned long"],defaultValue:o(()=>0,"defaultValue")},{key:"colno",converter:V.converters["unsigned long"],defaultValue:o(()=>0,"defaultValue")},{key:"error",converter:V.converters.any}]);eR.exports={MessageEvent:Gi,CloseEvent:Au,ErrorEvent:cu,createFastMessageEvent:r1}});var Rs=T((r3,tR)=>{"use strict";var s1="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",i1={enumerable:!0,writable:!1,configurable:!1},o1={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},a1={NOT_SENT:0,PROCESSING:1,SENT:2},A1={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},c1=2**16-1,u1={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},l1=Buffer.allocUnsafe(0),d1={string:1,typedArray:2,arrayBuffer:3,blob:4};tR.exports={uid:s1,sentCloseFrameState:a1,staticPropertyDescriptors:i1,states:o1,opcodes:A1,maxUnsigned16Bit:c1,parserStates:u1,emptyBuffer:l1,sendHints:d1}});var ya=T((s3,nR)=>{"use strict";nR.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var wa=T((i3,lR)=>{"use strict";var{kReadyState:Qa,kController:g1,kResponse:h1,kBinaryType:p1,kWebSocketURL:f1}=ya(),{states:Ba,opcodes:kr}=Rs(),{ErrorEvent:m1,createFastMessageEvent:E1}=$i(),{isUtf8:C1}=require("node:buffer"),{collectASequenceOfCodePointsFast:I1,removeHTTPWhitespace:rR}=gt();function y1(t){return t[Qa]===Ba.CONNECTING}o(y1,"isConnecting");function Q1(t){return t[Qa]===Ba.OPEN}o(Q1,"isEstablished");function B1(t){return t[Qa]===Ba.CLOSING}o(B1,"isClosing");function w1(t){return t[Qa]===Ba.CLOSED}o(w1,"isClosed");function gp(t,e,n=(s,i)=>new Event(s,i),r={}){let s=n(t,r);e.dispatchEvent(s)}o(gp,"fireEvent");function b1(t,e,n){if(t[Qa]!==Ba.OPEN)return;let r;if(e===kr.TEXT)try{r=uR(n)}catch{iR(t,"Received invalid UTF-8 in text frame.");return}else e===kr.BINARY&&(t[p1]==="blob"?r=new Blob([n]):r=R1(n));gp("message",t,E1,{origin:t[f1].origin,data:r})}o(b1,"websocketMessageReceived");function R1(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}o(R1,"toArrayBuffer");function k1(t){if(t.length===0)return!1;for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===44||n===47||n===58||n===59||n===60||n===61||n===62||n===63||n===64||n===91||n===92||n===93||n===123||n===125)return!1}return!0}o(k1,"isValidSubprotocol");function S1(t){return t>=1e3&&t<1015?t!==1004&&t!==1005&&t!==1006:t>=3e3&&t<=4999}o(S1,"isValidStatusCode");function iR(t,e){let{[g1]:n,[h1]:r}=t;n.abort(),r?.socket&&!r.socket.destroyed&&r.socket.destroy(),e&&gp("error",t,(s,i)=>new m1(s,i),{error:new Error(e),message:e})}o(iR,"failWebsocketConnection");function oR(t){return t===kr.CLOSE||t===kr.PING||t===kr.PONG}o(oR,"isControlFrame");function aR(t){return t===kr.CONTINUATION}o(aR,"isContinuationFrame");function AR(t){return t===kr.TEXT||t===kr.BINARY}o(AR,"isTextBinaryFrame");function v1(t){return AR(t)||aR(t)||oR(t)}o(v1,"isValidOpcode");function x1(t){let e={position:0},n=new Map;for(;e.position<t.length;){let r=I1(";",t,e),[s,i=""]=r.split("=");n.set(rR(s,!0,!1),rR(i,!1,!0)),e.position++}return n}o(x1,"parseExtensions");function D1(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<48||r>57)return!1}let e=Number.parseInt(t,10);return e>=8&&e<=15}o(D1,"isValidClientWindowBits");var cR=typeof process.versions.icu=="string",sR=cR?new TextDecoder("utf-8",{fatal:!0}):void 0,uR=cR?sR.decode.bind(sR):function(t){if(C1(t))return t.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};lR.exports={isConnecting:y1,isEstablished:Q1,isClosing:B1,isClosed:w1,fireEvent:gp,isValidSubprotocol:k1,isValidStatusCode:S1,failWebsocketConnection:iR,websocketMessageReceived:b1,utf8Decode:uR,isControlFrame:oR,isContinuationFrame:aR,isTextBinaryFrame:AR,isValidOpcode:v1,parseExtensions:x1,isValidClientWindowBits:D1}});var lu=T((a3,dR)=>{"use strict";var{maxUnsigned16Bit:T1}=Rs(),uu=16386,hp,ba=null,Yi=uu;try{hp=require("node:crypto")}catch{hp={randomFillSync:o(function(e,n,r){for(let s=0;s<e.length;++s)e[s]=Math.random()*255|0;return e},"randomFillSync")}}function N1(){return Yi===uu&&(Yi=0,hp.randomFillSync(ba??=Buffer.allocUnsafe(uu),0,uu)),[ba[Yi++],ba[Yi++],ba[Yi++],ba[Yi++]]}o(N1,"generateMask");var pp=class{static{o(this,"WebsocketFrameSend")}constructor(e){this.frameData=e}createFrame(e){let n=this.frameData,r=N1(),s=n?.byteLength??0,i=s,a=6;s>T1?(a+=8,i=127):s>125&&(a+=2,i=126);let c=Buffer.allocUnsafe(s+a);c[0]=c[1]=0,c[0]|=128,c[0]=(c[0]&240)+e;c[a-4]=r[0],c[a-3]=r[1],c[a-2]=r[2],c[a-1]=r[3],c[1]=i,i===126?c.writeUInt16BE(s,2):i===127&&(c[2]=c[3]=0,c.writeUIntBE(s,4,6)),c[1]|=128;for(let l=0;l<s;++l)c[a+l]=n[l]^r[l&3];return c}};dR.exports={WebsocketFrameSend:pp}});var mp=T((c3,CR)=>{"use strict";var{uid:F1,states:Ra,sentCloseFrameState:du,emptyBuffer:U1,opcodes:M1}=Rs(),{kReadyState:ka,kSentClose:gu,kByteParser:hR,kReceivedClose:gR,kResponse:pR}=ya(),{fireEvent:L1,failWebsocketConnection:Sr,isClosing:_1,isClosed:P1,isEstablished:O1,parseExtensions:G1}=wa(),{channels:Hi}=ni(),{CloseEvent:$1}=$i(),{makeRequest:Y1}=Mi(),{fetching:H1}=ma(),{Headers:V1,getHeadersList:J1}=Is(),{getDecodeSplit:q1}=Qt(),{WebsocketFrameSend:j1}=lu(),fp;try{fp=require("node:crypto")}catch{}function W1(t,e,n,r,s,i){let a=t;a.protocol=t.protocol==="ws:"?"http:":"https:";let c=Y1({urlList:[a],client:n,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){let h=J1(new V1(i.headers));c.headersList=h}let l=fp.randomBytes(16).toString("base64");c.headersList.append("sec-websocket-key",l),c.headersList.append("sec-websocket-version","13");for(let h of e)c.headersList.append("sec-websocket-protocol",h);return c.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),H1({request:c,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(h){if(h.type==="error"||h.status!==101){Sr(r,"Received network error or non-101 status code.");return}if(e.length!==0&&!h.headersList.get("Sec-WebSocket-Protocol")){Sr(r,"Server did not respond with sent protocols.");return}if(h.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){Sr(r,'Server did not set Upgrade header to "websocket".');return}if(h.headersList.get("Connection")?.toLowerCase()!=="upgrade"){Sr(r,'Server did not set Connection header to "upgrade".');return}let f=h.headersList.get("Sec-WebSocket-Accept"),m=fp.createHash("sha1").update(l+F1).digest("base64");if(f!==m){Sr(r,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let C=h.headersList.get("Sec-WebSocket-Extensions"),y;if(C!==null&&(y=G1(C),!y.has("permessage-deflate"))){Sr(r,"Sec-WebSocket-Extensions header does not match.");return}let v=h.headersList.get("Sec-WebSocket-Protocol");if(v!==null){let Q=q1("sec-websocket-protocol",c.headersList);if(Q===null||!Q.includes(v)){Sr(r,"Protocol was not set in the opening handshake.");return}}h.socket.on("data",fR),h.socket.on("close",mR),h.socket.on("error",ER),Hi.open.hasSubscribers&&Hi.open.publish({address:h.socket.address(),protocol:v,extensions:C}),s(h,y)}})}o(W1,"establishWebSocketConnection");function z1(t,e,n,r){if(!(_1(t)||P1(t)))if(!O1(t))Sr(t,"Connection was closed before it was established."),t[ka]=Ra.CLOSING;else if(t[gu]===du.NOT_SENT){t[gu]=du.PROCESSING;let s=new j1;e!==void 0&&n===void 0?(s.frameData=Buffer.allocUnsafe(2),s.frameData.writeUInt16BE(e,0)):e!==void 0&&n!==void 0?(s.frameData=Buffer.allocUnsafe(2+r),s.frameData.writeUInt16BE(e,0),s.frameData.write(n,2,"utf-8")):s.frameData=U1,t[pR].socket.write(s.createFrame(M1.CLOSE)),t[gu]=du.SENT,t[ka]=Ra.CLOSING}else t[ka]=Ra.CLOSING}o(z1,"closeWebSocketConnection");function fR(t){this.ws[hR].write(t)||this.pause()}o(fR,"onSocketData");function mR(){let{ws:t}=this,{[pR]:e}=t;e.socket.off("data",fR),e.socket.off("close",mR),e.socket.off("error",ER);let n=t[gu]===du.SENT&&t[gR],r=1005,s="",i=t[hR].closingInfo;i&&!i.error?(r=i.code??1005,s=i.reason):t[gR]||(r=1006),t[ka]=Ra.CLOSED,L1("close",t,(a,c)=>new $1(a,c),{wasClean:n,code:r,reason:s}),Hi.close.hasSubscribers&&Hi.close.publish({websocket:t,code:r,reason:s})}o(mR,"onSocketClose");function ER(t){let{ws:e}=this;e[ka]=Ra.CLOSING,Hi.socketError.hasSubscribers&&Hi.socketError.publish(t),this.destroy()}o(ER,"onSocketError");CR.exports={establishWebSocketConnection:W1,closeWebSocketConnection:z1}});var yR=T((l3,IR)=>{"use strict";var{createInflateRaw:Z1,Z_DEFAULT_WINDOWBITS:K1}=require("node:zlib"),{isValidClientWindowBits:X1}=wa(),{MessageSizeExceededError:e$}=pe(),t$=Buffer.from([0,0,255,255]),hu=Symbol("kBuffer"),Sa=Symbol("kLength"),Ep=class{static{o(this,"PerMessageDeflate")}#e;#t={};#n=0;constructor(e,n){this.#t.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=e.get("server_max_window_bits"),this.#n=n.maxPayloadSize}decompress(e,n,r){if(!this.#e){let s=K1;if(this.#t.serverMaxWindowBits){if(!X1(this.#t.serverMaxWindowBits)){r(new Error("Invalid server_max_window_bits"));return}s=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=Z1({windowBits:s})}catch(i){r(i);return}this.#e[hu]=[],this.#e[Sa]=0,this.#e.on("data",i=>{if(this.#e[Sa]+=i.length,this.#n>0&&this.#e[Sa]>this.#n){r(new e$),this.#e.removeAllListeners(),this.#e.destroy(),this.#e=null;return}this.#e[hu].push(i)}),this.#e.on("error",i=>{this.#e=null,r(i)})}this.#e.write(e),n&&this.#e.write(t$),this.#e.flush(()=>{if(!this.#e)return;let s=Buffer.concat(this.#e[hu],this.#e[Sa]);this.#e[hu].length=0,this.#e[Sa]=0,r(null,s)})}};IR.exports={PerMessageDeflate:Ep}});var xR=T((g3,vR)=>{"use strict";var{Writable:n$}=require("node:stream"),r$=require("node:assert"),{parserStates:Et,opcodes:Vi,states:s$,emptyBuffer:QR,sentCloseFrameState:BR}=Rs(),{kReadyState:i$,kSentClose:wR,kResponse:Cp,kReceivedClose:bR}=ya(),{channels:pu}=ni(),{isValidStatusCode:o$,isValidOpcode:a$,failWebsocketConnection:xt,websocketMessageReceived:RR,utf8Decode:A$,isControlFrame:Ip,isTextBinaryFrame:yp,isContinuationFrame:c$}=wa(),{WebsocketFrameSend:kR}=lu(),{closeWebSocketConnection:SR}=mp(),{PerMessageDeflate:u$}=yR(),{MessageSizeExceededError:Qp}=pe();function va(t,e,n){SR(t,e,n,Buffer.byteLength(n)),xt(t,n)}o(va,"failWebsocketConnectionWithCode");var Bp=class extends n${static{o(this,"ByteParser")}#e=[];#t=0;#n=0;#s=!1;#i=Et.INFO;#r={};#o=[];#a;#c;#A;constructor(e,n,r={}){super(),this.ws=e,this.#a=n??new Map,this.#c=r.maxFragments??0,this.#A=r.maxPayloadSize??0,this.#a.has("permessage-deflate")&&this.#a.set("permessage-deflate",new u$(n,r))}_write(e,n,r){this.#e.push(e),this.#n+=e.length,this.#s=!0,this.run(r)}#u(){return this.#A>0&&!Ip(this.#r.opcode)&&this.#r.payloadLength+this.#t>this.#A?(va(this.ws,1009,"Payload size exceeds maximum allowed size"),!1):!0}run(e){for(;this.#s;)if(this.#i===Et.INFO){if(this.#n<2)return e();let n=this.consume(2),r=(n[0]&128)!==0,s=n[0]&15,i=(n[1]&128)===128,a=!r&&s!==Vi.CONTINUATION,c=n[1]&127,l=n[0]&64,d=n[0]&32,g=n[0]&16;if(!a$(s))return xt(this.ws,"Invalid opcode received"),e();if(i)return xt(this.ws,"Frame cannot be masked"),e();if(l!==0&&!this.#a.has("permessage-deflate")){xt(this.ws,"Expected RSV1 to be clear.");return}if(d!==0||g!==0){xt(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(a&&!yp(s)){xt(this.ws,"Invalid frame type was fragmented.");return}if(yp(s)&&this.#o.length>0){xt(this.ws,"Expected continuation frame");return}if(this.#r.fragmented&&a){xt(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((c>125||a)&&Ip(s)){xt(this.ws,"Control frame either too large or fragmented");return}if(c$(s)&&this.#o.length===0&&!this.#r.compressed){xt(this.ws,"Unexpected continuation frame");return}if(c<=125){if(this.#r.payloadLength=c,this.#i=Et.READ_DATA,!this.#u())return}else c===126?this.#i=Et.PAYLOADLENGTH_16:c===127&&(this.#i=Et.PAYLOADLENGTH_64);yp(s)&&(this.#r.binaryType=s,this.#r.compressed=l!==0),this.#r.opcode=s,this.#r.masked=i,this.#r.fin=r,this.#r.fragmented=a}else if(this.#i===Et.PAYLOADLENGTH_16){if(this.#n<2)return e();let n=this.consume(2);if(this.#r.payloadLength=n.readUInt16BE(0),this.#i=Et.READ_DATA,!this.#u())return}else if(this.#i===Et.PAYLOADLENGTH_64){if(this.#n<8)return e();let n=this.consume(8),r=n.readUInt32BE(0),s=n.readUInt32BE(4);if(r!==0||s>2**31-1){xt(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#r.payloadLength=s,this.#i=Et.READ_DATA,!this.#u())return}else if(this.#i===Et.READ_DATA){if(this.#n<this.#r.payloadLength)return e();let n=this.consume(this.#r.payloadLength);if(Ip(this.#r.opcode)){this.#s=this.parseControlFrame(n),this.#i=Et.INFO;let r=this.ws[Cp].socket;if(this.#s&&r.writableNeedDrain){this.#s=!1,r.once("drain",()=>{this.destroyed||(this.#s=!0,this.run(e))});return}}else if(this.#r.compressed){this.#a.get("permessage-deflate").decompress(n,this.#r.fin,(r,s)=>{if(r){let i=r instanceof Qp?1009:1007;va(this.ws,i,r.message);return}if(this.writeFragments(s)){if(this.#A>0&&this.#t>this.#A){va(this.ws,1009,new Qp().message);return}if(!this.#r.fin){this.#i=Et.INFO,this.#s=!0,this.run(e);return}RR(this.ws,this.#r.binaryType,this.consumeFragments()),this.#s=!0,this.#i=Et.INFO,this.run(e)}}),this.#s=!1;break}else{if(!this.writeFragments(n))return;if(this.#A>0&&this.#t>this.#A){va(this.ws,1009,new Qp().message);return}!this.#r.fragmented&&this.#r.fin&&RR(this.ws,this.#r.binaryType,this.consumeFragments()),this.#i=Et.INFO}}}consume(e){if(e>this.#n)throw new Error("Called consume() before buffers satiated.");if(e===0)return QR;if(this.#e[0].length===e)return this.#n-=this.#e[0].length,this.#e.shift();let n=Buffer.allocUnsafe(e),r=0;for(;r!==e;){let s=this.#e[0],{length:i}=s;if(i+r===e){n.set(this.#e.shift(),r);break}else if(i+r>e){n.set(s.subarray(0,e-r),r),this.#e[0]=s.subarray(e-r);break}else n.set(this.#e.shift(),r),r+=s.length}return this.#n-=e,n}writeFragments(e){return this.#c>0&&this.#o.length===this.#c?(va(this.ws,1008,"Too many message fragments"),!1):(this.#t+=e.length,this.#o.push(e),!0)}consumeFragments(){let e=this.#o;if(e.length===1)return this.#t=0,e.shift();let n=Buffer.concat(e,this.#t);return this.#o=[],this.#t=0,n}parseCloseBody(e){r$(e.length!==1);let n;if(e.length>=2&&(n=e.readUInt16BE(0)),n!==void 0&&!o$(n))return{code:1002,reason:"Invalid status code",error:!0};let r=e.subarray(2);r[0]===239&&r[1]===187&&r[2]===191&&(r=r.subarray(3));try{r=A$(r)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:n,reason:r,error:!1}}parseControlFrame(e){let{opcode:n,payloadLength:r}=this.#r;if(n===Vi.CLOSE){if(r===1)return xt(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#r.closeInfo=this.parseCloseBody(e),this.#r.closeInfo.error){let{code:s,reason:i}=this.#r.closeInfo;return SR(this.ws,s,i,i.length),xt(this.ws,i),!1}if(this.ws[wR]!==BR.SENT){let s=QR;this.#r.closeInfo.code&&(s=Buffer.allocUnsafe(2),s.writeUInt16BE(this.#r.closeInfo.code,0));let i=new kR(s);this.ws[Cp].socket.write(i.createFrame(Vi.CLOSE),a=>{a||(this.ws[wR]=BR.SENT)})}return this.ws[i$]=s$.CLOSING,this.ws[bR]=!0,!1}else if(n===Vi.PING){if(!this.ws[bR]){let s=new kR(e);this.ws[Cp].socket.write(s.createFrame(Vi.PONG)),pu.ping.hasSubscribers&&pu.ping.publish({payload:e})}}else n===Vi.PONG&&pu.pong.hasSubscribers&&pu.pong.publish({payload:e});return!0}get closingInfo(){return this.#r.closeInfo}};vR.exports={ByteParser:Bp}});var UR=T((p3,FR)=>{"use strict";var{WebsocketFrameSend:l$}=lu(),{opcodes:DR,sendHints:Ji}=Rs(),d$=Sg(),TR=Buffer[Symbol.species],wp=class{static{o(this,"SendQueue")}#e=new d$;#t=!1;#n;constructor(e){this.#n=e}add(e,n,r){if(r!==Ji.blob){let i=NR(e,r);if(!this.#t)this.#n.write(i,n);else{let a={promise:null,callback:n,frame:i};this.#e.push(a)}return}let s={promise:e.arrayBuffer().then(i=>{s.promise=null,s.frame=NR(i,r)}),callback:n,frame:null};this.#e.push(s),this.#t||this.#s()}async#s(){this.#t=!0;let e=this.#e;for(;!e.isEmpty();){let n=e.shift();n.promise!==null&&await n.promise,this.#n.write(n.frame,n.callback),n.callback=n.frame=null}this.#t=!1}};function NR(t,e){return new l$(g$(t,e)).createFrame(e===Ji.string?DR.TEXT:DR.BINARY)}o(NR,"createFrame");function g$(t,e){switch(e){case Ji.string:return Buffer.from(t);case Ji.arrayBuffer:case Ji.blob:return new TR(t);case Ji.typedArray:return new TR(t.buffer,t.byteOffset,t.byteLength)}}o(g$,"toBuffer");FR.exports={SendQueue:wp}});var VR=T((m3,HR)=>{"use strict";var{webidl:ne}=je(),{URLSerializer:h$}=gt(),{environmentSettingsObject:MR}=Qt(),{staticPropertyDescriptors:vr,states:xa,sentCloseFrameState:p$,sendHints:fu}=Rs(),{kWebSocketURL:LR,kReadyState:bp,kController:_R,kBinaryType:mu,kResponse:PR,kSentClose:f$,kByteParser:m$}=ya(),{isConnecting:E$,isEstablished:C$,isClosing:I$,isValidSubprotocol:y$,fireEvent:OR}=wa(),{establishWebSocketConnection:Q$,closeWebSocketConnection:GR}=mp(),{ByteParser:B$}=xR(),{kEnumerableProperty:Yt,isBlobLike:$R}=ue(),{getGlobalDispatcher:w$}=da(),{types:YR}=require("node:util"),{ErrorEvent:b$,CloseEvent:R$}=$i(),{SendQueue:k$}=UR(),Dt=class t extends EventTarget{static{o(this,"WebSocket")}#e={open:null,error:null,close:null,message:null};#t=0;#n="";#s="";#i;constructor(e,n=[]){super(),ne.util.markAsUncloneable(this);let r="WebSocket constructor";ne.argumentLengthCheck(arguments,1,r);let s=ne.converters["DOMString or sequence<DOMString> or WebSocketInit"](n,r,"options");e=ne.converters.USVString(e,r,"url"),n=s.protocols;let i=MR.settingsObject.baseUrl,a;try{a=new URL(e,i)}catch(l){throw new DOMException(l,"SyntaxError")}if(a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),a.protocol!=="ws:"&&a.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${a.protocol}`,"SyntaxError");if(a.hash||a.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof n=="string"&&(n=[n]),n.length!==new Set(n.map(l=>l.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(n.length>0&&!n.every(l=>y$(l)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[LR]=new URL(a.href);let c=MR.settingsObject;this[_R]=Q$(a,n,c,this,(l,d)=>this.#r(l,d),s),this[bp]=t.CONNECTING,this[f$]=p$.NOT_SENT,this[mu]="blob"}close(e=void 0,n=void 0){ne.brandCheck(this,t);let r="WebSocket.close";if(e!==void 0&&(e=ne.converters["unsigned short"](e,r,"code",{clamp:!0})),n!==void 0&&(n=ne.converters.USVString(n,r,"reason")),e!==void 0&&e!==1e3&&(e<3e3||e>4999))throw new DOMException("invalid code","InvalidAccessError");let s=0;if(n!==void 0&&(s=Buffer.byteLength(n),s>123))throw new DOMException(`Reason must be less than 123 bytes; received ${s}`,"SyntaxError");GR(this,e,n,s)}send(e){ne.brandCheck(this,t);let n="WebSocket.send";if(ne.argumentLengthCheck(arguments,1,n),e=ne.converters.WebSocketSendData(e,n,"data"),E$(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!C$(this)||I$(this)))if(typeof e=="string"){let r=Buffer.byteLength(e);this.#t+=r,this.#i.add(e,()=>{this.#t-=r},fu.string)}else YR.isArrayBuffer(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},fu.arrayBuffer)):ArrayBuffer.isView(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},fu.typedArray)):$R(e)&&(this.#t+=e.size,this.#i.add(e,()=>{this.#t-=e.size},fu.blob))}get readyState(){return ne.brandCheck(this,t),this[bp]}get bufferedAmount(){return ne.brandCheck(this,t),this.#t}get url(){return ne.brandCheck(this,t),h$(this[LR])}get extensions(){return ne.brandCheck(this,t),this.#s}get protocol(){return ne.brandCheck(this,t),this.#n}get onopen(){return ne.brandCheck(this,t),this.#e.open}set onopen(e){ne.brandCheck(this,t),this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onerror(){return ne.brandCheck(this,t),this.#e.error}set onerror(e){ne.brandCheck(this,t),this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}get onclose(){return ne.brandCheck(this,t),this.#e.close}set onclose(e){ne.brandCheck(this,t),this.#e.close&&this.removeEventListener("close",this.#e.close),typeof e=="function"?(this.#e.close=e,this.addEventListener("close",e)):this.#e.close=null}get onmessage(){return ne.brandCheck(this,t),this.#e.message}set onmessage(e){ne.brandCheck(this,t),this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get binaryType(){return ne.brandCheck(this,t),this[mu]}set binaryType(e){ne.brandCheck(this,t),e!=="blob"&&e!=="arraybuffer"?this[mu]="blob":this[mu]=e}#r(e,n){this[PR]=e;let r=this[_R]?.dispatcher?.webSocketOptions,s=r?.maxFragments,i=r?.maxPayloadSize,a=new B$(this,n,{maxFragments:s,maxPayloadSize:i});a.on("drain",S$),a.on("error",v$.bind(this)),e.socket.ws=this,this[m$]=a,this.#i=new k$(e.socket),this[bp]=xa.OPEN;let c=e.headersList.get("sec-websocket-extensions");c!==null&&(this.#s=c);let l=e.headersList.get("sec-websocket-protocol");l!==null&&(this.#n=l),OR("open",this)}};Dt.CONNECTING=Dt.prototype.CONNECTING=xa.CONNECTING;Dt.OPEN=Dt.prototype.OPEN=xa.OPEN;Dt.CLOSING=Dt.prototype.CLOSING=xa.CLOSING;Dt.CLOSED=Dt.prototype.CLOSED=xa.CLOSED;Object.defineProperties(Dt.prototype,{CONNECTING:vr,OPEN:vr,CLOSING:vr,CLOSED:vr,url:Yt,readyState:Yt,bufferedAmount:Yt,onopen:Yt,onerror:Yt,onclose:Yt,close:Yt,onmessage:Yt,binaryType:Yt,send:Yt,extensions:Yt,protocol:Yt,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(Dt,{CONNECTING:vr,OPEN:vr,CLOSING:vr,CLOSED:vr});ne.converters["sequence<DOMString>"]=ne.sequenceConverter(ne.converters.DOMString);ne.converters["DOMString or sequence<DOMString>"]=function(t,e,n){return ne.util.Type(t)==="Object"&&Symbol.iterator in t?ne.converters["sequence<DOMString>"](t):ne.converters.DOMString(t,e,n)};ne.converters.WebSocketInit=ne.dictionaryConverter([{key:"protocols",converter:ne.converters["DOMString or sequence<DOMString>"],defaultValue:o(()=>new Array(0),"defaultValue")},{key:"dispatcher",converter:ne.converters.any,defaultValue:o(()=>w$(),"defaultValue")},{key:"headers",converter:ne.nullableConverter(ne.converters.HeadersInit)}]);ne.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(t){return ne.util.Type(t)==="Object"&&!(Symbol.iterator in t)?ne.converters.WebSocketInit(t):{protocols:ne.converters["DOMString or sequence<DOMString>"](t)}};ne.converters.WebSocketSendData=function(t){if(ne.util.Type(t)==="Object"){if($R(t))return ne.converters.Blob(t,{strict:!1});if(ArrayBuffer.isView(t)||YR.isArrayBuffer(t))return ne.converters.BufferSource(t)}return ne.converters.USVString(t)};function S$(){this.ws[PR].socket.resume()}o(S$,"onParserDrain");function v$(t){let e,n;t instanceof R$?(e=t.reason,n=t.code):e=t.message,OR("error",this,()=>new b$("error",{error:t,message:e})),GR(this,n)}o(v$,"onParserError");HR.exports={WebSocket:Dt}});var Rp=T((C3,JR)=>{"use strict";function x$(t){return t.indexOf("\0")===-1}o(x$,"isValidLastEventId");function D$(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(t.charCodeAt(e)<48||t.charCodeAt(e)>57)return!1;return!0}o(D$,"isASCIINumber");function T$(t){return new Promise(e=>{setTimeout(e,t).unref()})}o(T$,"delay");JR.exports={isValidLastEventId:x$,isASCIINumber:D$,delay:T$}});var jR=T((y3,qR)=>{"use strict";var N$=require("node:buffer"),{Transform:F$}=require("node:stream"),{isASCIINumber:U$,isValidLastEventId:M$}=Rp(),qi=[239,187,191],Eu=10,Da=13,L$=58,_$=32,P$=N$.kStringMaxLength,O$=Buffer.from("data"),G$=Buffer.from("event"),$$=Buffer.from("id"),Y$=Buffer.from("retry"),H$=1024,V$=131072,J$=128;function q$(t,e){if(e>=t.length)return!1;for(let n=e;n<t.length;n++)if(t[n]<48||t[n]>57)return!1;return!0}o(q$,"isASCIINumberBytes");function j$(t,e){for(let n=e;n<t.length;n++)if(t[n]===0)return!1;return!0}o(j$,"isValidLastEventIdBytes");function Cu(t,e,n){if(e!==n.length)return!1;for(let r=0;r<e;r++)if(t[r]!==n[r])return!1;return!0}o(Cu,"isFieldName");function Iu(){let t=new Error("EventSource message size exceeded");return t.aborted=!1,t}o(Iu,"createMaxEventSizeExceededError");var kp=class extends F${static{o(this,"EventSourceStream")}state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;chunks=[];chunkIndex=0;pos=0;lineChunkIndex=0;linePos=0;lineLength=0;eventSize=0;eventFieldSizes={data:0,event:0,id:0,retry:0};dataLineCount=0;maxEventSize;maxDataLines;maxBufferedChunks;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},this.maxEventSize=e.maxEventSize??P$;let n=this.maxEventSize>0?Math.min(V$,Math.max(H$,Math.floor(this.maxEventSize/J$))):0;this.maxDataLines=n,this.maxBufferedChunks=n,e.push&&(this.push=e.push)}_transform(e,n,r){if(e.length===0){r();return}if(this.maxEventSize>0&&this.chunks.length>=this.maxBufferedChunks&&e[0]!==Eu&&e[0]!==Da){r(Iu());return}if(this.chunks.push(e),this.checkBOM&&this.handleBOM()){r();return}for(;this.hasCurrentByte();){let s=this.currentByte();if(this.eventEndCheck){if(this.crlfCheck){if(s===Eu){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(s===Eu||s===Da){s===Da&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(s===Eu||s===Da){s===Da&&(this.crlfCheck=!0);try{this.parseLine(this.readLine(),this.event)}catch(i){r(i);return}this.consumeCurrentByte(),this.eventEndCheck=!0;continue}if(this.maxEventSize>0&&++this.lineLength>this.maxEventSize+7){r(Iu());return}this.advanceCursor()}r()}_destroy(e,n){this.chunks.length=0,this.clearEvent(),super._destroy(e,n)}parseLine(e,n){if(e.length===0)return;let r=e.indexOf(L$);if(r===0)return;let s=e.length,i=e.length;if(r!==-1&&(s=r,i=r+1,e[i]===_$&&++i),Cu(e,s,O$)){if(this.maxEventSize>0&&this.dataLineCount>=this.maxDataLines)throw Iu();let a=e.length-i,c=this.eventFieldSizes.data+(n.data===void 0?0:1)+a;this.setEventFieldSize("data",c);let l=e.toString("utf8",i);n.data===void 0?n.data=l:n.data+=`
|
|
45
|
+
`.trim())}};tw.exports=Uh});var da=T((c4,ow)=>{"use strict";var rw=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:fP}=pe(),mP=wi();iw()===void 0&&sw(new mP);function sw(t){if(!t||typeof t.dispatch!="function")throw new fP("Argument agent must implement Agent");Object.defineProperty(globalThis,rw,{value:t,writable:!0,enumerable:!1,configurable:!1})}o(sw,"setGlobalDispatcher");function iw(){return globalThis[rw]}o(iw,"getGlobalDispatcher");ow.exports={setGlobalDispatcher:sw,getGlobalDispatcher:iw}});var Nc=T((d4,aw)=>{"use strict";aw.exports=class{static{o(this,"DecoratorHandler")}#e;constructor(e){if(typeof e!="object"||e===null)throw new TypeError("handler must be an object");this.#e=e}onConnect(...e){return this.#e.onConnect?.(...e)}onError(...e){return this.#e.onError?.(...e)}onUpgrade(...e){return this.#e.onUpgrade?.(...e)}onResponseStarted(...e){return this.#e.onResponseStarted?.(...e)}onHeaders(...e){return this.#e.onHeaders?.(...e)}onData(...e){return this.#e.onData?.(...e)}onComplete(...e){return this.#e.onComplete?.(...e)}onBodySent(...e){return this.#e.onBodySent?.(...e)}}});var cw=T((h4,Aw)=>{"use strict";var EP=dc();Aw.exports=t=>{let e=t?.maxRedirections;return n=>o(function(s,i){let{maxRedirections:a=e,...c}=s;if(!a)return n(s,i);let l=new EP(n,a,s,i);return n(c,l)},"redirectInterceptor")}});var lw=T((f4,uw)=>{"use strict";var CP=Bc();uw.exports=t=>e=>o(function(r,s){return e(r,new CP({...r,retryOptions:{...t,...r.retryOptions}},{handler:s,dispatch:e}))},"retryInterceptor")});var gw=T((E4,dw)=>{"use strict";var IP=ue(),{InvalidArgumentError:yP,RequestAbortedError:QP}=pe(),BP=Nc(),Mh=class extends BP{static{o(this,"DumpHandler")}#e=1024*1024;#t=null;#n=!1;#s=!1;#i=0;#r=null;#o=null;constructor({maxSize:e},n){if(super(n),e!=null&&(!Number.isFinite(e)||e<1))throw new yP("maxSize must be a number greater than 0");this.#e=e??this.#e,this.#o=n}onConnect(e){this.#t=e,this.#o.onConnect(this.#a.bind(this))}#a(e){this.#s=!0,this.#r=e}onHeaders(e,n,r,s){let a=IP.parseHeaders(n)["content-length"];if(a!=null&&a>this.#e)throw new QP(`Response size (${a}) larger than maxSize (${this.#e})`);return this.#s?!0:this.#o.onHeaders(e,n,r,s)}onError(e){this.#n||(e=this.#r??e,this.#o.onError(e))}onData(e){return this.#i=this.#i+e.length,this.#i>=this.#e&&(this.#n=!0,this.#s?this.#o.onError(this.#r):this.#o.onComplete([])),!0}onComplete(e){if(!this.#n){if(this.#s){this.#o.onError(this.reason);return}this.#o.onComplete(e)}}};function wP({maxSize:t}={maxSize:1024*1024}){return e=>o(function(r,s){let{dumpMaxSize:i=t}=r,a=new Mh({maxSize:i},s);return e(r,a)},"Intercept")}o(wP,"createDumpInterceptor");dw.exports=wP});var fw=T((I4,pw)=>{"use strict";var{isIP:bP}=require("node:net"),{lookup:RP}=require("node:dns"),kP=Nc(),{InvalidArgumentError:Ni,InformationalError:SP}=pe(),hw=Math.pow(2,31)-1,Lh=class{static{o(this,"DNSInstance")}#e=0;#t=0;#n=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(e){this.#e=e.maxTTL,this.#t=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#s,this.pick=e.pick??this.#i}get full(){return this.#n.size===this.#t}runLookup(e,n,r){let s=this.#n.get(e.hostname);if(s==null&&this.full){r(null,e.origin);return}let i={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...n.dns,maxTTL:this.#e,maxItems:this.#t};if(s==null)this.lookup(e,i,(a,c)=>{if(a||c==null||c.length===0){r(a??new SP("No DNS entries found"));return}this.setRecords(e,c);let l=this.#n.get(e.hostname),d=this.pick(e,l,i.affinity),g;typeof d.port=="number"?g=`:${d.port}`:e.port!==""?g=`:${e.port}`:g="",r(null,`${e.protocol}//${d.family===6?`[${d.address}]`:d.address}${g}`)});else{let a=this.pick(e,s,i.affinity);if(a==null){this.#n.delete(e.hostname),this.runLookup(e,n,r);return}let c;typeof a.port=="number"?c=`:${a.port}`:e.port!==""?c=`:${e.port}`:c="",r(null,`${e.protocol}//${a.family===6?`[${a.address}]`:a.address}${c}`)}}#s(e,n,r){RP(e.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(s,i)=>{if(s)return r(s);let a=new Map;for(let c of i)a.set(`${c.address}:${c.family}`,c);r(null,a.values())})}#i(e,n,r){let s=null,{records:i,offset:a}=n,c;if(this.dualStack?(r==null&&(a==null||a===hw?(n.offset=0,r=4):(n.offset++,r=(n.offset&1)===1?6:4)),i[r]!=null&&i[r].ips.length>0?c=i[r]:c=i[r===4?6:4]):c=i[r],c==null||c.ips.length===0)return s;c.offset==null||c.offset===hw?c.offset=0:c.offset++;let l=c.offset%c.ips.length;return s=c.ips[l]??null,s==null?s:Date.now()-s.timestamp>s.ttl?(c.ips.splice(l,1),this.pick(e,n,r)):s}setRecords(e,n){let r=Date.now(),s={records:{4:null,6:null}};for(let i of n){i.timestamp=r,typeof i.ttl=="number"?i.ttl=Math.min(i.ttl,this.#e):i.ttl=this.#e;let a=s.records[i.family]??{ips:[]};a.ips.push(i),s.records[i.family]=a}this.#n.set(e.hostname,s)}getHandler(e,n){return new _h(this,e,n)}},_h=class extends kP{static{o(this,"DNSDispatchHandler")}#e=null;#t=null;#n=null;#s=null;#i=null;constructor(e,{origin:n,handler:r,dispatch:s},i){super(r),this.#i=n,this.#s=r,this.#t={...i},this.#e=e,this.#n=s}onError(e){switch(e.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#e.dualStack){this.#e.runLookup(this.#i,this.#t,(n,r)=>{if(n)return this.#s.onError(n);let s={...this.#t,origin:r};this.#n(s,this)});return}this.#s.onError(e);return}case"ENOTFOUND":this.#e.deleteRecord(this.#i);default:this.#s.onError(e);break}}};pw.exports=t=>{if(t?.maxTTL!=null&&(typeof t?.maxTTL!="number"||t?.maxTTL<0))throw new Ni("Invalid maxTTL. Must be a positive number");if(t?.maxItems!=null&&(typeof t?.maxItems!="number"||t?.maxItems<1))throw new Ni("Invalid maxItems. Must be a positive number and greater than zero");if(t?.affinity!=null&&t?.affinity!==4&&t?.affinity!==6)throw new Ni("Invalid affinity. Must be either 4 or 6");if(t?.dualStack!=null&&typeof t?.dualStack!="boolean")throw new Ni("Invalid dualStack. Must be a boolean");if(t?.lookup!=null&&typeof t?.lookup!="function")throw new Ni("Invalid lookup. Must be a function");if(t?.pick!=null&&typeof t?.pick!="function")throw new Ni("Invalid pick. Must be a function");let e=t?.dualStack??!0,n;e?n=t?.affinity??null:n=t?.affinity??4;let r={maxTTL:t?.maxTTL??1e4,lookup:t?.lookup??null,pick:t?.pick??null,dualStack:e,affinity:n,maxItems:t?.maxItems??1/0},s=new Lh(r);return i=>o(function(c,l){let d=c.origin.constructor===URL?c.origin:new URL(c.origin);return bP(d.hostname)!==0?i(c,l):(s.runLookup(d,c,(g,h)=>{if(g)return l.onError(g);let f=null;f={...c,servername:d.hostname,origin:h,headers:{host:d.hostname,...c.headers}},i(f,s.getHandler({origin:d,dispatch:i,handler:l},c))}),!0)},"dnsInterceptor")}});var Is=T((Q4,Bw)=>{"use strict";var{kConstruct:vP}=ke(),{kEnumerableProperty:Fi}=ue(),{iteratorMixin:xP,isValidHeaderName:ga,isValidHeaderValue:Ew}=Qt(),{webidl:he}=je(),Ph=require("node:assert"),Fc=require("node:util"),Pe=Symbol("headers map"),Rt=Symbol("headers map sorted");function mw(t){return t===10||t===13||t===9||t===32}o(mw,"isHTTPWhiteSpaceCharCode");function Cw(t){let e=0,n=t.length;for(;n>e&&mw(t.charCodeAt(n-1));)--n;for(;n>e&&mw(t.charCodeAt(e));)++e;return e===0&&n===t.length?t:t.substring(e,n)}o(Cw,"headerValueNormalize");function Iw(t,e){if(Array.isArray(e))for(let n=0;n<e.length;++n){let r=e[n];if(r.length!==2)throw he.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});Oh(t,r[0],r[1])}else if(typeof e=="object"&&e!==null){let n=Object.keys(e);for(let r=0;r<n.length;++r)Oh(t,n[r],e[n[r]])}else throw he.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}o(Iw,"fill");function Oh(t,e,n){if(n=Cw(n),ga(e)){if(!Ew(n))throw he.errors.invalidArgument({prefix:"Headers.append",value:n,type:"header value"})}else throw he.errors.invalidArgument({prefix:"Headers.append",value:e,type:"header name"});if(Qw(t)==="immutable")throw new TypeError("immutable");return Gh(t).append(e,n,!1)}o(Oh,"appendHeader");function yw(t,e){return t[0]<e[0]?-1:1}o(yw,"compareHeaderName");var Uc=class t{static{o(this,"HeadersList")}cookies=null;constructor(e){e instanceof t?(this[Pe]=new Map(e[Pe]),this[Rt]=e[Rt],this.cookies=e.cookies===null?null:[...e.cookies]):(this[Pe]=new Map(e),this[Rt]=null)}contains(e,n){return this[Pe].has(n?e:e.toLowerCase())}clear(){this[Pe].clear(),this[Rt]=null,this.cookies=null}append(e,n,r){this[Rt]=null;let s=r?e:e.toLowerCase(),i=this[Pe].get(s);if(i){let a=s==="cookie"?"; ":", ";this[Pe].set(s,{name:i.name,value:`${i.value}${a}${n}`})}else this[Pe].set(s,{name:e,value:n});s==="set-cookie"&&(this.cookies??=[]).push(n)}set(e,n,r){this[Rt]=null;let s=r?e:e.toLowerCase();s==="set-cookie"&&(this.cookies=[n]),this[Pe].set(s,{name:e,value:n})}delete(e,n){this[Rt]=null,n||(e=e.toLowerCase()),e==="set-cookie"&&(this.cookies=null),this[Pe].delete(e)}get(e,n){return this[Pe].get(n?e:e.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:e,1:{value:n}}of this[Pe])yield[e,n]}get entries(){let e={};if(this[Pe].size!==0)for(let{name:n,value:r}of this[Pe].values())e[n]=r;return e}rawValues(){return this[Pe].values()}get entriesList(){let e=[];if(this[Pe].size!==0)for(let{0:n,1:{name:r,value:s}}of this[Pe])if(n==="set-cookie")for(let i of this.cookies)e.push([r,i]);else e.push([r,s]);return e}toSortedArray(){let e=this[Pe].size,n=new Array(e);if(e<=32){if(e===0)return n;let r=this[Pe][Symbol.iterator](),s=r.next().value;n[0]=[s[0],s[1].value],Ph(s[1].value!==null);for(let i=1,a=0,c=0,l=0,d=0,g,h;i<e;++i){for(h=r.next().value,g=n[i]=[h[0],h[1].value],Ph(g[1]!==null),l=0,c=i;l<c;)d=l+(c-l>>1),n[d][0]<=g[0]?l=d+1:c=d;if(i!==d){for(a=i;a>l;)n[a]=n[--a];n[l]=g}}if(!r.next().done)throw new TypeError("Unreachable");return n}else{let r=0;for(let{0:s,1:{value:i}}of this[Pe])n[r++]=[s,i],Ph(i!==null);return n.sort(yw)}}},tn=class t{static{o(this,"Headers")}#e;#t;constructor(e=void 0){he.util.markAsUncloneable(this),e!==vP&&(this.#t=new Uc,this.#e="none",e!==void 0&&(e=he.converters.HeadersInit(e,"Headers contructor","init"),Iw(this,e)))}append(e,n){he.brandCheck(this,t),he.argumentLengthCheck(arguments,2,"Headers.append");let r="Headers.append";return e=he.converters.ByteString(e,r,"name"),n=he.converters.ByteString(n,r,"value"),Oh(this,e,n)}delete(e){if(he.brandCheck(this,t),he.argumentLengthCheck(arguments,1,"Headers.delete"),e=he.converters.ByteString(e,"Headers.delete","name"),!ga(e))throw he.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.contains(e,!1)&&this.#t.delete(e,!1)}get(e){he.brandCheck(this,t),he.argumentLengthCheck(arguments,1,"Headers.get");let n="Headers.get";if(e=he.converters.ByteString(e,n,"name"),!ga(e))throw he.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.get(e,!1)}has(e){he.brandCheck(this,t),he.argumentLengthCheck(arguments,1,"Headers.has");let n="Headers.has";if(e=he.converters.ByteString(e,n,"name"),!ga(e))throw he.errors.invalidArgument({prefix:n,value:e,type:"header name"});return this.#t.contains(e,!1)}set(e,n){he.brandCheck(this,t),he.argumentLengthCheck(arguments,2,"Headers.set");let r="Headers.set";if(e=he.converters.ByteString(e,r,"name"),n=he.converters.ByteString(n,r,"value"),n=Cw(n),ga(e)){if(!Ew(n))throw he.errors.invalidArgument({prefix:r,value:n,type:"header value"})}else throw he.errors.invalidArgument({prefix:r,value:e,type:"header name"});if(this.#e==="immutable")throw new TypeError("immutable");this.#t.set(e,n,!1)}getSetCookie(){he.brandCheck(this,t);let e=this.#t.cookies;return e?[...e]:[]}get[Rt](){if(this.#t[Rt])return this.#t[Rt];let e=[],n=this.#t.toSortedArray(),r=this.#t.cookies;if(r===null||r.length===1)return this.#t[Rt]=n;for(let s=0;s<n.length;++s){let{0:i,1:a}=n[s];if(i==="set-cookie")for(let c=0;c<r.length;++c)e.push([i,r[c]]);else e.push([i,a])}return this.#t[Rt]=e}[Fc.inspect.custom](e,n){return n.depth??=e,`Headers ${Fc.formatWithOptions(n,this.#t.entries)}`}static getHeadersGuard(e){return e.#e}static setHeadersGuard(e,n){e.#e=n}static getHeadersList(e){return e.#t}static setHeadersList(e,n){e.#t=n}},{getHeadersGuard:Qw,setHeadersGuard:DP,getHeadersList:Gh,setHeadersList:TP}=tn;Reflect.deleteProperty(tn,"getHeadersGuard");Reflect.deleteProperty(tn,"setHeadersGuard");Reflect.deleteProperty(tn,"getHeadersList");Reflect.deleteProperty(tn,"setHeadersList");xP("Headers",tn,Rt,0,1);Object.defineProperties(tn.prototype,{append:Fi,delete:Fi,get:Fi,has:Fi,set:Fi,getSetCookie:Fi,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Fc.inspect.custom]:{enumerable:!1}});he.converters.HeadersInit=function(t,e,n){if(he.util.Type(t)==="Object"){let r=Reflect.get(t,Symbol.iterator);if(!Fc.types.isProxy(t)&&r===tn.prototype.entries)try{return Gh(t).entriesList}catch{}return typeof r=="function"?he.converters["sequence<sequence<ByteString>>"](t,e,n,r.bind(t)):he.converters["record<ByteString, ByteString>"](t,e,n)}throw he.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};Bw.exports={fill:Iw,compareHeaderName:yw,Headers:tn,HeadersList:Uc,getHeadersGuard:Qw,setHeadersGuard:DP,setHeadersList:TP,getHeadersList:Gh}});var pa=T((w4,Uw)=>{"use strict";var{Headers:vw,HeadersList:ww,fill:NP,getHeadersGuard:FP,setHeadersGuard:xw,setHeadersList:Dw}=Is(),{extractBody:bw,cloneBody:UP,mixinBody:MP,hasFinalizationRegistry:Tw,streamRegistry:Nw,bodyUnusable:LP}=pi(),$h=ue(),Rw=require("node:util"),{kEnumerableProperty:kt}=$h,{isValidReasonPhrase:_P,isCancelled:PP,isAborted:OP,isBlobLike:GP,serializeJavascriptValueToJSONString:$P,isErrorLike:YP,isomorphicEncode:HP,environmentSettingsObject:VP}=Qt(),{redirectStatusSet:JP,nullBodyStatus:qP}=Lo(),{kState:ve,kHeaders:Hn}=gr(),{webidl:oe}=je(),{FormData:jP}=Yo(),{URLSerializer:kw}=gt(),{kConstruct:Lc}=ke(),Yh=require("node:assert"),{types:WP}=require("node:util"),zP=new TextEncoder("utf-8"),ys=class t{static{o(this,"Response")}static error(){return ha(_c(),"immutable")}static json(e,n={}){oe.argumentLengthCheck(arguments,1,"Response.json"),n!==null&&(n=oe.converters.ResponseInit(n));let r=zP.encode($P(e)),s=bw(r),i=ha(Ui({}),"response");return Sw(i,n,{body:s[0],type:"application/json"}),i}static redirect(e,n=302){oe.argumentLengthCheck(arguments,1,"Response.redirect"),e=oe.converters.USVString(e),n=oe.converters["unsigned short"](n);let r;try{r=new URL(e,VP.settingsObject.baseUrl)}catch(a){throw new TypeError(`Failed to parse URL from ${e}`,{cause:a})}if(!JP.has(n))throw new RangeError(`Invalid status code ${n}`);let s=ha(Ui({}),"immutable");s[ve].status=n;let i=HP(kw(r));return s[ve].headersList.append("location",i,!0),s}constructor(e=null,n={}){if(oe.util.markAsUncloneable(this),e===Lc)return;e!==null&&(e=oe.converters.BodyInit(e)),n=oe.converters.ResponseInit(n),this[ve]=Ui({}),this[Hn]=new vw(Lc),xw(this[Hn],"response"),Dw(this[Hn],this[ve].headersList);let r=null;if(e!=null){let[s,i]=bw(e);r={body:s,type:i}}Sw(this,n,r)}get type(){return oe.brandCheck(this,t),this[ve].type}get url(){oe.brandCheck(this,t);let e=this[ve].urlList,n=e[e.length-1]??null;return n===null?"":kw(n,!0)}get redirected(){return oe.brandCheck(this,t),this[ve].urlList.length>1}get status(){return oe.brandCheck(this,t),this[ve].status}get ok(){return oe.brandCheck(this,t),this[ve].status>=200&&this[ve].status<=299}get statusText(){return oe.brandCheck(this,t),this[ve].statusText}get headers(){return oe.brandCheck(this,t),this[Hn]}get body(){return oe.brandCheck(this,t),this[ve].body?this[ve].body.stream:null}get bodyUsed(){return oe.brandCheck(this,t),!!this[ve].body&&$h.isDisturbed(this[ve].body.stream)}clone(){if(oe.brandCheck(this,t),LP(this))throw oe.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=Hh(this[ve]);return Tw&&this[ve].body?.stream&&Nw.register(this,new WeakRef(this[ve].body.stream)),ha(e,FP(this[Hn]))}[Rw.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${Rw.formatWithOptions(n,r)}`}};MP(ys);Object.defineProperties(ys.prototype,{type:kt,url:kt,status:kt,ok:kt,redirected:kt,statusText:kt,headers:kt,clone:kt,body:kt,bodyUsed:kt,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(ys,{json:kt,redirect:kt,error:kt});function Hh(t){if(t.internalResponse)return Fw(Hh(t.internalResponse),t.type);let e=Ui({...t,body:null});return t.body!=null&&(e.body=UP(e,t.body)),e}o(Hh,"cloneResponse");function Ui(t){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...t,headersList:t?.headersList?new ww(t?.headersList):new ww,urlList:t?.urlList?[...t.urlList]:[]}}o(Ui,"makeResponse");function _c(t){let e=YP(t);return Ui({type:"error",status:0,error:e?t:new Error(t&&String(t)),aborted:t&&t.name==="AbortError"})}o(_c,"makeNetworkError");function ZP(t){return t.type==="error"&&t.status===0}o(ZP,"isNetworkError");function Mc(t,e){return e={internalResponse:t,...e},new Proxy(t,{get(n,r){return r in e?e[r]:n[r]},set(n,r,s){return Yh(!(r in e)),n[r]=s,!0}})}o(Mc,"makeFilteredResponse");function Fw(t,e){if(e==="basic")return Mc(t,{type:"basic",headersList:t.headersList});if(e==="cors")return Mc(t,{type:"cors",headersList:t.headersList});if(e==="opaque")return Mc(t,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(e==="opaqueredirect")return Mc(t,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});Yh(!1)}o(Fw,"filterResponse");function KP(t,e=null){return Yh(PP(t)),OP(t)?_c(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:e})):_c(Object.assign(new DOMException("Request was cancelled."),{cause:e}))}o(KP,"makeAppropriateNetworkError");function Sw(t,e,n){if(e.status!==null&&(e.status<200||e.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in e&&e.statusText!=null&&!_P(String(e.statusText)))throw new TypeError("Invalid statusText");if("status"in e&&e.status!=null&&(t[ve].status=e.status),"statusText"in e&&e.statusText!=null&&(t[ve].statusText=e.statusText),"headers"in e&&e.headers!=null&&NP(t[Hn],e.headers),n){if(qP.includes(t.status))throw oe.errors.exception({header:"Response constructor",message:`Invalid response status code ${t.status}`});t[ve].body=n.body,n.type!=null&&!t[ve].headersList.contains("content-type",!0)&&t[ve].headersList.append("content-type",n.type,!0)}}o(Sw,"initializeResponse");function ha(t,e){let n=new ys(Lc);return n[ve]=t,n[Hn]=new vw(Lc),Dw(n[Hn],t.headersList),xw(n[Hn],e),Tw&&t.body?.stream&&Nw.register(n,new WeakRef(t.body.stream)),n}o(ha,"fromInnerResponse");oe.converters.ReadableStream=oe.interfaceConverter(ReadableStream);oe.converters.FormData=oe.interfaceConverter(jP);oe.converters.URLSearchParams=oe.interfaceConverter(URLSearchParams);oe.converters.XMLHttpRequestBodyInit=function(t,e,n){return typeof t=="string"?oe.converters.USVString(t,e,n):GP(t)?oe.converters.Blob(t,e,n,{strict:!1}):ArrayBuffer.isView(t)||WP.isArrayBuffer(t)?oe.converters.BufferSource(t,e,n):$h.isFormDataLike(t)?oe.converters.FormData(t,e,n,{strict:!1}):t instanceof URLSearchParams?oe.converters.URLSearchParams(t,e,n):oe.converters.DOMString(t,e,n)};oe.converters.BodyInit=function(t,e,n){return t instanceof ReadableStream?oe.converters.ReadableStream(t,e,n):t?.[Symbol.asyncIterator]?t:oe.converters.XMLHttpRequestBodyInit(t,e,n)};oe.converters.ResponseInit=oe.dictionaryConverter([{key:"status",converter:oe.converters["unsigned short"],defaultValue:o(()=>200,"defaultValue")},{key:"statusText",converter:oe.converters.ByteString,defaultValue:o(()=>"","defaultValue")},{key:"headers",converter:oe.converters.HeadersInit}]);Uw.exports={isNetworkError:ZP,makeNetworkError:_c,makeResponse:Ui,makeAppropriateNetworkError:KP,filterResponse:Fw,Response:ys,cloneResponse:Hh,fromInnerResponse:ha}});var Pw=T((R4,_w)=>{"use strict";var{kConnected:Mw,kSize:Lw}=ke(),Vh=class{static{o(this,"CompatWeakRef")}constructor(e){this.value=e}deref(){return this.value[Mw]===0&&this.value[Lw]===0?void 0:this.value}},Jh=class{static{o(this,"CompatFinalizer")}constructor(e){this.finalizer=e}register(e,n){e.on&&e.on("disconnect",()=>{e[Mw]===0&&e[Lw]===0&&this.finalizer(n)})}unregister(e){}};_w.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:Vh,FinalizationRegistry:Jh}):{WeakRef,FinalizationRegistry}}});var Mi=T((S4,eb)=>{"use strict";var{extractBody:XP,mixinBody:eO,cloneBody:tO,bodyUnusable:Ow}=pi(),{Headers:Ww,fill:nO,HeadersList:$c,setHeadersGuard:jh,getHeadersGuard:rO,setHeadersList:zw,getHeadersList:Gw}=Is(),{FinalizationRegistry:sO}=Pw()(),Oc=ue(),$w=require("node:util"),{isValidHTTPToken:iO,sameOrigin:Yw,environmentSettingsObject:Pc}=Qt(),{forbiddenMethodsSet:oO,corsSafeListedMethodsSet:aO,referrerPolicy:AO,requestRedirect:cO,requestMode:uO,requestCredentials:lO,requestCache:dO,requestDuplex:gO}=Lo(),{kEnumerableProperty:Oe,normalizedMethodRecordsBase:hO,normalizedMethodRecords:pO}=Oc,{kHeaders:St,kSignal:Gc,kState:Re,kDispatcher:qh}=gr(),{webidl:X}=je(),{URLSerializer:fO}=gt(),{kConstruct:Yc}=ke(),mO=require("node:assert"),{getMaxListeners:Hw,setMaxListeners:Vw,getEventListeners:EO,defaultMaxListeners:Jw}=require("node:events"),CO=Symbol("abortController"),Zw=new sO(({signal:t,abort:e})=>{t.removeEventListener("abort",e)}),Hc=new WeakMap;function qw(t){return e;function e(){let n=t.deref();if(n!==void 0){Zw.unregister(e),this.removeEventListener("abort",e),n.abort(this.reason);let r=Hc.get(n.signal);if(r!==void 0){if(r.size!==0){for(let s of r){let i=s.deref();i!==void 0&&i.abort(this.reason)}r.clear()}Hc.delete(n.signal)}}}}o(qw,"buildAbort");var jw=!1,wr=class t{static{o(this,"Request")}constructor(e,n={}){if(X.util.markAsUncloneable(this),e===Yc)return;let r="Request constructor";X.argumentLengthCheck(arguments,1,r),e=X.converters.RequestInfo(e,r,"input"),n=X.converters.RequestInit(n,r,"init");let s=null,i=null,a=Pc.settingsObject.baseUrl,c=null;if(typeof e=="string"){this[qh]=n.dispatcher;let Q;try{Q=new URL(e,a)}catch(D){throw new TypeError("Failed to parse URL from "+e,{cause:D})}if(Q.username||Q.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+e);s=Vc({urlList:[Q]}),i="cors"}else this[qh]=n.dispatcher||e[qh],mO(e instanceof t),s=e[Re],c=e[Gc];let l=Pc.settingsObject.origin,d="client";if(s.window?.constructor?.name==="EnvironmentSettingsObject"&&Yw(s.window,l)&&(d=s.window),n.window!=null)throw new TypeError(`'window' option '${d}' must be null`);"window"in n&&(d="no-window"),s=Vc({method:s.method,headersList:s.headersList,unsafeRequest:s.unsafeRequest,client:Pc.settingsObject,window:d,priority:s.priority,origin:s.origin,referrer:s.referrer,referrerPolicy:s.referrerPolicy,mode:s.mode,credentials:s.credentials,cache:s.cache,redirect:s.redirect,integrity:s.integrity,keepalive:s.keepalive,reloadNavigation:s.reloadNavigation,historyNavigation:s.historyNavigation,urlList:[...s.urlList]});let g=Object.keys(n).length!==0;if(g&&(s.mode==="navigate"&&(s.mode="same-origin"),s.reloadNavigation=!1,s.historyNavigation=!1,s.origin="client",s.referrer="client",s.referrerPolicy="",s.url=s.urlList[s.urlList.length-1],s.urlList=[s.url]),n.referrer!==void 0){let Q=n.referrer;if(Q==="")s.referrer="no-referrer";else{let D;try{D=new URL(Q,a)}catch(G){throw new TypeError(`Referrer "${Q}" is not a valid URL.`,{cause:G})}D.protocol==="about:"&&D.hostname==="client"||l&&!Yw(D,Pc.settingsObject.baseUrl)?s.referrer="client":s.referrer=D}}n.referrerPolicy!==void 0&&(s.referrerPolicy=n.referrerPolicy);let h;if(n.mode!==void 0?h=n.mode:h=i,h==="navigate")throw X.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(h!=null&&(s.mode=h),n.credentials!==void 0&&(s.credentials=n.credentials),n.cache!==void 0&&(s.cache=n.cache),s.cache==="only-if-cached"&&s.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(n.redirect!==void 0&&(s.redirect=n.redirect),n.integrity!=null&&(s.integrity=String(n.integrity)),n.keepalive!==void 0&&(s.keepalive=!!n.keepalive),n.method!==void 0){let Q=n.method,D=pO[Q];if(D!==void 0)s.method=D;else{if(!iO(Q))throw new TypeError(`'${Q}' is not a valid HTTP method.`);let G=Q.toUpperCase();if(oO.has(G))throw new TypeError(`'${Q}' HTTP method is unsupported.`);Q=hO[G]??Q,s.method=Q}!jw&&s.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),jw=!0)}n.signal!==void 0&&(c=n.signal),this[Re]=s;let f=new AbortController;if(this[Gc]=f.signal,c!=null){if(!c||typeof c.aborted!="boolean"||typeof c.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(c.aborted)f.abort(c.reason);else{this[CO]=f;let Q=new WeakRef(f),D=qw(Q);try{(typeof Hw=="function"&&Hw(c)===Jw||EO(c,"abort").length>=Jw)&&Vw(1500,c)}catch{}Oc.addAbortListener(c,D),Zw.register(f,{signal:c,abort:D},D)}}if(this[St]=new Ww(Yc),zw(this[St],s.headersList),jh(this[St],"request"),h==="no-cors"){if(!aO.has(s.method))throw new TypeError(`'${s.method} is unsupported in no-cors mode.`);jh(this[St],"request-no-cors")}if(g){let Q=Gw(this[St]),D=n.headers!==void 0?n.headers:new $c(Q);if(Q.clear(),D instanceof $c){for(let{name:G,value:P}of D.rawValues())Q.append(G,P,!1);Q.cookies=D.cookies}else nO(this[St],D)}let m=e instanceof t?e[Re].body:null;if((n.body!=null||m!=null)&&(s.method==="GET"||s.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let C=null;if(n.body!=null){let[Q,D]=XP(n.body,s.keepalive);C=Q,D&&!Gw(this[St]).contains("content-type",!0)&&this[St].append("content-type",D)}let y=C??m;if(y!=null&&y.source==null){if(C!=null&&n.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(s.mode!=="same-origin"&&s.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');s.useCORSPreflightFlag=!0}let v=y;if(C==null&&m!=null){if(Ow(e))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let Q=new TransformStream;m.stream.pipeThrough(Q),v={source:m.source,length:m.length,stream:Q.readable}}this[Re].body=v}get method(){return X.brandCheck(this,t),this[Re].method}get url(){return X.brandCheck(this,t),fO(this[Re].url)}get headers(){return X.brandCheck(this,t),this[St]}get destination(){return X.brandCheck(this,t),this[Re].destination}get referrer(){return X.brandCheck(this,t),this[Re].referrer==="no-referrer"?"":this[Re].referrer==="client"?"about:client":this[Re].referrer.toString()}get referrerPolicy(){return X.brandCheck(this,t),this[Re].referrerPolicy}get mode(){return X.brandCheck(this,t),this[Re].mode}get credentials(){return this[Re].credentials}get cache(){return X.brandCheck(this,t),this[Re].cache}get redirect(){return X.brandCheck(this,t),this[Re].redirect}get integrity(){return X.brandCheck(this,t),this[Re].integrity}get keepalive(){return X.brandCheck(this,t),this[Re].keepalive}get isReloadNavigation(){return X.brandCheck(this,t),this[Re].reloadNavigation}get isHistoryNavigation(){return X.brandCheck(this,t),this[Re].historyNavigation}get signal(){return X.brandCheck(this,t),this[Gc]}get body(){return X.brandCheck(this,t),this[Re].body?this[Re].body.stream:null}get bodyUsed(){return X.brandCheck(this,t),!!this[Re].body&&Oc.isDisturbed(this[Re].body.stream)}get duplex(){return X.brandCheck(this,t),"half"}clone(){if(X.brandCheck(this,t),Ow(this))throw new TypeError("unusable");let e=Kw(this[Re]),n=new AbortController;if(this.signal.aborted)n.abort(this.signal.reason);else{let r=Hc.get(this.signal);r===void 0&&(r=new Set,Hc.set(this.signal,r));let s=new WeakRef(n);r.add(s),Oc.addAbortListener(n.signal,qw(s))}return Xw(e,n.signal,rO(this[St]))}[$w.inspect.custom](e,n){n.depth===null&&(n.depth=2),n.colors??=!0;let r={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${$w.formatWithOptions(n,r)}`}};eO(wr);function Vc(t){return{method:t.method??"GET",localURLsOnly:t.localURLsOnly??!1,unsafeRequest:t.unsafeRequest??!1,body:t.body??null,client:t.client??null,reservedClient:t.reservedClient??null,replacesClientId:t.replacesClientId??"",window:t.window??"client",keepalive:t.keepalive??!1,serviceWorkers:t.serviceWorkers??"all",initiator:t.initiator??"",destination:t.destination??"",priority:t.priority??null,origin:t.origin??"client",policyContainer:t.policyContainer??"client",referrer:t.referrer??"client",referrerPolicy:t.referrerPolicy??"",mode:t.mode??"no-cors",useCORSPreflightFlag:t.useCORSPreflightFlag??!1,credentials:t.credentials??"same-origin",useCredentials:t.useCredentials??!1,cache:t.cache??"default",redirect:t.redirect??"follow",integrity:t.integrity??"",cryptoGraphicsNonceMetadata:t.cryptoGraphicsNonceMetadata??"",parserMetadata:t.parserMetadata??"",reloadNavigation:t.reloadNavigation??!1,historyNavigation:t.historyNavigation??!1,userActivation:t.userActivation??!1,taintedOrigin:t.taintedOrigin??!1,redirectCount:t.redirectCount??0,responseTainting:t.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:t.preventNoCacheCacheControlHeaderModification??!1,done:t.done??!1,timingAllowFailed:t.timingAllowFailed??!1,urlList:t.urlList,url:t.urlList[0],headersList:t.headersList?new $c(t.headersList):new $c}}o(Vc,"makeRequest");function Kw(t){let e=Vc({...t,body:null});return t.body!=null&&(e.body=tO(e,t.body)),e}o(Kw,"cloneRequest");function Xw(t,e,n){let r=new wr(Yc);return r[Re]=t,r[Gc]=e,r[St]=new Ww(Yc),zw(r[St],t.headersList),jh(r[St],n),r}o(Xw,"fromInnerRequest");Object.defineProperties(wr.prototype,{method:Oe,url:Oe,headers:Oe,redirect:Oe,clone:Oe,signal:Oe,duplex:Oe,destination:Oe,body:Oe,bodyUsed:Oe,isHistoryNavigation:Oe,isReloadNavigation:Oe,keepalive:Oe,integrity:Oe,cache:Oe,credentials:Oe,attribute:Oe,referrerPolicy:Oe,referrer:Oe,mode:Oe,[Symbol.toStringTag]:{value:"Request",configurable:!0}});X.converters.Request=X.interfaceConverter(wr);X.converters.RequestInfo=function(t,e,n){return typeof t=="string"?X.converters.USVString(t,e,n):t instanceof wr?X.converters.Request(t,e,n):X.converters.USVString(t,e,n)};X.converters.AbortSignal=X.interfaceConverter(AbortSignal);X.converters.RequestInit=X.dictionaryConverter([{key:"method",converter:X.converters.ByteString},{key:"headers",converter:X.converters.HeadersInit},{key:"body",converter:X.nullableConverter(X.converters.BodyInit)},{key:"referrer",converter:X.converters.USVString},{key:"referrerPolicy",converter:X.converters.DOMString,allowedValues:AO},{key:"mode",converter:X.converters.DOMString,allowedValues:uO},{key:"credentials",converter:X.converters.DOMString,allowedValues:lO},{key:"cache",converter:X.converters.DOMString,allowedValues:dO},{key:"redirect",converter:X.converters.DOMString,allowedValues:cO},{key:"integrity",converter:X.converters.DOMString},{key:"keepalive",converter:X.converters.boolean},{key:"signal",converter:X.nullableConverter(t=>X.converters.AbortSignal(t,"RequestInit","signal",{strict:!1}))},{key:"window",converter:X.converters.any},{key:"duplex",converter:X.converters.DOMString,allowedValues:gO},{key:"dispatcher",converter:X.converters.any}]);eb.exports={Request:wr,makeRequest:Vc,fromInnerRequest:Xw,cloneRequest:Kw}});var ma=T((x4,pb)=>{"use strict";var{makeNetworkError:ye,makeAppropriateNetworkError:Jc,filterResponse:Wh,makeResponse:qc,fromInnerResponse:IO}=pa(),{HeadersList:tb}=Is(),{Request:yO,cloneRequest:QO}=Mi(),br=require("node:zlib"),{bytesMatch:BO,makePolicyContainer:wO,clonePolicyContainer:bO,requestBadPort:RO,TAOCheck:kO,appendRequestOriginHeader:SO,responseLocationURL:vO,requestCurrentURL:Qn,setRequestReferrerPolicyOnRedirect:xO,tryUpgradeRequestToAPotentiallyTrustworthyURL:DO,createOpaqueTimingInfo:ep,appendFetchMetadata:TO,corsCheck:NO,crossOriginResourcePolicyCheck:FO,determineRequestsReferrer:UO,coarsenedSharedCurrentTime:fa,createDeferredPromise:MO,isBlobLike:LO,sameOrigin:Xh,isCancelled:Qs,isAborted:nb,isErrorLike:_O,fullyReadBody:PO,readableStreamClose:OO,isomorphicEncode:jc,urlIsLocal:GO,urlIsHttpHttpsScheme:tp,urlHasHttpsScheme:$O,clampAndCoarsenConnectionTimingInfo:YO,simpleRangeHeaderValue:HO,buildContentRange:VO,createInflate:JO,extractMimeType:qO}=Qt(),{kState:ob,kDispatcher:jO}=gr(),Bs=require("node:assert"),{safelyExtractBody:np,extractBody:rb}=pi(),{redirectStatusSet:ab,nullBodyStatus:Ab,safeMethodsSet:WO,requestBodyHeader:zO,subresourceSet:ZO}=Lo(),KO=require("node:events"),{Readable:XO,pipeline:eG,finished:tG}=require("node:stream"),{addAbortListener:nG,isErrored:rG,isReadable:Wc,bufferToLowerCasedHeaderName:sb}=ue(),{dataURLProcessor:sG,serializeAMimeType:iG,minimizeSupportedMimeType:oG}=gt(),{getGlobalDispatcher:aG}=da(),{webidl:AG}=je(),{STATUS_CODES:cG}=require("node:http"),uG=["GET","HEAD"],lG=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",zh,zc=class extends KO{static{o(this,"Fetch")}constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){this.state==="ongoing"&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}};function dG(t){cb(t,"fetch")}o(dG,"handleFetchDone");function gG(t,e=void 0){AG.argumentLengthCheck(arguments,1,"globalThis.fetch");let n=MO(),r;try{r=new yO(t,e)}catch(g){return n.reject(g),n.promise}let s=r[ob];if(r.signal.aborted)return Zh(n,s,null,r.signal.reason),n.promise;s.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(s.serviceWorkers="none");let a=null,c=!1,l=null;return nG(r.signal,()=>{c=!0,Bs(l!=null),l.abort(r.signal.reason);let g=a?.deref();Zh(n,s,g,r.signal.reason)}),l=lb({request:s,processResponseEndOfBody:dG,processResponse:o(g=>{if(!c){if(g.aborted){Zh(n,s,a,l.serializedAbortReason);return}if(g.type==="error"){n.reject(new TypeError("fetch failed",{cause:g.error}));return}a=new WeakRef(IO(g,"immutable")),n.resolve(a.deref()),n=null}},"processResponse"),dispatcher:r[jO]}),n.promise}o(gG,"fetch");function cb(t,e="other"){if(t.type==="error"&&t.aborted||!t.urlList?.length)return;let n=t.urlList[0],r=t.timingInfo,s=t.cacheState;tp(n)&&r!==null&&(t.timingAllowPassed||(r=ep({startTime:r.startTime}),s=""),r.endTime=fa(),t.timingInfo=r,ub(r,n.href,e,globalThis,s))}o(cb,"finalizeAndReportTiming");var ub=performance.markResourceTiming;function Zh(t,e,n,r){if(t&&t.reject(r),e.body!=null&&Wc(e.body?.stream)&&e.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i}),n==null)return;let s=n[ob];s.body!=null&&Wc(s.body?.stream)&&s.body.stream.cancel(r).catch(i=>{if(i.code!=="ERR_INVALID_STATE")throw i})}o(Zh,"abortFetch");function lb({request:t,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseEndOfBody:s,processResponseConsumeBody:i,useParallelQueue:a=!1,dispatcher:c=aG()}){Bs(c);let l=null,d=!1;t.client!=null&&(l=t.client.globalObject,d=t.client.crossOriginIsolatedCapability);let g=fa(d),h=ep({startTime:g}),f={controller:new zc(c),request:t,timingInfo:h,processRequestBodyChunkLength:e,processRequestEndOfBody:n,processResponse:r,processResponseConsumeBody:i,processResponseEndOfBody:s,taskDestination:l,crossOriginIsolatedCapability:d};return Bs(!t.body||t.body.stream),t.window==="client"&&(t.window=t.client?.globalObject?.constructor?.name==="Window"?t.client:"no-window"),t.origin==="client"&&(t.origin=t.client.origin),t.policyContainer==="client"&&(t.client!=null?t.policyContainer=bO(t.client.policyContainer):t.policyContainer=wO()),t.headersList.contains("accept",!0)||t.headersList.append("accept","*/*",!0),t.headersList.contains("accept-language",!0)||t.headersList.append("accept-language","*",!0),t.priority,ZO.has(t.destination),db(f).catch(m=>{f.controller.terminate(m)}),f.controller}o(lb,"fetching");async function db(t,e=!1){let n=t.request,r=null;if(n.localURLsOnly&&!GO(Qn(n))&&(r=ye("local URLs only")),DO(n),RO(n)==="blocked"&&(r=ye("bad port")),n.referrerPolicy===""&&(n.referrerPolicy=n.policyContainer.referrerPolicy),n.referrer!=="no-referrer"&&(n.referrer=UO(n)),r===null&&(r=await(async()=>{let i=Qn(n);return Xh(i,n.url)&&n.responseTainting==="basic"||i.protocol==="data:"||n.mode==="navigate"||n.mode==="websocket"?(n.responseTainting="basic",await ib(t)):n.mode==="same-origin"?ye('request mode cannot be "same-origin"'):n.mode==="no-cors"?n.redirect!=="follow"?ye('redirect mode cannot be "follow" for "no-cors" request'):(n.responseTainting="opaque",await ib(t)):tp(Qn(n))?(n.responseTainting="cors",await gb(t)):ye("URL scheme must be a HTTP(S) scheme")})()),e)return r;r.status!==0&&!r.internalResponse&&(n.responseTainting,n.responseTainting==="basic"?r=Wh(r,"basic"):n.responseTainting==="cors"?r=Wh(r,"cors"):n.responseTainting==="opaque"?r=Wh(r,"opaque"):Bs(!1));let s=r.status===0?r:r.internalResponse;if(s.urlList.length===0&&s.urlList.push(...n.urlList),n.timingAllowFailed||(r.timingAllowPassed=!0),r.type==="opaque"&&s.status===206&&s.rangeRequested&&!n.headers.contains("range",!0)&&(r=s=ye()),r.status!==0&&(n.method==="HEAD"||n.method==="CONNECT"||Ab.includes(s.status))&&(s.body=null,t.controller.dump=!0),n.integrity){let i=o(c=>Kh(t,ye(c)),"processBodyError");if(n.responseTainting==="opaque"||r.body==null){i(r.error);return}let a=o(c=>{if(!BO(c,n.integrity)){i("integrity mismatch");return}r.body=np(c)[0],Kh(t,r)},"processBody");await PO(r.body,a,i)}else Kh(t,r)}o(db,"mainFetch");function ib(t){if(Qs(t)&&t.request.redirectCount===0)return Promise.resolve(Jc(t));let{request:e}=t,{protocol:n}=Qn(e);switch(n){case"about:":return Promise.resolve(ye("about scheme is not supported"));case"blob:":{zh||(zh=require("node:buffer").resolveObjectURL);let r=Qn(e);if(r.search.length!==0)return Promise.resolve(ye("NetworkError when attempting to fetch resource."));let s=zh(r.toString());if(e.method!=="GET"||!LO(s))return Promise.resolve(ye("invalid method"));let i=qc(),a=s.size,c=jc(`${a}`),l=s.type;if(e.headersList.contains("range",!0)){i.rangeRequested=!0;let d=e.headersList.get("range",!0),g=HO(d,!0);if(g==="failure")return Promise.resolve(ye("failed to fetch the data URL"));let{rangeStartValue:h,rangeEndValue:f}=g;if(h===null)h=a-f,f=h+f-1;else{if(h>=a)return Promise.resolve(ye("Range start is greater than the blob's size."));(f===null||f>=a)&&(f=a-1)}let m=s.slice(h,f,l),C=rb(m);i.body=C[0];let y=jc(`${m.size}`),v=VO(h,f,a);i.status=206,i.statusText="Partial Content",i.headersList.set("content-length",y,!0),i.headersList.set("content-type",l,!0),i.headersList.set("content-range",v,!0)}else{let d=rb(s);i.statusText="OK",i.body=d[0],i.headersList.set("content-length",c,!0),i.headersList.set("content-type",l,!0)}return Promise.resolve(i)}case"data:":{let r=Qn(e),s=sG(r);if(s==="failure")return Promise.resolve(ye("failed to fetch the data URL"));let i=iG(s.mimeType);return Promise.resolve(qc({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:i}]],body:np(s.body)[0]}))}case"file:":return Promise.resolve(ye("not implemented... yet..."));case"http:":case"https:":return gb(t).catch(r=>ye(r));default:return Promise.resolve(ye("unknown scheme"))}}o(ib,"schemeFetch");function hG(t,e){t.request.done=!0,t.processResponseDone!=null&&queueMicrotask(()=>t.processResponseDone(e))}o(hG,"finalizeResponse");function Kh(t,e){let n=t.timingInfo,r=o(()=>{let i=Date.now();t.request.destination==="document"&&(t.controller.fullTimingInfo=n),t.controller.reportTimingSteps=()=>{if(t.request.url.protocol!=="https:")return;n.endTime=i;let c=e.cacheState,l=e.bodyInfo;e.timingAllowPassed||(n=ep(n),c="");let d=0;if(t.request.mode!=="navigator"||!e.hasCrossOriginRedirects){d=e.status;let g=qO(e.headersList);g!=="failure"&&(l.contentType=oG(g))}t.request.initiatorType!=null&&ub(n,t.request.url.href,t.request.initiatorType,globalThis,c,l,d)};let a=o(()=>{t.request.done=!0,t.processResponseEndOfBody!=null&&queueMicrotask(()=>t.processResponseEndOfBody(e)),t.request.initiatorType!=null&&t.controller.reportTimingSteps()},"processResponseEndOfBodyTask");queueMicrotask(()=>a())},"processResponseEndOfBody");t.processResponse!=null&&queueMicrotask(()=>{t.processResponse(e),t.processResponse=null});let s=e.type==="error"?e:e.internalResponse??e;s.body==null?r():tG(s.body.stream,()=>{r()})}o(Kh,"fetchFinale");async function gb(t){let e=t.request,n=null,r=null,s=t.timingInfo;if(e.serviceWorkers,n===null){if(e.redirect==="follow"&&(e.serviceWorkers="none"),r=n=await hb(t),e.responseTainting==="cors"&&NO(e,n)==="failure")return ye("cors failure");kO(e,n)==="failure"&&(e.timingAllowFailed=!0)}return(e.responseTainting==="opaque"||n.type==="opaque")&&FO(e.origin,e.client,e.destination,r)==="blocked"?ye("blocked"):(ab.has(r.status)&&(e.redirect!=="manual"&&t.controller.connection.destroy(void 0,!1),e.redirect==="error"?n=ye("unexpected redirect"):e.redirect==="manual"?n=r:e.redirect==="follow"?n=await pG(t,n):Bs(!1)),n.timingInfo=s,n)}o(gb,"httpFetch");function pG(t,e){let n=t.request,r=e.internalResponse?e.internalResponse:e,s;try{if(s=vO(r,Qn(n).hash),s==null)return e}catch(a){return Promise.resolve(ye(a))}if(!tp(s))return Promise.resolve(ye("URL scheme must be a HTTP(S) scheme"));if(n.redirectCount===20)return Promise.resolve(ye("redirect count exceeded"));if(n.redirectCount+=1,n.mode==="cors"&&(s.username||s.password)&&!Xh(n,s))return Promise.resolve(ye('cross origin not allowed for request mode "cors"'));if(n.responseTainting==="cors"&&(s.username||s.password))return Promise.resolve(ye('URL cannot contain credentials for request mode "cors"'));if(r.status!==303&&n.body!=null&&n.body.source==null)return Promise.resolve(ye());if([301,302].includes(r.status)&&n.method==="POST"||r.status===303&&!uG.includes(n.method)){n.method="GET",n.body=null;for(let a of zO)n.headersList.delete(a)}Xh(Qn(n),s)||(n.headersList.delete("authorization",!0),n.headersList.delete("proxy-authorization",!0),n.headersList.delete("cookie",!0),n.headersList.delete("host",!0)),n.body!=null&&(Bs(n.body.source!=null),n.body=np(n.body.source)[0]);let i=t.timingInfo;return i.redirectEndTime=i.postRedirectStartTime=fa(t.crossOriginIsolatedCapability),i.redirectStartTime===0&&(i.redirectStartTime=i.startTime),n.urlList.push(s),xO(n,r),db(t,!0)}o(pG,"httpRedirectFetch");async function hb(t,e=!1,n=!1){let r=t.request,s=null,i=null,a=null,c=null,l=!1;r.window==="no-window"&&r.redirect==="error"?(s=t,i=r):(i=QO(r),s={...t},s.request=i);let d=r.credentials==="include"||r.credentials==="same-origin"&&r.responseTainting==="basic",g=i.body?i.body.length:null,h=null;if(i.body==null&&["POST","PUT"].includes(i.method)&&(h="0"),g!=null&&(h=jc(`${g}`)),h!=null&&i.headersList.append("content-length",h,!0),g!=null&&i.keepalive,i.referrer instanceof URL&&i.headersList.append("referer",jc(i.referrer.href),!0),SO(i),TO(i),i.headersList.contains("user-agent",!0)||i.headersList.append("user-agent",lG),i.cache==="default"&&(i.headersList.contains("if-modified-since",!0)||i.headersList.contains("if-none-match",!0)||i.headersList.contains("if-unmodified-since",!0)||i.headersList.contains("if-match",!0)||i.headersList.contains("if-range",!0))&&(i.cache="no-store"),i.cache==="no-cache"&&!i.preventNoCacheCacheControlHeaderModification&&!i.headersList.contains("cache-control",!0)&&i.headersList.append("cache-control","max-age=0",!0),(i.cache==="no-store"||i.cache==="reload")&&(i.headersList.contains("pragma",!0)||i.headersList.append("pragma","no-cache",!0),i.headersList.contains("cache-control",!0)||i.headersList.append("cache-control","no-cache",!0)),i.headersList.contains("range",!0)&&i.headersList.append("accept-encoding","identity",!0),i.headersList.contains("accept-encoding",!0)||($O(Qn(i))?i.headersList.append("accept-encoding","br, gzip, deflate",!0):i.headersList.append("accept-encoding","gzip, deflate",!0)),i.headersList.delete("host",!0),c==null&&(i.cache="no-store"),i.cache!=="no-store"&&i.cache,a==null){if(i.cache==="only-if-cached")return ye("only if cached");let f=await fG(s,d,n);!WO.has(i.method)&&f.status>=200&&f.status<=399,l&&f.status,a==null&&(a=f)}if(a.urlList=[...i.urlList],i.headersList.contains("range",!0)&&(a.rangeRequested=!0),a.requestIncludesCredentials=d,a.status===407)return r.window==="no-window"?ye():Qs(t)?Jc(t):ye("proxy authentication required");if(a.status===421&&!n&&(r.body==null||r.body.source!=null)){if(Qs(t))return Jc(t);t.controller.connection.destroy(),a=await hb(t,e,!0)}return a}o(hb,"httpNetworkOrCacheFetch");async function fG(t,e=!1,n=!1){Bs(!t.controller.connection||t.controller.connection.destroyed),t.controller.connection={abort:null,destroyed:!1,destroy(C,y=!0){this.destroyed||(this.destroyed=!0,y&&this.abort?.(C??new DOMException("The operation was aborted.","AbortError")))}};let r=t.request,s=null,i=t.timingInfo;null==null&&(r.cache="no-store");let c=n?"yes":"no";r.mode;let l=null;if(r.body==null&&t.processRequestEndOfBody)queueMicrotask(()=>t.processRequestEndOfBody());else if(r.body!=null){let C=o(async function*(Q){Qs(t)||(yield Q,t.processRequestBodyChunkLength?.(Q.byteLength))},"processBodyChunk"),y=o(()=>{Qs(t)||t.processRequestEndOfBody&&t.processRequestEndOfBody()},"processEndOfBody"),v=o(Q=>{Qs(t)||(Q.name==="AbortError"?t.controller.abort():t.controller.terminate(Q))},"processBodyError");l=(async function*(){try{for await(let Q of r.body.stream)yield*C(Q);y()}catch(Q){v(Q)}})()}try{let{body:C,status:y,statusText:v,headersList:Q,socket:D}=await m({body:l});if(D)s=qc({status:y,statusText:v,headersList:Q,socket:D});else{let G=C[Symbol.asyncIterator]();t.controller.next=()=>G.next(),s=qc({status:y,statusText:v,headersList:Q})}}catch(C){return C.name==="AbortError"?(t.controller.connection.destroy(),Jc(t,C)):ye(C)}let d=o(async()=>{await t.controller.resume()},"pullAlgorithm"),g=o(C=>{Qs(t)||t.controller.abort(C)},"cancelAlgorithm"),h=new ReadableStream({async start(C){t.controller.controller=C},async pull(C){await d(C)},async cancel(C){await g(C)},type:"bytes"});s.body={stream:h,source:null,length:null},t.controller.resume||t.controller.on("terminated",f),t.controller.resume=async()=>{for(;;){let C,y;try{let{done:Q,value:D}=await t.controller.next();if(nb(t))break;C=Q?void 0:D}catch(Q){t.controller.ended&&!i.encodedBodySize?C=void 0:(C=Q,y=!0)}if(C===void 0){OO(t.controller.controller),hG(t,s);return}if(i.decodedBodySize+=C?.byteLength??0,y){t.controller.terminate(C);return}let v=new Uint8Array(C);if(v.byteLength&&t.controller.controller.enqueue(v),rG(h)){t.controller.terminate();return}if(t.controller.controller.desiredSize<=0)return}};function f(C){nb(t)?(s.aborted=!0,Wc(h)&&t.controller.controller.error(t.controller.serializedAbortReason)):Wc(h)&&t.controller.controller.error(new TypeError("terminated",{cause:_O(C)?C:void 0})),t.controller.connection.destroy()}return o(f,"onAborted"),s;function m({body:C}){let y=Qn(r),v=t.controller.dispatcher;return new Promise((Q,D)=>v.dispatch({path:y.pathname+y.search,origin:y.origin,method:r.method,body:v.isMockActive?r.body&&(r.body.source||r.body.stream):C,headers:r.headersList.entries,maxRedirections:0,upgrade:r.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(G){let{connection:P}=t.controller;i.finalConnectionTimingInfo=YO(void 0,i.postRedirectStartTime,t.crossOriginIsolatedCapability),P.destroyed?G(new DOMException("The operation was aborted.","AbortError")):(t.controller.on("terminated",G),this.abort=P.abort=G),i.finalNetworkRequestStartTime=fa(t.crossOriginIsolatedCapability)},onResponseStarted(){i.finalNetworkResponseStartTime=fa(t.crossOriginIsolatedCapability)},onHeaders(G,P,ae,Ee){if(G<200)return;let Ce="",De=new tb;for(let Ge=0;Ge<P.length;Ge+=2)De.append(sb(P[Ge]),P[Ge+1].toString("latin1"),!0);Ce=De.get("location",!0);let et=[],sn=Ce&&r.redirect==="follow"&&ab.has(G);if(r.method!=="HEAD"&&r.method!=="CONNECT"&&!Ab.includes(G)&&!sn){let Ge=De.get("content-encoding",!0),Tt=Ge?Ge.toLowerCase().split(","):[],xe=5;if(Tt.length>xe)return this.abort(new Error(`too many content-encodings in response: ${Tt.length}, maximum allowed is ${xe}`)),!0;for(let Nt=Tt.length-1;Nt>=0;--Nt){let $=Tt[Nt].trim();if($==="x-gzip"||$==="gzip")et.push(br.createGunzip({flush:br.constants.Z_SYNC_FLUSH,finishFlush:br.constants.Z_SYNC_FLUSH}));else if($==="deflate")et.push(JO({flush:br.constants.Z_SYNC_FLUSH,finishFlush:br.constants.Z_SYNC_FLUSH}));else if($==="br")et.push(br.createBrotliDecompress({flush:br.constants.BROTLI_OPERATION_FLUSH,finishFlush:br.constants.BROTLI_OPERATION_FLUSH}));else{et.length=0;break}}}this.body=new XO({read:ae});let At=this.onError.bind(this);return Q({status:G,statusText:Ee,headersList:De,body:et.length?eG(this.body,...et,Ge=>{Ge&&this.onError(Ge)}).on("error",At):this.body.on("error",At)}),!0},onData(G){if(t.controller.dump)return;let P=G;return i.encodedBodySize+=P.byteLength,this.body.push(P)},onComplete(){this.abort&&t.controller.off("terminated",this.abort),t.controller.ended=!0,this.body.push(null)},onError(G){this.abort&&t.controller.off("terminated",this.abort),this.body?.destroy(G),t.controller.terminate(G),D(G)},onUpgrade(G,P,ae){if(G!==101)return;let Ee=new tb;for(let Ce=0;Ce<P.length;Ce+=2)Ee.append(sb(P[Ce]),P[Ce+1].toString("latin1"),!0);return Q({status:G,statusText:cG[G],headersList:Ee,socket:ae}),!0}}))}o(m,"dispatch")}o(fG,"httpNetworkFetch");pb.exports={fetch:gG,Fetch:zc,fetching:lb,finalizeAndReportTiming:cb}});var rp=T((T4,fb)=>{"use strict";fb.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var Eb=T((N4,mb)=>{"use strict";var{webidl:vt}=je(),Zc=Symbol("ProgressEvent state"),sp=class t extends Event{static{o(this,"ProgressEvent")}constructor(e,n={}){e=vt.converters.DOMString(e,"ProgressEvent constructor","type"),n=vt.converters.ProgressEventInit(n??{}),super(e,n),this[Zc]={lengthComputable:n.lengthComputable,loaded:n.loaded,total:n.total}}get lengthComputable(){return vt.brandCheck(this,t),this[Zc].lengthComputable}get loaded(){return vt.brandCheck(this,t),this[Zc].loaded}get total(){return vt.brandCheck(this,t),this[Zc].total}};vt.converters.ProgressEventInit=vt.dictionaryConverter([{key:"lengthComputable",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"loaded",converter:vt.converters["unsigned long long"],defaultValue:o(()=>0,"defaultValue")},{key:"total",converter:vt.converters["unsigned long long"],defaultValue:o(()=>0,"defaultValue")},{key:"bubbles",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"cancelable",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"composed",converter:vt.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}]);mb.exports={ProgressEvent:sp}});var Ib=T((U4,Cb)=>{"use strict";function mG(t){if(!t)return"failure";switch(t.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}o(mG,"getEncoding");Cb.exports={getEncoding:mG}});var Sb=T((L4,kb)=>{"use strict";var{kState:Li,kError:ip,kResult:yb,kAborted:Ea,kLastProgressEventFired:op}=rp(),{ProgressEvent:EG}=Eb(),{getEncoding:Qb}=Ib(),{serializeAMimeType:CG,parseMIMEType:Bb}=gt(),{types:IG}=require("node:util"),{StringDecoder:wb}=require("string_decoder"),{btoa:bb}=require("node:buffer"),yG={enumerable:!0,writable:!1,configurable:!1};function QG(t,e,n,r){if(t[Li]==="loading")throw new DOMException("Invalid state","InvalidStateError");t[Li]="loading",t[yb]=null,t[ip]=null;let i=e.stream().getReader(),a=[],c=i.read(),l=!0;(async()=>{for(;!t[Ea];)try{let{done:d,value:g}=await c;if(l&&!t[Ea]&&queueMicrotask(()=>{Rr("loadstart",t)}),l=!1,!d&&IG.isUint8Array(g))a.push(g),(t[op]===void 0||Date.now()-t[op]>=50)&&!t[Ea]&&(t[op]=Date.now(),queueMicrotask(()=>{Rr("progress",t)})),c=i.read();else if(d){queueMicrotask(()=>{t[Li]="done";try{let h=BG(a,n,e.type,r);if(t[Ea])return;t[yb]=h,Rr("load",t)}catch(h){t[ip]=h,Rr("error",t)}t[Li]!=="loading"&&Rr("loadend",t)});break}}catch(d){if(t[Ea])return;queueMicrotask(()=>{t[Li]="done",t[ip]=d,Rr("error",t),t[Li]!=="loading"&&Rr("loadend",t)});break}})()}o(QG,"readOperation");function Rr(t,e){let n=new EG(t,{bubbles:!1,cancelable:!1});e.dispatchEvent(n)}o(Rr,"fireAProgressEvent");function BG(t,e,n,r){switch(e){case"DataURL":{let s="data:",i=Bb(n||"application/octet-stream");i!=="failure"&&(s+=CG(i)),s+=";base64,";let a=new wb("latin1");for(let c of t)s+=bb(a.write(c));return s+=bb(a.end()),s}case"Text":{let s="failure";if(r&&(s=Qb(r)),s==="failure"&&n){let i=Bb(n);i!=="failure"&&(s=Qb(i.parameters.get("charset")))}return s==="failure"&&(s="UTF-8"),wG(t,s)}case"ArrayBuffer":return Rb(t).buffer;case"BinaryString":{let s="",i=new wb("latin1");for(let a of t)s+=i.write(a);return s+=i.end(),s}}}o(BG,"packageData");function wG(t,e){let n=Rb(t),r=bG(n),s=0;r!==null&&(e=r,s=r==="UTF-8"?3:2);let i=n.slice(s);return new TextDecoder(e).decode(i)}o(wG,"decode");function bG(t){let[e,n,r]=t;return e===239&&n===187&&r===191?"UTF-8":e===254&&n===255?"UTF-16BE":e===255&&n===254?"UTF-16LE":null}o(bG,"BOMSniffing");function Rb(t){let e=t.reduce((r,s)=>r+s.byteLength,0),n=0;return t.reduce((r,s)=>(r.set(s,n),n+=s.byteLength,r),new Uint8Array(e))}o(Rb,"combineByteSequences");kb.exports={staticPropertyDescriptors:yG,readOperation:QG,fireAProgressEvent:Rr}});var Tb=T((P4,Db)=>{"use strict";var{staticPropertyDescriptors:_i,readOperation:Kc,fireAProgressEvent:vb}=Sb(),{kState:ws,kError:xb,kResult:Xc,kEvents:fe,kAborted:RG}=rp(),{webidl:Be}=je(),{kEnumerableProperty:ft}=ue(),nn=class t extends EventTarget{static{o(this,"FileReader")}constructor(){super(),this[ws]="empty",this[Xc]=null,this[xb]=null,this[fe]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),e=Be.converters.Blob(e,{strict:!1}),Kc(this,e,"ArrayBuffer")}readAsBinaryString(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),e=Be.converters.Blob(e,{strict:!1}),Kc(this,e,"BinaryString")}readAsText(e,n=void 0){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsText"),e=Be.converters.Blob(e,{strict:!1}),n!==void 0&&(n=Be.converters.DOMString(n,"FileReader.readAsText","encoding")),Kc(this,e,"Text",n)}readAsDataURL(e){Be.brandCheck(this,t),Be.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),e=Be.converters.Blob(e,{strict:!1}),Kc(this,e,"DataURL")}abort(){if(this[ws]==="empty"||this[ws]==="done"){this[Xc]=null;return}this[ws]==="loading"&&(this[ws]="done",this[Xc]=null),this[RG]=!0,vb("abort",this),this[ws]!=="loading"&&vb("loadend",this)}get readyState(){switch(Be.brandCheck(this,t),this[ws]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return Be.brandCheck(this,t),this[Xc]}get error(){return Be.brandCheck(this,t),this[xb]}get onloadend(){return Be.brandCheck(this,t),this[fe].loadend}set onloadend(e){Be.brandCheck(this,t),this[fe].loadend&&this.removeEventListener("loadend",this[fe].loadend),typeof e=="function"?(this[fe].loadend=e,this.addEventListener("loadend",e)):this[fe].loadend=null}get onerror(){return Be.brandCheck(this,t),this[fe].error}set onerror(e){Be.brandCheck(this,t),this[fe].error&&this.removeEventListener("error",this[fe].error),typeof e=="function"?(this[fe].error=e,this.addEventListener("error",e)):this[fe].error=null}get onloadstart(){return Be.brandCheck(this,t),this[fe].loadstart}set onloadstart(e){Be.brandCheck(this,t),this[fe].loadstart&&this.removeEventListener("loadstart",this[fe].loadstart),typeof e=="function"?(this[fe].loadstart=e,this.addEventListener("loadstart",e)):this[fe].loadstart=null}get onprogress(){return Be.brandCheck(this,t),this[fe].progress}set onprogress(e){Be.brandCheck(this,t),this[fe].progress&&this.removeEventListener("progress",this[fe].progress),typeof e=="function"?(this[fe].progress=e,this.addEventListener("progress",e)):this[fe].progress=null}get onload(){return Be.brandCheck(this,t),this[fe].load}set onload(e){Be.brandCheck(this,t),this[fe].load&&this.removeEventListener("load",this[fe].load),typeof e=="function"?(this[fe].load=e,this.addEventListener("load",e)):this[fe].load=null}get onabort(){return Be.brandCheck(this,t),this[fe].abort}set onabort(e){Be.brandCheck(this,t),this[fe].abort&&this.removeEventListener("abort",this[fe].abort),typeof e=="function"?(this[fe].abort=e,this.addEventListener("abort",e)):this[fe].abort=null}};nn.EMPTY=nn.prototype.EMPTY=0;nn.LOADING=nn.prototype.LOADING=1;nn.DONE=nn.prototype.DONE=2;Object.defineProperties(nn.prototype,{EMPTY:_i,LOADING:_i,DONE:_i,readAsArrayBuffer:ft,readAsBinaryString:ft,readAsText:ft,readAsDataURL:ft,abort:ft,readyState:ft,result:ft,error:ft,onloadstart:ft,onprogress:ft,onload:ft,onabort:ft,onerror:ft,onloadend:ft,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(nn,{EMPTY:_i,LOADING:_i,DONE:_i});Db.exports={FileReader:nn}});var eu=T((G4,Nb)=>{"use strict";Nb.exports={kConstruct:ke().kConstruct}});var Mb=T(($4,Ub)=>{"use strict";var kG=require("node:assert"),{URLSerializer:Fb}=gt(),{isValidHeaderName:SG}=Qt();function vG(t,e,n=!1){let r=Fb(t,n),s=Fb(e,n);return r===s}o(vG,"urlEquals");function xG(t){kG(t!==null);let e=[];for(let n of t.split(","))n=n.trim(),SG(n)&&e.push(n);return e}o(xG,"getFieldValues");Ub.exports={urlEquals:vG,getFieldValues:xG}});var Pb=T((H4,_b)=>{"use strict";var{kConstruct:DG}=eu(),{urlEquals:TG,getFieldValues:ap}=Mb(),{kEnumerableProperty:bs,isDisturbed:NG}=ue(),{webidl:q}=je(),{Response:FG,cloneResponse:UG,fromInnerResponse:MG}=pa(),{Request:Vn,fromInnerRequest:LG}=Mi(),{kState:rn}=gr(),{fetching:_G}=ma(),{urlIsHttpHttpsScheme:tu,createDeferredPromise:Pi,readAllBytes:PG}=Qt(),Ap=require("node:assert"),nu=class t{static{o(this,"Cache")}#e;constructor(){arguments[0]!==DG&&q.illegalConstructor(),q.util.markAsUncloneable(this),this.#e=arguments[1]}async match(e,n={}){q.brandCheck(this,t);let r="Cache.match";q.argumentLengthCheck(arguments,1,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.CacheQueryOptions(n,r,"options");let s=this.#i(e,n,1);if(s.length!==0)return s[0]}async matchAll(e=void 0,n={}){q.brandCheck(this,t);let r="Cache.matchAll";return e!==void 0&&(e=q.converters.RequestInfo(e,r,"request")),n=q.converters.CacheQueryOptions(n,r,"options"),this.#i(e,n)}async add(e){q.brandCheck(this,t);let n="Cache.add";q.argumentLengthCheck(arguments,1,n),e=q.converters.RequestInfo(e,n,"request");let r=[e];return await this.addAll(r)}async addAll(e){q.brandCheck(this,t);let n="Cache.addAll";q.argumentLengthCheck(arguments,1,n);let r=[],s=[];for(let f of e){if(f===void 0)throw q.errors.conversionFailed({prefix:n,argument:"Argument 1",types:["undefined is not allowed"]});if(f=q.converters.RequestInfo(f),typeof f=="string")continue;let m=f[rn];if(!tu(m.url)||m.method!=="GET")throw q.errors.exception({header:n,message:"Expected http/s scheme when method is not GET."})}let i=[];for(let f of e){let m=new Vn(f)[rn];if(!tu(m.url))throw q.errors.exception({header:n,message:"Expected http/s scheme."});m.initiator="fetch",m.destination="subresource",s.push(m);let C=Pi();i.push(_G({request:m,processResponse(y){if(y.type==="error"||y.status===206||y.status<200||y.status>299)C.reject(q.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(y.headersList.contains("vary")){let v=ap(y.headersList.get("vary"));for(let Q of v)if(Q==="*"){C.reject(q.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let D of i)D.abort();return}}},processResponseEndOfBody(y){if(y.aborted){C.reject(new DOMException("aborted","AbortError"));return}C.resolve(y)}})),r.push(C.promise)}let c=await Promise.all(r),l=[],d=0;for(let f of c){let m={type:"put",request:s[d],response:f};l.push(m),d++}let g=Pi(),h=null;try{this.#t(l)}catch(f){h=f}return queueMicrotask(()=>{h===null?g.resolve(void 0):g.reject(h)}),g.promise}async put(e,n){q.brandCheck(this,t);let r="Cache.put";q.argumentLengthCheck(arguments,2,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.Response(n,r,"response");let s=null;if(e instanceof Vn?s=e[rn]:s=new Vn(e)[rn],!tu(s.url)||s.method!=="GET")throw q.errors.exception({header:r,message:"Expected an http/s scheme when method is not GET"});let i=n[rn];if(i.status===206)throw q.errors.exception({header:r,message:"Got 206 status"});if(i.headersList.contains("vary")){let m=ap(i.headersList.get("vary"));for(let C of m)if(C==="*")throw q.errors.exception({header:r,message:"Got * vary field value"})}if(i.body&&(NG(i.body.stream)||i.body.stream.locked))throw q.errors.exception({header:r,message:"Response body is locked or disturbed"});let a=UG(i),c=Pi();if(i.body!=null){let C=i.body.stream.getReader();PG(C).then(c.resolve,c.reject)}else c.resolve(void 0);let l=[],d={type:"put",request:s,response:a};l.push(d);let g=await c.promise;a.body!=null&&(a.body.source=g);let h=Pi(),f=null;try{this.#t(l)}catch(m){f=m}return queueMicrotask(()=>{f===null?h.resolve():h.reject(f)}),h.promise}async delete(e,n={}){q.brandCheck(this,t);let r="Cache.delete";q.argumentLengthCheck(arguments,1,r),e=q.converters.RequestInfo(e,r,"request"),n=q.converters.CacheQueryOptions(n,r,"options");let s=null;if(e instanceof Vn){if(s=e[rn],s.method!=="GET"&&!n.ignoreMethod)return!1}else Ap(typeof e=="string"),s=new Vn(e)[rn];let i=[],a={type:"delete",request:s,options:n};i.push(a);let c=Pi(),l=null,d;try{d=this.#t(i)}catch(g){l=g}return queueMicrotask(()=>{l===null?c.resolve(!!d?.length):c.reject(l)}),c.promise}async keys(e=void 0,n={}){q.brandCheck(this,t);let r="Cache.keys";e!==void 0&&(e=q.converters.RequestInfo(e,r,"request")),n=q.converters.CacheQueryOptions(n,r,"options");let s=null;if(e!==void 0)if(e instanceof Vn){if(s=e[rn],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Vn(e)[rn]);let i=Pi(),a=[];if(e===void 0)for(let c of this.#e)a.push(c[0]);else{let c=this.#n(s,n);for(let l of c)a.push(l[0])}return queueMicrotask(()=>{let c=[];for(let l of a){let d=LG(l,new AbortController().signal,"immutable");c.push(d)}i.resolve(Object.freeze(c))}),i.promise}#t(e){let n=this.#e,r=[...n],s=[],i=[];try{for(let a of e){if(a.type!=="delete"&&a.type!=="put")throw q.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(a.type==="delete"&&a.response!=null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#n(a.request,a.options,s).length)throw new DOMException("???","InvalidStateError");let c;if(a.type==="delete"){if(c=this.#n(a.request,a.options),c.length===0)return[];for(let l of c){let d=n.indexOf(l);Ap(d!==-1),n.splice(d,1)}}else if(a.type==="put"){if(a.response==null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let l=a.request;if(!tu(l.url))throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(l.method!=="GET")throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(a.options!=null)throw q.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});c=this.#n(a.request);for(let d of c){let g=n.indexOf(d);Ap(g!==-1),n.splice(g,1)}n.push([a.request,a.response]),s.push([a.request,a.response])}i.push([a.request,a.response])}return i}catch(a){throw this.#e.length=0,this.#e=r,a}}#n(e,n,r){let s=[],i=r??this.#e;for(let a of i){let[c,l]=a;this.#s(e,c,l,n)&&s.push(a)}return s}#s(e,n,r=null,s){let i=new URL(e.url),a=new URL(n.url);if(s?.ignoreSearch&&(a.search="",i.search=""),!TG(i,a,!0))return!1;if(r==null||s?.ignoreVary||!r.headersList.contains("vary"))return!0;let c=ap(r.headersList.get("vary"));for(let l of c){if(l==="*")return!1;let d=n.headersList.get(l),g=e.headersList.get(l);if(d!==g)return!1}return!0}#i(e,n,r=1/0){let s=null;if(e!==void 0)if(e instanceof Vn){if(s=e[rn],s.method!=="GET"&&!n.ignoreMethod)return[]}else typeof e=="string"&&(s=new Vn(e)[rn]);let i=[];if(e===void 0)for(let c of this.#e)i.push(c[1]);else{let c=this.#n(s,n);for(let l of c)i.push(l[1])}let a=[];for(let c of i){let l=MG(c,"immutable");if(a.push(l.clone()),a.length>=r)break}return Object.freeze(a)}};Object.defineProperties(nu.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:bs,matchAll:bs,add:bs,addAll:bs,put:bs,delete:bs,keys:bs});var Lb=[{key:"ignoreSearch",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"ignoreMethod",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"ignoreVary",converter:q.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}];q.converters.CacheQueryOptions=q.dictionaryConverter(Lb);q.converters.MultiCacheQueryOptions=q.dictionaryConverter([...Lb,{key:"cacheName",converter:q.converters.DOMString}]);q.converters.Response=q.interfaceConverter(FG);q.converters["sequence<RequestInfo>"]=q.sequenceConverter(q.converters.RequestInfo);_b.exports={Cache:nu}});var Gb=T((J4,Ob)=>{"use strict";var{kConstruct:Ca}=eu(),{Cache:ru}=Pb(),{webidl:Xe}=je(),{kEnumerableProperty:Ia}=ue(),su=class t{static{o(this,"CacheStorage")}#e=new Map;constructor(){arguments[0]!==Ca&&Xe.illegalConstructor(),Xe.util.markAsUncloneable(this)}async match(e,n={}){if(Xe.brandCheck(this,t),Xe.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=Xe.converters.RequestInfo(e),n=Xe.converters.MultiCacheQueryOptions(n),n.cacheName!=null){if(this.#e.has(n.cacheName)){let r=this.#e.get(n.cacheName);return await new ru(Ca,r).match(e,n)}}else for(let r of this.#e.values()){let i=await new ru(Ca,r).match(e,n);if(i!==void 0)return i}}async has(e){Xe.brandCheck(this,t);let n="CacheStorage.has";return Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.has(e)}async open(e){Xe.brandCheck(this,t);let n="CacheStorage.open";if(Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.has(e)){let s=this.#e.get(e);return new ru(Ca,s)}let r=[];return this.#e.set(e,r),new ru(Ca,r)}async delete(e){Xe.brandCheck(this,t);let n="CacheStorage.delete";return Xe.argumentLengthCheck(arguments,1,n),e=Xe.converters.DOMString(e,n,"cacheName"),this.#e.delete(e)}async keys(){return Xe.brandCheck(this,t),[...this.#e.keys()]}};Object.defineProperties(su.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Ia,has:Ia,open:Ia,delete:Ia,keys:Ia});Ob.exports={CacheStorage:su}});var Yb=T((j4,$b)=>{"use strict";$b.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var lp=T((W4,qb)=>{"use strict";function OG(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n>=0&&n<=8||n>=10&&n<=31||n===127)return!0}return!1}o(OG,"isCTLExcludingHtab");function cp(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===60||n===62||n===64||n===44||n===59||n===58||n===92||n===47||n===91||n===93||n===63||n===61||n===123||n===125)throw new Error("Invalid cookie name")}}o(cp,"validateCookieName");function up(t){let e=t.length,n=0;if(t[0]==='"'){if(e===1||t[e-1]!=='"')throw new Error("Invalid cookie value");--e,++n}for(;n<e;){let r=t.charCodeAt(n++);if(r<33||r>126||r===34||r===44||r===59||r===92)throw new Error("Invalid cookie value")}}o(up,"validateCookieValue");function Vb(t){for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<32||n>126||n===59)throw new Error("Invalid cookie path")}}o(Vb,"validateCookiePath");function Hb(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}o(Hb,"isLetterOrDigit");function GG(t){if(t===" ")return;if(t.length>255)throw new Error("Invalid cookie domain");let e=0;for(let n=0;n<t.length;++n){let r=t.charCodeAt(n);if(r===46){if(e===0)throw new Error("Invalid cookie domain");if(t.charCodeAt(n-1)===45)throw new Error("Invalid cookie domain");e=0;continue}if(e===0&&!Hb(r))throw new Error("Invalid cookie domain");if(!Hb(r)&&r!==45)throw new Error("Invalid cookie domain");if(++e>63)throw new Error("Invalid cookie domain")}if(e===0||t.charCodeAt(t.length-1)===45)throw new Error("Invalid cookie domain")}o(GG,"validateCookieDomain");var $G=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],YG=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],iu=Array(61).fill(0).map((t,e)=>e.toString().padStart(2,"0"));function Jb(t){return typeof t=="number"&&(t=new Date(t)),`${$G[t.getUTCDay()]}, ${iu[t.getUTCDate()]} ${YG[t.getUTCMonth()]} ${t.getUTCFullYear()} ${iu[t.getUTCHours()]}:${iu[t.getUTCMinutes()]}:${iu[t.getUTCSeconds()]} GMT`}o(Jb,"toIMFDate");function HG(t){if(t<0)throw new Error("Invalid cookie max-age")}o(HG,"validateCookieMaxAge");function VG(t){if(t.name.length===0)return null;cp(t.name),up(t.value);let e=[`${t.name}=${t.value}`];t.name.startsWith("__Secure-")&&(t.secure=!0),t.name.startsWith("__Host-")&&(t.secure=!0,t.domain=null,t.path="/"),t.secure&&e.push("Secure"),t.httpOnly&&e.push("HttpOnly"),typeof t.maxAge=="number"&&(HG(t.maxAge),e.push(`Max-Age=${t.maxAge}`)),t.domain&&(GG(t.domain),e.push(`Domain=${t.domain}`)),t.path&&(Vb(t.path),e.push(`Path=${t.path}`)),t.expires&&t.expires.toString()!=="Invalid Date"&&e.push(`Expires=${Jb(t.expires)}`),t.sameSite&&e.push(`SameSite=${t.sameSite}`);for(let n of t.unparsed){if(!n.includes("="))throw new Error("Invalid unparsed");let[r,...s]=n.split("="),i=r.trim(),a=s.join("=");cp(i),up(a),e.push(`${i}=${a}`)}return e.join("; ")}o(VG,"stringify");qb.exports={isCTLExcludingHtab:OG,validateCookieName:cp,validateCookiePath:Vb,validateCookieValue:up,toIMFDate:Jb,stringify:VG}});var Wb=T((Z4,jb)=>{"use strict";var{maxNameValuePairSize:JG,maxAttributeValueSize:qG}=Yb(),{isCTLExcludingHtab:jG}=lp(),{collectASequenceOfCodePointsFast:ou}=gt(),WG=require("node:assert");function zG(t){if(jG(t))return null;let e="",n="",r="",s="";if(t.includes(";")){let i={position:0};e=ou(";",t,i),n=t.slice(i.position)}else e=t;if(!e.includes("="))s=e;else{let i={position:0};r=ou("=",e,i),s=e.slice(i.position+1)}return r=r.trim(),s=s.trim(),r.length+s.length>JG?null:{name:r,value:s,...Oi(n)}}o(zG,"parseSetCookie");function Oi(t,e={}){if(t.length===0)return e;WG(t[0]===";"),t=t.slice(1);let n="";t.includes(";")?(n=ou(";",t,{position:0}),t=t.slice(n.length)):(n=t,t="");let r="",s="";if(n.includes("=")){let a={position:0};r=ou("=",n,a),s=n.slice(a.position+1)}else r=n;if(r=r.trim(),s=s.trim(),s.length>qG)return Oi(t,e);let i=r.toLowerCase();if(i==="expires"){let a=new Date(s);e.expires=a}else if(i==="max-age"){let a=s.charCodeAt(0);if((a<48||a>57)&&s[0]!=="-"||!/^\d+$/.test(s))return Oi(t,e);let c=Number(s);e.maxAge=c}else if(i==="domain"){let a=s;a[0]==="."&&(a=a.slice(1)),a=a.toLowerCase(),e.domain=a}else if(i==="path"){let a="";s.length===0||s[0]!=="/"?a="/":a=s,e.path=a}else if(i==="secure")e.secure=!0;else if(i==="httponly")e.httpOnly=!0;else if(i==="samesite"){let a=s.toLowerCase();a==="none"?e.sameSite="None":a==="strict"?e.sameSite="Strict":a==="lax"&&(e.sameSite="Lax")}else e.unparsed??=[],e.unparsed.push(`${r}=${s}`);return Oi(t,e)}o(Oi,"parseUnparsedAttributes");jb.exports={parseSetCookie:zG,parseUnparsedAttributes:Oi}});var Kb=T((X4,Zb)=>{"use strict";var{parseSetCookie:ZG}=Wb(),{stringify:KG}=lp(),{webidl:ge}=je(),{Headers:au}=Is();function XG(t){ge.argumentLengthCheck(arguments,1,"getCookies"),ge.brandCheck(t,au,{strict:!1});let e=t.get("cookie"),n={};if(!e)return n;for(let r of e.split(";")){let[s,...i]=r.split("=");n[s.trim()]=i.join("=")}return n}o(XG,"getCookies");function e1(t,e,n){ge.brandCheck(t,au,{strict:!1});let r="deleteCookie";ge.argumentLengthCheck(arguments,2,r),e=ge.converters.DOMString(e,r,"name"),n=ge.converters.DeleteCookieAttributes(n),zb(t,{name:e,value:"",expires:new Date(0),...n})}o(e1,"deleteCookie");function t1(t){ge.argumentLengthCheck(arguments,1,"getSetCookies"),ge.brandCheck(t,au,{strict:!1});let e=t.getSetCookie();return e?e.map(n=>ZG(n)):[]}o(t1,"getSetCookies");function zb(t,e){ge.argumentLengthCheck(arguments,2,"setCookie"),ge.brandCheck(t,au,{strict:!1}),e=ge.converters.Cookie(e);let n=KG(e);n&&t.append("Set-Cookie",n)}o(zb,"setCookie");ge.converters.DeleteCookieAttributes=ge.dictionaryConverter([{converter:ge.nullableConverter(ge.converters.DOMString),key:"path",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.DOMString),key:"domain",defaultValue:o(()=>null,"defaultValue")}]);ge.converters.Cookie=ge.dictionaryConverter([{converter:ge.converters.DOMString,key:"name"},{converter:ge.converters.DOMString,key:"value"},{converter:ge.nullableConverter(t=>typeof t=="number"?ge.converters["unsigned long long"](t):new Date(t)),key:"expires",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters["long long"]),key:"maxAge",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.DOMString),key:"domain",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.DOMString),key:"path",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.boolean),key:"secure",defaultValue:o(()=>null,"defaultValue")},{converter:ge.nullableConverter(ge.converters.boolean),key:"httpOnly",defaultValue:o(()=>null,"defaultValue")},{converter:ge.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:ge.sequenceConverter(ge.converters.DOMString),key:"unparsed",defaultValue:o(()=>new Array(0),"defaultValue")}]);Zb.exports={getCookies:XG,deleteCookie:e1,getSetCookies:t1,setCookie:zb}});var $i=T((t3,eR)=>{"use strict";var{webidl:V}=je(),{kEnumerableProperty:mt}=ue(),{kConstruct:Xb}=ke(),{MessagePort:n1}=require("node:worker_threads"),Gi=class t extends Event{static{o(this,"MessageEvent")}#e;constructor(e,n={}){if(e===Xb){super(arguments[1],arguments[2]),V.util.markAsUncloneable(this);return}let r="MessageEvent constructor";V.argumentLengthCheck(arguments,1,r),e=V.converters.DOMString(e,r,"type"),n=V.converters.MessageEventInit(n,r,"eventInitDict"),super(e,n),this.#e=n,V.util.markAsUncloneable(this)}get data(){return V.brandCheck(this,t),this.#e.data}get origin(){return V.brandCheck(this,t),this.#e.origin}get lastEventId(){return V.brandCheck(this,t),this.#e.lastEventId}get source(){return V.brandCheck(this,t),this.#e.source}get ports(){return V.brandCheck(this,t),Object.isFrozen(this.#e.ports)||Object.freeze(this.#e.ports),this.#e.ports}initMessageEvent(e,n=!1,r=!1,s=null,i="",a="",c=null,l=[]){return V.brandCheck(this,t),V.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new t(e,{bubbles:n,cancelable:r,data:s,origin:i,lastEventId:a,source:c,ports:l})}static createFastMessageEvent(e,n){let r=new t(Xb,e,n);return r.#e=n,r.#e.data??=null,r.#e.origin??="",r.#e.lastEventId??="",r.#e.source??=null,r.#e.ports??=[],r}},{createFastMessageEvent:r1}=Gi;delete Gi.createFastMessageEvent;var Au=class t extends Event{static{o(this,"CloseEvent")}#e;constructor(e,n={}){let r="CloseEvent constructor";V.argumentLengthCheck(arguments,1,r),e=V.converters.DOMString(e,r,"type"),n=V.converters.CloseEventInit(n),super(e,n),this.#e=n,V.util.markAsUncloneable(this)}get wasClean(){return V.brandCheck(this,t),this.#e.wasClean}get code(){return V.brandCheck(this,t),this.#e.code}get reason(){return V.brandCheck(this,t),this.#e.reason}},cu=class t extends Event{static{o(this,"ErrorEvent")}#e;constructor(e,n){let r="ErrorEvent constructor";V.argumentLengthCheck(arguments,1,r),super(e,n),V.util.markAsUncloneable(this),e=V.converters.DOMString(e,r,"type"),n=V.converters.ErrorEventInit(n??{}),this.#e=n}get message(){return V.brandCheck(this,t),this.#e.message}get filename(){return V.brandCheck(this,t),this.#e.filename}get lineno(){return V.brandCheck(this,t),this.#e.lineno}get colno(){return V.brandCheck(this,t),this.#e.colno}get error(){return V.brandCheck(this,t),this.#e.error}};Object.defineProperties(Gi.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:mt,origin:mt,lastEventId:mt,source:mt,ports:mt,initMessageEvent:mt});Object.defineProperties(Au.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:mt,code:mt,wasClean:mt});Object.defineProperties(cu.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:mt,filename:mt,lineno:mt,colno:mt,error:mt});V.converters.MessagePort=V.interfaceConverter(n1);V.converters["sequence<MessagePort>"]=V.sequenceConverter(V.converters.MessagePort);var dp=[{key:"bubbles",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"cancelable",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"composed",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")}];V.converters.MessageEventInit=V.dictionaryConverter([...dp,{key:"data",converter:V.converters.any,defaultValue:o(()=>null,"defaultValue")},{key:"origin",converter:V.converters.USVString,defaultValue:o(()=>"","defaultValue")},{key:"lastEventId",converter:V.converters.DOMString,defaultValue:o(()=>"","defaultValue")},{key:"source",converter:V.nullableConverter(V.converters.MessagePort),defaultValue:o(()=>null,"defaultValue")},{key:"ports",converter:V.converters["sequence<MessagePort>"],defaultValue:o(()=>new Array(0),"defaultValue")}]);V.converters.CloseEventInit=V.dictionaryConverter([...dp,{key:"wasClean",converter:V.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"code",converter:V.converters["unsigned short"],defaultValue:o(()=>0,"defaultValue")},{key:"reason",converter:V.converters.USVString,defaultValue:o(()=>"","defaultValue")}]);V.converters.ErrorEventInit=V.dictionaryConverter([...dp,{key:"message",converter:V.converters.DOMString,defaultValue:o(()=>"","defaultValue")},{key:"filename",converter:V.converters.USVString,defaultValue:o(()=>"","defaultValue")},{key:"lineno",converter:V.converters["unsigned long"],defaultValue:o(()=>0,"defaultValue")},{key:"colno",converter:V.converters["unsigned long"],defaultValue:o(()=>0,"defaultValue")},{key:"error",converter:V.converters.any}]);eR.exports={MessageEvent:Gi,CloseEvent:Au,ErrorEvent:cu,createFastMessageEvent:r1}});var Rs=T((r3,tR)=>{"use strict";var s1="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",i1={enumerable:!0,writable:!1,configurable:!1},o1={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},a1={NOT_SENT:0,PROCESSING:1,SENT:2},A1={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},c1=2**16-1,u1={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},l1=Buffer.allocUnsafe(0),d1={string:1,typedArray:2,arrayBuffer:3,blob:4};tR.exports={uid:s1,sentCloseFrameState:a1,staticPropertyDescriptors:i1,states:o1,opcodes:A1,maxUnsigned16Bit:c1,parserStates:u1,emptyBuffer:l1,sendHints:d1}});var ya=T((s3,nR)=>{"use strict";nR.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var wa=T((i3,lR)=>{"use strict";var{kReadyState:Qa,kController:g1,kResponse:h1,kBinaryType:p1,kWebSocketURL:f1}=ya(),{states:Ba,opcodes:kr}=Rs(),{ErrorEvent:m1,createFastMessageEvent:E1}=$i(),{isUtf8:C1}=require("node:buffer"),{collectASequenceOfCodePointsFast:I1,removeHTTPWhitespace:rR}=gt();function y1(t){return t[Qa]===Ba.CONNECTING}o(y1,"isConnecting");function Q1(t){return t[Qa]===Ba.OPEN}o(Q1,"isEstablished");function B1(t){return t[Qa]===Ba.CLOSING}o(B1,"isClosing");function w1(t){return t[Qa]===Ba.CLOSED}o(w1,"isClosed");function gp(t,e,n=(s,i)=>new Event(s,i),r={}){let s=n(t,r);e.dispatchEvent(s)}o(gp,"fireEvent");function b1(t,e,n){if(t[Qa]!==Ba.OPEN)return;let r;if(e===kr.TEXT)try{r=uR(n)}catch{iR(t,"Received invalid UTF-8 in text frame.");return}else e===kr.BINARY&&(t[p1]==="blob"?r=new Blob([n]):r=R1(n));gp("message",t,E1,{origin:t[f1].origin,data:r})}o(b1,"websocketMessageReceived");function R1(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}o(R1,"toArrayBuffer");function k1(t){if(t.length===0)return!1;for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);if(n<33||n>126||n===34||n===40||n===41||n===44||n===47||n===58||n===59||n===60||n===61||n===62||n===63||n===64||n===91||n===92||n===93||n===123||n===125)return!1}return!0}o(k1,"isValidSubprotocol");function S1(t){return t>=1e3&&t<1015?t!==1004&&t!==1005&&t!==1006:t>=3e3&&t<=4999}o(S1,"isValidStatusCode");function iR(t,e){let{[g1]:n,[h1]:r}=t;n.abort(),r?.socket&&!r.socket.destroyed&&r.socket.destroy(),e&&gp("error",t,(s,i)=>new m1(s,i),{error:new Error(e),message:e})}o(iR,"failWebsocketConnection");function oR(t){return t===kr.CLOSE||t===kr.PING||t===kr.PONG}o(oR,"isControlFrame");function aR(t){return t===kr.CONTINUATION}o(aR,"isContinuationFrame");function AR(t){return t===kr.TEXT||t===kr.BINARY}o(AR,"isTextBinaryFrame");function v1(t){return AR(t)||aR(t)||oR(t)}o(v1,"isValidOpcode");function x1(t){let e={position:0},n=new Map;for(;e.position<t.length;){let r=I1(";",t,e),[s,i=""]=r.split("=");n.set(rR(s,!0,!1),rR(i,!1,!0)),e.position++}return n}o(x1,"parseExtensions");function D1(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<48||r>57)return!1}let e=Number.parseInt(t,10);return e>=8&&e<=15}o(D1,"isValidClientWindowBits");var cR=typeof process.versions.icu=="string",sR=cR?new TextDecoder("utf-8",{fatal:!0}):void 0,uR=cR?sR.decode.bind(sR):function(t){if(C1(t))return t.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};lR.exports={isConnecting:y1,isEstablished:Q1,isClosing:B1,isClosed:w1,fireEvent:gp,isValidSubprotocol:k1,isValidStatusCode:S1,failWebsocketConnection:iR,websocketMessageReceived:b1,utf8Decode:uR,isControlFrame:oR,isContinuationFrame:aR,isTextBinaryFrame:AR,isValidOpcode:v1,parseExtensions:x1,isValidClientWindowBits:D1}});var lu=T((a3,dR)=>{"use strict";var{maxUnsigned16Bit:T1}=Rs(),uu=16386,hp,ba=null,Yi=uu;try{hp=require("node:crypto")}catch{hp={randomFillSync:o(function(e,n,r){for(let s=0;s<e.length;++s)e[s]=Math.random()*255|0;return e},"randomFillSync")}}function N1(){return Yi===uu&&(Yi=0,hp.randomFillSync(ba??=Buffer.allocUnsafe(uu),0,uu)),[ba[Yi++],ba[Yi++],ba[Yi++],ba[Yi++]]}o(N1,"generateMask");var pp=class{static{o(this,"WebsocketFrameSend")}constructor(e){this.frameData=e}createFrame(e){let n=this.frameData,r=N1(),s=n?.byteLength??0,i=s,a=6;s>T1?(a+=8,i=127):s>125&&(a+=2,i=126);let c=Buffer.allocUnsafe(s+a);c[0]=c[1]=0,c[0]|=128,c[0]=(c[0]&240)+e;c[a-4]=r[0],c[a-3]=r[1],c[a-2]=r[2],c[a-1]=r[3],c[1]=i,i===126?c.writeUInt16BE(s,2):i===127&&(c[2]=c[3]=0,c.writeUIntBE(s,4,6)),c[1]|=128;for(let l=0;l<s;++l)c[a+l]=n[l]^r[l&3];return c}};dR.exports={WebsocketFrameSend:pp}});var mp=T((c3,CR)=>{"use strict";var{uid:F1,states:Ra,sentCloseFrameState:du,emptyBuffer:U1,opcodes:M1}=Rs(),{kReadyState:ka,kSentClose:gu,kByteParser:hR,kReceivedClose:gR,kResponse:pR}=ya(),{fireEvent:L1,failWebsocketConnection:Sr,isClosing:_1,isClosed:P1,isEstablished:O1,parseExtensions:G1}=wa(),{channels:Hi}=ni(),{CloseEvent:$1}=$i(),{makeRequest:Y1}=Mi(),{fetching:H1}=ma(),{Headers:V1,getHeadersList:J1}=Is(),{getDecodeSplit:q1}=Qt(),{WebsocketFrameSend:j1}=lu(),fp;try{fp=require("node:crypto")}catch{}function W1(t,e,n,r,s,i){let a=t;a.protocol=t.protocol==="ws:"?"http:":"https:";let c=Y1({urlList:[a],client:n,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(i.headers){let h=J1(new V1(i.headers));c.headersList=h}let l=fp.randomBytes(16).toString("base64");c.headersList.append("sec-websocket-key",l),c.headersList.append("sec-websocket-version","13");for(let h of e)c.headersList.append("sec-websocket-protocol",h);return c.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),H1({request:c,useParallelQueue:!0,dispatcher:i.dispatcher,processResponse(h){if(h.type==="error"||h.status!==101){Sr(r,"Received network error or non-101 status code.");return}if(e.length!==0&&!h.headersList.get("Sec-WebSocket-Protocol")){Sr(r,"Server did not respond with sent protocols.");return}if(h.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){Sr(r,'Server did not set Upgrade header to "websocket".');return}if(h.headersList.get("Connection")?.toLowerCase()!=="upgrade"){Sr(r,'Server did not set Connection header to "upgrade".');return}let f=h.headersList.get("Sec-WebSocket-Accept"),m=fp.createHash("sha1").update(l+F1).digest("base64");if(f!==m){Sr(r,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let C=h.headersList.get("Sec-WebSocket-Extensions"),y;if(C!==null&&(y=G1(C),!y.has("permessage-deflate"))){Sr(r,"Sec-WebSocket-Extensions header does not match.");return}let v=h.headersList.get("Sec-WebSocket-Protocol");if(v!==null){let Q=q1("sec-websocket-protocol",c.headersList);if(Q===null||!Q.includes(v)){Sr(r,"Protocol was not set in the opening handshake.");return}}h.socket.on("data",fR),h.socket.on("close",mR),h.socket.on("error",ER),Hi.open.hasSubscribers&&Hi.open.publish({address:h.socket.address(),protocol:v,extensions:C}),s(h,y)}})}o(W1,"establishWebSocketConnection");function z1(t,e,n,r){if(!(_1(t)||P1(t)))if(!O1(t))Sr(t,"Connection was closed before it was established."),t[ka]=Ra.CLOSING;else if(t[gu]===du.NOT_SENT){t[gu]=du.PROCESSING;let s=new j1;e!==void 0&&n===void 0?(s.frameData=Buffer.allocUnsafe(2),s.frameData.writeUInt16BE(e,0)):e!==void 0&&n!==void 0?(s.frameData=Buffer.allocUnsafe(2+r),s.frameData.writeUInt16BE(e,0),s.frameData.write(n,2,"utf-8")):s.frameData=U1,t[pR].socket.write(s.createFrame(M1.CLOSE)),t[gu]=du.SENT,t[ka]=Ra.CLOSING}else t[ka]=Ra.CLOSING}o(z1,"closeWebSocketConnection");function fR(t){this.ws[hR].write(t)||this.pause()}o(fR,"onSocketData");function mR(){let{ws:t}=this,{[pR]:e}=t;e.socket.off("data",fR),e.socket.off("close",mR),e.socket.off("error",ER);let n=t[gu]===du.SENT&&t[gR],r=1005,s="",i=t[hR].closingInfo;i&&!i.error?(r=i.code??1005,s=i.reason):t[gR]||(r=1006),t[ka]=Ra.CLOSED,L1("close",t,(a,c)=>new $1(a,c),{wasClean:n,code:r,reason:s}),Hi.close.hasSubscribers&&Hi.close.publish({websocket:t,code:r,reason:s})}o(mR,"onSocketClose");function ER(t){let{ws:e}=this;e[ka]=Ra.CLOSING,Hi.socketError.hasSubscribers&&Hi.socketError.publish(t),this.destroy()}o(ER,"onSocketError");CR.exports={establishWebSocketConnection:W1,closeWebSocketConnection:z1}});var yR=T((l3,IR)=>{"use strict";var{createInflateRaw:Z1,Z_DEFAULT_WINDOWBITS:K1}=require("node:zlib"),{isValidClientWindowBits:X1}=wa(),{MessageSizeExceededError:e$}=pe(),t$=Buffer.from([0,0,255,255]),hu=Symbol("kBuffer"),Sa=Symbol("kLength"),Ep=class{static{o(this,"PerMessageDeflate")}#e;#t={};#n=0;constructor(e,n){this.#t.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#t.serverMaxWindowBits=e.get("server_max_window_bits"),this.#n=n.maxPayloadSize}decompress(e,n,r){if(!this.#e){let s=K1;if(this.#t.serverMaxWindowBits){if(!X1(this.#t.serverMaxWindowBits)){r(new Error("Invalid server_max_window_bits"));return}s=Number.parseInt(this.#t.serverMaxWindowBits)}try{this.#e=Z1({windowBits:s})}catch(i){r(i);return}this.#e[hu]=[],this.#e[Sa]=0,this.#e.on("data",i=>{if(this.#e[Sa]+=i.length,this.#n>0&&this.#e[Sa]>this.#n){r(new e$),this.#e.removeAllListeners(),this.#e.destroy(),this.#e=null;return}this.#e[hu].push(i)}),this.#e.on("error",i=>{this.#e=null,r(i)})}this.#e.write(e),n&&this.#e.write(t$),this.#e.flush(()=>{if(!this.#e)return;let s=Buffer.concat(this.#e[hu],this.#e[Sa]);this.#e[hu].length=0,this.#e[Sa]=0,r(null,s)})}};IR.exports={PerMessageDeflate:Ep}});var xR=T((g3,vR)=>{"use strict";var{Writable:n$}=require("node:stream"),r$=require("node:assert"),{parserStates:Et,opcodes:Vi,states:s$,emptyBuffer:QR,sentCloseFrameState:BR}=Rs(),{kReadyState:i$,kSentClose:wR,kResponse:Cp,kReceivedClose:bR}=ya(),{channels:pu}=ni(),{isValidStatusCode:o$,isValidOpcode:a$,failWebsocketConnection:xt,websocketMessageReceived:RR,utf8Decode:A$,isControlFrame:Ip,isTextBinaryFrame:yp,isContinuationFrame:c$}=wa(),{WebsocketFrameSend:kR}=lu(),{closeWebSocketConnection:SR}=mp(),{PerMessageDeflate:u$}=yR(),{MessageSizeExceededError:Qp}=pe();function va(t,e,n){SR(t,e,n,Buffer.byteLength(n)),xt(t,n)}o(va,"failWebsocketConnectionWithCode");var Bp=class extends n${static{o(this,"ByteParser")}#e=[];#t=0;#n=0;#s=!1;#i=Et.INFO;#r={};#o=[];#a;#c;#A;constructor(e,n,r={}){super(),this.ws=e,this.#a=n??new Map,this.#c=r.maxFragments??0,this.#A=r.maxPayloadSize??0,this.#a.has("permessage-deflate")&&this.#a.set("permessage-deflate",new u$(n,r))}_write(e,n,r){this.#e.push(e),this.#n+=e.length,this.#s=!0,this.run(r)}#u(){return this.#A>0&&!Ip(this.#r.opcode)&&this.#r.payloadLength+this.#t>this.#A?(va(this.ws,1009,"Payload size exceeds maximum allowed size"),!1):!0}run(e){for(;this.#s;)if(this.#i===Et.INFO){if(this.#n<2)return e();let n=this.consume(2),r=(n[0]&128)!==0,s=n[0]&15,i=(n[1]&128)===128,a=!r&&s!==Vi.CONTINUATION,c=n[1]&127,l=n[0]&64,d=n[0]&32,g=n[0]&16;if(!a$(s))return xt(this.ws,"Invalid opcode received"),e();if(i)return xt(this.ws,"Frame cannot be masked"),e();if(l!==0&&!this.#a.has("permessage-deflate")){xt(this.ws,"Expected RSV1 to be clear.");return}if(d!==0||g!==0){xt(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(a&&!yp(s)){xt(this.ws,"Invalid frame type was fragmented.");return}if(yp(s)&&this.#o.length>0){xt(this.ws,"Expected continuation frame");return}if(this.#r.fragmented&&a){xt(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((c>125||a)&&Ip(s)){xt(this.ws,"Control frame either too large or fragmented");return}if(c$(s)&&this.#o.length===0&&!this.#r.compressed){xt(this.ws,"Unexpected continuation frame");return}if(c<=125){if(this.#r.payloadLength=c,this.#i=Et.READ_DATA,!this.#u())return}else c===126?this.#i=Et.PAYLOADLENGTH_16:c===127&&(this.#i=Et.PAYLOADLENGTH_64);yp(s)&&(this.#r.binaryType=s,this.#r.compressed=l!==0),this.#r.opcode=s,this.#r.masked=i,this.#r.fin=r,this.#r.fragmented=a}else if(this.#i===Et.PAYLOADLENGTH_16){if(this.#n<2)return e();let n=this.consume(2);if(this.#r.payloadLength=n.readUInt16BE(0),this.#i=Et.READ_DATA,!this.#u())return}else if(this.#i===Et.PAYLOADLENGTH_64){if(this.#n<8)return e();let n=this.consume(8),r=n.readUInt32BE(0),s=n.readUInt32BE(4);if(r!==0||s>2**31-1){xt(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#r.payloadLength=s,this.#i=Et.READ_DATA,!this.#u())return}else if(this.#i===Et.READ_DATA){if(this.#n<this.#r.payloadLength)return e();let n=this.consume(this.#r.payloadLength);if(Ip(this.#r.opcode)){this.#s=this.parseControlFrame(n),this.#i=Et.INFO;let r=this.ws[Cp].socket;if(this.#s&&r.writableNeedDrain){this.#s=!1,r.once("drain",()=>{this.destroyed||(this.#s=!0,this.run(e))});return}}else if(this.#r.compressed){this.#a.get("permessage-deflate").decompress(n,this.#r.fin,(r,s)=>{if(r){let i=r instanceof Qp?1009:1007;va(this.ws,i,r.message);return}if(this.writeFragments(s)){if(this.#A>0&&this.#t>this.#A){va(this.ws,1009,new Qp().message);return}if(!this.#r.fin){this.#i=Et.INFO,this.#s=!0,this.run(e);return}RR(this.ws,this.#r.binaryType,this.consumeFragments()),this.#s=!0,this.#i=Et.INFO,this.run(e)}}),this.#s=!1;break}else{if(!this.writeFragments(n))return;if(this.#A>0&&this.#t>this.#A){va(this.ws,1009,new Qp().message);return}!this.#r.fragmented&&this.#r.fin&&RR(this.ws,this.#r.binaryType,this.consumeFragments()),this.#i=Et.INFO}}}consume(e){if(e>this.#n)throw new Error("Called consume() before buffers satiated.");if(e===0)return QR;if(this.#e[0].length===e)return this.#n-=this.#e[0].length,this.#e.shift();let n=Buffer.allocUnsafe(e),r=0;for(;r!==e;){let s=this.#e[0],{length:i}=s;if(i+r===e){n.set(this.#e.shift(),r);break}else if(i+r>e){n.set(s.subarray(0,e-r),r),this.#e[0]=s.subarray(e-r);break}else n.set(this.#e.shift(),r),r+=s.length}return this.#n-=e,n}writeFragments(e){return this.#c>0&&this.#o.length===this.#c?(va(this.ws,1008,"Too many message fragments"),!1):(this.#t+=e.length,this.#o.push(e),!0)}consumeFragments(){let e=this.#o;if(e.length===1)return this.#t=0,e.shift();let n=Buffer.concat(e,this.#t);return this.#o=[],this.#t=0,n}parseCloseBody(e){r$(e.length!==1);let n;if(e.length>=2&&(n=e.readUInt16BE(0)),n!==void 0&&!o$(n))return{code:1002,reason:"Invalid status code",error:!0};let r=e.subarray(2);r[0]===239&&r[1]===187&&r[2]===191&&(r=r.subarray(3));try{r=A$(r)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:n,reason:r,error:!1}}parseControlFrame(e){let{opcode:n,payloadLength:r}=this.#r;if(n===Vi.CLOSE){if(r===1)return xt(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#r.closeInfo=this.parseCloseBody(e),this.#r.closeInfo.error){let{code:s,reason:i}=this.#r.closeInfo;return SR(this.ws,s,i,i.length),xt(this.ws,i),!1}if(this.ws[wR]!==BR.SENT){let s=QR;this.#r.closeInfo.code&&(s=Buffer.allocUnsafe(2),s.writeUInt16BE(this.#r.closeInfo.code,0));let i=new kR(s);this.ws[Cp].socket.write(i.createFrame(Vi.CLOSE),a=>{a||(this.ws[wR]=BR.SENT)})}return this.ws[i$]=s$.CLOSING,this.ws[bR]=!0,!1}else if(n===Vi.PING){if(!this.ws[bR]){let s=new kR(e);this.ws[Cp].socket.write(s.createFrame(Vi.PONG)),pu.ping.hasSubscribers&&pu.ping.publish({payload:e})}}else n===Vi.PONG&&pu.pong.hasSubscribers&&pu.pong.publish({payload:e});return!0}get closingInfo(){return this.#r.closeInfo}};vR.exports={ByteParser:Bp}});var UR=T((p3,FR)=>{"use strict";var{WebsocketFrameSend:l$}=lu(),{opcodes:DR,sendHints:Ji}=Rs(),d$=Sg(),TR=Buffer[Symbol.species],wp=class{static{o(this,"SendQueue")}#e=new d$;#t=!1;#n;constructor(e){this.#n=e}add(e,n,r){if(r!==Ji.blob){let i=NR(e,r);if(!this.#t)this.#n.write(i,n);else{let a={promise:null,callback:n,frame:i};this.#e.push(a)}return}let s={promise:e.arrayBuffer().then(i=>{s.promise=null,s.frame=NR(i,r)}),callback:n,frame:null};this.#e.push(s),this.#t||this.#s()}async#s(){this.#t=!0;let e=this.#e;for(;!e.isEmpty();){let n=e.shift();n.promise!==null&&await n.promise,this.#n.write(n.frame,n.callback),n.callback=n.frame=null}this.#t=!1}};function NR(t,e){return new l$(g$(t,e)).createFrame(e===Ji.string?DR.TEXT:DR.BINARY)}o(NR,"createFrame");function g$(t,e){switch(e){case Ji.string:return Buffer.from(t);case Ji.arrayBuffer:case Ji.blob:return new TR(t);case Ji.typedArray:return new TR(t.buffer,t.byteOffset,t.byteLength)}}o(g$,"toBuffer");FR.exports={SendQueue:wp}});var VR=T((m3,HR)=>{"use strict";var{webidl:re}=je(),{URLSerializer:h$}=gt(),{environmentSettingsObject:MR}=Qt(),{staticPropertyDescriptors:vr,states:xa,sentCloseFrameState:p$,sendHints:fu}=Rs(),{kWebSocketURL:LR,kReadyState:bp,kController:_R,kBinaryType:mu,kResponse:PR,kSentClose:f$,kByteParser:m$}=ya(),{isConnecting:E$,isEstablished:C$,isClosing:I$,isValidSubprotocol:y$,fireEvent:OR}=wa(),{establishWebSocketConnection:Q$,closeWebSocketConnection:GR}=mp(),{ByteParser:B$}=xR(),{kEnumerableProperty:Yt,isBlobLike:$R}=ue(),{getGlobalDispatcher:w$}=da(),{types:YR}=require("node:util"),{ErrorEvent:b$,CloseEvent:R$}=$i(),{SendQueue:k$}=UR(),Dt=class t extends EventTarget{static{o(this,"WebSocket")}#e={open:null,error:null,close:null,message:null};#t=0;#n="";#s="";#i;constructor(e,n=[]){super(),re.util.markAsUncloneable(this);let r="WebSocket constructor";re.argumentLengthCheck(arguments,1,r);let s=re.converters["DOMString or sequence<DOMString> or WebSocketInit"](n,r,"options");e=re.converters.USVString(e,r,"url"),n=s.protocols;let i=MR.settingsObject.baseUrl,a;try{a=new URL(e,i)}catch(l){throw new DOMException(l,"SyntaxError")}if(a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),a.protocol!=="ws:"&&a.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${a.protocol}`,"SyntaxError");if(a.hash||a.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof n=="string"&&(n=[n]),n.length!==new Set(n.map(l=>l.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(n.length>0&&!n.every(l=>y$(l)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[LR]=new URL(a.href);let c=MR.settingsObject;this[_R]=Q$(a,n,c,this,(l,d)=>this.#r(l,d),s),this[bp]=t.CONNECTING,this[f$]=p$.NOT_SENT,this[mu]="blob"}close(e=void 0,n=void 0){re.brandCheck(this,t);let r="WebSocket.close";if(e!==void 0&&(e=re.converters["unsigned short"](e,r,"code",{clamp:!0})),n!==void 0&&(n=re.converters.USVString(n,r,"reason")),e!==void 0&&e!==1e3&&(e<3e3||e>4999))throw new DOMException("invalid code","InvalidAccessError");let s=0;if(n!==void 0&&(s=Buffer.byteLength(n),s>123))throw new DOMException(`Reason must be less than 123 bytes; received ${s}`,"SyntaxError");GR(this,e,n,s)}send(e){re.brandCheck(this,t);let n="WebSocket.send";if(re.argumentLengthCheck(arguments,1,n),e=re.converters.WebSocketSendData(e,n,"data"),E$(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!C$(this)||I$(this)))if(typeof e=="string"){let r=Buffer.byteLength(e);this.#t+=r,this.#i.add(e,()=>{this.#t-=r},fu.string)}else YR.isArrayBuffer(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},fu.arrayBuffer)):ArrayBuffer.isView(e)?(this.#t+=e.byteLength,this.#i.add(e,()=>{this.#t-=e.byteLength},fu.typedArray)):$R(e)&&(this.#t+=e.size,this.#i.add(e,()=>{this.#t-=e.size},fu.blob))}get readyState(){return re.brandCheck(this,t),this[bp]}get bufferedAmount(){return re.brandCheck(this,t),this.#t}get url(){return re.brandCheck(this,t),h$(this[LR])}get extensions(){return re.brandCheck(this,t),this.#s}get protocol(){return re.brandCheck(this,t),this.#n}get onopen(){return re.brandCheck(this,t),this.#e.open}set onopen(e){re.brandCheck(this,t),this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onerror(){return re.brandCheck(this,t),this.#e.error}set onerror(e){re.brandCheck(this,t),this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}get onclose(){return re.brandCheck(this,t),this.#e.close}set onclose(e){re.brandCheck(this,t),this.#e.close&&this.removeEventListener("close",this.#e.close),typeof e=="function"?(this.#e.close=e,this.addEventListener("close",e)):this.#e.close=null}get onmessage(){return re.brandCheck(this,t),this.#e.message}set onmessage(e){re.brandCheck(this,t),this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get binaryType(){return re.brandCheck(this,t),this[mu]}set binaryType(e){re.brandCheck(this,t),e!=="blob"&&e!=="arraybuffer"?this[mu]="blob":this[mu]=e}#r(e,n){this[PR]=e;let r=this[_R]?.dispatcher?.webSocketOptions,s=r?.maxFragments,i=r?.maxPayloadSize,a=new B$(this,n,{maxFragments:s,maxPayloadSize:i});a.on("drain",S$),a.on("error",v$.bind(this)),e.socket.ws=this,this[m$]=a,this.#i=new k$(e.socket),this[bp]=xa.OPEN;let c=e.headersList.get("sec-websocket-extensions");c!==null&&(this.#s=c);let l=e.headersList.get("sec-websocket-protocol");l!==null&&(this.#n=l),OR("open",this)}};Dt.CONNECTING=Dt.prototype.CONNECTING=xa.CONNECTING;Dt.OPEN=Dt.prototype.OPEN=xa.OPEN;Dt.CLOSING=Dt.prototype.CLOSING=xa.CLOSING;Dt.CLOSED=Dt.prototype.CLOSED=xa.CLOSED;Object.defineProperties(Dt.prototype,{CONNECTING:vr,OPEN:vr,CLOSING:vr,CLOSED:vr,url:Yt,readyState:Yt,bufferedAmount:Yt,onopen:Yt,onerror:Yt,onclose:Yt,close:Yt,onmessage:Yt,binaryType:Yt,send:Yt,extensions:Yt,protocol:Yt,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(Dt,{CONNECTING:vr,OPEN:vr,CLOSING:vr,CLOSED:vr});re.converters["sequence<DOMString>"]=re.sequenceConverter(re.converters.DOMString);re.converters["DOMString or sequence<DOMString>"]=function(t,e,n){return re.util.Type(t)==="Object"&&Symbol.iterator in t?re.converters["sequence<DOMString>"](t):re.converters.DOMString(t,e,n)};re.converters.WebSocketInit=re.dictionaryConverter([{key:"protocols",converter:re.converters["DOMString or sequence<DOMString>"],defaultValue:o(()=>new Array(0),"defaultValue")},{key:"dispatcher",converter:re.converters.any,defaultValue:o(()=>w$(),"defaultValue")},{key:"headers",converter:re.nullableConverter(re.converters.HeadersInit)}]);re.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(t){return re.util.Type(t)==="Object"&&!(Symbol.iterator in t)?re.converters.WebSocketInit(t):{protocols:re.converters["DOMString or sequence<DOMString>"](t)}};re.converters.WebSocketSendData=function(t){if(re.util.Type(t)==="Object"){if($R(t))return re.converters.Blob(t,{strict:!1});if(ArrayBuffer.isView(t)||YR.isArrayBuffer(t))return re.converters.BufferSource(t)}return re.converters.USVString(t)};function S$(){this.ws[PR].socket.resume()}o(S$,"onParserDrain");function v$(t){let e,n;t instanceof R$?(e=t.reason,n=t.code):e=t.message,OR("error",this,()=>new b$("error",{error:t,message:e})),GR(this,n)}o(v$,"onParserError");HR.exports={WebSocket:Dt}});var Rp=T((C3,JR)=>{"use strict";function x$(t){return t.indexOf("\0")===-1}o(x$,"isValidLastEventId");function D$(t){if(t.length===0)return!1;for(let e=0;e<t.length;e++)if(t.charCodeAt(e)<48||t.charCodeAt(e)>57)return!1;return!0}o(D$,"isASCIINumber");function T$(t){return new Promise(e=>{setTimeout(e,t).unref()})}o(T$,"delay");JR.exports={isValidLastEventId:x$,isASCIINumber:D$,delay:T$}});var jR=T((y3,qR)=>{"use strict";var N$=require("node:buffer"),{Transform:F$}=require("node:stream"),{isASCIINumber:U$,isValidLastEventId:M$}=Rp(),qi=[239,187,191],Eu=10,Da=13,L$=58,_$=32,P$=N$.kStringMaxLength,O$=Buffer.from("data"),G$=Buffer.from("event"),$$=Buffer.from("id"),Y$=Buffer.from("retry"),H$=1024,V$=131072,J$=128;function q$(t,e){if(e>=t.length)return!1;for(let n=e;n<t.length;n++)if(t[n]<48||t[n]>57)return!1;return!0}o(q$,"isASCIINumberBytes");function j$(t,e){for(let n=e;n<t.length;n++)if(t[n]===0)return!1;return!0}o(j$,"isValidLastEventIdBytes");function Cu(t,e,n){if(e!==n.length)return!1;for(let r=0;r<e;r++)if(t[r]!==n[r])return!1;return!0}o(Cu,"isFieldName");function Iu(){let t=new Error("EventSource message size exceeded");return t.aborted=!1,t}o(Iu,"createMaxEventSizeExceededError");var kp=class extends F${static{o(this,"EventSourceStream")}state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;chunks=[];chunkIndex=0;pos=0;lineChunkIndex=0;linePos=0;lineLength=0;eventSize=0;eventFieldSizes={data:0,event:0,id:0,retry:0};dataLineCount=0;maxEventSize;maxDataLines;maxBufferedChunks;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},this.maxEventSize=e.maxEventSize??P$;let n=this.maxEventSize>0?Math.min(V$,Math.max(H$,Math.floor(this.maxEventSize/J$))):0;this.maxDataLines=n,this.maxBufferedChunks=n,e.push&&(this.push=e.push)}_transform(e,n,r){if(e.length===0){r();return}if(this.maxEventSize>0&&this.chunks.length>=this.maxBufferedChunks&&e[0]!==Eu&&e[0]!==Da){r(Iu());return}if(this.chunks.push(e),this.checkBOM&&this.handleBOM()){r();return}for(;this.hasCurrentByte();){let s=this.currentByte();if(this.eventEndCheck){if(this.crlfCheck){if(s===Eu){this.crlfCheck=!1,this.consumeCurrentByte();continue}this.crlfCheck=!1}if(s===Eu||s===Da){s===Da&&(this.crlfCheck=!0),this.consumeCurrentByte(),this.hasPendingEvent()&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(s===Eu||s===Da){s===Da&&(this.crlfCheck=!0);try{this.parseLine(this.readLine(),this.event)}catch(i){r(i);return}this.consumeCurrentByte(),this.eventEndCheck=!0;continue}if(this.maxEventSize>0&&++this.lineLength>this.maxEventSize+7){r(Iu());return}this.advanceCursor()}r()}_destroy(e,n){this.chunks.length=0,this.clearEvent(),super._destroy(e,n)}parseLine(e,n){if(e.length===0)return;let r=e.indexOf(L$);if(r===0)return;let s=e.length,i=e.length;if(r!==-1&&(s=r,i=r+1,e[i]===_$&&++i),Cu(e,s,O$)){if(this.maxEventSize>0&&this.dataLineCount>=this.maxDataLines)throw Iu();let a=e.length-i,c=this.eventFieldSizes.data+(n.data===void 0?0:1)+a;this.setEventFieldSize("data",c);let l=e.toString("utf8",i);n.data===void 0?n.data=l:n.data+=`
|
|
46
46
|
${l}`,this.dataLineCount++;return}if(Cu(e,s,Y$)){q$(e,i)&&(this.setEventFieldSize("retry",e.length-i),n.retry=e.toString("utf8",i));return}if(Cu(e,s,$$)){j$(e,i)&&(this.setEventFieldSize("id",e.length-i),n.id=e.toString("utf8",i));return}Cu(e,s,G$)&&i<e.length&&(this.setEventFieldSize("event",e.length-i),n.event=e.toString("utf8",i))}setEventFieldSize(e,n){let r=this.eventSize-this.eventFieldSizes[e]+n;if(this.maxEventSize>0&&r>this.maxEventSize)throw Iu();this.eventSize=r,this.eventFieldSizes[e]=n}processEvent(e){e.retry&&U$(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id&&M$(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event.data=void 0,this.event.event=void 0,this.event.id=void 0,this.event.retry=void 0,this.eventSize=0,this.dataLineCount=0,this.eventFieldSizes.data=0,this.eventFieldSizes.event=0,this.eventFieldSizes.id=0,this.eventFieldSizes.retry=0}hasPendingEvent(){return this.event.data!==void 0||this.event.event!==void 0||this.event.id!==void 0||this.event.retry!==void 0}hasCurrentByte(){return this.chunkIndex<this.chunks.length&&this.pos<this.chunks[this.chunkIndex].length}currentByte(){return this.chunks[this.chunkIndex][this.pos]}consumeCurrentByte(){this.advanceCursor(),this.syncLineStartToCursor()}advanceCursor(){for(this.pos++;this.chunkIndex<this.chunks.length&&this.pos>=this.chunks[this.chunkIndex].length;)this.chunkIndex++,this.pos=0}syncLineStartToCursor(){this.lineChunkIndex=this.chunkIndex,this.linePos=this.pos,this.lineLength=0,this.dropConsumedChunks()}dropConsumedChunks(){if(this.lineChunkIndex>0){let e=this.lineChunkIndex;this.chunks.splice(0,e),this.lineChunkIndex=0,this.chunkIndex-=e}this.chunkIndex===this.chunks.length&&(this.chunks.length=0,this.chunkIndex=0,this.pos=0,this.lineChunkIndex=0,this.linePos=0)}readLine(){if(this.lineChunkIndex===this.chunkIndex)return this.chunks[this.chunkIndex].subarray(this.linePos,this.pos);let e=[],n=0;for(let r=this.lineChunkIndex;r<=this.chunkIndex;r++){let s=this.chunks[r],i=r===this.lineChunkIndex?this.linePos:0,a=r===this.chunkIndex?this.pos:s.length,c=s.subarray(i,a);n+=c.length,e.push(c)}return Buffer.concat(e,n)}peekBufferedByte(e){let n=this.lineChunkIndex,r=this.linePos;for(;n<this.chunks.length;){let s=this.chunks[n],i=s.length-r;if(e<i)return s[r+e];e-=i,n++,r=0}}discardLeadingBytes(e){for(;e>0&&this.lineChunkIndex<this.chunks.length;){let r=this.chunks[this.lineChunkIndex].length-this.linePos;e<r?(this.linePos+=e,e=0):(e-=r,this.lineChunkIndex++,this.linePos=0)}this.chunkIndex=this.lineChunkIndex,this.pos=this.linePos,this.dropConsumedChunks()}handleBOM(){let e=this.peekBufferedByte(0),n=this.peekBufferedByte(1),r=this.peekBufferedByte(2);return n===void 0?(e===qi[0]||(this.checkBOM=!1),!0):r===void 0?e===qi[0]&&n===qi[1]?!0:(this.checkBOM=!1,!1):(e===qi[0]&&n===qi[1]&&r===qi[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}};qR.exports={EventSourceStream:kp}});var nk=T((B3,tk)=>{"use strict";var{pipeline:W$}=require("node:stream"),{fetching:z$}=ma(),{makeRequest:Z$}=Mi(),{webidl:Jn}=je(),{EventSourceStream:K$}=jR(),{parseMIMEType:X$}=gt(),{createFastMessageEvent:eY}=$i(),{isNetworkError:WR}=pa(),{delay:tY}=Rp(),{kEnumerableProperty:ks}=ue(),{environmentSettingsObject:zR}=Qt(),{getGlobalDispatcher:nY}=da(),ZR=!1,KR=3e3,Ta=0,XR=1,Na=2,rY="anonymous",sY="use-credentials",ji=class t extends EventTarget{static{o(this,"EventSource")}#e={open:null,error:null,message:null};#t=null;#n=!1;#s=Ta;#i=null;#r=null;#o;#a;constructor(e,n={}){super(),Jn.util.markAsUncloneable(this);let r="EventSource constructor";Jn.argumentLengthCheck(arguments,1,r),ZR||(ZR=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=Jn.converters.USVString(e,r,"url"),n=Jn.converters.EventSourceInitDict(n,r,"eventSourceInitDict"),this.#o=n.dispatcher,this.#a={lastEventId:"",reconnectionTime:KR};let s=zR,i;try{i=new URL(e,s.settingsObject.baseUrl),this.#a.origin=i.origin}catch(l){throw new DOMException(l,"SyntaxError")}this.#t=i.href;let a=rY;n.withCredentials&&(a=sY,this.#n=!0);let c={redirect:"follow",keepalive:!0,mode:"cors",credentials:a==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};c.client=zR.settingsObject,c.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],c.cache="no-store",c.initiator="other",c.urlList=[new URL(this.#t)],this.#i=Z$(c),this.#c()}get readyState(){return this.#s}get url(){return this.#t}get withCredentials(){return this.#n}#c(){if(this.#s===Na)return;this.#s=Ta;let e={request:this.#i,dispatcher:this.#o},n=o(r=>{WR(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#A()},"processEventSourceEndOfBody");e.processResponseEndOfBody=n,e.processResponse=r=>{if(WR(r))if(r.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#A();return}let s=r.headersList.get("content-type",!0),i=s!==null?X$(s):"failure",a=i!=="failure"&&i.essence==="text/event-stream";if(r.status!==200||a===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#s=XR,this.dispatchEvent(new Event("open")),this.#a.origin=r.urlList[r.urlList.length-1].origin;let c=new K$({eventSourceSettings:this.#a,maxEventSize:this.#o.eventSourceOptions?.maxEventSize,push:o(l=>{this.dispatchEvent(eY(l.type,l.options))},"push")});W$(r.body.stream,c,l=>{l?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#r=z$(e)}async#A(){this.#s!==Na&&(this.#s=Ta,this.dispatchEvent(new Event("error")),await tY(this.#a.reconnectionTime),this.#s===Ta&&(this.#a.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#a.lastEventId,!0),this.#c()))}close(){Jn.brandCheck(this,t),this.#s!==Na&&(this.#s=Na,this.#r.abort(),this.#i=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open),typeof e=="function"?(this.#e.open=e,this.addEventListener("open",e)):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message),typeof e=="function"?(this.#e.message=e,this.addEventListener("message",e)):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error),typeof e=="function"?(this.#e.error=e,this.addEventListener("error",e)):this.#e.error=null}},ek={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Ta,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:XR,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Na,writable:!1}};Object.defineProperties(ji,ek);Object.defineProperties(ji.prototype,ek);Object.defineProperties(ji.prototype,{close:ks,onerror:ks,onmessage:ks,onopen:ks,readyState:ks,url:ks,withCredentials:ks});Jn.converters.EventSourceInitDict=Jn.dictionaryConverter([{key:"withCredentials",converter:Jn.converters.boolean,defaultValue:o(()=>!1,"defaultValue")},{key:"dispatcher",converter:Jn.converters.any,defaultValue:o(()=>nY(),"defaultValue")}]);tk.exports={EventSource:ji,defaultReconnectionTime:KR}});var ok=T((b3,te)=>{"use strict";var iY=Qi(),rk=Fo(),oY=Bi(),aY=rQ(),AY=wi(),cY=jg(),uY=kQ(),lY=FQ(),sk=pe(),Qu=ue(),{InvalidArgumentError:yu}=sk,Wi=IB(),dY=Mo(),gY=vh(),hY=nw(),pY=Th(),fY=fh(),mY=Bc(),{getGlobalDispatcher:ik,setGlobalDispatcher:EY}=da(),CY=Nc(),IY=dc(),yY=gc();Object.assign(rk.prototype,Wi);te.exports.Dispatcher=rk;te.exports.Client=iY;te.exports.Pool=oY;te.exports.BalancedPool=aY;te.exports.Agent=AY;te.exports.ProxyAgent=cY;te.exports.EnvHttpProxyAgent=uY;te.exports.RetryAgent=lY;te.exports.RetryHandler=mY;te.exports.DecoratorHandler=CY;te.exports.RedirectHandler=IY;te.exports.createRedirectInterceptor=yY;te.exports.interceptors={redirect:cw(),retry:lw(),dump:gw(),dns:fw()};te.exports.buildConnector=dY;te.exports.errors=sk;te.exports.util={parseHeaders:Qu.parseHeaders,headerNameToString:Qu.headerNameToString};function Fa(t){return(e,n,r)=>{if(typeof n=="function"&&(r=n,n=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new yu("invalid url");if(n!=null&&typeof n!="object")throw new yu("invalid opts");if(n&&n.path!=null){if(typeof n.path!="string")throw new yu("invalid opts.path");let a=n.path;n.path.startsWith("/")||(a=`/${a}`),e=new URL(Qu.parseOrigin(e).origin+a)}else n||(n=typeof e=="object"?e:{}),e=Qu.parseURL(e);let{agent:s,dispatcher:i=ik()}=n;if(s)throw new yu("unsupported opts.agent. Did you mean opts.client?");return t.call(i,{...n,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:n.method||(n.body?"PUT":"GET")},r)}}o(Fa,"makeDispatcher");te.exports.setGlobalDispatcher=EY;te.exports.getGlobalDispatcher=ik;var QY=ma().fetch;te.exports.fetch=o(async function(e,n=void 0){try{return await QY(e,n)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}},"fetch");te.exports.Headers=Is().Headers;te.exports.Response=pa().Response;te.exports.Request=Mi().Request;te.exports.FormData=Yo().FormData;te.exports.File=globalThis.File??require("node:buffer").File;te.exports.FileReader=Tb().FileReader;var{setGlobalOrigin:BY,getGlobalOrigin:wY}=qd();te.exports.setGlobalOrigin=BY;te.exports.getGlobalOrigin=wY;var{CacheStorage:bY}=Gb(),{kConstruct:RY}=eu();te.exports.caches=new bY(RY);var{deleteCookie:kY,getCookies:SY,getSetCookies:vY,setCookie:xY}=Kb();te.exports.deleteCookie=kY;te.exports.getCookies=SY;te.exports.getSetCookies=vY;te.exports.setCookie=xY;var{parseMIMEType:DY,serializeAMimeType:TY}=gt();te.exports.parseMIMEType=DY;te.exports.serializeAMimeType=TY;var{CloseEvent:NY,ErrorEvent:FY,MessageEvent:UY}=$i();te.exports.WebSocket=VR().WebSocket;te.exports.CloseEvent=NY;te.exports.ErrorEvent=FY;te.exports.MessageEvent=UY;te.exports.request=Fa(Wi.request);te.exports.stream=Fa(Wi.stream);te.exports.pipeline=Fa(Wi.pipeline);te.exports.connect=Fa(Wi.connect);te.exports.upgrade=Fa(Wi.upgrade);te.exports.MockClient=gY;te.exports.MockPool=pY;te.exports.MockAgent=hY;te.exports.mockErrors=fY;var{EventSource:MY}=nk();te.exports.EventSource=MY});var b2={};_p(b2,{AppRefusal:()=>Bn,AppUnreachable:()=>zi,AttemptEndReason:()=>ho,NoReportCause:()=>po,V3Attempt:()=>Pa,closedV3Attempt:()=>Bk,endV3Attempt:()=>Rk,heartbeatV3Attempt:()=>Lp,startV3Attempt:()=>Qk,uploadV3Report:()=>bk});module.exports=Tk(b2);var A={};_p(A,{BRAND:()=>sS,DIRTY:()=>Tr,EMPTY_PATH:()=>Mk,INVALID:()=>Z,NEVER:()=>$S,OK:()=>We,ParseStatus:()=>Ve,Schema:()=>Ae,ZodAny:()=>er,ZodArray:()=>vn,ZodBigInt:()=>Fr,ZodBoolean:()=>Ur,ZodBranded:()=>oo,ZodCatch:()=>Jr,ZodDate:()=>Mr,ZodDefault:()=>Vr,ZodDiscriminatedUnion:()=>Za,ZodEffects:()=>Mt,ZodEnum:()=>Yr,ZodError:()=>ct,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>Xa,ZodIntersection:()=>Or,ZodIssueCode:()=>N,ZodLazy:()=>Gr,ZodLiteral:()=>$r,ZodMap:()=>Ms,ZodNaN:()=>_s,ZodNativeEnum:()=>Hr,ZodNever:()=>Vt,ZodNull:()=>_r,ZodNullable:()=>cn,ZodNumber:()=>Nr,ZodObject:()=>ut,ZodOptional:()=>Ft,ZodParsedType:()=>O,ZodPipeline:()=>ao,ZodPromise:()=>tr,ZodReadonly:()=>qr,ZodRecord:()=>Ka,ZodSchema:()=>Ae,ZodSet:()=>Ls,ZodString:()=>Xn,ZodSymbol:()=>Fs,ZodTransformer:()=>Mt,ZodTuple:()=>An,ZodType:()=>Ae,ZodUndefined:()=>Lr,ZodUnion:()=>Pr,ZodUnknown:()=>Sn,ZodVoid:()=>Us,addIssueToContext:()=>_,any:()=>gS,array:()=>mS,bigint:()=>AS,boolean:()=>zp,coerce:()=>GS,custom:()=>qp,date:()=>cS,datetimeRegex:()=>Vp,defaultErrorMap:()=>Rn,discriminatedUnion:()=>yS,effect:()=>NS,enum:()=>xS,function:()=>kS,getErrorMap:()=>Ds,getParsedType:()=>an,instanceof:()=>oS,intersection:()=>QS,isAborted:()=>Wa,isAsync:()=>Ts,isDirty:()=>za,isValid:()=>Kn,late:()=>iS,lazy:()=>SS,literal:()=>vS,makeIssue:()=>io,map:()=>bS,nan:()=>aS,nativeEnum:()=>DS,never:()=>pS,null:()=>dS,nullable:()=>US,number:()=>Wp,object:()=>ES,objectUtil:()=>Nu,oboolean:()=>OS,onumber:()=>PS,optional:()=>FS,ostring:()=>_S,pipeline:()=>LS,preprocess:()=>MS,promise:()=>TS,quotelessJson:()=>Nk,record:()=>wS,set:()=>RS,setErrorMap:()=>Uk,strictObject:()=>CS,string:()=>jp,symbol:()=>uS,transformer:()=>NS,tuple:()=>BS,undefined:()=>lS,union:()=>IS,unknown:()=>hS,util:()=>le,void:()=>fS});var le;(function(t){t.assertEqual=s=>{};function e(s){}o(e,"assertIs"),t.assertIs=e;function n(s){throw new Error}o(n,"assertNever"),t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let a of s)i[a]=a;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),a={};for(let c of i)a[c]=s[c];return t.objectValues(a)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},t.find=(s,i)=>{for(let a of s)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}o(r,"joinValues"),t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(le||(le={}));var Nu;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Nu||(Nu={}));var O=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),an=o(t=>{switch(typeof t){case"undefined":return O.undefined;case"string":return O.string;case"number":return Number.isNaN(t)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(t)?O.array:t===null?O.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?O.promise:typeof Map<"u"&&t instanceof Map?O.map:typeof Set<"u"&&t instanceof Set?O.set:typeof Date<"u"&&t instanceof Date?O.date:O.object;default:return O.unknown}},"getParsedType");var N=le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nk=o(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),ct=class t extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=o(i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,l=0;for(;l<a.path.length;){let d=a.path[l];l===a.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(n(a))):c[d]=c[d]||{_errors:[]},c=c[d],l++}}},"processError");return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};ct.create=t=>new ct(t);var Fk=o((t,e)=>{let n;switch(t.code){case N.invalid_type:t.received===O.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,le.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:n=`Unrecognized key(s) in object: ${le.joinValues(t.keys,", ")}`;break;case N.invalid_union:n="Invalid input";break;case N.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${le.joinValues(t.options)}`;break;case N.invalid_enum_value:n=`Invalid enum value. Expected ${le.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:n="Invalid function arguments";break;case N.invalid_return_type:n="Invalid function return type";break;case N.invalid_date:n="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:le.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case N.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case N.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case N.custom:n="Invalid input";break;case N.invalid_intersection_types:n="Intersection results could not be merged";break;case N.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:n="Number must be finite";break;default:n=e.defaultError,le.assertNever(t)}return{message:n}},"errorMap"),Rn=Fk;var Op=Rn;function Uk(t){Op=t}o(Uk,"setErrorMap");function Ds(){return Op}o(Ds,"getErrorMap");var io=o(t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)c=d(a,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},"makeIssue"),Mk=[];function _(t,e){let n=Ds(),r=io({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Rn?void 0:Rn].filter(s=>!!s)});t.common.issues.push(r)}o(_,"addIssueToContext");var Ve=class t{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return Z;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,a=await s.value;r.push({key:i,value:a})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return Z;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}},Z=Object.freeze({status:"aborted"}),Tr=o(t=>({status:"dirty",value:t}),"DIRTY"),We=o(t=>({status:"valid",value:t}),"OK"),Wa=o(t=>t.status==="aborted","isAborted"),za=o(t=>t.status==="dirty","isDirty"),Kn=o(t=>t.status==="valid","isValid"),Ts=o(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync");var H;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(H||(H={}));var Ut=class{static{o(this,"ParseInputLazyPath")}constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Gp=o((t,e)=>{if(Kn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new ct(t.common.issues);return this._error=n,this._error}}},"handleResult");function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:o((a,c)=>{let{message:l}=t;return a.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??r??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:l??n??c.defaultError}},"customMap"),description:s}}o(ie,"processCreateParams");var Ae=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(e){return an(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:an(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ve,ctx:{common:e.parent.common,data:e.data,parsedType:an(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ts(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:an(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Gp(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:an(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Kn(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Kn(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:an(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Ts(s)?s:Promise.resolve(s));return Gp(r,i)}refine(e,n){let r=o(s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n,"getIssueProperties");return this._refinement((s,i)=>{let a=e(s),c=o(()=>i.addIssue({code:N.custom,...r(s)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Mt({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(n=>this["~validate"](n),"validate")}}optional(){return Ft.create(this,this._def)}nullable(){return cn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vn.create(this)}promise(){return tr.create(this,this._def)}or(e){return Pr.create([this,e],this._def)}and(e){return Or.create(this,e,this._def)}transform(e){return new Mt({...ie(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Vr({...ie(this._def),innerType:this,defaultValue:n,typeName:ee.ZodDefault})}brand(){return new oo({typeName:ee.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Jr({...ie(this._def),innerType:this,catchValue:n,typeName:ee.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return ao.create(this,e)}readonly(){return qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Lk=/^c[^\s-]{8,}$/i,_k=/^[0-9a-z]+$/,Pk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ok=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Gk=/^[a-z0-9_-]{21}$/i,$k=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Fu,Jk=/^(?:(?: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])$/,qk=/^(?:(?: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])$/,jk=/^(([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]))$/,Wk=/^(([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])$/,zk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Zk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Kk=new RegExp(`^${Yp}$`);function Hp(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}o(Hp,"timeRegexSource");function Xk(t){return new RegExp(`^${Hp(t)}$`)}o(Xk,"timeRegex");function Vp(t){let e=`${Yp}T${Hp(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}o(Vp,"datetimeRegex");function eS(t,e){return!!((e==="v4"||!e)&&Jk.test(t)||(e==="v6"||!e)&&jk.test(t))}o(eS,"isValidIP");function tS(t,e){if(!$k.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}o(tS,"isValidJWT");function nS(t,e){return!!((e==="v4"||!e)&&qk.test(t)||(e==="v6"||!e)&&Wk.test(t))}o(nS,"isValidCidr");var Xn=class t extends Ae{static{o(this,"ZodString")}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.string,received:i.parsedType}),Z}let r=new Ve,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,c=e.data.length<i.value;(a||c)&&(s=this._getOrReturnCtx(e,s),a?_(s,{code:N.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&_(s,{code:N.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Hk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"email",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Fu||(Fu=new RegExp(Vk,"u")),Fu.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"emoji",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Ok.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"uuid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Gk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"nanoid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Lk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cuid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")_k.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cuid2",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Pk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ulid",code:N.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),_(s,{validation:"url",code:N.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"regex",code:N.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Vp(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Kk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Xk(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{code:N.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Yk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"duration",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?eS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"ip",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?tS(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"jwt",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?nS(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"cidr",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?zk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64",code:N.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Zk.test(e.data)||(s=this._getOrReturnCtx(e,s),_(s,{validation:"base64url",code:N.invalid_string,message:i.message}),r.dirty()):le.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:N.invalid_string,...H.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...H.errToObj(e)})}url(e){return this._addCheck({kind:"url",...H.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...H.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...H.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...H.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...H.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...H.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...H.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...H.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...H.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...H.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...H.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...H.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...H.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...H.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...H.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...H.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...H.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...H.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...H.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...H.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...H.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...H.errToObj(n)})}nonempty(e){return this.min(1,H.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Xn.create=t=>new Xn({checks:[],typeName:ee.ZodString,coerce:t?.coerce??!1,...ie(t)});function rS(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}o(rS,"floatSafeRemainder");var Nr=class t extends Ae{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.number,received:i.parsedType}),Z}let r,s=new Ve;for(let i of this._def.checks)i.kind==="int"?le.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:N.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?rS(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_finite,message:i.message}),s.dirty()):le.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,H.toString(n))}gt(e,n){return this.setLimit("min",e,!1,H.toString(n))}lte(e,n){return this.setLimit("max",e,!0,H.toString(n))}lt(e,n){return this.setLimit("max",e,!1,H.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:H.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:H.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:H.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Nr.create=t=>new Nr({checks:[],typeName:ee.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Fr=class t extends Ae{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let r,s=new Ve;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),_(r,{code:N.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):le.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return _(n,{code:N.invalid_type,expected:O.bigint,received:n.parsedType}),Z}gte(e,n){return this.setLimit("min",e,!0,H.toString(n))}gt(e,n){return this.setLimit("min",e,!1,H.toString(n))}lte(e,n){return this.setLimit("max",e,!0,H.toString(n))}lt(e,n){return this.setLimit("max",e,!1,H.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:H.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Fr.create=t=>new Fr({checks:[],typeName:ee.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Ur=class extends Ae{static{o(this,"ZodBoolean")}_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.boolean,received:r.parsedType}),Z}return We(e.data)}};Ur.create=t=>new Ur({typeName:ee.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var Mr=class t extends Ae{static{o(this,"ZodDate")}_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_type,expected:O.date,received:i.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return _(i,{code:N.invalid_date}),Z}let r=new Ve,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),_(s,{code:N.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):le.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:H.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:H.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Mr.create=t=>new Mr({checks:[],coerce:t?.coerce||!1,typeName:ee.ZodDate,...ie(t)});var Fs=class extends Ae{static{o(this,"ZodSymbol")}_parse(e){if(this._getType(e)!==O.symbol){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.symbol,received:r.parsedType}),Z}return We(e.data)}};Fs.create=t=>new Fs({typeName:ee.ZodSymbol,...ie(t)});var Lr=class extends Ae{static{o(this,"ZodUndefined")}_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.undefined,received:r.parsedType}),Z}return We(e.data)}};Lr.create=t=>new Lr({typeName:ee.ZodUndefined,...ie(t)});var _r=class extends Ae{static{o(this,"ZodNull")}_parse(e){if(this._getType(e)!==O.null){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.null,received:r.parsedType}),Z}return We(e.data)}};_r.create=t=>new _r({typeName:ee.ZodNull,...ie(t)});var er=class extends Ae{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(e){return We(e.data)}};er.create=t=>new er({typeName:ee.ZodAny,...ie(t)});var Sn=class extends Ae{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return We(e.data)}};Sn.create=t=>new Sn({typeName:ee.ZodUnknown,...ie(t)});var Vt=class extends Ae{static{o(this,"ZodNever")}_parse(e){let n=this._getOrReturnCtx(e);return _(n,{code:N.invalid_type,expected:O.never,received:n.parsedType}),Z}};Vt.create=t=>new Vt({typeName:ee.ZodNever,...ie(t)});var Us=class extends Ae{static{o(this,"ZodVoid")}_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.void,received:r.parsedType}),Z}return We(e.data)}};Us.create=t=>new Us({typeName:ee.ZodVoid,...ie(t)});var vn=class t extends Ae{static{o(this,"ZodArray")}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==O.array)return _(n,{code:N.invalid_type,expected:O.array,received:n.parsedType}),Z;if(s.exactLength!==null){let a=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(a||c)&&(_(n,{code:a?N.too_big:N.too_small,minimum:c?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(_(n,{code:N.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(_(n,{code:N.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>s.type._parseAsync(new Ut(n,a,n.path,c)))).then(a=>Ve.mergeArray(r,a));let i=[...n.data].map((a,c)=>s.type._parseSync(new Ut(n,a,n.path,c)));return Ve.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:H.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:H.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:H.toString(n)}})}nonempty(e){return this.min(1,e)}};vn.create=(t,e)=>new vn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Ns(t){if(t instanceof ut){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ft.create(Ns(r))}return new ut({...t._def,shape:o(()=>e,"shape")})}else return t instanceof vn?new vn({...t._def,type:Ns(t.element)}):t instanceof Ft?Ft.create(Ns(t.unwrap())):t instanceof cn?cn.create(Ns(t.unwrap())):t instanceof An?An.create(t.items.map(e=>Ns(e))):t}o(Ns,"deepPartialify");var ut=class t extends Ae{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=le.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==O.object){let d=this._getOrReturnCtx(e);return _(d,{code:N.invalid_type,expected:O.object,received:d.parsedType}),Z}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof Vt&&this._def.unknownKeys==="strip"))for(let d in s.data)a.includes(d)||c.push(d);let l=[];for(let d of a){let g=i[d],h=s.data[d];l.push({key:{status:"valid",value:d},value:g._parse(new Ut(s,h,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Vt){let d=this._def.unknownKeys;if(d==="passthrough")for(let g of c)l.push({key:{status:"valid",value:g},value:{status:"valid",value:s.data[g]}});else if(d==="strict")c.length>0&&(_(s,{code:N.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let g of c){let h=s.data[g];l.push({key:{status:"valid",value:g},value:d._parse(new Ut(s,h,s.path,g)),alwaysSet:g in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let g of l){let h=await g.key,f=await g.value;d.push({key:h,value:f,alwaysSet:g.alwaysSet})}return d}).then(d=>Ve.mergeObjectSync(r,d)):Ve.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return H.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:o((n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:H.errToObj(e).message??s}:{message:s}},"errorMap")}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:o(()=>({...this._def.shape(),...e}),"shape")})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:o(()=>({...this._def.shape(),...e._def.shape()}),"shape"),typeName:ee.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of le.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:o(()=>n,"shape")})}omit(e){let n={};for(let r of le.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return Ns(this)}partial(e){let n={};for(let r of le.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:o(()=>n,"shape")})}required(e){let n={};for(let r of le.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ft;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:o(()=>n,"shape")})}keyof(){return Jp(le.objectKeys(this.shape))}};ut.create=(t,e)=>new ut({shape:o(()=>t,"shape"),unknownKeys:"strip",catchall:Vt.create(),typeName:ee.ZodObject,...ie(e)});ut.strictCreate=(t,e)=>new ut({shape:o(()=>t,"shape"),unknownKeys:"strict",catchall:Vt.create(),typeName:ee.ZodObject,...ie(e)});ut.lazycreate=(t,e)=>new ut({shape:t,unknownKeys:"strip",catchall:Vt.create(),typeName:ee.ZodObject,...ie(e)});var Pr=class extends Ae{static{o(this,"ZodUnion")}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=i.map(c=>new ct(c.ctx.common.issues));return _(n,{code:N.invalid_union,unionErrors:a}),Z}if(o(s,"handleResults"),n.common.async)return Promise.all(r.map(async i=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(s);{let i,a=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},g=l._parseSync({data:n.data,path:n.path,parent:d});if(g.status==="valid")return g;g.status==="dirty"&&!i&&(i={result:g,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=a.map(l=>new ct(l));return _(n,{code:N.invalid_union,unionErrors:c}),Z}}get options(){return this._def.options}};Pr.create=(t,e)=>new Pr({options:t,typeName:ee.ZodUnion,...ie(e)});var kn=o(t=>t instanceof Gr?kn(t.schema):t instanceof Mt?kn(t.innerType()):t instanceof $r?[t.value]:t instanceof Yr?t.options:t instanceof Hr?le.objectValues(t.enum):t instanceof Vr?kn(t._def.innerType):t instanceof Lr?[void 0]:t instanceof _r?[null]:t instanceof Ft?[void 0,...kn(t.unwrap())]:t instanceof cn?[null,...kn(t.unwrap())]:t instanceof oo||t instanceof qr?kn(t.unwrap()):t instanceof Jr?kn(t._def.innerType):[],"getDiscriminator"),Za=class t extends Ae{static{o(this,"ZodDiscriminatedUnion")}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return _(n,{code:N.invalid_type,expected:O.object,received:n.parsedType}),Z;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(_(n,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let a=kn(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...ie(r)})}};function Uu(t,e){let n=an(t),r=an(e);if(t===e)return{valid:!0,data:t};if(n===O.object&&r===O.object){let s=le.objectKeys(e),i=le.objectKeys(t).filter(c=>s.indexOf(c)!==-1),a={...t,...e};for(let c of i){let l=Uu(t[c],e[c]);if(!l.valid)return{valid:!1};a[c]=l.data}return{valid:!0,data:a}}else if(n===O.array&&r===O.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let a=t[i],c=e[i],l=Uu(a,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===O.date&&r===O.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}o(Uu,"mergeValues");var Or=class extends Ae{static{o(this,"ZodIntersection")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=o((i,a)=>{if(Wa(i)||Wa(a))return Z;let c=Uu(i.value,a.value);return c.valid?((za(i)||za(a))&&n.dirty(),{status:n.value,value:c.data}):(_(r,{code:N.invalid_intersection_types}),Z)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Or.create=(t,e,n)=>new Or({left:t,right:e,typeName:ee.ZodIntersection,...ie(n)});var An=class t extends Ae{static{o(this,"ZodTuple")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.array)return _(r,{code:N.invalid_type,expected:O.array,received:r.parsedType}),Z;if(r.data.length<this._def.items.length)return _(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((a,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new Ut(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>Ve.mergeArray(n,a)):Ve.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};An.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new An({items:t,typeName:ee.ZodTuple,rest:null,...ie(e)})};var Ka=class t extends Ae{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.object)return _(r,{code:N.invalid_type,expected:O.object,received:r.parsedType}),Z;let s=[],i=this._def.keyType,a=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new Ut(r,c,r.path,c)),value:a._parse(new Ut(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?Ve.mergeObjectAsync(n,s):Ve.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ae?new t({keyType:e,valueType:n,typeName:ee.ZodRecord,...ie(r)}):new t({keyType:Xn.create(),valueType:e,typeName:ee.ZodRecord,...ie(n)})}},Ms=class extends Ae{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.map)return _(r,{code:N.invalid_type,expected:O.map,received:r.parsedType}),Z;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([c,l],d)=>({key:s._parse(new Ut(r,c,r.path,[d,"key"])),value:i._parse(new Ut(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of a){let d=await l.key,g=await l.value;if(d.status==="aborted"||g.status==="aborted")return Z;(d.status==="dirty"||g.status==="dirty")&&n.dirty(),c.set(d.value,g.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let l of a){let d=l.key,g=l.value;if(d.status==="aborted"||g.status==="aborted")return Z;(d.status==="dirty"||g.status==="dirty")&&n.dirty(),c.set(d.value,g.value)}return{status:n.value,value:c}}}};Ms.create=(t,e,n)=>new Ms({valueType:e,keyType:t,typeName:ee.ZodMap,...ie(n)});var Ls=class t extends Ae{static{o(this,"ZodSet")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.set)return _(r,{code:N.invalid_type,expected:O.set,received:r.parsedType}),Z;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(_(r,{code:N.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(_(r,{code:N.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function a(l){let d=new Set;for(let g of l){if(g.status==="aborted")return Z;g.status==="dirty"&&n.dirty(),d.add(g.value)}return{status:n.value,value:d}}o(a,"finalizeSet");let c=[...r.data.values()].map((l,d)=>i._parse(new Ut(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>a(l)):a(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:H.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:H.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Ls.create=(t,e)=>new Ls({valueType:t,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var Xa=class t extends Ae{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.function)return _(n,{code:N.invalid_type,expected:O.function,received:n.parsedType}),Z;function r(c,l){return io({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ds(),Rn].filter(d=>!!d),issueData:{code:N.invalid_arguments,argumentsError:l}})}o(r,"makeArgsIssue");function s(c,l){return io({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ds(),Rn].filter(d=>!!d),issueData:{code:N.invalid_return_type,returnTypeError:l}})}o(s,"makeReturnsIssue");let i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof tr){let c=this;return We(async function(...l){let d=new ct([]),g=await c._def.args.parseAsync(l,i).catch(m=>{throw d.addIssue(r(l,m)),d}),h=await Reflect.apply(a,this,g);return await c._def.returns._def.type.parseAsync(h,i).catch(m=>{throw d.addIssue(s(h,m)),d})})}else{let c=this;return We(function(...l){let d=c._def.args.safeParse(l,i);if(!d.success)throw new ct([r(l,d.error)]);let g=Reflect.apply(a,this,d.data),h=c._def.returns.safeParse(g,i);if(!h.success)throw new ct([s(g,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:An.create(e).rest(Sn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||An.create([]).rest(Sn.create()),returns:n||Sn.create(),typeName:ee.ZodFunction,...ie(r)})}},Gr=class extends Ae{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Gr.create=(t,e)=>new Gr({getter:t,typeName:ee.ZodLazy,...ie(e)});var $r=class extends Ae{static{o(this,"ZodLiteral")}_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return _(n,{received:n.data,code:N.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};$r.create=(t,e)=>new $r({value:t,typeName:ee.ZodLiteral,...ie(e)});function Jp(t,e){return new Yr({values:t,typeName:ee.ZodEnum,...ie(e)})}o(Jp,"createZodEnum");var Yr=class t extends Ae{static{o(this,"ZodEnum")}_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return _(n,{expected:le.joinValues(r),received:n.parsedType,code:N.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return _(n,{received:n.data,code:N.invalid_enum_value,options:r}),Z}return We(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Yr.create=Jp;var Hr=class extends Ae{static{o(this,"ZodNativeEnum")}_parse(e){let n=le.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==O.string&&r.parsedType!==O.number){let s=le.objectValues(n);return _(r,{expected:le.joinValues(s),received:r.parsedType,code:N.invalid_type}),Z}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=le.objectValues(n);return _(r,{received:r.data,code:N.invalid_enum_value,options:s}),Z}return We(e.data)}get enum(){return this._def.values}};Hr.create=(t,e)=>new Hr({values:t,typeName:ee.ZodNativeEnum,...ie(e)});var tr=class extends Ae{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==O.promise&&n.common.async===!1)return _(n,{code:N.invalid_type,expected:O.promise,received:n.parsedType}),Z;let r=n.parsedType===O.promise?n.data:Promise.resolve(n.data);return We(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};tr.create=(t,e)=>new tr({type:t,typeName:ee.ZodPromise,...ie(e)});var Mt=class extends Ae{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o(a=>{_(r,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Z;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Z:l.status==="dirty"?Tr(l.value):n.value==="dirty"?Tr(l.value):l});{if(n.value==="aborted")return Z;let c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?Z:c.status==="dirty"?Tr(c.value):n.value==="dirty"?Tr(c.value):c}}if(s.type==="refinement"){let a=o(c=>{let l=s.refinement(c,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Z:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Z:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Kn(a))return Z;let c=s.transform(a.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Kn(a)?Promise.resolve(s.transform(a.value,i)).then(c=>({status:n.value,value:c})):Z);le.assertNever(s)}};Mt.create=(t,e,n)=>new Mt({schema:t,typeName:ee.ZodEffects,effect:e,...ie(n)});Mt.createWithPreprocess=(t,e,n)=>new Mt({schema:e,effect:{type:"preprocess",transform:t},typeName:ee.ZodEffects,...ie(n)});var Ft=class extends Ae{static{o(this,"ZodOptional")}_parse(e){return this._getType(e)===O.undefined?We(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ft.create=(t,e)=>new Ft({innerType:t,typeName:ee.ZodOptional,...ie(e)});var cn=class extends Ae{static{o(this,"ZodNullable")}_parse(e){return this._getType(e)===O.null?We(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};cn.create=(t,e)=>new cn({innerType:t,typeName:ee.ZodNullable,...ie(e)});var Vr=class extends Ae{static{o(this,"ZodDefault")}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===O.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Vr.create=(t,e)=>new Vr({innerType:t,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var Jr=class extends Ae{static{o(this,"ZodCatch")}_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ts(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ct(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Jr.create=(t,e)=>new Jr({innerType:t,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var _s=class extends Ae{static{o(this,"ZodNaN")}_parse(e){if(this._getType(e)!==O.nan){let r=this._getOrReturnCtx(e);return _(r,{code:N.invalid_type,expected:O.nan,received:r.parsedType}),Z}return{status:"valid",value:e.data}}};_s.create=t=>new _s({typeName:ee.ZodNaN,...ie(t)});var sS=Symbol("zod_brand"),oo=class extends Ae{static{o(this,"ZodBranded")}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},ao=class t extends Ae{static{o(this,"ZodPipeline")}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return o(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Z:i.status==="dirty"?(n.dirty(),Tr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})},"handleAsync")();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Z:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:ee.ZodPipeline})}},qr=class extends Ae{static{o(this,"ZodReadonly")}_parse(e){let n=this._def.innerType._parse(e),r=o(s=>(Kn(s)&&(s.value=Object.freeze(s.value)),s),"freeze");return Ts(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};qr.create=(t,e)=>new qr({innerType:t,typeName:ee.ZodReadonly,...ie(e)});function $p(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}o($p,"cleanParams");function qp(t,e={},n){return t?er.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(a=>{if(!a){let c=$p(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let a=$p(e,r),c=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:c})}}):er.create()}o(qp,"custom");var iS={object:ut.lazycreate},ee;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ee||(ee={}));var oS=o((t,e={message:`Input not instance of ${t.name}`})=>qp(n=>n instanceof t,e),"instanceOfType"),jp=Xn.create,Wp=Nr.create,aS=_s.create,AS=Fr.create,zp=Ur.create,cS=Mr.create,uS=Fs.create,lS=Lr.create,dS=_r.create,gS=er.create,hS=Sn.create,pS=Vt.create,fS=Us.create,mS=vn.create,ES=ut.create,CS=ut.strictCreate,IS=Pr.create,yS=Za.create,QS=Or.create,BS=An.create,wS=Ka.create,bS=Ms.create,RS=Ls.create,kS=Xa.create,SS=Gr.create,vS=$r.create,xS=Yr.create,DS=Hr.create,TS=tr.create,NS=Mt.create,FS=Ft.create,US=cn.create,MS=Mt.createWithPreprocess,LS=ao.create,_S=o(()=>jp().optional(),"ostring"),PS=o(()=>Wp().optional(),"onumber"),OS=o(()=>zp().optional(),"oboolean"),GS={string:o((t=>Xn.create({...t,coerce:!0})),"string"),number:o((t=>Nr.create({...t,coerce:!0})),"number"),boolean:o((t=>Ur.create({...t,coerce:!0})),"boolean"),bigint:o((t=>Fr.create({...t,coerce:!0})),"bigint"),date:o((t=>Mr.create({...t,coerce:!0})),"date")};var $S=Z;var ff=require("node:crypto");var jr=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(jr||{});var Mu=o(t=>`${t.source}:${t.site??""}:${t.key}`,"requirementItemId");var eA=/^pasted-[0-9a-f]{16}$/,Ao=/^file-[0-9a-f]{16}$/,co=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(co||{});var uo=(n=>(n.Sufficient="sufficient",n.Insufficient="insufficient",n))(uo||{}),lo=(f=>(f.RelatedChangeConflict="related_change_conflict",f.ReferenceOutsideTarget="reference_outside_target",f.SourceAccessLost="source_access_lost",f.ConfigurationIncomplete="configuration_incomplete",f.CredentialUnavailable="credential_unavailable",f.WorkflowBindingUnverified="workflow_binding_unverified",f.WorkflowRefUnprotected="workflow_ref_unprotected",f.BedrockWorkflowRequired="bedrock_workflow_required",f.DeploymentReview="deployment_review",f.SutRevisionMismatch="sut_revision_mismatch",f.IsolationUnavailable="isolation_unavailable",f.EvidenceInsufficient="evidence_insufficient",f))(lo||{}),nr=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(nr||{}),Lu=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(Lu||{}),_u=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(_u||{});var tA=(n=>(n.Probe="probe",n.Agent="agent",n))(tA||{}),nA=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(nA||{}),rA=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(rA||{});var Pu=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Pu||{}),Ne=A.string().trim().min(1),YS=A.object({action:A.enum(["start","run","wait"]),text:Ne,source:A.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Ne.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),HS=/^[A-Za-z_][A-Za-z0-9_]*$/,go=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Ps=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Ps||{}),un="shared",VS=Ne.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),Os=A.object({address:VS,readyWhen:Ne.nullable(),credentials:A.array(A.string().regex(go)).max(50),revisionSources:A.array(A.object({method:A.nativeEnum(Ps),detail:Ne.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:A.array(Ne).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),Ou={steps:A.array(YS).max(20).optional().describe("how it starts, in order"),kind:A.enum(["web_app","service","database","external_service"]).optional(),from:A.object({file:Ne,service:Ne.nullable()}).strict().optional(),credentials:A.array(A.string().max(100).regex(HS)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},JS=A.object({name:Ne,repository:Ne.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:A.boolean(),...Ou,deployed:Ne.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),qS=A.object({component:Ne,problem:Ne,evidence:Ne.describe("the exact command and output that shows it"),fix:Ne.describe("what the user must provide, and where")}),jS=A.object({framework:Ne,file:Ne.describe("the test file run, relative to its repository root"),result:A.enum(["pass","fail","error"])}),WS=A.object({input:Ne.describe("the part of the user's SUT input, as given"),reason:Ne}),AH=A.object({schemaVersion:A.literal(1),status:A.nativeEnum(Pu).describe("ready only if every component came up healthy and the recipe is written"),components:A.array(JS),suites:A.array(jS).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:A.array(Ne).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:A.array(A.object({input:Ne.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Ne.describe("what the recipe did with it")})).optional(),inputsNotUsed:A.array(WS).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one that names a file, command, port, route or setting that does not exist or does not work (SKYR-5265)"),blockers:A.array(qS).describe("required (non-empty) when status is blocked"),environment:Os.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var Gu=64*1024,$u=512*1024,Zp=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Xp=He(require("path"));var sr=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(sr||{}),rr=A.string().trim().min(1),zS=A.object({url:A.string().optional().describe("the URL probed, if the check is an HTTP request"),command:A.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:A.record(A.string()).optional(),status:A.union([A.number(),A.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:rr.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),Yu=A.array(A.object({component:rr.describe("a shared component listed above"),url:rr.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:rr.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),Kp=A.object({schemaVersion:A.literal(1),baseUrls:A.record(A.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:zS.optional(),teardown:rr.describe("command that tears the SUT down"),dependencies:A.record(A.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:A.nativeEnum(sr).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:A.array(A.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:A.object({command:rr,output:rr}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:A.array(A.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:A.boolean(),startedAt:rr.describe("ISO timestamp"),revisions:Yu.optional()});var ze=A.string().trim().min(1),Hu=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(Hu||{}),Vu=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],ef=A.object({schemaVersion:A.literal(1),type:A.nativeEnum(Hu).optional(),status:A.enum(["ready","blocked"]),environment:Os.optional(),components:A.array(A.object({name:ze,repository:ze.describe(`owner/repo, or "${un}" for a customer-deployed component no repository builds`),healthy:A.boolean(),url:A.string().min(1).nullable(),...Ou,credentials:A.array(A.string().regex(go)).max(50).optional(),deployed:ze.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:A.array(A.object({framework:ze,file:ze,result:A.enum(["pass","fail","error"])}).strict()),inputsUsed:A.array(ze),inputsUsedHow:A.array(A.object({input:ze,how:ze}).strict()).optional(),inputsNotUsed:A.array(A.object({input:ze,reason:ze}).strict()),blockers:A.array(A.object({component:ze,problem:ze,evidence:ze,fix:ze}).strict()),replay:A.object({outcome:ze,durationSeconds:A.number().nonnegative().nullable()}).strict().nullable(),files:A.array(A.object({path:ze,content:A.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:A.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=t.type==="customer_deployed";n!==(t.environment!==void 0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((a,c)=>{r.has(a)||e.addIssue({code:A.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",c],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===un&&!n&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${un}`})}),n&&(t.components.forEach((s,i)=>{t.components.findIndex(a=>a.name===s.name)!==i&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:A.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{Vu.includes(s.path)&&e.addIssue({code:A.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,a)=>{i.repository!==un&&!s.has(i.name)&&e.addIssue({code:A.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var mH=["clean","recipe-drift"];function sA(t){let e=Xp.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}o(sA,"isRuntimePlanFile");var AA=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(AA||{}),zu=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(zu||{}),Zu=(a=>(a.PullRequest="pull_request",a.ReadyForReview="ready_for_review",a.Schedule="schedule",a.Manual="manual",a.SutSetup="sut_setup",a.RevisionRead="revision_read",a))(Zu||{}),ZS=["sut_setup"],KS=["sut_setup","schedule","revision_read"],XS=["sut_setup"],Ku=(e=>(e.PullRequest="pull_request",e))(Ku||{}),mf=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(mf||{});var ho=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(ho||{}),Ef=(n=>(n.Running="running",n.Ended="ended",n))(Ef||{}),po=(c=>(c.TimedOut="timed_out",c.AgentFailed="agent_failed",c.SetupFailed="setup_failed",c.CredentialMissing="credential_missing",c.RunnerLost="runner_lost",c.CheckoutFailed="checkout_failed",c.EnvironmentUnverified="environment_unverified",c))(po||{}),Cf=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(Cf||{}),If=(n=>(n.Started="started",n.Finished="finished",n))(If||{}),yf=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(yf||{});var Qf=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(Qf||{});var Xu=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(Xu||{}),el=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(el||{}),Jt=A.string().regex(/^[1-9][0-9]{0,18}$/),ir=A.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),$s=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,tt=A.string().regex($s),nt=A.string().regex(/^[0-9a-f]{64}$/),oA=A.object({id:tt,revision:Jt}).strict(),cA={provider:A.literal("github"),providerAccountId:Jt,providerRepositoryId:Jt},uA={provider:A.literal("azure-devops"),providerAccountId:tt,providerRepositoryId:tt},or=A.discriminatedUnion("provider",[A.object(cA).strict(),A.object(uA).strict()]),tl=A.discriminatedUnion("provider",[A.object(cA).passthrough(),A.object(uA).passthrough()]),xn=o(t=>`${t.provider}:${t.providerRepositoryId}`,"sourceKey"),tf={namespace:A.string().min(1),name:A.string().min(1)},Bf=A.discriminatedUnion("provider",[A.object({...cA,...tf}).strict(),A.object({...uA,...tf}).strict()]),nf=A.object({ref:A.string().min(1),revision:ir}).strict(),ev=A.object({repository:Bf,revision:ir,ref:A.string().nullable(),reason:A.nativeEnum(zu),change:A.object({kind:A.nativeEnum(Ku),number:Jt,base:nf.optional()}).strict().nullable(),compareWith:nf.optional()}).strict();function tv(t){if(t.trigger.kind==="revision_read"!=!t.baseline)return t.baseline?"a revision_read run names no baseline":"names its baseline";if(!t.baseline)return null;let{confirmedRunId:e,initialBaselineId:n,sources:r}=t.baseline;if(e!==null&&n!==void 0)return"a run compares with one baseline";let s=t.trigger.kind==="schedule"&&e!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(e===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(t.sources.map(l=>xn(l.repository))),a=new Set(r.map(l=>xn(l.repository)));return a.size===r.length&&a.size===i.size&&[...a].every(l=>i.has(l))?null:"names every source of the snapshot, once"}o(tv,"baselineSourcesIssue");var wf=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,bf=/^[1-9][0-9]{0,18}$/,rf=new RegExp(`${wf.source}|${bf.source}`),sf=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,nv=A.union([A.object({source:A.literal("jira"),site:A.string().regex(sf),key:A.string().regex(wf),updated:A.string().datetime(),contentHash:nt}).strict(),A.object({source:A.literal("confluence"),site:A.string().regex(sf),key:A.string().regex(bf),version:A.number().int().positive(),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(eA),contentHash:nt}).strict(),A.object({source:A.literal("other"),key:A.string().regex(Ao),contentHash:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(co)}).strict()]),of=A.union([A.literal("jira"),A.literal("confluence")]),rv=A.object({schemaVersion:A.literal(1),items:A.array(A.union([A.object({source:of,site:A.string(),key:A.string().regex(rf),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:of,site:A.string(),key:A.string().regex(rf),state:A.literal("not_read"),reason:A.nativeEnum(jr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(eA),state:A.literal("read"),text:A.string(),version:A.string().min(1),contentMatches:A.boolean()}).strict(),A.object({source:A.literal("other"),key:A.string().regex(eA),state:A.literal("not_read"),reason:A.nativeEnum(jr)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(Ao),state:A.literal("read"),version:nt,fileName:A.string().min(1).max(255),mediaType:A.nativeEnum(co)}).strict(),A.object({source:A.literal("other"),key:A.string().regex(Ao),state:A.literal("not_read"),reason:A.nativeEnum(jr)}).strict()])),instructions:A.array(A.string()).optional()}).strict(),sv=A.object({schemaVersion:A.literal(1),runId:tt,skyrampOrgId:tt,target:oA,policy:oA.nullable(),trigger:A.object({kind:A.nativeEnum(Zu),requestedAt:A.string().datetime()}).strict(),configuration:A.object({captureId:tt,revision:Jt.nullable(),hash:nt}).strict(),baseline:A.object({confirmedRunId:tt.nullable(),initialBaselineId:tt.optional(),sources:A.array(A.object({repository:or,revision:ir}).strict()).optional()}).strict().optional(),sources:A.array(ev).min(1),execution:A.object({provider:A.nativeEnum(AA),repository:Bf,workflowPath:A.string(),ref:A.string()}).strict(),credentials:A.array(A.object({name:A.string(),purpose:A.nativeEnum(mf),required:A.boolean()}).strict()),requirements:A.array(nv).min(1).optional(),instructions:A.object({contentHash:nt}).strict().optional(),deployedRevisions:A.array(A.object({repository:or,revision:ir}).strict()).min(1).optional()}).strict().superRefine((t,e)=>{let n=new Set;(t.requirements??[]).forEach((l,d)=>{let g="fileName"in l?"file":"pasted";l.source==="other"&&l.key!==`${g}-${l.contentHash.slice(0,16)}`&&e.addIssue({code:A.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let h=Mu({source:l.source,key:l.key});n.has(h)&&e.addIssue({code:A.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(h)});let r=t.trigger.kind,s=ZS.includes(r);s!==(t.policy===null)&&e.addIssue({code:A.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=tv(t);i&&e.addIssue({code:A.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),KS.includes(r)&&t.sources.forEach((l,d)=>{l.reason!=="BASELINE"&&e.addIssue({code:A.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),t.deployedRevisions&&r!=="manual"&&e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(t.sources.map(l=>xn(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let g=xn(l.repository);a.has(g)?c.has(g)&&e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):e.addIssue({code:A.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),c.add(g)}),t.sources.forEach((l,d)=>{l.compareWith&&(l.reason!=="MANUAL_OVERRIDE"||l.change)&&e.addIssue({code:A.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"})})});var Rf=(n=>(n.Person="person",n.Policy="policy",n))(Rf||{}),iv=A.object({kind:A.nativeEnum(Rf),name:A.string().min(1).max(256)}).strict(),ov=A.object({schemaVersion:A.literal(1),attempt:A.object({id:tt,number:A.number().int().positive(),deadlineAt:A.string().datetime()}).strict(),manifest:sv,manifestHash:nt,entitlements:A.array(A.string()).optional(),runToken:A.string().min(1).optional(),requestedBy:iv.nullable().optional(),writeAllowed:A.boolean().optional(),claudeCodeVersion:A.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:A.array(A.object({repository:or,revision:ir}).strict()).optional()}).strict(),af={providerRunAttempt:A.number().int().positive(),workflowRef:A.string().min(1)},av=A.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),Av=A.object({schemaVersion:A.literal(1),runId:tt,execution:A.discriminatedUnion("provider",[A.object({...af,provider:A.literal("github"),repository:A.object(cA).strict(),providerRunId:Jt}).strict(),A.object({...af,provider:A.literal("azure-devops"),repository:A.object(uA).strict(),providerRunId:av}).strict()]),requester:A.literal(!0).optional(),writeCheck:A.literal(!0).optional(),claudeCodePin:A.literal(!0).optional(),deployedPins:A.literal(!0).optional()}).strict(),Af=A.object({repository:or,number:Jt}).strict(),cv=A.discriminatedUnion("status",[A.object({status:A.literal("none")}).strict(),A.object({status:A.literal("delivered"),pullRequests:A.array(Af).min(1)}).strict(),A.object({status:A.literal("partial"),pullRequests:A.array(Af).min(1),failures:A.array(A.object({repository:or,message:A.string()}).strict()).min(1)}).strict(),A.object({status:A.literal("failed"),message:A.string()}).strict()]),uv=A.object({sufficiency:A.nativeEnum(uo),rationale:A.string().min(1),gaps:A.array(A.string().min(1)),acceptedEvidence:A.array(A.object({kind:A.nativeEnum(nr),repository:A.string().min(1),revision:ir,reference:A.string().min(1),summary:A.string().min(1)}).strict()),actionRequired:A.array(A.nativeEnum(lo))}).strict().superRefine((t,e)=>{t.sufficiency==="sufficient"!=(t.gaps.length===0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["gaps"],message:"sufficient evidence has no gaps, and insufficient evidence names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Ju=500,lv=2048,dv=1e3,gv=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,cf=o(t=>t.length>0&&t.length<=64&&t===t.trim()&&!gv.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),"isAzureName"),hv=o(t=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(t))return!0;let[e,n,r,...s]=t.split("/");return t.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(e)&&cf(n)&&cf(r)},"isResultRepository"),pv=A.object({testResults:A.array(A.object({resultId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:A.string().refine(hv,"Invalid"),testType:A.string(),endpoint:A.string(),status:A.enum(["Pass","Fail","Skipped"]),details:A.string(),fileName:A.string().optional(),testId:A.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:A.object({kind:A.nativeEnum(Lu),family:A.nativeEnum(_u).optional()}).strict().optional()}).strict()),validation:uv,changes:A.array(A.object({id:A.string().min(1).max(512),text:A.string().max(16384),source:A.string().max(lv),testedBy:A.array(A.string().min(1).max(1024)).max(Ju),writtenBy:A.array(A.string().min(1).max(1024)).max(Ju),maintainedBy:A.array(A.string().min(1).max(1024)).max(Ju)}).strict()).max(dv).optional(),traceVersion:A.literal(1)}).passthrough().superRefine((t,e)=>{let n=new Set;t.testResults.forEach((r,s)=>{let i=r.failureCause;i&&r.status==="Pass"&&e.addIssue({code:A.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"a passing result has no failure cause"}),i&&i.kind==="environment"!=(i.family!==void 0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["testResults",s,"failureCause"],message:"an environment cause names its family, and no other cause does"});let a=["testResults",s,"resultId"],c=r.resultId.slice(`${r.repository}:${r.testType}:`.length);(!r.resultId.startsWith(`${r.repository}:${r.testType}:`)||c===""||c.startsWith("/")||c.startsWith("#"))&&e.addIssue({code:A.ZodIssueCode.custom,path:a,message:"is not repository:testType:path for this result"}),n.has(r.resultId)&&e.addIssue({code:A.ZodIssueCode.custom,path:a,message:"stable identity repeated"}),n.add(r.resultId)})}),uf=o(t=>t.replace(/[%:#]/g,e=>encodeURIComponent(e)),"encodeIdPart");function kf(t,e,n,r){let s=n.replace(/\\/g,"/"),i=s.split("/").filter(l=>l!==""&&l!==".");if(s.startsWith("/")||/^[A-Za-z]:/.test(s)||i.length===0||i.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=i.join("/"),c=`${t}:${e}:${uf(a)}`;return r?`${c}#${uf(r)}`:c}o(kf,"testResultId");var Sf=50,lf=A.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),vf=A.discriminatedUnion("kind",[A.object({kind:A.literal("branch_pushed"),repository:or,branch:lf,commit:ir}).strict(),A.object({kind:A.enum(["pull_request_opened","pull_request_edited"]),repository:or,number:Jt,branch:lf}).strict()]),xf=A.object({schemaVersion:A.literal(1),run:A.object({runId:tt,attemptNumber:A.number().int().positive(),manifestHash:nt}).strict(),target:oA,policy:oA,provenance:A.object({sources:A.array(A.object({repository:or,revision:ir}).strict()),firstQualification:A.literal(!0).optional()}).strict(),delivery:A.object({generatedTests:cv}).strict(),producer:A.object({testbot:A.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:A.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:pv,githubWrites:A.array(vf).max(Sf).optional()}).strict(),bH=xf.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:ef}).strict().superRefine(({recipe:t},e)=>{let n=o((i,a)=>e.addIssue({code:A.ZodIssueCode.custom,path:["recipe",...i],message:a}),"issue");t.status==="blocked"&&t.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;t.files.forEach((i,a)=>{sA(i.path)||n(["files",a,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",a,"path"],"file repeated"),r.add(i.path),Zp.test(i.content)&&n(["files",a,"content"],"is not text");let c=Buffer.byteLength(i.content,"utf8");s+=c,c>Gu&&n(["files",a,"content"],`larger than ${Gu} bytes`)}),s>$u&&n(["files"],`recipe text over ${$u} bytes in total`)}),RH=A.object({components:A.array(A.object({name:A.string().min(1),repository:A.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:A.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:A.nativeEnum(tA),evidence:A.string()}).strict().refine(t=>t.source!=="agent"||t.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var fv=A.object({schemaVersion:A.literal(1),stage:A.nativeEnum(Cf),event:A.nativeEnum(If),status:A.nativeEnum(yf).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Df=100,mv=5e3,qu=2e3,df=100,Tf=/^[A-Za-z0-9_-]{1,64}$/,Ev=20,Cv=200,Iv=100,yv=100,Qv=200,gf="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Bv=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${gf}/${gf})$`),wv=500,bv=50,Rv=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,ln=o(t=>A.string().max(t).refine(e=>e.trim().length>0&&!Rv.test(e),"blank, or not text"),"setupText"),Gs={sequence:A.number().int().min(1).max(mv),at:A.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},kv=A.discriminatedUnion("kind",[A.object({...Gs,kind:A.literal("log"),phase:A.nativeEnum(Xu),text:ln(qu)}).strict(),A.object({...Gs,kind:A.literal("component"),name:ln(df),repository:ln(Qv).refine(t=>Bv.test(t)||t===un,"not owner/name"),file:ln(wv).nullable(),status:A.nativeEnum(el),version:ln(yv).optional()}).strict(),A.object({...Gs,kind:A.literal("reply"),to:A.string().uuid(),accepted:A.boolean(),text:ln(qu)}).strict(),A.object({...Gs,kind:A.literal("question"),id:A.string().regex(Tf),type:A.nativeEnum(Qf),text:ln(qu),component:ln(df).nullable(),choices:A.array(ln(Cv)).max(Ev),placeholder:ln(Iv).optional()}).strict(),A.object({...Gs,kind:A.literal("delivered"),ids:A.array(A.string().uuid()).max(Df)}).strict(),A.object({...Gs,kind:A.literal("credentials"),names:A.array(A.string().regex(go)).min(1).max(bv)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:A.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:A.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Sv=A.object({schemaVersion:A.literal(1),events:A.array(kv).max(Df)}).strict(),hf={id:A.string().uuid(),text:A.string(),by:A.string().nullable(),at:A.string(),replied:A.literal(!0).optional()},vv=A.discriminatedUnion("kind",[A.object({...hf,kind:A.literal("instruction"),question:A.null()}),A.object({...hf,kind:A.literal("answer"),question:A.string().regex(Tf)})]),Nf=A.string().regex(/^[A-Za-z0-9+/]{43}=$/),xv=A.object({id:A.string().uuid(),revision:A.string(),by:A.string().nullable(),at:A.string(),target:A.string(),own:A.object({source:A.enum(["policy","test_environment"]),text:A.string()}).nullable()}),Dv=A.object({schemaVersion:A.literal(1),leftOut:A.array(A.string()),messages:A.array(vv).optional(),stop:A.object({key:Nf}).optional(),notes:xv.optional()});var Tv=500*1024*1024,Ff=A.object({id:Jt,name:A.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Jt,expiresAt:A.string().datetime()}).strict(),Nv=A.object({schemaVersion:A.literal(1),artifact:Ff,sessionId:tt,contentHash:nt,bytes:A.number().int().min(1).max(Tv)}).strict(),Fv=A.object({schemaVersion:A.literal(1),checkpoint:A.object({artifact:Ff,repository:A.object({namespace:A.string().min(1),name:A.string().min(1)}).strict(),sessionId:tt,contentHash:nt,key:Nf}).strict().nullable()}).strict(),Uv=200,iA=100,Uf=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(Uf||{}),Mv=A.object({kind:A.nativeEnum(Uf),setup:A.object({runId:tt,endedAt:A.string().nullable(),outcome:A.string().nullable()}).strict(),components:A.array(A.object({name:A.string().min(1),repository:A.string().min(1),status:A.nativeEnum(el)}).strict()).max(iA),credentials:A.array(A.string().min(1)).max(iA),answers:A.array(A.object({question:A.string(),answer:A.string().nullable()}).strict()).max(iA),instructions:A.array(A.object({text:A.string(),reply:A.string().nullable()}).strict()).max(iA),log:A.array(A.object({phase:A.nativeEnum(Xu),text:A.string()}).strict()).max(Uv)}).strict(),Lv=A.object({schemaVersion:A.literal(1),context:Mv.nullable()}).strict(),_v=A.object({schemaVersion:A.literal(1),configuration:A.object({captureId:tt,revision:Jt.nullable(),hash:nt}).strict(),capture:A.object({schemaVersion:A.literal(1),settings:A.object({target:A.object({environment:A.unknown()}).passthrough(),timeoutMinutes:A.number().int().positive(),answerWaitMinutes:A.number().int().positive().optional(),testEnvironment:A.object({name:A.string().min(1),address:A.string().min(1).optional(),readyWhen:A.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:A.object({}).passthrough(),hash:nt}).strict()}).strict(),Pv=Os.extend({version:A.number().int().positive(),components:A.array(A.object({name:A.string().min(1),repository:A.string().min(1)}).strict()),contentHash:nt.optional(),files:A.array(A.object({path:A.string().refine(t=>sA(t)&&!Vu.includes(t),"not a file of a customer_deployed plan"),content:A.string()}).strict()).optional()}).strict(),Ov=A.object({schemaVersion:A.literal(1),testEnvironment:Pv.nullable().optional(),runtimePlan:A.object({version:A.number().int().positive(),contentHash:nt,files:A.array(A.object({path:A.string().refine(sA,"not a recipe file path"),content:A.string()}).strict()).min(1),recipe:A.record(A.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),Mf=A.object({schemaVersion:A.literal(1),state:A.nativeEnum(Ef),ending:A.nativeEnum(ho).nullable(),cause:A.nativeEnum(po).nullable(),deadlineAt:A.string().datetime()}).strict();function Lf(t,e){return t.state==="ended"?t.ending==="cancelled"?"cancelled":t.cause==="runner_lost"?"expired":"ended":e.getTime()>=Date.parse(t.deadlineAt)?"expired":null}o(Lf,"attemptClosure");function ju(t){if(typeof t=="number"&&!Number.isFinite(t))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(t))return`[${t.map(ju).join(",")}]`;if(t!==null&&typeof t=="object"){let n=t;return`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${ju(n[r])}`).join(",")}}`}let e=JSON.stringify(t);if(e===void 0)throw new TypeError("Canonical JSON requires JSON values");return e}o(ju,"canonicalJson");function _f(t){return(0,ff.createHash)("sha256").update(ju(t),"utf8").digest("hex")}o(_f,"manifestHash");var aA=o(t=>({provider:t.provider,providerAccountId:t.providerAccountId,providerRepositoryId:t.providerRepositoryId}),"toSourceRef");function Pf(t,e){return Av.parse({schemaVersion:1,runId:t,execution:e.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0})}o(Pf,"handshakeRequest");function Of(t){let e=ov.parse(t);if(_f(e.manifest)!==e.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return e}o(Of,"parseHandshakeResponse");function Gv(t){let e=o(n=>n.map(r=>({repository:aA(r.repository),number:r.number})),"pullRequests");return t.status==="delivered"?{status:t.status,pullRequests:e(t.pullRequests)}:t.status==="partial"?{status:t.status,pullRequests:e(t.pullRequests),failures:t.failures.map(n=>({repository:aA(n.repository),message:n.message}))}:t}o(Gv,"toDelivery");function $v(t){return t.issues.map(e=>`${e.path.map((r,s)=>typeof r=="number"?`[${r}]`:s===0?r:`.${r}`).join("")}: ${e.message}`).join("; ")}o($v,"describeIssues");function Gf(t){let{manifest:e}=t;if(XS.includes(e.trigger.kind))throw new Error(`The report upload is invalid: a ${e.trigger.kind} run uploads its SUT recipe, never a report`);if(e.trigger.kind==="revision_read")throw new Error("The report upload is invalid: a revision_read run uploads what each component runs, never a report");if(t.firstQualification&&!e.baseline?.sources)throw new Error("The report upload is invalid: only a run whose manifest names baseline sources can be a first qualification");let n=xf.safeParse({schemaVersion:1,run:{runId:e.runId,attemptNumber:t.attemptNumber,manifestHash:_f(e)},target:{id:e.target.id,revision:e.target.revision},policy:e.policy&&{id:e.policy.id,revision:e.policy.revision},provenance:{sources:t.checkedOut.map(r=>({repository:aA(r.repository),revision:r.revision})),...t.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:Gv(t.generatedTests)},producer:t.producer,report:t.report,...t.githubWrites?.length?{githubWrites:t.githubWrites.map(r=>({...r,repository:aA(r.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${$v(n.error)}`);return Yv(n.data,e,t.checkedOut),n.data}o(Gf,"buildReportUpload");function Yv(t,e,n){let r=o(i=>n.find(a=>xn(a.repository)===xn(i.repository))?.revision??i.revision,"revisionOf"),s=new Map(e.sources.map(i=>[`${i.repository.namespace}/${i.repository.name}`.toLowerCase(),r(i)]));t.report.validation.acceptedEvidence.forEach((i,a)=>{let c=`report.validation.acceptedEvidence[${a}]`,l=s.get(i.repository.toLowerCase());if(!l)throw new Error(`${c}.repository: ${i.repository} is outside the run's snapshot`);if(i.revision!==l)throw new Error(`${c}.revision: evidence is not from the checked-out revision ${l}`)})}o(Yv,"assertEvidenceFromSnapshot");function $f(t){return t.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:t.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:t.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:t.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:{schemaVersion:1,reason:"no_report",cause:Hv(t)}}o($f,"attemptEndFor");function Hv(t){return t.credentialMissing?"credential_missing":t.checkoutFailed?"checkout_failed":t.environmentUnverified?"environment_unverified":t.setupFailed?"setup_failed":t.timedOut?"timed_out":"agent_failed"}o(Hv,"noReportCause");var DH={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var Jv=10*1024*1024;var qv=["generate-unit","native-run"],LH=["preflight","plan","write",...qv,"report","deliver"];var lA=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(lA||{});var fo=He(require("fs")),mo=He(require("path"));var jv=8;function lt(t,e,n={}){let r=e.slice(0,jv),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}o(lt,"fail");function Ys(t){if(fo.existsSync(t))try{return JSON.parse(fo.readFileSync(t,"utf-8"))}catch{return}}o(Ys,"readJsonFile");function qt(t,e){return Ys(mo.join(t.outputsDir,e))}o(qt,"readArtifact");function ar(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:lt(this.name,s,{fatal:!0})}}}o(ar,"schemaGate");function Eo(t){return t.replace(/\s+/g," ").trim()}o(Eo,"normalizeCode");var dA=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var Wv=4,Yf="\xABredacted\xBB";function Hf(t){let e=new Set;for(let n of t){let r=(n??"").trim();r.length>=Wv&&e.add(r)}return[...e].sort((n,r)=>r.length-n.length)}o(Hf,"redactionsFrom");function Hs(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(Yf));return n}o(Hs,"redactSecrets");function zv(t,e){let n=o(r=>typeof r=="string"?e(r):Array.isArray(r)?r.map(n):r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,i])=>[s,n(i)])):r,"walk");return n(t)}o(zv,"mapStrings");function Vs(t,e){return e.length===0?t:zv(t,n=>Hs(n,e))}o(Vs,"redactDeep");var jH=new TextDecoder("utf-8",{fatal:!0});var rV=new Set(Object.values(nr));var sV=A.object({checks:A.array(A.object({repository:A.string().optional(),name:A.string().min(1),headSha:A.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:A.string().default("completed"),conclusion:A.string().nullable().optional(),url:A.string().optional(),summary:A.string().optional()}))});var Co=(n=>(n.Full="full",n.Static="static",n))(Co||{}),Ar=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(Ar||{}),Io=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(Io||{}),Wr=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(Wr||{}),gA=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(gA||{});var It=A.string().trim().min(1),Kv=A.object({subject:It.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:A.nativeEnum(gA),value:A.union([A.string(),A.number(),A.boolean(),A.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),Xv=A.object({test:It.describe("existing test path, relative to its repository"),repository:It.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:A.nativeEnum(Wr),evidence:It.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:A.array(A.string()).optional().describe("analyze behavior ids this maintenance covers")});var e0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axis:A.nativeEnum(Io)}),t0=A.object({id:It.describe("short-slug, unique across generate[]"),type:A.nativeEnum(Ar),target:It.describe('"METHOD /path", or a business-flow name'),from_finding:A.string().optional().describe("analyze finding id this case catches"),from_behavior:A.string().optional().describe("analyze behavior id this case pins"),derived_from:e0.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:It.describe("why this test matters"),expected_observable:It.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:Kv.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:It.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:A.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),n0=A.object({covered:A.array(A.string()).optional(),abstain:A.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:A.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:A.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:A.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),r0=A.object({surface:It.describe("a surface from the list, copied verbatim"),axes:A.object(Object.fromEntries(Object.values(Io).map(t=>[t,n0])))}),Vf=A.object({schemaVersion:A.literal(1),mode:A.nativeEnum(Co),maintenance:A.array(Xv),generate:A.array(t0),surfaces:A.array(r0).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:A.object({total:A.number().describe("case count"),rationale:It}),summary:It.describe("one paragraph")});var hA=["-c","core.fsmonitor=false"],s0=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),i0=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Dn(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&i0.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(s0.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}o(Dn,"untrustedChildEnv");var o0=".skyramp/sut/deployed-revisions.sh",nl=(n=>(n.Running="running",n.Requested="requested",n))(nl||{});var yV=new Set(Object.values(nl));var QV=`Fix ${o0} so it prints the full commit each component runs, then set it up again.`;var rl="shared-environment";var _V=64*1024;var PV=new Set(["version_endpoint","api"]);function sl(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}o(sl,"verifiableComponents");function Jf(t){return sl(t).length>0||(t?.dependencies.length??0)>0}o(Jf,"hasSharedSystem");function a0(t){let e=t.inputs?.sharedEnvironment;if(!Jf(e))return;let n=qt(t,`${rl}.json`);if(n)return{components:A0(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:sl(e).map(s=>qf(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}o(a0,"sharedSystem");var qf=o((t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e}),"unrecordedRow");function A0(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=sl(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>qf(s,"Not checked: the run recorded no read of it."))]}o(A0,"withUnrecordedTouched");function il(t){return(a0(t)?.components??[]).filter(e=>e.status!=="verified")}o(il,"unverifiedComponents");function ol(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}o(ol,"unfrozenComponents");function Lt(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=o(l=>{try{let d=JSON.parse(l);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},"tryParse"),s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(l){i=l instanceof Error?l.message:String(l)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let l=a.length-1;l>=0;l--){let d=r(a[l][1].trim());if(d!==void 0)return{value:d}}let c;for(let l=n.indexOf("{");l!==-1;l=n.indexOf("{",l+1)){let d=0,g=!1,h=!1;for(let f=l;f<n.length;f++){let m=n[f];if(h){h=!1;continue}if(m==="\\"){h=g;continue}if(m==='"'){g=!g;continue}if(!g){if(m==="{")d++;else if(m==="}"&&(d--,d===0)){let C=r(n.slice(l,f+1));C!==void 0&&Object.keys(C).length>0&&(c=C,l=f);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${c0(Hs(n,e))}"`}}o(Lt,"extractJsonObject");var jf=240;function c0(t){let e=t.replace(/\s+/g," ").trim();return e.length<=jf?e:`\u2026${e.slice(-jf)}`}o(c0,"snippetOf");function u0(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),a=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${a}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}o(u0,"issuesToMessages");function Tn(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=o((i,a)=>a.reduce((c,l)=>c&&typeof c=="object"?c[l]:void 0,i),"at"),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((a,{path:c})=>Wf(a,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:u0(n.error)}}o(Tn,"validateWith");function Wf(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=Wf(s[n],r):delete s[n],s}o(Wf,"withoutAt");var qs=He(require("path"));function l0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}o(l0,"getDefaultExportFromCjs");var Ze={},pA={},cr={},zf;function yo(){if(zf)return cr;zf=1;function t(a){return typeof a>"u"||a===null}o(t,"isNothing");function e(a){return typeof a=="object"&&a!==null}o(e,"isObject");function n(a){return Array.isArray(a)?a:t(a)?[]:[a]}o(n,"toArray");function r(a,c){if(c){let l=Object.keys(c);for(let d=0,g=l.length;d<g;d+=1){let h=l[d];a[h]=c[h]}}return a}o(r,"extend");function s(a,c){let l="";for(let d=0;d<c;d+=1)l+=a;return l}o(s,"repeat");function i(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return o(i,"isNegativeZero"),cr.isNothing=t,cr.isObject=e,cr.toArray=n,cr.repeat=s,cr.isNegativeZero=i,cr.extend=r,cr}o(yo,"requireCommon");var al,Zf;function Qo(){if(Zf)return al;Zf=1;function t(n,r){let s="",i=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(s+='in "'+n.mark.name+'" '),s+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(s+=`
|
|
47
47
|
|
|
48
48
|
`+n.mark.snippet),i+" "+s):i}o(t,"formatError");function e(n,r){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=r,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return o(e,"YAMLException2"),e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=o(function(r){return this.name+": "+t(this,r)},"toString"),al=e,al}o(Qo,"requireException");var Al,Kf;function d0(){if(Kf)return Al;Kf=1;let t=yo();function e(s,i,a,c,l){let d="",g="",h=Math.floor(l/2)-1;return c-i>h&&(d=" ... ",i=c-h+d.length),a-c>h&&(g=" ...",a=c+h-g.length),{str:d+s.slice(i,a).replace(/\t/g,"\u2192")+g,pos:c-i+d.length}}o(e,"getLine");function n(s,i){return t.repeat(" ",i-s.length)+s}o(n,"padStart");function r(s,i){if(i=Object.create(i||null),!s.buffer)return null;i.maxLength||(i.maxLength=79),typeof i.indent!="number"&&(i.indent=1),typeof i.linesBefore!="number"&&(i.linesBefore=3),typeof i.linesAfter!="number"&&(i.linesAfter=2);let a=/\r?\n|\r|\0/g,c=[0],l=[],d,g=-1;for(;d=a.exec(s.buffer);)l.push(d.index),c.push(d.index+d[0].length),s.position<=d.index&&g<0&&(g=c.length-2);g<0&&(g=c.length-1);let h="",f=Math.min(s.line+i.linesAfter,l.length).toString().length,m=i.maxLength-(i.indent+f+3);for(let y=1;y<=i.linesBefore&&!(g-y<0);y++){let v=e(s.buffer,c[g-y],l[g-y],s.position-(c[g]-c[g-y]),m);h=t.repeat(" ",i.indent)+n((s.line-y+1).toString(),f)+" | "+v.str+`
|
|
@@ -78,7 +78,7 @@ ${l}`,this.dataLineCount++;return}if(Cu(e,s,Y$)){q$(e,i)&&(this.setEventFieldSiz
|
|
|
78
78
|
`)){let n=e.trim();if(n)try{let r=JSON.parse(n);if(r.type==="system"&&r.subtype==="init"&&Array.isArray(r.mcp_servers))return Object.fromEntries(r.mcp_servers.filter(s=>typeof s.name=="string").map(s=>[s.name,typeof s.status=="string"?s.status:"unknown"]))}catch{}}return{}}o(U0,"mcpServerStatuses");function Wm(t){let e=U0(t).skyramp;return e===void 0||e==="connected"}o(Wm,"skyrampConnected");function M0(t){if(!zr.existsSync(t))return[];let e=[];for(let n of zr.readFileSync(t,"utf-8").split(`
|
|
79
79
|
`)){let r=n.trim();if(!r)continue;let s;try{s=JSON.parse(r)}catch{continue}let i=s.message?.content;Array.isArray(i)&&e.push(...i)}return e}o(M0,"contentBlocks");var L0=A.object({route:A.string().describe('the page this step happens on, e.g. "/products/:id"'),action:A.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:A.array(A.string()).optional().describe("the plan clause ids this step exercises"),check:A.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),Bo=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Bo||{}),zm=(r=>(r.Spec="spec",r.PrDescription="pr-description",r.Inferred="inferred",r))(zm||{}),Zm=A.object({id:A.string().describe('e.g. "J1"'),name:A.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:A.string().describe("the route the user starts the flow on: the app's normal starting page for it, never a deep link into its middle"),steps:A.array(L0).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:A.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:A.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:A.nativeEnum(Bo).optional().describe("in-process when the repo's in-process tests (components, app routes) can walk the whole flow and check it; else browser"),source:A.nativeEnum(zm).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:A.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:A.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),mA=A.object({journey:A.string().describe("the plan's journey id"),file:A.string().describe("the browser test file that walks it"),brokeAt:A.object({step:A.number().int().describe("the 1-based step whose check failed first"),expected:A.string(),actual:A.string().describe("what the app did instead, from the runner's output"),notReached:A.array(A.number().int()).optional().describe("later steps the test could not get to")}).optional().describe("only when the journey's test failed on a check: where"),test:A.string().describe("the title of the one test in that file that walks it end to end")});var Ll=(s=>(s.RestApi="rest-api",s.Frontend="frontend",s.FullStack="full-stack",s.Other="other",s))(Ll||{}),wo=(s=>(s.Critical="critical",s.High="high",s.Medium="medium",s.Low="low",s))(wo||{}),EA=(r=>(r.Suspected="suspected",r.Latent="latent",r.Refuted="refuted",r))(EA||{}),Xm=(r=>(r.Skyramp="skyramp",r.External="external",r.Unknown="unknown",r))(Xm||{}),eE=(s=>(s.Cascade="cascade",s.Restrict="restrict",s.Orphan="orphan",s.Unknown="unknown",s))(eE||{}),Ws=(s=>(s.RequirementReference="requirement-reference",s.Spec="spec",s.PrDescription="pr-description",s.CouldBreak="could-break",s))(Ws||{}),Ie=A.string().trim().min(1),zs=Ie.describe("file:line"),Km=o(t=>Ie.refine(e=>e.length<=400,e=>({message:`is ${e.length} characters, over the 400 cap \u2014 ${t}`})),"cap400"),bo=Ie.optional().describe('multi-repo only: the OTHER checkout this lives in \u2014 its "owner/repo" slug, or the directory name if the run discovered it; omit for the working checkout'),Ml=A.object({method:Ie,path:Ie,service:A.string().optional(),evidence:zs,repository:bo}),_0=A.object({id:Ie.describe("short-slug, e.g. R9"),statement:Ie.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:A.nativeEnum(Ws).describe("spec outranks pr-description when both state it"),evidence:Ie.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),P0=A.object({id:Ie.describe("short-slug"),statement:Ie.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:Ie.describe("METHOD /path, or a component/page name"),evidence:Ie.describe("file:line from the diff that introduces it"),repository:bo,satisfies:A.array(Ie).optional().describe("requirement ids (from `requirements`) this behaviour correctly implements \u2014 a requirement met only in part is ALSO named by the finding that shows the rest (conflictsWith)")}),O0=A.object({id:Ie.describe("short-slug"),file:Ie,line:A.number().optional(),claim:Km("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:A.nativeEnum(wo),evidence:Km("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:A.nativeEnum(EA),repository:bo,conflictsWith:A.array(Ie).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),G0=A.object({name:Ie,language:A.string().optional(),framework:A.string().optional(),evidence:zs,repository:bo}),$0=A.object({dir:Ie,framework:A.string().optional(),kind:A.nativeEnum(Xm),evidence:zs,repository:bo}),Y0=A.object({from:Ie,to:Ie,onDelete:A.nativeEnum(eE),evidence:zs}),H0=A.object({entity:Ie,field:Ie,values:A.array(A.string()),evidence:zs}),V0=A.object({entities:A.array(A.object({name:Ie,evidence:zs})),references:A.array(Y0).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:A.array(H0)}),yq=A.object({schemaVersion:A.literal(1),repository:A.object({path:Ie.describe("absolute repo path"),currentBranch:Ie,baseBranch:Ie}),project:A.object({type:A.nativeEnum(Ll),primaryLanguage:Ie,languages:A.array(A.string()),frameworks:A.array(A.string())}),services:A.array(G0),infrastructure:A.object({containerized:A.boolean(),hasDockerCompose:A.boolean(),composeFiles:A.array(A.string()),hasCiCd:A.boolean()}),diff:A.object({changedFiles:A.array(A.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:A.boolean(),summary:Ie.describe("\u2264400 chars")}),endpoints:A.object({new:A.array(Ml),modified:A.array(Ml),removed:A.array(Ml)}),existingTests:A.object({locations:A.array($0)}),entityMap:V0,requirements:A.array(_0).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:A.array(P0),findings:A.array(O0),unexamined:A.array(A.string()).describe("files or areas outside this change you did not open"),summary:Ie.describe("one paragraph on what this change does and its test-relevant risk")});var CA=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(CA||{}),Nn=A.string().trim().min(1),J0=A.object({case:Nn.describe("recommend id this assertion enforces"),evidence:Nn.describe("the exact assertion line from the file that checks that case's observable")}),q0=A.object({kind:A.nativeEnum(nA),target:Nn.describe("the dependency, endpoint or data it affects"),mechanism:A.nativeEnum(rA).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:Nn.describe("what it sets up"),worker:Nn.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:Nn.optional().describe("seed: a command, without a shell, that removes the data when the test does not")}),j0=A.object({file:Nn.describe("staged path under .skyramp/staged/"),source:A.nativeEnum(CA),language:Nn,covers:A.array(A.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:A.array(J0).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:A.array(q0).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),_l=A.object({schemaVersion:A.literal(1),tests:A.array(j0),deferredUi:A.array(A.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:Nn.describe("one paragraph")});var Zr=A.string().trim().min(1),Ro=72,W0=A.object({repository:Zr.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:A.string(),command:A.string().describe("the exact command you ran, scoped to the changed files"),clean:A.boolean(),fixed:A.array(A.string()).optional().describe("files you fixed"),uncovered:A.array(A.string()).describe("changed/new files this linter's own config does not match (wrong extension, wrong directory) \u2014 so `clean` never examined them, even though CI may still execute them. Empty array, not omitted, when every changed/new file IS covered.")}),Nq=A.object({schemaVersion:A.literal(1),lint:A.array(W0).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:A.object({ok:A.boolean(),notes:A.string().optional()}),ciReadiness:A.object({covered:A.boolean().describe("will the repo's CI run these tests?"),notes:A.string().optional()}),dependencies:A.object({added:A.array(A.object({package:A.string(),manifest:A.string(),repository:Zr.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:Zr.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).describe("every package added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own")}),commit:A.object({message:Zr.refine(t=>t.split(`
|
|
80
80
|
`)[0].length<=Ro,{message:`subject line must be <= ${Ro} chars`})}),pr:A.object({title:Zr.max(Ro,`must be <= ${Ro} chars`),body:Zr}),ready:A.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:A.array(A.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:Zr.describe("one paragraph")});var lr=He(require("fs")),Ks=He(require("path")),oE=require("child_process");var Fn="{junit}",nE=(r=>(r.Junit="junit",r.Trx="trx",r.GoTestJson="go-test-json",r))(nE||{}),rE=(e=>(e.Minitest="minitest",e))(rE||{}),tE=A.string().trim().min(1),Zs=A.object({cwd:tE.describe('repo-relative directory the command starts in ("." for the root)'),argv:A.array(tE).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report one argument holds ${Fn}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:A.record(A.string(),A.string()).optional().describe("plain settings the tests read beyond the repository's CI test job (RAILS_ENV=test, DB_CONNECTION=sqlite); never a credential, PATH, or a tool's install path"),report:A.object({format:A.nativeEnum(nE).describe(`junit (JUnit XML to ${Fn}), trx (to ${Fn}), or go-test-json (go test -json on the command's output)`),reporter:A.nativeEnum(rE).optional().describe("a reporter Testbot loads for a runner that writes no report: minitest")}).optional().describe("the report the command writes; junit when omitted")});var Lq=`pytest, Jest, Vitest and node --test tests run as the run already knows them. A test in any other framework also gives "run": the repository's own command for only those tests, from the directory the repository runs it in, as separate arguments without a shell. Its "report" says what the runner writes: junit (JUnit XML to the argument ${Fn}), trx (a TRX file to ${Fn}, which every dotnet test writes with its built-in logger), or go-test-json (go test -json, read from the command's output). A Maven or Gradle command names no ${Fn}: its build writes JUnit XML to its own report directory, which the run reads. Use a reporter the repository already has, or one of those; a reporter or converter the command fetches is the version the repository pins, or else its latest release (an older one may not build with the repository's toolchain). For minitest, which writes none, give report.reporter "minitest" and the run fills ${Fn} itself. A setting the tests read goes in "env" (RAILS_ENV=test): the run sets it, so never wrap the command in a shell to set one. The run executes the command and reads that report.`;var Kr=(s=>(s.ExistingEvidenceSufficient="existing_evidence_sufficient",s.TargetedUnit="targeted_unit",s.RuntimeRequired="runtime_required",s.BlockedPreflight="blocked_preflight",s))(Kr||{}),ur=(i=>(i.ExistingEvidence="existing_evidence",i.Unaffected="unaffected",i.ExistingUnit="existing_unit",i.NewUnit="new_unit",i.Runtime="runtime",i))(ur||{}),Ol=(n=>(n.Repository="repository",n.Testbot="testbot",n))(Ol||{}),Gl=(r=>(r.Identified="identified",r.Passed="passed",r.Failed="failed",r))(Gl||{}),dt=A.string().trim().min(1),z0=A.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var Z0=A.object({id:z0,source:A.nativeEnum(Ol),kind:A.nativeEnum(nr),outcome:A.nativeEnum(Gl),summary:dt.max(400).describe("one line: what it shows"),tests:A.array(dt).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:dt.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:dt.optional().describe("source testbot: the exact command you ran, as you ran it"),run:Zs.optional().describe("source repository, for tests in a framework other than pytest, jest, vitest and node --test: how the run executes only these tests, all of them in one command, with the repository's own runner writing JUnit XML to {junit}. Name each test (path::test-name): a test is credited to a file only by its name or by a report that names the file")}),K0=A.object({behaviorId:dt.describe("an id from analyze's behaviors"),mechanism:A.nativeEnum(ur),evidenceIds:A.array(dt).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:A.string().trim().optional().describe('new_unit / runtime: the missing evidence this obtains, e.g. "the boundary the change moved"; unaffected: why the change cannot reach it, citing path:line')}),X0=A.object({behaviorId:A.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:dt.max(600).describe("the evidence that is required and cannot be obtained in this run")}),ex=A.object({file:dt.describe("the changed file the failure is in"),repository:dt.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:dt.max(300).describe("what prerequisite the change fails"),evidence:dt.max(400).describe("the error line, quoted")}),tx=A.object({behaviorId:dt.describe("an id from analyze's behaviors"),reason:dt.max(600).describe("\u2264600 characters: why this change leaves the behavior's result as it was, citing the unchanged line that decides it (path:line)")}),ko=A.object({schemaVersion:A.literal(1),decision:A.nativeEnum(Kr),evidence:A.array(Z0).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:A.array(K0).describe("how each changed behavior's evidence is obtained"),gaps:A.array(X0),outOfScope:A.array(tx).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:ex.optional().describe("only for blocked_preflight"),rationale:dt.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function yA(t){let e=qt(t,"recommend.json");if(!e||!Array.isArray(e.generate)||!Array.isArray(e.maintenance))return;let n=e;return{...n,maintenance:n.maintenance.map(({repository:r,...s})=>({...s,test:s.test.trim().replace(/^\.\//,""),...r?.trim()?{repository:r.trim()}:{}}))}}o(yA,"readRecommend");function ix(t){return Tn(_l,t).errors}o(ix,"validateGenerateOutput");function ox(t,e=[]){let{value:n,error:r}=Lt(t,e);if(r)return{errors:[r]};let s=ix(n);return s.length>0?{errors:s}:{generate:n,errors:[]}}o(ox,"parseGenerateText");function QA(t,e=[]){return ox(t.stdout,e)}o(QA,"parseGenerateFromSession");function ax(t){return t.generate.filter(e=>e.type!=="ui").map(e=>e.id)}o(ax,"backendCases");function aE(t){return t.generate.filter(e=>e.type==="ui").map(e=>e.id)}o(aE,"uiCases");var BA={backend:{stage:"generate",cases:ax,noRecommendCoverage:"recommend.json missing or malformed \u2014 cannot check coverage",noRecommendIntent:"recommend.json missing or malformed \u2014 cannot check intent",uncovered:o(t=>`recommend case "${t}" is not covered by any generated test`,"uncovered"),unknownCovered:o(t=>`test covers unknown recommend id "${t}"`,"unknownCovered"),unasserted:o(t=>`case "${t}" has no verified assertion enforcing its expected_observable`,"unasserted"),usedCodegen:qm,codegenHint:"These tests were hand-written. Skyramp codegen (skyramp_contract_test_generation / skyramp_integration_test_generation) was available but not used \u2014 it computes valid sample data and response correlations. Prefer scaffolding with it and then refining, especially for the failures above."},ui:{stage:"generate-ui",cases:aE,noRecommendCoverage:"recommend.json not found \u2014 cannot check UI coverage",noRecommendIntent:"recommend.json not found \u2014 cannot check UI intent",uncovered:o(t=>`UI case "${t}" is not covered by any generated UI test`,"uncovered"),unknownCovered:o(t=>`test covers "${t}" which is not a recommend UI case`,"unknownCovered"),unasserted:o(t=>`UI case "${t}" has no verified assertion enforcing its expected_observable`,"unasserted"),usedCodegen:jm,codegenHint:"This UI test was hand-authored. Skyramp UI codegen (skyramp_ui_test_generation) was available but not used. Prefer scaffolding with it and then refining, especially for the failures above."}},Cj=ar("generate-schema",(t,e)=>QA(e,t.secretValues));function Ax(t){let e=BA[t];return{name:`${e.stage}-coverage`,verify(n,r){let{generate:s,errors:i}=QA(r,n.secretValues);if(!s)return lt(this.name,i);let a=yA(n);if(!a)return lt(this.name,[e.noRecommendCoverage]);let c=new Set(s.tests.flatMap(h=>h.covers)),l=[],d=e.cases(a);for(let h of d)c.has(h)||l.push(e.uncovered(h));let g=new Set(t==="ui"?d:a.generate.map(h=>h.id));for(let h of c)g.has(h)||l.push(e.unknownCovered(h));if(t==="backend"){let h=new Set(s.deferredUi),f=new Set(aE(a));for(let m of f)!h.has(m)&&!c.has(m)&&l.push(`UI case "${m}" is neither covered nor deferred to the UI stage`);for(let m of h)f.has(m)||l.push(`deferredUi lists "${m}" which is not a UI case`)}return l.length===0?{name:this.name,passed:!0}:lt(this.name,l)}}}o(Ax,"generateCoverageGateFor");function cx(t){let e=BA[t];return{name:`${e.stage}-intent`,verify(n,r){let{generate:s,errors:i}=QA(r,n.secretValues);if(!s)return lt(this.name,i);let a=yA(n);if(!a)return lt(this.name,[e.noRecommendIntent]);let{asserted:c,errors:l,badFiles:d}=fx(s,n.inputs.repositoryPath),g=l.length;for(let f of e.cases(a))c.has(f)||l.push(e.unasserted(f));if(l.length===0)return{name:this.name,passed:!0};let h=lt(this.name,l);return g>0&&g===l.length&&d.size>0?{...h,droppable:[...d]}:h}}}o(cx,"generateIntentGateFor");function ux(t){let e=BA[t];return n=>{if(!n.inputs.skyrampMcp?.command||t==="backend"&&!Nl(n))return;let r=Ks.join(n.outputsDir,`${e.stage}-stream.ndjson`);if(!(!lr.existsSync(r)||e.usedCodegen(r)))return Wm(r)?e.codegenHint:"Skyramp codegen tools were configured but the MCP server did not connect this session, so they were not available. Hand-authoring was the only option; this is an environment problem, not yours."}}o(ux,"codegenRetryHintFor");var Ij=Ax("backend"),yj=cx("backend"),Qj=ux("backend");var iE=o(t=>t.replace(/\s+/g,""),"squeeze");var $l={python:[/\bassert\s*[({\w"'`]/g,/\bpytest\.raises\s*\(/g,/\bself\.assert\w*\s*\(/g],typescript:[/\bexpect\s*\(/g,/\.should\b/g,/\bassert\s*[.(]/g],go:[/\bt\.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)\s*\(/g,/\b(assert|require)\.\w+\s*\(/g],java:[/\bassert\w*\s*\(/g,/\bassertThat\s*\(/g],ruby:[/\bexpect\s*[({]/g,/\bassert\w*\b/g,/\.should\b/g]};for(let[t,e]of[["javascript","typescript"],["kotlin","java"]])$l[t]=$l[e];function lx(t,e){if(t.includes(Eo(e))||iE(t).includes(iE(e)))return!0;let n=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!/^(\/\/|#|\*|\/\*)/.test(r));return n.length>0&&n.every(r=>t.includes(Eo(r)))?!0:px(t,e)}o(lx,"evidenceFound");var dx=/\bassert\w*\b|\bexpect\s*\(|\.should\b|\brequire\s*\(/i,gx=12,hx=/,\s*\(\s*#|,\s*f?["'`]|\s+#\s|\s+\/\/|\s*\((?:line|lines|at line)\b|\s*,\s*$/i;function px(t,e){let n=e.split(/\s*;\s*|\s*\.\.\.\s*|\r?\n/),r=0;for(let s of n){let i=dx.exec(s);if(!i)continue;let a=s.slice(i.index),c=hx.exec(a);if(c&&(a=a.slice(0,c.index)),a=Eo(a).replace(/[,\s]+$/,""),a.length<gx||!t.includes(a))return!1;r++}return r>0}o(px,"annotatedAssertionFound");function fx(t,e){let n=new Set,r=[],s=new Set;for(let i of t.tests){let a=Ks.resolve(e,i.file);if(!lr.existsSync(a))continue;let c=Eo(lr.readFileSync(a,"utf-8"));for(let l of i.assertions??[]){if(!lx(c,l.evidence)){r.push(`assertion evidence for "${l.case}" not found in ${i.file} \u2014 cite the real assertion line`),s.add(i.file);continue}i.covers.includes(l.case)?n.add(l.case):(r.push(`assertion cites case "${l.case}" not in that test's covers[]`),s.add(i.file))}}return{asserted:n,errors:r,badFiles:s}}o(fx,"verifiedAssertions");var mx=/\.(spec|test)\.[cm]?[jt]sx?$/i;function AE(t){let e;try{e=(0,oE.execFileSync)("git",[...hA,"status","--porcelain","--untracked-files=all"],{env:Dn(),cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return}let n=o(s=>/_scaffold/i.test(s)||dA.test(s),"isTestLitter"),r=[];for(let s of e.split(`
|
|
81
|
-
`)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),a=i.indexOf(" -> ");if(a!==-1&&(i=i.slice(a+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let c=i.replace(/^\.\//,"");c.startsWith(".skyramp/")||!n(c)||r.push(c)}return r}o(AE,"testLitter");function Ex(t){let e=BA[t],n=t==="ui";return{name:`${e.stage}-no-litter`,verify(r){let s=AE(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(a=>mx.test(a)===n);return i.length===0?{name:this.name,passed:!0}:lt(this.name,[`${e.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}o(Ex,"noLitterGateFor");var Bj=Ex("backend");var So=He(require("fs")),Xr=He(require("path"));function lE(t){return Tn(Fl,t).errors}o(lE,"validateAdaptOutput");function yx(t,e=[]){let{value:n,error:r}=Lt(t,e);if(r)return{errors:[r]};let s=lE(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}o(yx,"parseAdaptText");var Qx="adapt-scratch",cE=`${Qx}/adapt-result.json`;function dE(t,e){let n=Xr.join(t.outputsDir,cE),r;try{r=So.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(t.secretValues??[]).some(a=>r.includes(a)))return{errors:[`${cE} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=yx(e.stdout,t.secretValues);if(s.adapt)return s;let i=r!==void 0?Ys(n):void 0;return i!==void 0&&lE(i).length===0?{adapt:i,errors:[]}:s}o(dE,"parseAdaptFromSession");var qj=ar("adapt-schema",dE);var rW=2*1024*1024;var re=A.string().trim().min(1),wx=o(t=>{if(!t||typeof t!="object")return t;let e=t;return typeof e.skip=="string"&&e.skip.trim()&&(e.expected===void 0||e.expected===null)?{...e,expected:"(not tested)"}:t},"skippedNeedsNoExpected"),bx=A.preprocess(wx,A.object({id:re.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:re.describe("one testable part of the requirement"),expected:re.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:A.string().optional().describe("only when no test can check this clause here: why"),type:A.nativeEnum(Ar).optional().describe("the test that checks this clause: contract / integration (the API, or code called directly in-process: a function, hook or module) or ui (a page)"),target:A.string().optional().describe('its "METHOD /path", or the page / flow'),steps:A.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:A.string().optional().describe("the finding id, when this clause's test also catches that defect (the defect still gets a case of its own)"),code:A.string().optional().describe("path:line of the code that decides this clause, when there is one"),mutates:A.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes"),browserOnly:A.boolean().optional().describe("true when its behaviour happens only in a browser: real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript"),browserHarness:A.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)")})),Rx=A.object({id:re.describe('the label its source gives it ("AC-3", "REQ-12"; item 4 of a numbered list is "R4"), else "R1", "R2"\u2026 in order'),statement:re,source:A.nativeEnum(Ws).describe("requirement-reference (an item the run was given), spec, pr-description (also for what the change is evidently meant to do when nothing is written down), or could-break (what the change could break that no requirement mentions)"),reference:A.string().optional().describe('requirement-reference only: the key of its item as listed, e.g. "PAY-184", or a Confluence page id such as "3021"'),evidence:re.describe("where it is stated: for requirement-reference, the item's own words, copied exactly; else file:line, a doc section, or the quoted phrase"),criterion:A.number().int().positive().optional().describe("requirement-reference only: leave it out; Testbot numbers each criterion by the item's own label (AC2, 2.), else after the item's labels"),notInChange:A.string().optional().describe("requirement-reference only: when the change does not touch this criterion at all (e.g. a later step of a staged rollout), why; give it no clauses"),overrules:A.array(A.object({spec:re.describe("file:line of the spec in the repository"),says:re.describe("what the spec says there, in its own words")})).optional().describe("requirement-reference only: each spec in the repository that says otherwise; the item wins, so test what it says"),clauses:A.array(bx)}),kx=A.object({id:re.describe('e.g. "F1"'),file:re,line:A.number().optional(),claim:re.describe("the defect, in one sentence"),severity:A.nativeEnum(wo),evidence:re.describe("the code line, or the probe request and response, that shows it"),conflictsWith:A.array(re).optional().describe("requirement or clause ids it violates"),existing:A.string().optional().describe("only when the base already does this, in code the change left as it was: where the base does it (its file:line); such a defect gets no case"),needsApp:A.enum(["browser","live-api"]).optional().describe("only when the running app alone can show this defect and the repo has no in-process test that can: browser (page script, what the user sees after a click or a save) or live-api (code the repo tests only against the running app's API)")}),Sx=A.object({id:re.describe('e.g. "Q1"'),question:re.describe("what is unsettled, as a question the PR author can answer"),readings:A.array(re).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:A.string().optional().describe("the requirement or clause id it is about, when there is one")}),vx=A.object({id:re.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:A.nativeEnum(Ar).describe("contract / integration: checks the API, or calls code directly in-process (a function, hook or module); ui: checks what a user sees or does on a page"),target:re.describe('"METHOD /path", or the page / flow'),clause:A.string().optional().describe("the clause id this case checks"),finding:A.string().optional().describe("the finding id this case catches"),steps:re.describe("what the test does"),expected:re.describe("the expected outcome, from the clause"),mutates:A.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes")}),xx=A.object({test:re.describe("existing test file"),action:A.nativeEnum(Wr),reason:re,mutates:A.boolean().optional().describe("true when the maintained test changes state"),clauses:A.array(re).optional().describe("the clause ids this test checks")}),Dx=A.object({outcome:A.nativeEnum(sr).describe("clean | recipe-drift (you had to fix the recipe) | change-broke-bringup (this PR broke start-up) | bringup-failed (the environment, not the PR)"),baseUrls:A.record(A.string()).optional().describe("service \u2192 base URL of the running app"),health:A.object({url:A.string().optional(),command:A.string().optional(),output:A.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:A.string().optional().describe("command that stops the app"),dependencies:A.record(A.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:A.array(A.string()).optional().describe("what you changed in the recipe"),error:A.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:A.array(A.string()).optional().describe("change-broke-bringup: the changed files to blame"),revisions:Yu.optional()}),UW=A.object({schemaVersion:A.literal(1),requirements:A.array(Rx),findings:A.array(kx),cases:A.array(vx).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:A.array(Sx).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:A.array(xx),journeys:A.array(Zm).optional().describe("the user journeys that, together, pass through everything the change alters that a user sees or does; empty when it alters nothing a user sees"),notInJourney:A.array(A.object({clause:re,why:re})).optional().describe("a clause a user sees or does that no journey can reach through the UI, and why"),triage:ko.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:Dx.optional().describe("omit when no app was needed or none was started"),summary:re.describe("one paragraph: what the change does and where the risk is")});var gE=(n=>(n.Backend="backend",n.Ui="ui",n))(gE||{}),Yl=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Yl||{}),Tx=A.object({file:re.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:A.nativeEnum(gE),change:A.nativeEnum(Yl).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:A.array(A.string()).describe("the plan case ids this file tests"),defect:A.boolean().optional().describe("true when a case of it fails because the app is wrong and the test is right \u2014 kept failing on purpose"),staleBecause:A.object({requirement:re.describe("the requirement or clause id the change deliberately alters"),line:re.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),result:A.object({exit:A.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:A.array(A.object({case:re,status:A.nativeEnum(jt),defect:A.boolean().optional().describe("for a failing case: true when the app is wrong and the test is right; false when the test is at fault and you could not fix it"),failure:A.string().optional().describe("for a failing case: the runner's failure for it as printed (the error and the line it was raised at), not a summary"),cause:A.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:A.string().optional().describe("for a case you keep as a defect: the words of the PR description or the plan's requirement that state what its failing check expects, quoted exactly")})).describe("one entry per covered case, from the runner's own output"),details:A.string().optional().describe("what failed and why, or why it was not run")}),assertions:A.array(A.object({case:re,evidence:re})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:A.array(A.object({name:re.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:A.array(re).describe("the plan case ids it checks")})).optional().describe("for a file you added or updated: each test function in it and the plan case ids it checks"),run:Zs.optional().describe(`for a file in a framework other than pytest, jest, vitest and node --test (go test, rails test, mvn, dotnet test), added, updated or re-run: how the run executes only this file's tests, with the repository's own runner and the report it writes (junit or trx to ${Fn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),Nx=A.object({description:re.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:A.nativeEnum(wo).optional(),sourceFile:A.string().optional().describe("the app file at fault"),sourceLine:A.number().optional(),test:A.string().optional().describe("the test file that shows it"),finding:A.string().optional().describe("the plan's finding id, when it is one"),requirements:A.array(re).optional().describe("the plan's requirement or clause ids it violates")}),MW=A.object({schemaVersion:A.literal(1),tests:A.array(Tx),notWritten:A.array(A.object({case:re,reason:re})).describe("every plan case no test covers, and why"),journeys:A.array(mA).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:A.object({command:A.string(),clean:A.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repo has one: the exact command, with its file paths (Testbot re-runs it)"),dependenciesAdded:A.array(A.object({package:re,manifest:re.describe("the manifest file's path relative to its checkout (e.g. package.json, pom.xml or pyproject.toml), and nothing else; name another checkout in repository"),repository:re.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:re.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).optional().describe("every package you added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own"),ciRunsTests:A.boolean().optional().describe("will the repo's CI pick these tests up as they are?"),commit:A.object({message:re.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:re.describe("at most 72 characters"),prBody:re.describe("what the tests cover and what they found")}),report:A.object({summary:re.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:A.array(Nx).describe("every defect the tests found"),nextSteps:A.array(A.string())})});var LW={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var pE=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(pE||{}),Je=A.string().trim().min(1),Fx=A.object({expectation:Je.max(300).describe("the behavior this assertion pins, in words"),source:A.nativeEnum(pE),expected:Je.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),Ux=A.object({file:Je.describe("path of the NEW test file you wrote, relative to its repository"),repository:Je.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Je.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:Zs.optional().describe("for a framework other than pytest, jest, vitest and node-test: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}"),covers:A.array(Je).length(1).describe("the ONE behavior id, or defect id, from the plan that the tests in names provide evidence for; a file covering several is listed once per id"),names:A.array(Je).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:A.array(Fx).min(1)}),Hl=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Hl||{}),hE=300,Mx=A.object({file:Je.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Je.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:A.nativeEnum(Hl),staleBecause:A.object({requirement:Je.describe("the requirement or clause id the change deliberately alters"),line:Je.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),reason:A.preprocess(t=>typeof t=="string"?t.trim().slice(0,hE):t,Je.max(hE)).describe("what the change deliberately altered that made the test wrong")}),Vl=A.object({schemaVersion:A.literal(1),tests:A.array(Ux),maintained:A.array(Mx).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:A.array(A.object({id:Je,reason:Je.max(300)})).optional().describe("defects the plan found that no in-process test can reach, each with why; omit when every defect has a test"),journeys:A.array(mA).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:A.array(A.object({journey:Je,missing:Je.transform(t=>t.length>300?`${t.slice(0,299)}\u2026`:t)})).optional().describe("a planned journey no in-process test can walk here, with what it needs that is missing; it is reported as not covered"),lint:A.object({command:A.string(),clean:A.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Je.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var Az=5*6e4;function Ox(t){let{value:e,error:n}=Lt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Tn(Vl,e);return s.length?{errors:s}:{output:r,errors:[]}}o(Ox,"parseGenerateUnitText");function Gx(t){return Ox(t.stdout)}o(Gx,"parseGenerateUnitFromSession");var m9=ar("generate-unit-schema",(t,e)=>Gx(e));var wA=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,E9=[[/\b(localhost|127\.0\.0\.1|0\.0\.0\.0)\b/,"a local server address"],[/^\s*(import|from)\s+(requests|aiohttp|urllib3|websockets?)\b/m,"an HTTP client"],[/^\s*(?:import|from)\s+(?:urllib\.request|http\.client|http\.server|socket|ssl|ftplib|smtplib|telnetlib)\b|^\s*from\s+urllib\s+import\b[^\n]*\brequest\b|\burlopen\s*\(/m,"a standard-library network client"],[/\bfrom\s+["'](axios|node-fetch|undici|ws)["']|require\(\s*["'](axios|node-fetch|undici|ws)["']\s*\)/,"an HTTP client"],[new RegExp(String.raw`\bfrom\s+["']${wA}["']|\bimport\s+["']${wA}["']|require\(\s*["']${wA}["']\s*\)|\bimport\(\s*["']${wA}["']\s*\)`),"Node's network modules"],[/\bfetch\s*\(|\bnew\s+(XMLHttpRequest|WebSocket)\b/,"a network call (fetch, XMLHttpRequest, WebSocket)"],[/\bskyramp\b/i,"the Skyramp runtime (a runtime mock or client)"]];var fE=String.raw`\b(?:real browser|browser|javascript|js|htmx|client-side)\b`,mE=String.raw`\b(?:not|isn't|aren't|never|no)\s+(?:be\s+)?(?:covered|tested|exercised|verified|checked|walked|executed|run)\b|\buncovered\b|\bunverified\b`,F9=[new RegExp(`${fE}[^.;\\n]{0,100}(?:${mE})`,"i"),new RegExp(`(?:${mE})[^.;\\n]{0,100}${fE}`,"i")];var U9=new Set(["targeted_unit","existing_evidence_sufficient"]);var bZ=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),RZ={existing_evidence:"existing evidence",unaffected:"showing the change cannot reach it",existing_unit:"running the existing unit tests",new_unit:"a new unit test",runtime:"tests against the running application"};function Hx(t){let{value:e,error:n}=Lt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Tn(ko,e);return s.length?{errors:s}:{triage:r,errors:[]}}o(Hx,"parseTriageText");function Vx(t){return Hx(t.stdout)}o(Vx,"parseTriageFromSession");var kZ=ar("triage-schema",(t,e)=>Vx(e));var SZ=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);var EE=He(require("fs"));var Jx="SKYRAMP_AZURE_SUPERVISED",qx=3;function jx(t,e=process.env){e[Jx]==="1"?EE.writeSync(qx,`${JSON.stringify(t)}
|
|
81
|
+
`)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),a=i.indexOf(" -> ");if(a!==-1&&(i=i.slice(a+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let c=i.replace(/^\.\//,"");c.startsWith(".skyramp/")||!n(c)||r.push(c)}return r}o(AE,"testLitter");function Ex(t){let e=BA[t],n=t==="ui";return{name:`${e.stage}-no-litter`,verify(r){let s=AE(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(a=>mx.test(a)===n);return i.length===0?{name:this.name,passed:!0}:lt(this.name,[`${e.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}o(Ex,"noLitterGateFor");var Bj=Ex("backend");var So=He(require("fs")),Xr=He(require("path"));function lE(t){return Tn(Fl,t).errors}o(lE,"validateAdaptOutput");function yx(t,e=[]){let{value:n,error:r}=Lt(t,e);if(r)return{errors:[r]};let s=lE(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}o(yx,"parseAdaptText");var Qx="adapt-scratch",cE=`${Qx}/adapt-result.json`;function dE(t,e){let n=Xr.join(t.outputsDir,cE),r;try{r=So.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(t.secretValues??[]).some(a=>r.includes(a)))return{errors:[`${cE} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=yx(e.stdout,t.secretValues);if(s.adapt)return s;let i=r!==void 0?Ys(n):void 0;return i!==void 0&&lE(i).length===0?{adapt:i,errors:[]}:s}o(dE,"parseAdaptFromSession");var qj=ar("adapt-schema",dE);var rW=2*1024*1024;var ne=A.string().trim().min(1),wx=o(t=>{if(!t||typeof t!="object")return t;let e=t;return typeof e.skip=="string"&&e.skip.trim()&&(e.expected===void 0||e.expected===null)?{...e,expected:"(not tested)"}:t},"skippedNeedsNoExpected"),bx=A.preprocess(wx,A.object({id:ne.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ne.describe("one testable part of the requirement"),expected:ne.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:A.string().optional().describe("only when no test can check this clause here: why"),type:A.nativeEnum(Ar).optional().describe("the test that checks this clause: contract / integration (the API, or code called directly in-process: a function, hook or module) or ui (a page)"),target:A.string().optional().describe('its "METHOD /path", or the page / flow'),steps:A.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:A.string().optional().describe("the finding id, when this clause's test also catches that defect (the defect still gets a case of its own)"),code:A.string().optional().describe("path:line of the code that decides this clause, when there is one"),mutates:A.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes"),browserOnly:A.boolean().optional().describe("true when its behaviour happens only in a browser: real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript"),browserHarness:A.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)")})),Rx=A.object({id:ne.describe('the label its source gives it ("AC-3", "REQ-12"; item 4 of a numbered list is "R4"), else "R1", "R2"\u2026 in order'),statement:ne,source:A.nativeEnum(Ws).describe("requirement-reference (an item the run was given), spec, pr-description (also for what the change is evidently meant to do when nothing is written down), or could-break (what the change could break that no requirement mentions)"),reference:A.string().optional().describe('requirement-reference only: the key of its item as listed, e.g. "PAY-184", or a Confluence page id such as "3021"'),evidence:ne.describe("where it is stated: for requirement-reference, the item's own words, copied exactly; else file:line, a doc section, or the quoted phrase"),criterion:A.number().int().positive().optional().describe("requirement-reference only: leave it out; Testbot numbers each criterion by the item's own label (AC2, 2.), else after the item's labels"),notInChange:A.string().optional().describe("requirement-reference only: when the change does not touch this criterion at all (e.g. a later step of a staged rollout), why; give it no clauses"),overrules:A.array(A.object({spec:ne.describe("file:line of the spec in the repository"),says:ne.describe("what the spec says there, in its own words")})).optional().describe("requirement-reference only: each spec in the repository that says otherwise; the item wins, so test what it says"),clauses:A.array(bx)}),kx=A.object({id:ne.describe('e.g. "F1"'),file:ne,line:A.number().optional(),claim:ne.describe("the defect, in one sentence"),severity:A.nativeEnum(wo),evidence:ne.describe("the code line, or the probe request and response, that shows it"),conflictsWith:A.array(ne).optional().describe("requirement or clause ids it violates"),existing:A.string().optional().describe("only when the base already does this, in code the change left as it was: where the base does it (its file:line); such a defect gets no case"),needsApp:A.enum(["browser","live-api"]).optional().describe("only when the running app alone can show this defect and the repo has no in-process test that can: browser (page script, what the user sees after a click or a save) or live-api (code the repo tests only against the running app's API)")}),Sx=A.object({id:ne.describe('e.g. "Q1"'),question:ne.describe("what is unsettled, as a question the PR author can answer"),readings:A.array(ne).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:A.string().optional().describe("the requirement or clause id it is about, when there is one")}),vx=A.object({id:ne.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:A.nativeEnum(Ar).describe("contract / integration: checks the API, or calls code directly in-process (a function, hook or module); ui: checks what a user sees or does on a page"),target:ne.describe('"METHOD /path", or the page / flow'),clause:A.string().optional().describe("the clause id this case checks"),finding:A.string().optional().describe("the finding id this case catches"),steps:ne.describe("what the test does"),expected:ne.describe("the expected outcome, from the clause"),mutates:A.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes")}),xx=A.object({test:ne.describe("existing test file"),action:A.nativeEnum(Wr),reason:ne,mutates:A.boolean().optional().describe("true when the maintained test changes state"),clauses:A.array(ne).optional().describe("the clause ids this test checks")}),Dx=A.object({outcome:A.nativeEnum(sr).describe("clean | recipe-drift (you had to fix the recipe) | change-broke-bringup (this PR broke start-up) | bringup-failed (the environment, not the PR)"),baseUrls:A.record(A.string()).optional().describe("service \u2192 base URL of the running app"),health:A.object({url:A.string().optional(),command:A.string().optional(),output:A.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:A.string().optional().describe("command that stops the app"),dependencies:A.record(A.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:A.array(A.string()).optional().describe("what you changed in the recipe"),error:A.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:A.array(A.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:A.object({username:ne,password:A.string()}).optional().describe("the account the tests sign in as, when they sign in: each a literal value the recipe seeds, or $VARIABLE when a secret in the environment holds it"),revisions:Yu.optional()}),UW=A.object({schemaVersion:A.literal(1),requirements:A.array(Rx),findings:A.array(kx),cases:A.array(vx).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:A.array(Sx).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:A.array(xx),journeys:A.array(Zm).optional().describe("the user journeys that, together, pass through everything the change alters that a user sees or does; empty when it alters nothing a user sees"),notInJourney:A.array(A.object({clause:ne,why:ne})).optional().describe("a clause a user sees or does that no journey can reach through the UI, and why"),triage:ko.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:Dx.optional().describe("omit when no app was needed or none was started"),summary:ne.describe("one paragraph: what the change does and where the risk is")});var gE=(n=>(n.Backend="backend",n.Ui="ui",n))(gE||{}),Yl=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Yl||{}),Tx=A.object({file:ne.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:A.nativeEnum(gE),change:A.nativeEnum(Yl).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:A.array(A.string()).describe("the plan case ids this file tests"),defect:A.boolean().optional().describe("true when a case of it fails because the app is wrong and the test is right \u2014 kept failing on purpose"),staleBecause:A.object({requirement:ne.describe("the requirement or clause id the change deliberately alters"),line:ne.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),result:A.object({exit:A.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:A.array(A.object({case:ne,status:A.nativeEnum(jt),defect:A.boolean().optional().describe("for a failing case: true when the app is wrong and the test is right; false when the test is at fault and you could not fix it"),failure:A.string().optional().describe("for a failing case: the runner's failure for it as printed (the error and the line it was raised at), not a summary"),cause:A.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:A.string().optional().describe("for a case you keep as a defect: the words of the PR description or the plan's requirement that state what its failing check expects, quoted exactly")})).describe("one entry per covered case, from the runner's own output"),details:A.string().optional().describe("what failed and why, or why it was not run")}),assertions:A.array(A.object({case:ne,evidence:ne})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:A.array(A.object({name:ne.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:A.array(ne).describe("the plan case ids it checks")})).optional().describe("for a file you added or updated: each test function in it and the plan case ids it checks"),run:Zs.optional().describe(`for a file in a framework other than pytest, jest, vitest and node --test (go test, rails test, mvn, dotnet test), added, updated or re-run: how the run executes only this file's tests, with the repository's own runner and the report it writes (junit or trx to ${Fn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),Nx=A.object({description:ne.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:A.nativeEnum(wo).optional(),sourceFile:A.string().optional().describe("the app file at fault"),sourceLine:A.number().optional(),test:A.string().optional().describe("the test file that shows it"),finding:A.string().optional().describe("the plan's finding id, when it is one"),requirements:A.array(ne).optional().describe("the plan's requirement or clause ids it violates")}),MW=A.object({schemaVersion:A.literal(1),tests:A.array(Tx),notWritten:A.array(A.object({case:ne,reason:ne})).describe("every plan case no test covers, and why"),journeys:A.array(mA).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:A.object({command:A.string(),clean:A.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repo has one: the exact command, with its file paths (Testbot re-runs it)"),dependenciesAdded:A.array(A.object({package:ne,manifest:ne.describe("the manifest file's path relative to its checkout (e.g. package.json, pom.xml or pyproject.toml), and nothing else; name another checkout in repository"),repository:ne.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ne.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).optional().describe("every package you added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own"),ciRunsTests:A.boolean().optional().describe("will the repo's CI pick these tests up as they are?"),commit:A.object({message:ne.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:ne.describe("at most 72 characters"),prBody:ne.describe("what the tests cover and what they found")}),report:A.object({summary:ne.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:A.array(Nx).describe("every defect the tests found"),nextSteps:A.array(A.string())})});var LW={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var pE=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(pE||{}),Je=A.string().trim().min(1),Fx=A.object({expectation:Je.max(300).describe("the behavior this assertion pins, in words"),source:A.nativeEnum(pE),expected:Je.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),Ux=A.object({file:Je.describe("path of the NEW test file you wrote, relative to its repository"),repository:Je.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Je.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:Zs.optional().describe("for a framework other than pytest, jest, vitest and node-test: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}"),covers:A.array(Je).length(1).describe("the ONE behavior id, or defect id, from the plan that the tests in names provide evidence for; a file covering several is listed once per id"),names:A.array(Je).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:A.array(Fx).min(1)}),Hl=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Hl||{}),hE=300,Mx=A.object({file:Je.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Je.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:A.nativeEnum(Hl),staleBecause:A.object({requirement:Je.describe("the requirement or clause id the change deliberately alters"),line:Je.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),reason:A.preprocess(t=>typeof t=="string"?t.trim().slice(0,hE):t,Je.max(hE)).describe("what the change deliberately altered that made the test wrong")}),Vl=A.object({schemaVersion:A.literal(1),tests:A.array(Ux),maintained:A.array(Mx).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:A.array(A.object({id:Je,reason:Je.max(300)})).optional().describe("defects the plan found that no in-process test can reach, each with why; omit when every defect has a test"),journeys:A.array(mA).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:A.array(A.object({journey:Je,missing:Je.transform(t=>t.length>300?`${t.slice(0,299)}\u2026`:t)})).optional().describe("a planned journey no in-process test can walk here, with what it needs that is missing; it is reported as not covered"),lint:A.object({command:A.string(),clean:A.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Je.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var Az=5*6e4;function Ox(t){let{value:e,error:n}=Lt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Tn(Vl,e);return s.length?{errors:s}:{output:r,errors:[]}}o(Ox,"parseGenerateUnitText");function Gx(t){return Ox(t.stdout)}o(Gx,"parseGenerateUnitFromSession");var m9=ar("generate-unit-schema",(t,e)=>Gx(e));var wA=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,E9=[[/\b(localhost|127\.0\.0\.1|0\.0\.0\.0)\b/,"a local server address"],[/^\s*(import|from)\s+(requests|aiohttp|urllib3|websockets?)\b/m,"an HTTP client"],[/^\s*(?:import|from)\s+(?:urllib\.request|http\.client|http\.server|socket|ssl|ftplib|smtplib|telnetlib)\b|^\s*from\s+urllib\s+import\b[^\n]*\brequest\b|\burlopen\s*\(/m,"a standard-library network client"],[/\bfrom\s+["'](axios|node-fetch|undici|ws)["']|require\(\s*["'](axios|node-fetch|undici|ws)["']\s*\)/,"an HTTP client"],[new RegExp(String.raw`\bfrom\s+["']${wA}["']|\bimport\s+["']${wA}["']|require\(\s*["']${wA}["']\s*\)|\bimport\(\s*["']${wA}["']\s*\)`),"Node's network modules"],[/\bfetch\s*\(|\bnew\s+(XMLHttpRequest|WebSocket)\b/,"a network call (fetch, XMLHttpRequest, WebSocket)"],[/\bskyramp\b/i,"the Skyramp runtime (a runtime mock or client)"]];var fE=String.raw`\b(?:real browser|browser|javascript|js|htmx|client-side)\b`,mE=String.raw`\b(?:not|isn't|aren't|never|no)\s+(?:be\s+)?(?:covered|tested|exercised|verified|checked|walked|executed|run)\b|\buncovered\b|\bunverified\b`,F9=[new RegExp(`${fE}[^.;\\n]{0,100}(?:${mE})`,"i"),new RegExp(`(?:${mE})[^.;\\n]{0,100}${fE}`,"i")];var U9=new Set(["targeted_unit","existing_evidence_sufficient"]);var bZ=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),RZ={existing_evidence:"existing evidence",unaffected:"showing the change cannot reach it",existing_unit:"running the existing unit tests",new_unit:"a new unit test",runtime:"tests against the running application"};function Hx(t){let{value:e,error:n}=Lt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Tn(ko,e);return s.length?{errors:s}:{triage:r,errors:[]}}o(Hx,"parseTriageText");function Vx(t){return Hx(t.stdout)}o(Vx,"parseTriageFromSession");var kZ=ar("triage-schema",(t,e)=>Vx(e));var SZ=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);var EE=He(require("fs"));var Jx="SKYRAMP_AZURE_SUPERVISED",qx=3;function jx(t,e=process.env){e[Jx]==="1"?EE.writeSync(qx,`${JSON.stringify(t)}
|
|
82
82
|
`):process.stdout.write(t.command!==void 0?`${t.command}
|
|
83
83
|
`:t.text??"")}o(jx,"writeFrame");function Wx(t){jx({command:t})}o(Wx,"writeAzureCommand");function CE(t){return t.replace(/%/g,"%AZP25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}o(CE,"escapeData");function zx(t){return CE(t).replace(/;/g,"%3B").replace(/]/g,"%5D")}o(zx,"escapeProperty");function Zx(t,e,n){let r=Object.entries(e).map(([s,i])=>`${s}=${zx(i)}`).join(";");return`##vso[${t}${r?` ${r}`:""}]${CE(n)}`}o(Zx,"vsoCommand");function Kx(t){if(!t)return[];let e=t.split(/\r?\n/).filter(n=>n.trim()&&n!==t);return[t,...e].map(n=>Zx("task.setsecret",{},n))}o(Kx,"setSecretLines");function IE(t,e=Wx){for(let n of Kx(t))e(n)}o(IE,"azureSetSecret");function xo(t){return t.replace(/\/+$/,"")}o(xo,"withoutTrailingSlash");function Jl(t){let e=new URL(t),n=e.pathname.split("/").filter(Boolean);if(n.length)return decodeURIComponent(n[n.length-1]);if(e.hostname.endsWith(".visualstudio.com"))return e.hostname.split(".")[0];throw new Error(`SYSTEM_COLLECTIONURI "${t}" names no organization`)}o(Jl,"azureOrganization");var Xx=/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/,eD=/[\\/:*?"<>|;#${},+=[\]%\p{Cc}\p{Cf}]/u;function yE(t){return t.length>0&&t.length<=64&&t===t.trim()&&!eD.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith(".")}o(yE,"isName");function bA(t){return ql(`${t.namespace}/${t.name}`)}o(bA,"azureRepositoryOfSource");function ql(t){let e=t.indexOf("/"),n=t.lastIndexOf("/"),r=t.slice(0,e),s=t.slice(e+1,n),i=t.slice(n+1);if(e<0||e===n||!Xx.test(r)||!yE(s)||!yE(i))throw new Error(`"${t}" is not an Azure DevOps organization/project/repository`);return{organization:r,project:s,name:i}}o(ql,"azureRepositoryOf");function QE(t,e){let n=Jl(t);if(n.toLowerCase()!==e.organization.toLowerCase())throw new Error(`${e.organization}/${e.project}/${e.name} is not in ${n}, the Azure DevOps organization this job runs in`)}o(QE,"inOrganization");function BE(t,e){return QE(t,e),`${xo(t)}/${encodeURIComponent(e.project)}/_git/${encodeURIComponent(e.name)}`}o(BE,"azureCloneUrl");function jl(t,e){return QE(t,e),`${xo(t)}/${encodeURIComponent(e.project)}/_apis/git/repositories/${encodeURIComponent(e.name)}`}o(jl,"azureRepositoryApi");var tD="7.1",vo=class extends Error{constructor(n,r){super(n);this.status=r}status;static{o(this,"AzureRestError")}};async function Wl(t){let e=t.accept??"application/json",n=new URL(t.url);n.searchParams.has("api-version")||n.searchParams.set("api-version",tD);let r=await(t.fetch??fetch)(n.toString(),{method:t.method??"GET",headers:{Authorization:`Bearer ${t.token}`,Accept:e,...t.body!==void 0?{"Content-Type":"application/json"}:{}},...t.body!==void 0?{body:JSON.stringify(t.body)}:{},redirect:"error",signal:AbortSignal.timeout(3e4)});if(!r.ok){let s=(await r.json().catch(()=>({}))).message;throw new vo(`Azure DevOps answered ${r.status}${typeof s=="string"?`: ${s}`:""}`,r.status)}return e!=="application/json"?Buffer.from(await r.arrayBuffer()):r.status===204?{}:await r.json()}o(Wl,"azureRest");function nD(t){return`AUTHORIZATION: bearer ${t}`}o(nD,"azureGitAuthorization");function wE(t,e){return{GIT_CONFIG_COUNT:"1",GIT_CONFIG_KEY_0:`http.${xo(t)}/.extraheader`,GIT_CONFIG_VALUE_0:nD(e)}}o(wE,"azureGitAuthEnv");var rD="7.1-preview.1",sD=".azure-pipelines/skyramp-testbot-v3.yml";function zl(t){return t.GITHUB_ACTIONS!=="true"&&/^true$/i.test(t.TF_BUILD??"")}o(zl,"isAzurePipelines");function kE(t,e={}){let n=o(h=>{let f=t[h];if(!f)throw new Error(`${h} is not set; the V3 runner handshake needs it`);return f},"read"),r=xo(t.SYSTEM_COLLECTIONURI??""),s=o(()=>Jl(n("SYSTEM_COLLECTIONURI")),"organization"),i=t.SYSTEM_TEAMPROJECT,a=t.BUILD_REPOSITORY_NAME,c=t.BUILD_REPOSITORY_ID?.toLowerCase(),l=t.SYSTEM_ACCESSTOKEN,d=e.mask??(h=>IE(h)),g=o(h=>async()=>{if(!h)throw new Error("The job cannot request an OIDC token: the Testbot step's env must set SYSTEM_OIDCREQUESTURI to $(System.OidcRequestUri).");if(!l)throw new Error("The job cannot request an OIDC token: the Testbot step's env must set SYSTEM_ACCESSTOKEN to $(System.AccessToken).");let f=new URL(h);if(f.protocol!=="https:")throw new Error("SYSTEM_OIDCREQUESTURI is not an https URL");f.searchParams.set("api-version",rD);let m=await(e.fetch??fetch)(f.toString(),{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json",Accept:"application/json"},body:"{}",redirect:"error",signal:AbortSignal.timeout(3e4)});if(!m.ok)throw new Error(`Azure DevOps refused the OIDC token request: ${m.status}`);let C=(await m.json().catch(()=>({}))).oidcToken;if(typeof C!="string"||!C)throw new Error("Azure DevOps's OIDC token response carried no token");return d(C),C},"mint");return{runnerPlatform:zl(t)?"azure":void 0,workspace:t.BUILD_SOURCESDIRECTORY||void 0,serverUrl:r,apiUrl:r,repository:c&&i&&a&&r?{id:c,slug:`${s()}/${i}/${a}`}:void 0,runId:t.BUILD_BUILDID||void 0,runAttempt:t.SYSTEM_STAGEATTEMPT||void 0,job:t.SYSTEM_JOBNAME||void 0,execution(){let h=n("SYSTEM_STAGEATTEMPT");if(!/^[1-9][0-9]*$/.test(h))throw new Error(`SYSTEM_STAGEATTEMPT is "${h}", not a positive whole number`);let f=n("SYSTEM_COLLECTIONID").toLowerCase();if(!$s.test(f))throw new Error(`SYSTEM_COLLECTIONID is "${f}", not a GUID`);let m=n("BUILD_REPOSITORY_ID").toLowerCase();if(!$s.test(m))throw new Error(`BUILD_REPOSITORY_ID is "${m}", not a GUID`);let C=[s(),n("SYSTEM_TEAMPROJECT"),n("SYSTEM_DEFINITIONID"),n("BUILD_BUILDID")].map(encodeURIComponent).join("/");return{provider:"azure-devops",repository:{provider:"azure-devops",providerAccountId:f,providerRepositoryId:m},providerRunId:C,providerRunAttempt:Number(h),workflowRef:`${sD}@${n("BUILD_SOURCEBRANCH")}`}},takeIdToken(){let h=t.SYSTEM_OIDCREQUESTURI;delete t.SYSTEM_OIDCREQUESTURI;let f=g(h);return()=>f()},takeSourceToken(){return delete t.SYSTEM_ACCESSTOKEN,l||void 0},webIdentity(){if(!t.SYSTEM_OIDCREQUESTURI?.trim()||!l)return;let h=g(t.SYSTEM_OIDCREQUESTURI);return{token:o(()=>h(),"token"),runId:t.BUILD_BUILDID}},v3RunsOnly:!0,assumesBedrockRole:!0,namesSourceToMcp:!0,checkSourceName(h){bA(h)},cloneUrl(h){return BE(r,bA(h))},gitAuthEnv(h){return wE(r,h)},async pullRequest(h,f,m){let C=await Wl({token:await m.token(),url:`${jl(r,bA(h))}/pullrequests/${f}`,fetch:m.fetch}),y=C.status==="completed";return{...typeof C.title=="string"?{title:C.title}:{},...typeof C.description=="string"?{body:C.description}:{},...typeof C.status=="string"?{merged:y}:{},...y&&typeof C.lastMergeCommit?.commitId=="string"?{mergeCommit:C.lastMergeCommit.commitId}:{},...y&&typeof C.lastMergeSourceCommit?.commitId=="string"?{mergedHead:C.lastMergeSourceCommit.commitId}:{}}},async commit(h,f,m){let C;try{C=jl(r,ql(h))}catch{return{lookup:"unknown"}}try{let y=await Wl({token:await m.token(),url:`${C}/commits/${encodeURIComponent(f)}`,fetch:m.fetch});return typeof y.commitId=="string"?{sha:y.commitId}:{lookup:"missing"}}catch(y){return{lookup:y instanceof vo&&(y.status===404||y.status===400)?"missing":"unknown"}}}}}o(kE,"azureRunnerHost");var vE=He(require("os"),1);function Do(t){return t==null?"":typeof t=="string"||t instanceof String?t:JSON.stringify(t)}o(Do,"toCommandValue");function Kl(t,e,n){let r=new Zl(t,e,n);process.stdout.write(r.toString()+vE.EOL)}o(Kl,"issueCommand");var SE="::",Zl=class{static{o(this,"Command")}constructor(e,n,r){e||(e="missing.command"),this.command=e,this.properties=n,this.message=r}toString(){let e=SE+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let n=!0;for(let r in this.properties)if(this.properties.hasOwnProperty(r)){let s=this.properties[r];s&&(n?n=!1:e+=",",e+=`${r}=${oD(s)}`)}}return e+=`${SE}${iD(this.message)}`,e}};function iD(t){return Do(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}o(iD,"escapeData");function oD(t){return Do(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}o(oD,"escapeProperty");var Ma=He(require("http"),1),xp=He(require("https"),1);function Xl(t){let e=t.protocol==="https:";if(aD(t))return;let n=e?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY;if(n)try{return new RA(n)}catch{if(!n.startsWith("http://")&&!n.startsWith("https://"))return new RA(`http://${n}`)}else return}o(Xl,"getProxyUrl");function aD(t){if(!t.hostname)return!1;let e=t.hostname;if(AD(e))return!0;let n=process.env.no_proxy||process.env.NO_PROXY||"";if(!n)return!1;let r;t.port?r=Number(t.port):t.protocol==="http:"?r=80:t.protocol==="https:"&&(r=443);let s=[t.hostname.toUpperCase()];typeof r=="number"&&s.push(`${s[0]}:${r}`);for(let i of n.split(",").map(a=>a.trim().toUpperCase()).filter(a=>a))if(i==="*"||s.some(a=>a===i||a.endsWith(`.${i}`)||i.startsWith(".")&&a.endsWith(`${i}`)))return!0;return!1}o(aD,"checkBypass");function AD(t){let e=t.toLowerCase();return e==="localhost"||e.startsWith("127.")||e.startsWith("[::1]")||e.startsWith("[0:0:0:0:0:0:0:1]")}o(AD,"isLoopbackAddress");var RA=class extends URL{static{o(this,"DecodedURL")}constructor(e,n){super(e,n),this._decodedUsername=decodeURIComponent(super.username),this._decodedPassword=decodeURIComponent(super.password)}get username(){return this._decodedUsername}get password(){return this._decodedPassword}};var xr=He(UE(),1),ak=He(ok(),1);var Le=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(a){a(i)})}return o(s,"adopt"),new(n||(n=Promise))(function(i,a){function c(g){try{d(r.next(g))}catch(h){a(h)}}o(c,"fulfilled");function l(g){try{d(r.throw(g))}catch(h){a(h)}}o(l,"rejected");function d(g){g.done?i(g.value):s(g.value).then(c,l)}o(d,"step"),d((r=r.apply(t,e||[])).next())})},Ht;(function(t){t[t.OK=200]="OK",t[t.MultipleChoices=300]="MultipleChoices",t[t.MovedPermanently=301]="MovedPermanently",t[t.ResourceMoved=302]="ResourceMoved",t[t.SeeOther=303]="SeeOther",t[t.NotModified=304]="NotModified",t[t.UseProxy=305]="UseProxy",t[t.SwitchProxy=306]="SwitchProxy",t[t.TemporaryRedirect=307]="TemporaryRedirect",t[t.PermanentRedirect=308]="PermanentRedirect",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.PaymentRequired=402]="PaymentRequired",t[t.Forbidden=403]="Forbidden",t[t.NotFound=404]="NotFound",t[t.MethodNotAllowed=405]="MethodNotAllowed",t[t.NotAcceptable=406]="NotAcceptable",t[t.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",t[t.RequestTimeout=408]="RequestTimeout",t[t.Conflict=409]="Conflict",t[t.Gone=410]="Gone",t[t.TooManyRequests=429]="TooManyRequests",t[t.InternalServerError=500]="InternalServerError",t[t.NotImplemented=501]="NotImplemented",t[t.BadGateway=502]="BadGateway",t[t.ServiceUnavailable=503]="ServiceUnavailable",t[t.GatewayTimeout=504]="GatewayTimeout"})(Ht||(Ht={}));var at;(function(t){t.Accept="accept",t.ContentType="content-type"})(at||(at={}));var qn;(function(t){t.ApplicationJson="application/json"})(qn||(qn={}));var LY=[Ht.MovedPermanently,Ht.ResourceMoved,Ht.SeeOther,Ht.TemporaryRedirect,Ht.PermanentRedirect],_Y=[Ht.BadGateway,Ht.ServiceUnavailable,Ht.GatewayTimeout],PY=["OPTIONS","GET","DELETE","HEAD"],OY=10,GY=5,Sp=class t extends Error{static{o(this,"HttpClientError")}constructor(e,n){super(e),this.name="HttpClientError",this.statusCode=n,Object.setPrototypeOf(this,t.prototype)}},vp=class{static{o(this,"HttpClientResponse")}constructor(e){this.message=e}readBody(){return Le(this,void 0,void 0,function*(){return new Promise(e=>Le(this,void 0,void 0,function*(){let n=Buffer.alloc(0);this.message.on("data",r=>{n=Buffer.concat([n,r])}),this.message.on("end",()=>{e(n.toString())})}))})}readBodyBuffer(){return Le(this,void 0,void 0,function*(){return new Promise(e=>Le(this,void 0,void 0,function*(){let n=[];this.message.on("data",r=>{n.push(r)}),this.message.on("end",()=>{e(Buffer.concat(n))})}))})}};var Bu=class{static{o(this,"HttpClient")}constructor(e,n,r){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=this._getUserAgentWithOrchestrationId(e),this.handlers=n||[],this.requestOptions=r,r&&(r.ignoreSslError!=null&&(this._ignoreSslError=r.ignoreSslError),this._socketTimeout=r.socketTimeout,r.allowRedirects!=null&&(this._allowRedirects=r.allowRedirects),r.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=r.allowRedirectDowngrade),r.maxRedirects!=null&&(this._maxRedirects=Math.max(r.maxRedirects,0)),r.keepAlive!=null&&(this._keepAlive=r.keepAlive),r.allowRetries!=null&&(this._allowRetries=r.allowRetries),r.maxRetries!=null&&(this._maxRetries=r.maxRetries))}options(e,n){return Le(this,void 0,void 0,function*(){return this.request("OPTIONS",e,null,n||{})})}get(e,n){return Le(this,void 0,void 0,function*(){return this.request("GET",e,null,n||{})})}del(e,n){return Le(this,void 0,void 0,function*(){return this.request("DELETE",e,null,n||{})})}post(e,n,r){return Le(this,void 0,void 0,function*(){return this.request("POST",e,n,r||{})})}patch(e,n,r){return Le(this,void 0,void 0,function*(){return this.request("PATCH",e,n,r||{})})}put(e,n,r){return Le(this,void 0,void 0,function*(){return this.request("PUT",e,n,r||{})})}head(e,n){return Le(this,void 0,void 0,function*(){return this.request("HEAD",e,null,n||{})})}sendStream(e,n,r,s){return Le(this,void 0,void 0,function*(){return this.request(e,n,r,s)})}getJson(e){return Le(this,arguments,void 0,function*(n,r={}){r[at.Accept]=this._getExistingOrDefaultHeader(r,at.Accept,qn.ApplicationJson);let s=yield this.get(n,r);return this._processResponse(s,this.requestOptions)})}postJson(e,n){return Le(this,arguments,void 0,function*(r,s,i={}){let a=JSON.stringify(s,null,2);i[at.Accept]=this._getExistingOrDefaultHeader(i,at.Accept,qn.ApplicationJson),i[at.ContentType]=this._getExistingOrDefaultContentTypeHeader(i,qn.ApplicationJson);let c=yield this.post(r,a,i);return this._processResponse(c,this.requestOptions)})}putJson(e,n){return Le(this,arguments,void 0,function*(r,s,i={}){let a=JSON.stringify(s,null,2);i[at.Accept]=this._getExistingOrDefaultHeader(i,at.Accept,qn.ApplicationJson),i[at.ContentType]=this._getExistingOrDefaultContentTypeHeader(i,qn.ApplicationJson);let c=yield this.put(r,a,i);return this._processResponse(c,this.requestOptions)})}patchJson(e,n){return Le(this,arguments,void 0,function*(r,s,i={}){let a=JSON.stringify(s,null,2);i[at.Accept]=this._getExistingOrDefaultHeader(i,at.Accept,qn.ApplicationJson),i[at.ContentType]=this._getExistingOrDefaultContentTypeHeader(i,qn.ApplicationJson);let c=yield this.patch(r,a,i);return this._processResponse(c,this.requestOptions)})}request(e,n,r,s){return Le(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let i=new URL(n),a=this._prepareRequest(e,i,s),c=this._allowRetries&&PY.includes(e)?this._maxRetries+1:1,l=0,d;do{if(d=yield this.requestRaw(a,r),d&&d.message&&d.message.statusCode===Ht.Unauthorized){let h;for(let f of this.handlers)if(f.canHandleAuthentication(d)){h=f;break}return h?h.handleAuthentication(this,a,r):d}let g=this._maxRedirects;for(;d.message.statusCode&&LY.includes(d.message.statusCode)&&this._allowRedirects&&g>0;){let h=d.message.headers.location;if(!h)break;let f=new URL(h);if(i.protocol==="https:"&&i.protocol!==f.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield d.readBody(),f.hostname!==i.hostname)for(let m in s)m.toLowerCase()==="authorization"&&delete s[m];a=this._prepareRequest(e,f,s),d=yield this.requestRaw(a,r),g--}if(!d.message.statusCode||!_Y.includes(d.message.statusCode))return d;l+=1,l<c&&(yield d.readBody(),yield this._performExponentialBackoff(l))}while(l<c);return d})}dispose(){this._agent&&this._agent.destroy(),this._disposed=!0}requestRaw(e,n){return Le(this,void 0,void 0,function*(){return new Promise((r,s)=>{function i(a,c){a?s(a):c?r(c):s(new Error("Unknown error"))}o(i,"callbackForResult"),this.requestRawWithCallback(e,n,i)})})}requestRawWithCallback(e,n,r){typeof n=="string"&&(e.options.headers||(e.options.headers={}),e.options.headers["Content-Length"]=Buffer.byteLength(n,"utf8"));let s=!1;function i(l,d){s||(s=!0,r(l,d))}o(i,"handleResult");let a=e.httpModule.request(e.options,l=>{let d=new vp(l);i(void 0,d)}),c;a.on("socket",l=>{c=l}),a.setTimeout(this._socketTimeout||3*6e4,()=>{c&&c.end(),i(new Error(`Request timeout: ${e.options.path}`))}),a.on("error",function(l){i(l)}),n&&typeof n=="string"&&a.write(n,"utf8"),n&&typeof n!="string"?(n.on("close",function(){a.end()}),n.pipe(a)):a.end()}getAgent(e){let n=new URL(e);return this._getAgent(n)}getAgentDispatcher(e){let n=new URL(e),r=Xl(n);if(r&&r.hostname)return this._getProxyAgentDispatcher(n,r)}_prepareRequest(e,n,r){let s={};s.parsedUrl=n;let i=s.parsedUrl.protocol==="https:";s.httpModule=i?xp:Ma;let a=i?443:80;if(s.options={},s.options.host=s.parsedUrl.hostname,s.options.port=s.parsedUrl.port?parseInt(s.parsedUrl.port):a,s.options.path=(s.parsedUrl.pathname||"")+(s.parsedUrl.search||""),s.options.method=e,s.options.headers=this._mergeHeaders(r),this.userAgent!=null&&(s.options.headers["user-agent"]=this.userAgent),s.options.agent=this._getAgent(s.parsedUrl),this.handlers)for(let c of this.handlers)c.prepareRequest(s.options);return s}_mergeHeaders(e){return this.requestOptions&&this.requestOptions.headers?Object.assign({},Ua(this.requestOptions.headers),Ua(e||{})):Ua(e||{})}_getExistingOrDefaultHeader(e,n,r){let s;if(this.requestOptions&&this.requestOptions.headers){let a=Ua(this.requestOptions.headers)[n];a&&(s=typeof a=="number"?a.toString():a)}let i=e[n];return i!==void 0?typeof i=="number"?i.toString():i:s!==void 0?s:r}_getExistingOrDefaultContentTypeHeader(e,n){let r;if(this.requestOptions&&this.requestOptions.headers){let i=Ua(this.requestOptions.headers)[at.ContentType];i&&(typeof i=="number"?r=String(i):Array.isArray(i)?r=i.join(", "):r=i)}let s=e[at.ContentType];return s!==void 0?typeof s=="number"?String(s):Array.isArray(s)?s.join(", "):s:r!==void 0?r:n}_getAgent(e){let n,r=Xl(e),s=r&&r.hostname;if(this._keepAlive&&s&&(n=this._proxyAgent),s||(n=this._agent),n)return n;let i=e.protocol==="https:",a=100;if(this.requestOptions&&(a=this.requestOptions.maxSockets||Ma.globalAgent.maxSockets),r&&r.hostname){let c={maxSockets:a,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(r.username||r.password)&&{proxyAuth:`${r.username}:${r.password}`}),{host:r.hostname,port:r.port})},l,d=r.protocol==="https:";i?l=d?xr.httpsOverHttps:xr.httpsOverHttp:l=d?xr.httpOverHttps:xr.httpOverHttp,n=l(c),this._proxyAgent=n}if(!n){let c={keepAlive:this._keepAlive,maxSockets:a};n=i?new xp.Agent(c):new Ma.Agent(c),this._agent=n}return i&&this._ignoreSslError&&(n.options=Object.assign(n.options||{},{rejectUnauthorized:!1})),n}_getProxyAgentDispatcher(e,n){let r;if(this._keepAlive&&(r=this._proxyAgentDispatcher),r)return r;let s=e.protocol==="https:";return r=new ak.ProxyAgent(Object.assign({uri:n.href,pipelining:this._keepAlive?1:0},(n.username||n.password)&&{token:`Basic ${Buffer.from(`${n.username}:${n.password}`).toString("base64")}`})),this._proxyAgentDispatcher=r,s&&this._ignoreSslError&&(r.options=Object.assign(r.options.requestTls||{},{rejectUnauthorized:!1})),r}_getUserAgentWithOrchestrationId(e){let n=e||"actions/http-client",r=process.env.ACTIONS_ORCHESTRATION_ID;if(r){let s=r.replace(/[^a-z0-9_.-]/gi,"_");return`${n} actions_orchestration_id/${s}`}return n}_performExponentialBackoff(e){return Le(this,void 0,void 0,function*(){e=Math.min(OY,e);let n=GY*Math.pow(2,e);return new Promise(r=>setTimeout(()=>r(),n))})}_processResponse(e,n){return Le(this,void 0,void 0,function*(){return new Promise((r,s)=>Le(this,void 0,void 0,function*(){let i=e.message.statusCode||0,a={statusCode:i,result:null,headers:{}};i===Ht.NotFound&&r(a);function c(g,h){if(typeof h=="string"){let f=new Date(h);if(!isNaN(f.valueOf()))return f}return h}o(c,"dateTimeDeserializer");let l,d;try{d=yield e.readBody(),d&&d.length>0&&(n&&n.deserializeDates?l=JSON.parse(d,c):l=JSON.parse(d),a.result=l),a.headers=e.message.headers}catch{}if(i>299){let g;l&&l.message?g=l.message:d&&d.length>0?g=d:g=`Failed request: (${i})`;let h=new Sp(g,i);h.result=a.result,s(h)}else r(a)}))})}},Ua=o(t=>Object.keys(t).reduce((e,n)=>(e[n.toLowerCase()]=t[n],e),{}),"lowercaseKeys");var $Y=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(a){a(i)})}return o(s,"adopt"),new(n||(n=Promise))(function(i,a){function c(g){try{d(r.next(g))}catch(h){a(h)}}o(c,"fulfilled");function l(g){try{d(r.throw(g))}catch(h){a(h)}}o(l,"rejected");function d(g){g.done?i(g.value):s(g.value).then(c,l)}o(d,"step"),d((r=r.apply(t,e||[])).next())})};var wu=class{static{o(this,"BearerCredentialHandler")}constructor(e){this.token=e}prepareRequest(e){if(!e.headers)throw Error("The request has no headers");e.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return $Y(this,void 0,void 0,function*(){throw new Error("not implemented")})}};var Ak=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(a){a(i)})}return o(s,"adopt"),new(n||(n=Promise))(function(i,a){function c(g){try{d(r.next(g))}catch(h){a(h)}}o(c,"fulfilled");function l(g){try{d(r.throw(g))}catch(h){a(h)}}o(l,"rejected");function d(g){g.done?i(g.value):s(g.value).then(c,l)}o(d,"step"),d((r=r.apply(t,e||[])).next())})},bu=class t{static{o(this,"OidcClient")}static createHttpClient(e=!0,n=10){let r={allowRetries:e,maxRetries:n};return new Bu("actions/oidc-client",[new wu(t.getRequestToken())],r)}static getRequestToken(){let e=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!e)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return e}static getIDTokenUrl(){let e=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!e)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return e}static getCall(e){return Ak(this,void 0,void 0,function*(){var n;let i=(n=(yield t.createHttpClient().getJson(e).catch(a=>{throw new Error(`Failed to get ID Token.
|
|
84
84
|
|