diff --git a/action.yml b/action.yml index 3aead45..3e3a163 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,10 @@ inputs: description: "The main branch to rebase on" default: "dev" required: false + ciToken: + description: Token to use + default: "${{ secrets.CI_TOKEN }}" + required: false runs: using: 'node20' diff --git a/app.ts b/app.ts index 52f2ca1..9c40d27 100644 --- a/app.ts +++ b/app.ts @@ -8,7 +8,9 @@ const IGNORED_BRANCHES: string[] = core.getInput('branchesToIgnore', { required: const mainBranch: string = `origin/${ core.getInput('mainBranch', { required: false }) }`; -const { CI_TOKEN, GITHUB_SERVER_URL } = process.env; +const CI_TOKEN: string = core.getInput('ciToken', { required: false, trimWhitespace: true }); + +const { GITHUB_SERVER_URL } = process.env; enum Action { Rebase = 0, @@ -214,7 +216,7 @@ const setupCIToken = async () => { "origin" ]); - const httpLessUrl = remoteUrl.replace(/https?:\/\//, ""); + const httpLessUrl = remoteUrl.trim().replace(/https?:\/\//, ""); const newUrl = `https://MilaBot:${ CI_TOKEN }@${ httpLessUrl }.git`; await runGitCommand([ @@ -228,7 +230,7 @@ const setupCIToken = async () => { "config", "--local", "--unset", - `http.https://${ GITHUB_SERVER_URL }/.extraheader` + `http.https://${ GITHUB_SERVER_URL.replace(/https?:\/\//, "") }/.extraheader` ]); } diff --git a/dist/app.js b/dist/app.js index ba8a27b..66e4177 100644 --- a/dist/app.js +++ b/dist/app.js @@ -4,4 +4,4 @@ ${A.count} ${A.noun} ${A.is} pending: ${y.format(z)} `.trim())}};b.exports=x}),require_proxy_agent=__commonJSMin((exports,b)=>{const {kProxy:c,kClose:d,kDestroy:e,kInterceptors:f}=require_symbols$4(),{URL:g}=__require("url"),h=require_agent(),i=require_pool(),j=require_dispatcher_base(),{InvalidArgumentError:k,RequestAbortedError:l}=require_errors(),m=require_connect(),n=Symbol("proxy agent"),o=Symbol("proxy client"),p=Symbol("proxy headers"),q=Symbol("request tls settings"),r=Symbol("proxy tls settings"),s=Symbol("connect endpoint function");function t(z){return z==="https:"?443:80}function u(z){if(typeof z==="string")z={uri:z};if(!z||!z.uri)throw new k("Proxy opts.uri is mandatory");return{uri:z.uri,protocol:z.protocol||"https"}}function v(z,A){return new i(z,A)}var w=class extends j{constructor(z){super(z);this[c]=u(z);this[n]=new h(z);this[f]=z.interceptors&&z.interceptors.ProxyAgent&&Array.isArray(z.interceptors.ProxyAgent)?z.interceptors.ProxyAgent:[];if(typeof z==="string")z={uri:z};if(!z||!z.uri)throw new k("Proxy opts.uri is mandatory");const {clientFactory:A=v}=z;if(typeof A!=="function")throw new k("Proxy opts.clientFactory must be a function.");this[q]=z.requestTls;this[r]=z.proxyTls;this[p]=z.headers||{};const B=new g(z.uri),{origin:C,port:D,host:E,username:F,password:G}=B;if(z.auth&&z.token)throw new k("opts.auth cannot be used in combination with opts.token");else if(z.auth)this[p]["proxy-authorization"]=`Basic ${z.auth}`;else if(z.token)this[p]["proxy-authorization"]=z.token;else if(F&&G)this[p]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(F)}:${decodeURIComponent(G)}`).toString("base64")}`;const H=m({...z.proxyTls});this[s]=m({...z.requestTls});this[o]=A(B,{connect:H});this[n]=new h({...z,connect:async(I,J)=>{let K=I.host;if(!I.port)K+=`:${t(I.protocol)}`;try{const {socket:Bd,statusCode:Cd}=await this[o].connect({origin:C,port:D,path:K,signal:I.signal,headers:{...this[p],host:E}});if(Cd!==200)Bd.on("error",()=>{}).destroy(),J(new l(`Proxy response (${Cd}) !== 200 when HTTP Tunneling`));if(I.protocol!=="https:"){J(null,Bd);return}let Dd;if(this[q])Dd=this[q].servername;else Dd=I.servername;this[s]({...I,servername:Dd,httpSocket:Bd},J)}catch(Bd){J(Bd)}}})}dispatch(z,A){const {host:B}=new g(z.origin),C=x(z.headers);y(C);return this[n].dispatch({...z,headers:{...C,host:B}},A)}async [d](){await this[n].close(),await this[o].close()}async [e](){await this[n].destroy(),await this[o].destroy()}};function x(z){if(Array.isArray(z)){const A={};for(let B=0;BB.toLowerCase()==="proxy-authorization");if(A)throw new k("Proxy-Authorization should be sent in ProxyAgent constructor")}b.exports=w}),require_RetryHandler=__commonJSMin((exports,b)=>{const c=__require("assert"),{kRetryHandlerDefaultRetry:d}=require_symbols$4(),{RequestRetryError:e}=require_errors(),{isDisturbed:f,parseHeaders:g,parseRangeHeader:h}=require_util$6();function i(k){const l=Date.now(),m=new Date(k).getTime()-l;return m}var j=class k{constructor(l,m){const {retryOptions:n,...o}=l,{retry:p,maxRetries:q,maxTimeout:r,minTimeout:s,timeoutFactor:t,methods:u,errorCodes:v,retryAfter:w,statusCodes:x}=n??{};this.dispatch=m.dispatch;this.handler=m.handler;this.opts=o;this.abort=null;this.aborted=!1;this.retryOpts={retry:p??k[d],retryAfter:w??!0,maxTimeout:r??3e4,timeout:s??500,timeoutFactor:t??2,maxRetries:q??5,methods:u??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:x??[500,502,503,504,429],errorCodes:v??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE"]};this.retryCount=0;this.start=0;this.end=null;this.etag=null;this.resume=null;this.handler.onConnect((y)=>{if(this.aborted=!0,this.abort)this.abort(y);else this.reason=y})}onRequestSent(){if(this.handler.onRequestSent)this.handler.onRequestSent()}onUpgrade(l,m,n){if(this.handler.onUpgrade)this.handler.onUpgrade(l,m,n)}onConnect(l){if(this.aborted)l(this.reason);else this.abort=l}onBodySent(l){if(this.handler.onBodySent)return this.handler.onBodySent(l)}static [d](l,{state:m,opts:n},o){const {statusCode:p,code:q,headers:r}=l,{method:s,retryOptions:t}=n,{maxRetries:u,timeout:v,maxTimeout:w,timeoutFactor:x,statusCodes:y,errorCodes:z,methods:A}=t;let {counter:B,currentTimeout:C}=m;C=C!=null&&C>0?C:v;if(q&&q!=="UND_ERR_REQ_RETRY"&&q!=="UND_ERR_SOCKET"&&!z.includes(q)){o(l);return}if(Array.isArray(A)&&!A.includes(s)){o(l);return}if(p!=null&&Array.isArray(y)&&!y.includes(p)){o(l);return}if(B>u){o(l);return}let D=r!=null&&r["retry-after"];if(D)D=Number(D),D=isNaN(D)?i(D):D*1e3;const E=D>0?Math.min(D,w):Math.min(C*x**B,w);m.currentTimeout=E;setTimeout(()=>o(null),E)}onHeaders(l,m,n,o){const p=g(m);this.retryCount+=1;if(l>=300)return this.abort(new e("Request failed",l,{headers:p,count:this.retryCount})),!1;if(this.resume!=null){this.resume=null;if(l!==206)return!0;const r=h(p["content-range"]);if(!r)return this.abort(new e("Content-Range mismatch",l,{headers:p,count:this.retryCount})),!1;if(this.etag!=null&&this.etag!==p.etag)return this.abort(new e("ETag mismatch",l,{headers:p,count:this.retryCount})),!1;const {start:s,size:t,end:u=t}=r;c(this.start===s,"content-range mismatch");c(this.end==null||this.end===u,"content-range mismatch");this.resume=n;return!0}if(this.end==null){if(l===206){const r=h(p["content-range"]);if(r==null)return this.handler.onHeaders(l,m,n,o);const {start:s,size:t,end:u=t}=r;c(s!=null&&Number.isFinite(s)&&this.start!==s,"content-range mismatch");c(Number.isFinite(s));c(u!=null&&Number.isFinite(u)&&this.end!==u,"invalid content-length");this.start=s;this.end=u}if(this.end==null){const r=p["content-length"];this.end=r!=null?Number(r):null}c(Number.isFinite(this.start));c(this.end==null||Number.isFinite(this.end),"invalid content-length");this.resume=n;this.etag=p.etag!=null?p.etag:null;return this.handler.onHeaders(l,m,n,o)}const q=new e("Request failed",l,{headers:p,count:this.retryCount});this.abort(q);return!1}onData(l){return this.start+=l.length,this.handler.onData(l)}onComplete(l){return this.retryCount=0,this.handler.onComplete(l)}onError(l){if(this.aborted||f(this.opts.body))return this.handler.onError(l);this.retryOpts.retry(l,{state:{counter:this.retryCount++,currentTimeout:this.retryAfter},opts:{retryOptions:this.retryOpts,...this.opts}},m.bind(this));function m(n){if(n!=null||this.aborted||f(this.opts.body))return this.handler.onError(n);if(this.start!==0)this.opts={...this.opts,headers:{...this.opts.headers,range:`bytes=${this.start}-${this.end??""}`}};try{this.dispatch(this.opts,this)}catch(o){this.handler.onError(o)}}}};b.exports=j}),require_global=__commonJSMin((exports,b)=>{const c=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:d}=require_errors(),e=require_agent();if(g()===void 0)f(new e());function f(h){if(!h||typeof h.dispatch!=="function")throw new d("Argument agent must implement Agent");Object.defineProperty(globalThis,c,{value:h,writable:!0,enumerable:!1,configurable:!1})}function g(){return globalThis[c]}b.exports={setGlobalDispatcher:f,getGlobalDispatcher:g}}),require_DecoratorHandler=__commonJSMin((exports,b)=>{b.exports=class c{constructor(d){this.handler=d}onConnect(...d){return this.handler.onConnect(...d)}onError(...d){return this.handler.onError(...d)}onUpgrade(...d){return this.handler.onUpgrade(...d)}onHeaders(...d){return this.handler.onHeaders(...d)}onData(...d){return this.handler.onData(...d)}onComplete(...d){return this.handler.onComplete(...d)}onBodySent(...d){return this.handler.onBodySent(...d)}}}),require_headers=__commonJSMin((exports,b)=>{const {kHeadersList:c,kConstruct:d}=require_symbols$4(),{kGuard:e}=require_symbols$3(),{kEnumerableProperty:f}=require_util$6(),{makeIterator:g,isValidHeaderName:h,isValidHeaderValue:i}=require_util$5(),{webidl:j}=require_webidl(),k=__require("assert"),l=Symbol("headers map"),m=Symbol("headers map sorted");function n(t){return t===10||t===13||t===9||t===32}function o(t){let u=0,v=t.length;while(v>u&&n(t.charCodeAt(v-1)))--v;while(v>u&&n(t.charCodeAt(u)))++u;return u===0&&v===t.length?t:t.substring(u,v)}function p(t,u){if(Array.isArray(u))for(let v=0;v>","record"]})}function q(t,u,v){v=o(v);if(!h(u))throw j.errors.invalidArgument({prefix:"Headers.append",value:u,type:"header name"});else if(!i(v))throw j.errors.invalidArgument({prefix:"Headers.append",value:v,type:"header value"});if(t[e]==="immutable")throw new TypeError("immutable");else if(t[e]==="request-no-cors"){}return t[c].append(u,v)}var r=class t{cookies=null;constructor(u){if(u instanceof t)this[l]=new Map(u[l]),this[m]=u[m],this.cookies=u.cookies===null?null:[...u.cookies];else this[l]=new Map(u),this[m]=null}contains(u){return u=u.toLowerCase(),this[l].has(u)}clear(){this[l].clear(),this[m]=null,this.cookies=null}append(u,v){this[m]=null;const w=u.toLowerCase(),x=this[l].get(w);if(x){const y=w==="cookie"?"; ":", ";this[l].set(w,{name:x.name,value:`${x.value}${y}${v}`})}else this[l].set(w,{name:u,value:v});if(w==="set-cookie")this.cookies??=[],this.cookies.push(v)}set(u,v){this[m]=null;const w=u.toLowerCase();if(w==="set-cookie")this.cookies=[v];this[l].set(w,{name:u,value:v})}delete(u){this[m]=null;u=u.toLowerCase();if(u==="set-cookie")this.cookies=null;this[l].delete(u)}get(u){const v=this[l].get(u.toLowerCase());return v===void 0?null:v.value}*[Symbol.iterator](){for(const [u,{value:v}]of this[l])yield [u,v]}get entries(){const u={};if(this[l].size)for(const {name:v,value:w}of this[l].values())u[v]=w;return u}},s=class t{constructor(u=void 0){if(u===d)return;this[c]=new r();this[e]="none";if(u!==void 0)u=j.converters.HeadersInit(u),p(this,u)}append(u,v){return j.brandCheck(this,t),j.argumentLengthCheck(arguments,2,{header:"Headers.append"}),u=j.converters.ByteString(u),v=j.converters.ByteString(v),q(this,u,v)}delete(u){j.brandCheck(this,t);j.argumentLengthCheck(arguments,1,{header:"Headers.delete"});u=j.converters.ByteString(u);if(!h(u))throw j.errors.invalidArgument({prefix:"Headers.delete",value:u,type:"header name"});if(this[e]==="immutable")throw new TypeError("immutable");else if(this[e]==="request-no-cors"){}if(!this[c].contains(u))return;this[c].delete(u)}get(u){j.brandCheck(this,t);j.argumentLengthCheck(arguments,1,{header:"Headers.get"});u=j.converters.ByteString(u);if(!h(u))throw j.errors.invalidArgument({prefix:"Headers.get",value:u,type:"header name"});return this[c].get(u)}has(u){j.brandCheck(this,t);j.argumentLengthCheck(arguments,1,{header:"Headers.has"});u=j.converters.ByteString(u);if(!h(u))throw j.errors.invalidArgument({prefix:"Headers.has",value:u,type:"header name"});return this[c].contains(u)}set(u,v){j.brandCheck(this,t);j.argumentLengthCheck(arguments,2,{header:"Headers.set"});u=j.converters.ByteString(u);v=j.converters.ByteString(v);v=o(v);if(!h(u))throw j.errors.invalidArgument({prefix:"Headers.set",value:u,type:"header name"});else if(!i(v))throw j.errors.invalidArgument({prefix:"Headers.set",value:v,type:"header value"});if(this[e]==="immutable")throw new TypeError("immutable");else if(this[e]==="request-no-cors"){}this[c].set(u,v)}getSetCookie(){j.brandCheck(this,t);const u=this[c].cookies;if(u)return[...u];return[]}get [m](){if(this[c][m])return this[c][m];const u=[],v=[...this[c]].sort((x,y)=>x[0]u,"Headers","key")}return g(()=>[...this[m].values()],"Headers","key")}values(){j.brandCheck(this,t);if(this[e]==="immutable"){const u=this[m];return g(()=>u,"Headers","value")}return g(()=>[...this[m].values()],"Headers","value")}entries(){j.brandCheck(this,t);if(this[e]==="immutable"){const u=this[m];return g(()=>u,"Headers","key+value")}return g(()=>[...this[m].values()],"Headers","key+value")}forEach(u,v=globalThis){j.brandCheck(this,t);j.argumentLengthCheck(arguments,1,{header:"Headers.forEach"});if(typeof u!=="function")throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");for(const [w,x]of this)u.apply(v,[x,w,this])}[Symbol.for("nodejs.util.inspect.custom")](){return j.brandCheck(this,t),this[c]}};s.prototype[Symbol.iterator]=s.prototype.entries;Object.defineProperties(s.prototype,{append:f,delete:f,get:f,has:f,set:f,getSetCookie:f,keys:f,values:f,entries:f,forEach:f,[Symbol.iterator]:{enumerable:!1},[Symbol.toStringTag]:{value:"Headers",configurable:!0}});j.converters.HeadersInit=function(t){if(j.util.Type(t)==="Object"){if(t[Symbol.iterator])return j.converters["sequence>"](t);return j.converters["record"](t)}throw j.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence>","record"]})};b.exports={fill:p,Headers:s,HeadersList:r}}),require_response=__commonJSMin((exports,b)=>{const {Headers:c,HeadersList:d,fill:e}=require_headers(),{extractBody:f,cloneBody:g,mixinBody:h}=require_body(),i=require_util$6(),{kEnumerableProperty:j}=i,{isValidReasonPhrase:k,isCancelled:l,isAborted:m,isBlobLike:n,serializeJavascriptValueToJSONString:o,isErrorLike:p,isomorphicEncode:q}=require_util$5(),{redirectStatusSet:r,nullBodyStatus:s,DOMException:t}=require_constants$3(),{kState:u,kHeaders:v,kGuard:w,kRealm:x}=require_symbols$3(),{webidl:y}=require_webidl(),{FormData:z}=require_formdata(),{getGlobalOrigin:A}=require_global$1(),{URLSerializer:B}=require_dataURL(),{kHeadersList:C,kConstruct:D}=require_symbols$4(),E=__require("assert"),{types:F}=__require("util"),G=globalThis.ReadableStream||__require("stream/web").ReadableStream,H=new TextEncoder("utf-8");var I=class M{static error(){const N={settingsObject:{}},O=new M();O[u]=Bd();O[x]=N;O[v][C]=O[u].headersList;O[v][w]="immutable";O[v][x]=N;return O}static json(N,O={}){y.argumentLengthCheck(arguments,1,{header:"Response.json"});if(O!==null)O=y.converters.ResponseInit(O);const P=H.encode(o(N)),Fd=f(P),Q={settingsObject:{}},R=new M();R[x]=Q;R[v][w]="response";R[v][x]=Q;L(R,O,{body:Fd[0],type:"application/json"});return R}static redirect(N,O=302){const P={settingsObject:{}};y.argumentLengthCheck(arguments,1,{header:"Response.redirect"});N=y.converters.USVString(N);O=y.converters["unsigned short"](O);let Fd;try{Fd=new URL(N,A())}catch(Gd){throw Object.assign(new TypeError("Failed to parse URL from "+N),{cause:Gd})}if(!r.has(O))throw new RangeError("Invalid status code "+O);const Q=new M();Q[x]=P;Q[v][w]="immutable";Q[v][x]=P;Q[u].status=O;const R=q(B(Fd));Q[u].headersList.append("location",R);return Q}constructor(N=null,O={}){if(N!==null)N=y.converters.BodyInit(N);O=y.converters.ResponseInit(O);this[x]={settingsObject:{}};this[u]=K({});this[v]=new c(D);this[v][w]="response";this[v][C]=this[u].headersList;this[v][x]=this[x];let P=null;if(N!=null){const [Fd,Q]=f(N);P={body:Fd,type:Q}}L(this,O,P)}get type(){return y.brandCheck(this,M),this[u].type}get url(){y.brandCheck(this,M);const N=this[u].urlList,O=N[N.length-1]??null;if(O===null)return"";return B(O,!0)}get redirected(){return y.brandCheck(this,M),this[u].urlList.length>1}get status(){return y.brandCheck(this,M),this[u].status}get ok(){return y.brandCheck(this,M),this[u].status>=200&&this[u].status<=299}get statusText(){return y.brandCheck(this,M),this[u].statusText}get headers(){return y.brandCheck(this,M),this[v]}get body(){return y.brandCheck(this,M),this[u].body?this[u].body.stream:null}get bodyUsed(){return y.brandCheck(this,M),!!this[u].body&&i.isDisturbed(this[u].body.stream)}clone(){y.brandCheck(this,M);if(this.bodyUsed||this.body&&this.body.locked)throw y.errors.exception({header:"Response.clone",message:"Body has already been consumed."});const N=J(this[u]),O=new M();O[u]=N;O[x]=this[x];O[v][C]=N.headersList;O[v][w]=this[v][w];O[v][x]=this[v][x];return O}};h(I);Object.defineProperties(I.prototype,{type:j,url:j,status:j,ok:j,redirected:j,statusText:j,headers:j,clone:j,body:j,bodyUsed:j,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(I,{json:j,redirect:j,error:j});function J(M){if(M.internalResponse)return Dd(J(M.internalResponse),M.type);const N=K({...M,body:null});if(M.body!=null)N.body=g(M.body);return N}function K(M){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...M,headersList:M.headersList?new d(M.headersList):new d(),urlList:M.urlList?[...M.urlList]:[]}}function Bd(M){const N=p(M);return K({type:"error",status:0,error:N?M:new Error(M?""+M:M),aborted:M&&M.name==="AbortError"})}function Cd(M,N){return N={internalResponse:M,...N},new Proxy(M,{get(O,P){return P in N?N[P]:O[P]},set(O,P,Fd){return E(!(P in N)),O[P]=Fd,!0}})}function Dd(M,N){if(N==="basic")return Cd(M,{type:"basic",headersList:M.headersList});else if(N==="cors")return Cd(M,{type:"cors",headersList:M.headersList});else if(N==="opaque")return Cd(M,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});else if(N==="opaqueredirect")return Cd(M,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});else E(!1)}function Ed(M,N=null){return E(l(M)),m(M)?Bd(Object.assign(new t("The operation was aborted.","AbortError"),{cause:N})):Bd(Object.assign(new t("Request was cancelled."),{cause:N}))}function L(M,N,O){if(N.status!==null&&(N.status<200||N.status>599))throw new RangeError("init[\"status\"] must be in the range of 200 to 599, inclusive.");if("statusText"in N&&N.statusText!=null){if(!k(String(N.statusText)))throw new TypeError("Invalid statusText")}if("status"in N&&N.status!=null)M[u].status=N.status;if("statusText"in N&&N.statusText!=null)M[u].statusText=N.statusText;if("headers"in N&&N.headers!=null)e(M[v],N.headers);if(O){if(s.includes(M.status))throw y.errors.exception({header:"Response constructor",message:"Invalid response status code "+M.status});M[u].body=O.body;if(O.type!=null&&!M[u].headersList.contains("Content-Type"))M[u].headersList.append("content-type",O.type)}}y.converters.ReadableStream=y.interfaceConverter(G);y.converters.FormData=y.interfaceConverter(z);y.converters.URLSearchParams=y.interfaceConverter(URLSearchParams);y.converters.XMLHttpRequestBodyInit=function(M){if(typeof M==="string")return y.converters.USVString(M);if(n(M))return y.converters.Blob(M,{strict:!1});if(F.isArrayBuffer(M)||F.isTypedArray(M)||F.isDataView(M))return y.converters.BufferSource(M);if(i.isFormDataLike(M))return y.converters.FormData(M,{strict:!1});if(M instanceof URLSearchParams)return y.converters.URLSearchParams(M);return y.converters.DOMString(M)};y.converters.BodyInit=function(M){if(M instanceof G)return y.converters.ReadableStream(M);if(M?.[Symbol.asyncIterator])return M;return y.converters.XMLHttpRequestBodyInit(M)};y.converters.ResponseInit=y.dictionaryConverter([{key:"status",converter:y.converters["unsigned short"],defaultValue:200},{key:"statusText",converter:y.converters.ByteString,defaultValue:""},{key:"headers",converter:y.converters.HeadersInit}]);b.exports={makeNetworkError:Bd,makeResponse:K,makeAppropriateNetworkError:Ed,filterResponse:Dd,Response:I,cloneResponse:J}}),require_request=__commonJSMin((exports,b)=>{const {extractBody:c,mixinBody:d,cloneBody:e}=require_body(),{Headers:f,fill:g,HeadersList:h}=require_headers(),{FinalizationRegistry:i}=require_dispatcher_weakref()(),j=require_util$6(),{isValidHTTPToken:k,sameOrigin:l,normalizeMethod:m,makePolicyContainer:n,normalizeMethodRecord:o}=require_util$5(),{forbiddenMethodsSet:p,corsSafeListedMethodsSet:q,referrerPolicy:r,requestRedirect:s,requestMode:t,requestCredentials:u,requestCache:v,requestDuplex:w}=require_constants$3(),{kEnumerableProperty:x}=j,{kHeaders:y,kSignal:z,kState:A,kGuard:B,kRealm:C}=require_symbols$3(),{webidl:D}=require_webidl(),{getGlobalOrigin:E}=require_global$1(),{URLSerializer:F}=require_dataURL(),{kHeadersList:G,kConstruct:H}=require_symbols$4(),I=__require("assert"),{getMaxListeners:J,setMaxListeners:K,getEventListeners:Bd,defaultMaxListeners:Cd}=__require("events");let Dd=globalThis.TransformStream;const Ed=Symbol("abortController"),L=new i(({signal:P,abort:Fd})=>{P.removeEventListener("abort",Fd)});var M=class P{constructor(Fd,Q={}){if(Fd===H)return;D.argumentLengthCheck(arguments,1,{header:"Request constructor"});Fd=D.converters.RequestInfo(Fd);Q=D.converters.RequestInit(Q);this[C]={settingsObject:{baseUrl:E(),get origin(){return this.baseUrl?.origin},policyContainer:n()}};let R=null,Gd=null;const Hd=this[C].settingsObject.baseUrl;let S=null;if(typeof Fd==="string"){let Rd;try{Rd=new URL(Fd,Hd)}catch(Sd){throw new TypeError("Failed to parse URL from "+Fd,{cause:Sd})}if(Rd.username||Rd.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+Fd);R=N({urlList:[Rd]});Gd="cors"}else I(Fd instanceof P),R=Fd[A],S=Fd[z];const Id=this[C].settingsObject.origin;let Jd="client";if(R.window?.constructor?.name==="EnvironmentSettingsObject"&&l(R.window,Id))Jd=R.window;if(Q.window!=null)throw new TypeError(`'window' option '${Jd}' must be null`);if("window"in Q)Jd="no-window";R=N({method:R.method,headersList:R.headersList,unsafeRequest:R.unsafeRequest,client:this[C].settingsObject,window:Jd,priority:R.priority,origin:R.origin,referrer:R.referrer,referrerPolicy:R.referrerPolicy,mode:R.mode,credentials:R.credentials,cache:R.cache,redirect:R.redirect,integrity:R.integrity,keepalive:R.keepalive,reloadNavigation:R.reloadNavigation,historyNavigation:R.historyNavigation,urlList:[...R.urlList]});const Kd=Object.keys(Q).length!==0;if(Kd){if(R.mode==="navigate")R.mode="same-origin";R.reloadNavigation=!1;R.historyNavigation=!1;R.origin="client";R.referrer="client";R.referrerPolicy="";R.url=R.urlList[R.urlList.length-1];R.urlList=[R.url]}if(Q.referrer!==void 0){const Rd=Q.referrer;if(Rd==="")R.referrer="no-referrer";else{let Sd;try{Sd=new URL(Rd,Hd)}catch(Td){throw new TypeError(`Referrer "${Rd}" is not a valid URL.`,{cause:Td})}if(Sd.protocol==="about:"&&Sd.hostname==="client"||Id&&!l(Sd,this[C].settingsObject.baseUrl))R.referrer="client";else R.referrer=Sd}}if(Q.referrerPolicy!==void 0)R.referrerPolicy=Q.referrerPolicy;let Ld;if(Q.mode!==void 0)Ld=Q.mode;else Ld=Gd;if(Ld==="navigate")throw D.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(Ld!=null)R.mode=Ld;if(Q.credentials!==void 0)R.credentials=Q.credentials;if(Q.cache!==void 0)R.cache=Q.cache;if(R.cache==="only-if-cached"&&R.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(Q.redirect!==void 0)R.redirect=Q.redirect;if(Q.integrity!=null)R.integrity=String(Q.integrity);if(Q.keepalive!==void 0)R.keepalive=!!Q.keepalive;if(Q.method!==void 0){let Rd=Q.method;if(!k(Rd))throw new TypeError(`'${Rd}' is not a valid HTTP method.`);if(p.has(Rd.toUpperCase()))throw new TypeError(`'${Rd}' HTTP method is unsupported.`);Rd=o[Rd]??m(Rd);R.method=Rd}if(Q.signal!==void 0)S=Q.signal;this[A]=R;const Md=new AbortController();this[z]=Md.signal;this[z][C]=this[C];if(S!=null){if(!S||typeof S.aborted!=="boolean"||typeof S.addEventListener!=="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(S.aborted)Md.abort(S.reason);else{this[Ed]=Md;const Rd=new WeakRef(Md),Sd=function(){const Td=Rd.deref();if(Td!==void 0)Td.abort(this.reason)};try{if(typeof J==="function"&&J(S)===Cd)K(100,S);else if(Bd(S,"abort").length>=Cd)K(100,S)}catch{}j.addAbortListener(S,Sd);L.register(Md,{signal:S,abort:Sd})}}this[y]=new f(H);this[y][G]=R.headersList;this[y][B]="request";this[y][C]=this[C];if(Ld==="no-cors"){if(!q.has(R.method))throw new TypeError(`'${R.method} is unsupported in no-cors mode.`);this[y][B]="request-no-cors"}if(Kd){const Rd=this[y][G],Sd=Q.headers!==void 0?Q.headers:new h(Rd);Rd.clear();if(Sd instanceof h){for(const [Td,Ud]of Sd)Rd.append(Td,Ud);Rd.cookies=Sd.cookies}else g(this[y],Sd)}const Nd=Fd instanceof P?Fd[A].body:null;if((Q.body!=null||Nd!=null)&&(R.method==="GET"||R.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let Od=null;if(Q.body!=null){const [Rd,Sd]=c(Q.body,R.keepalive);Od=Rd;if(Sd&&!this[y][G].contains("content-type"))this[y].append("content-type",Sd)}const Pd=Od??Nd;if(Pd!=null&&Pd.source==null){if(Od!=null&&Q.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(R.mode!=="same-origin"&&R.mode!=="cors")throw new TypeError("If request is made from ReadableStream, mode should be \"same-origin\" or \"cors\"");R.useCORSPreflightFlag=!0}let Qd=Pd;if(Od==null&&Nd!=null){if(j.isDisturbed(Nd.stream)||Nd.stream.locked)throw new TypeError("Cannot construct a Request with a Request object that has already been used.");if(!Dd)Dd=__require("stream/web").TransformStream;const Rd=new Dd();Nd.stream.pipeThrough(Rd);Qd={source:Nd.source,length:Nd.length,stream:Rd.readable}}this[A].body=Qd}get method(){return D.brandCheck(this,P),this[A].method}get url(){return D.brandCheck(this,P),F(this[A].url)}get headers(){return D.brandCheck(this,P),this[y]}get destination(){return D.brandCheck(this,P),this[A].destination}get referrer(){D.brandCheck(this,P);if(this[A].referrer==="no-referrer")return"";if(this[A].referrer==="client")return"about:client";return this[A].referrer.toString()}get referrerPolicy(){return D.brandCheck(this,P),this[A].referrerPolicy}get mode(){return D.brandCheck(this,P),this[A].mode}get credentials(){return this[A].credentials}get cache(){return D.brandCheck(this,P),this[A].cache}get redirect(){return D.brandCheck(this,P),this[A].redirect}get integrity(){return D.brandCheck(this,P),this[A].integrity}get keepalive(){return D.brandCheck(this,P),this[A].keepalive}get isReloadNavigation(){return D.brandCheck(this,P),this[A].reloadNavigation}get isHistoryNavigation(){return D.brandCheck(this,P),this[A].historyNavigation}get signal(){return D.brandCheck(this,P),this[z]}get body(){return D.brandCheck(this,P),this[A].body?this[A].body.stream:null}get bodyUsed(){return D.brandCheck(this,P),!!this[A].body&&j.isDisturbed(this[A].body.stream)}get duplex(){return D.brandCheck(this,P),"half"}clone(){D.brandCheck(this,P);if(this.bodyUsed||this.body?.locked)throw new TypeError("unusable");const Fd=O(this[A]),Q=new P(H);Q[A]=Fd;Q[C]=this[C];Q[y]=new f(H);Q[y][G]=Fd.headersList;Q[y][B]=this[y][B];Q[y][C]=this[y][C];const R=new AbortController();if(this.signal.aborted)R.abort(this.signal.reason);else j.addAbortListener(this.signal,()=>{R.abort(this.signal.reason)});Q[z]=R.signal;return Q}};d(M);function N(P){const Fd={method:"GET",localURLsOnly:!1,unsafeRequest:!1,body:null,client:null,reservedClient:null,replacesClientId:"",window:"client",keepalive:!1,serviceWorkers:"all",initiator:"",destination:"",priority:null,origin:"client",policyContainer:"client",referrer:"client",referrerPolicy:"",mode:"no-cors",useCORSPreflightFlag:!1,credentials:"same-origin",useCredentials:!1,cache:"default",redirect:"follow",integrity:"",cryptoGraphicsNonceMetadata:"",parserMetadata:"",reloadNavigation:!1,historyNavigation:!1,userActivation:!1,taintedOrigin:!1,redirectCount:0,responseTainting:"basic",preventNoCacheCacheControlHeaderModification:!1,done:!1,timingAllowFailed:!1,...P,headersList:P.headersList?new h(P.headersList):new h()};Fd.url=Fd.urlList[0];return Fd}function O(P){const Fd=N({...P,body:null});if(P.body!=null)Fd.body=e(P.body);return Fd}Object.defineProperties(M.prototype,{method:x,url:x,headers:x,redirect:x,clone:x,signal:x,duplex:x,destination:x,body:x,bodyUsed:x,isHistoryNavigation:x,isReloadNavigation:x,keepalive:x,integrity:x,cache:x,credentials:x,attribute:x,referrerPolicy:x,referrer:x,mode:x,[Symbol.toStringTag]:{value:"Request",configurable:!0}});D.converters.Request=D.interfaceConverter(M);D.converters.RequestInfo=function(P){if(typeof P==="string")return D.converters.USVString(P);if(P instanceof M)return D.converters.Request(P);return D.converters.USVString(P)};D.converters.AbortSignal=D.interfaceConverter(AbortSignal);D.converters.RequestInit=D.dictionaryConverter([{key:"method",converter:D.converters.ByteString},{key:"headers",converter:D.converters.HeadersInit},{key:"body",converter:D.nullableConverter(D.converters.BodyInit)},{key:"referrer",converter:D.converters.USVString},{key:"referrerPolicy",converter:D.converters.DOMString,allowedValues:r},{key:"mode",converter:D.converters.DOMString,allowedValues:t},{key:"credentials",converter:D.converters.DOMString,allowedValues:u},{key:"cache",converter:D.converters.DOMString,allowedValues:v},{key:"redirect",converter:D.converters.DOMString,allowedValues:s},{key:"integrity",converter:D.converters.DOMString},{key:"keepalive",converter:D.converters.boolean},{key:"signal",converter:D.nullableConverter((P)=>D.converters.AbortSignal(P,{strict:!1}))},{key:"window",converter:D.converters.any},{key:"duplex",converter:D.converters.DOMString,allowedValues:w}]);b.exports={Request:M,makeRequest:N}}),require_fetch=__commonJSMin((exports,b)=>{const {Response:c,makeNetworkError:d,makeAppropriateNetworkError:e,filterResponse:f,makeResponse:g}=require_response(),{Headers:h}=require_headers(),{Request:i,makeRequest:j}=require_request(),k=__require("zlib"),{bytesMatch:l,makePolicyContainer:m,clonePolicyContainer:n,requestBadPort:o,TAOCheck:p,appendRequestOriginHeader:q,responseLocationURL:r,requestCurrentURL:s,setRequestReferrerPolicyOnRedirect:t,tryUpgradeRequestToAPotentiallyTrustworthyURL:u,createOpaqueTimingInfo:v,appendFetchMetadata:w,corsCheck:x,crossOriginResourcePolicyCheck:y,determineRequestsReferrer:z,coarsenedSharedCurrentTime:A,createDeferredPromise:B,isBlobLike:C,sameOrigin:D,isCancelled:E,isAborted:F,isErrorLike:G,fullyReadBody:H,readableStreamClose:I,isomorphicEncode:J,urlIsLocal:K,urlIsHttpHttpsScheme:Bd,urlHasHttpsScheme:Cd}=require_util$5(),{kState:Dd,kHeaders:Ed,kGuard:L,kRealm:M}=require_symbols$3(),N=__require("assert"),{safelyExtractBody:O}=require_body(),{redirectStatusSet:P,nullBodyStatus:Fd,safeMethodsSet:Q,requestBodyHeader:R,subresourceSet:Gd,DOMException:Hd}=require_constants$3(),{kHeadersList:S}=require_symbols$4(),Id=__require("events"),{Readable:Jd,pipeline:Kd}=__require("stream"),{addAbortListener:Ld,isErrored:Md,isReadable:Nd,nodeMajor:Od,nodeMinor:Pd}=require_util$6(),{dataURLProcessor:Qd,serializeAMimeType:Rd}=require_dataURL(),{TransformStream:Sd}=__require("stream/web"),{getGlobalDispatcher:Td}=require_global(),{webidl:Ud}=require_webidl(),{STATUS_CODES:Vd}=__require("http"),T=["GET","HEAD"];let U,Wd=globalThis.ReadableStream;var Xd=class extends Id{constructor(V){super(),this.dispatcher=V,this.connection=null,this.dump=!1,this.state="ongoing",this.setMaxListeners(21)}terminate(V){if(this.state!=="ongoing")return;this.state="terminated";this.connection?.destroy(V);this.emit("terminated",V)}abort(V){if(this.state!=="ongoing")return;this.state="aborted";if(!V)V=new Hd("The operation was aborted.","AbortError");this.serializedAbortReason=V;this.connection?.destroy(V);this.emit("terminated",V)}};function Yd(V,je={}){Ud.argumentLengthCheck(arguments,1,{header:"globalThis.fetch"});const W=B();let X;try{X=new i(V,je)}catch(se){return W.reject(se),W.promise}const ke=X[Dd];if(X.signal.aborted)return _d(W,ke,null,X.signal.reason),W.promise;const le=ke.client.globalObject;if(le?.constructor?.name==="ServiceWorkerGlobalScope")ke.serviceWorkers="none";let me=null;const ne=null;let oe=!1,pe=null;Ld(X.signal,()=>{oe=!0,N(pe!=null),pe.abort(X.signal.reason),_d(W,ke,me,X.signal.reason)});const qe=(se)=>Zd(se,"fetch"),re=(se)=>{if(oe)return Promise.resolve();if(se.aborted)return _d(W,ke,me,pe.serializedAbortReason),Promise.resolve();if(se.type==="error")return W.reject(Object.assign(new TypeError("fetch failed"),{cause:se.error})),Promise.resolve();me=new c();me[Dd]=se;me[M]=ne;me[Ed][S]=se.headersList;me[Ed][L]="immutable";me[Ed][M]=ne;W.resolve(me)};pe=ae({request:ke,processResponseEndOfBody:qe,processResponse:re,dispatcher:je.dispatcher??Td()});return W.promise}function Zd(V,je="other"){if(V.type==="error"&&V.aborted)return;if(!V.urlList?.length)return;const W=V.urlList[0];let X=V.timingInfo,ke=V.cacheState;if(!Bd(W))return;if(X===null)return;if(!V.timingAllowPassed)X=v({startTime:X.startTime}),ke="";X.endTime=A();V.timingInfo=X;$d(X,W,je,globalThis,ke)}function $d(V,je,W,X,ke){if(Od>18||Od===18&&Pd>=2)performance.markResourceTiming(V,je.href,W,X,ke)}function _d(V,je,W,X){if(!X)X=new Hd("The operation was aborted.","AbortError");V.reject(X);if(je.body!=null&&Nd(je.body?.stream))je.body.stream.cancel(X).catch((le)=>{if(le.code==="ERR_INVALID_STATE")return;throw le});if(W==null)return;const ke=W[Dd];if(ke.body!=null&&Nd(ke.body?.stream))ke.body.stream.cancel(X).catch((le)=>{if(le.code==="ERR_INVALID_STATE")return;throw le})}function ae({request:V,processRequestBodyChunkLength:je,processRequestEndOfBody:W,processResponse:X,processResponseEndOfBody:ke,processResponseConsumeBody:le,useParallelQueue:me=!1,dispatcher:ne}){let oe=null,pe=!1;if(V.client!=null)oe=V.client.globalObject,pe=V.client.crossOriginIsolatedCapability;const qe=A(pe),re=v({startTime:qe}),se={controller:new Xd(ne),request:V,timingInfo:re,processRequestBodyChunkLength:je,processRequestEndOfBody:W,processResponse:X,processResponseConsumeBody:le,processResponseEndOfBody:ke,taskDestination:oe,crossOriginIsolatedCapability:pe};N(!V.body||V.body.stream);if(V.window==="client")V.window=V.client?.globalObject?.constructor?.name==="Window"?V.client:"no-window";if(V.origin==="client")V.origin=V.client?.origin;if(V.policyContainer==="client")if(V.client!=null)V.policyContainer=n(V.client.policyContainer);else V.policyContainer=m();if(!V.headersList.contains("accept")){const te="*/*";V.headersList.append("accept",te)}if(!V.headersList.contains("accept-language"))V.headersList.append("accept-language","*");if(V.priority===null){}if(Gd.has(V.destination)){}be(se).catch((te)=>{se.controller.terminate(te)});return se.controller}async function be(V,je=!1){const W=V.request;let X=null;if(W.localURLsOnly&&!K(s(W)))X=d("local URLs only");u(W);if(o(W)==="blocked")X=d("bad port");if(W.referrerPolicy==="")W.referrerPolicy=W.policyContainer.referrerPolicy;if(W.referrer!=="no-referrer")W.referrer=z(W);if(X===null)X=await(async()=>{const le=s(W);if(D(le,W.url)&&W.responseTainting==="basic"||le.protocol==="data:"||W.mode==="navigate"||W.mode==="websocket")return W.responseTainting="basic",await ce(V);if(W.mode==="same-origin")return d("request mode cannot be \"same-origin\"");if(W.mode==="no-cors"){if(W.redirect!=="follow")return d("redirect mode cannot be \"follow\" for \"no-cors\" request");W.responseTainting="opaque";return await ce(V)}if(!Bd(s(W)))return d("URL scheme must be a HTTP(S) scheme");W.responseTainting="cors";return await fe(V)})();if(je)return X;if(X.status!==0&&!X.internalResponse){if(W.responseTainting==="cors"){}if(W.responseTainting==="basic")X=f(X,"basic");else if(W.responseTainting==="cors")X=f(X,"cors");else if(W.responseTainting==="opaque")X=f(X,"opaque");else N(!1)}let ke=X.status===0?X:X.internalResponse;if(ke.urlList.length===0)ke.urlList.push(...W.urlList);if(!W.timingAllowFailed)X.timingAllowPassed=!0;if(X.type==="opaque"&&ke.status===206&&ke.rangeRequested&&!W.headers.contains("range"))X=ke=d();if(X.status!==0&&(W.method==="HEAD"||W.method==="CONNECT"||Fd.includes(ke.status)))ke.body=null,V.controller.dump=!0;if(W.integrity){const le=(ne)=>ee(V,d(ne));if(W.responseTainting==="opaque"||X.body==null){le(X.error);return}const me=(ne)=>{if(!l(ne,W.integrity)){le("integrity mismatch");return}X.body=O(ne)[0];ee(V,X)};await H(X.body,me,le)}else ee(V,X)}function ce(V){if(E(V)&&V.request.redirectCount===0)return Promise.resolve(e(V));const {request:je}=V,{protocol:W}=s(je);switch(W){case "about:":return Promise.resolve(d("about scheme is not supported"));case "blob:":{if(!U)U=__require("buffer").resolveObjectURL;const X=s(je);if(X.search.length!==0)return Promise.resolve(d("NetworkError when attempting to fetch resource."));const ke=U(X.toString());if(je.method!=="GET"||!C(ke))return Promise.resolve(d("invalid method"));const le=O(ke),me=le[0],ne=J(`${me.length}`),oe=le[1]??"",pe=g({statusText:"OK",headersList:[["content-length",{name:"Content-Length",value:ne}],["content-type",{name:"Content-Type",value:oe}]]});pe.body=me;return Promise.resolve(pe)}case "data:":{const X=s(je),ke=Qd(X);if(ke==="failure")return Promise.resolve(d("failed to fetch the data URL"));const le=Rd(ke.mimeType);return Promise.resolve(g({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:le}]],body:O(ke.body)[0]}))}case "file:":return Promise.resolve(d("not implemented... yet..."));case "http:":case "https:":return fe(V).catch((X)=>d(X));default:return Promise.resolve(d("unknown scheme"))}}function de(V,je){if(V.request.done=!0,V.processResponseDone!=null)queueMicrotask(()=>V.processResponseDone(je))}function ee(V,je){if(je.type==="error")je.urlList=[V.request.urlList[0]],je.timingInfo=v({startTime:V.timingInfo.startTime});const W=()=>{if(V.request.done=!0,V.processResponseEndOfBody!=null)queueMicrotask(()=>V.processResponseEndOfBody(je))};if(V.processResponse!=null)queueMicrotask(()=>V.processResponse(je));if(je.body==null)W();else{const X=(le,me)=>{me.enqueue(le)},ke=new Sd({start(){},transform:X,flush:W},{size(){return 1}},{size(){return 1}});je.body={stream:je.body.stream.pipeThrough(ke)}}if(V.processResponseConsumeBody!=null){const X=(le)=>V.processResponseConsumeBody(je,le),ke=(le)=>V.processResponseConsumeBody(je,le);if(je.body==null)queueMicrotask(()=>X(null));else return H(je.body,X,ke);return Promise.resolve()}}async function fe(V){const je=V.request;let W=null,X=null;const ke=V.timingInfo;if(je.serviceWorkers==="all"){}if(W===null){if(je.redirect==="follow")je.serviceWorkers="none";X=W=await he(V);if(je.responseTainting==="cors"&&x(je,W)==="failure")return d("cors failure");if(p(je,W)==="failure")je.timingAllowFailed=!0}if((je.responseTainting==="opaque"||W.type==="opaque")&&y(je.origin,je.client,je.destination,X)==="blocked")return d("blocked");if(P.has(X.status)){if(je.redirect!=="manual")V.controller.connection.destroy();if(je.redirect==="error")W=d("unexpected redirect");else if(je.redirect==="manual")W=X;else if(je.redirect==="follow")W=await ge(V,W);else N(!1)}W.timingInfo=ke;return W}function ge(V,je){const W=V.request,X=je.internalResponse?je.internalResponse:je;let ke;try{if(ke=r(X,s(W).hash),ke==null)return je}catch(me){return Promise.resolve(d(me))}if(!Bd(ke))return Promise.resolve(d("URL scheme must be a HTTP(S) scheme"));if(W.redirectCount===20)return Promise.resolve(d("redirect count exceeded"));W.redirectCount+=1;if(W.mode==="cors"&&(ke.username||ke.password)&&!D(W,ke))return Promise.resolve(d("cross origin not allowed for request mode \"cors\""));if(W.responseTainting==="cors"&&(ke.username||ke.password))return Promise.resolve(d("URL cannot contain credentials for request mode \"cors\""));if(X.status!==303&&W.body!=null&&W.body.source==null)return Promise.resolve(d());if([301,302].includes(X.status)&&W.method==="POST"||X.status===303&&!T.includes(W.method)){W.method="GET";W.body=null;for(const me of R)W.headersList.delete(me)}if(!D(s(W),ke))W.headersList.delete("authorization"),W.headersList.delete("proxy-authorization",!0),W.headersList.delete("cookie"),W.headersList.delete("host");if(W.body!=null)N(W.body.source!=null),W.body=O(W.body.source)[0];const le=V.timingInfo;le.redirectEndTime=le.postRedirectStartTime=A(V.crossOriginIsolatedCapability);if(le.redirectStartTime===0)le.redirectStartTime=le.startTime;W.urlList.push(ke);t(W,X);return be(V,!0)}async function he(V,je=!1,W=!1){const X=V.request;let ke=null,le=null,me=null;const ne=null,oe=!1;if(X.window==="no-window"&&X.redirect==="error")ke=V,le=X;else le=j(X),ke={...V},ke.request=le;const pe=X.credentials==="include"||X.credentials==="same-origin"&&X.responseTainting==="basic",qe=le.body?le.body.length:null;let re=null;if(le.body==null&&["POST","PUT"].includes(le.method))re="0";if(qe!=null)re=J(`${qe}`);if(re!=null)le.headersList.append("content-length",re);if(qe!=null&&le.keepalive){}if(le.referrer instanceof URL)le.headersList.append("referer",J(le.referrer.href));q(le);w(le);if(!le.headersList.contains("user-agent"))le.headersList.append("user-agent",typeof esbuildDetection>"u"?"undici":"node");if(le.cache==="default"&&(le.headersList.contains("if-modified-since")||le.headersList.contains("if-none-match")||le.headersList.contains("if-unmodified-since")||le.headersList.contains("if-match")||le.headersList.contains("if-range")))le.cache="no-store";if(le.cache==="no-cache"&&!le.preventNoCacheCacheControlHeaderModification&&!le.headersList.contains("cache-control"))le.headersList.append("cache-control","max-age=0");if(le.cache==="no-store"||le.cache==="reload"){if(!le.headersList.contains("pragma"))le.headersList.append("pragma","no-cache");if(!le.headersList.contains("cache-control"))le.headersList.append("cache-control","no-cache")}if(le.headersList.contains("range"))le.headersList.append("accept-encoding","identity");if(!le.headersList.contains("accept-encoding"))if(Cd(s(le)))le.headersList.append("accept-encoding","br, gzip, deflate");else le.headersList.append("accept-encoding","gzip, deflate");le.headersList.delete("host");if(pe){}if(ne==null)le.cache="no-store";if(le.mode!=="no-store"&&le.mode!=="reload"){}if(me==null){if(le.mode==="only-if-cached")return d("only if cached");const se=await ie(ke,pe,W);if(!Q.has(le.method)&&se.status>=200&&se.status<=399){}if(oe&&se.status===304){}if(me==null)me=se}me.urlList=[...le.urlList];if(le.headersList.contains("range"))me.rangeRequested=!0;me.requestIncludesCredentials=pe;if(me.status===407){if(X.window==="no-window")return d();if(E(V))return e(V);return d("proxy authentication required")}if(me.status===421&&!W&&(X.body==null||X.body.source!=null)){if(E(V))return e(V);V.controller.connection.destroy();me=await he(V,je,!0)}if(je){}return me}async function ie(V,je=!1,W=!1){N(!V.controller.connection||V.controller.connection.destroyed);V.controller.connection={abort:null,destroyed:!1,destroy(ue){if(!this.destroyed)this.destroyed=!0,this.abort?.(ue??new Hd("The operation was aborted.","AbortError"))}};const X=V.request;let ke=null;const le=V.timingInfo,me=null;if(me==null)X.cache="no-store";const ne=W?"yes":"no";if(X.mode==="websocket"){}else{}let oe=null;if(X.body==null&&V.processRequestEndOfBody)queueMicrotask(()=>V.processRequestEndOfBody());else if(X.body!=null){const ue=async function*(xe){if(E(V))return;yield xe;V.processRequestBodyChunkLength?.(xe.byteLength)},ve=()=>{if(E(V))return;if(V.processRequestEndOfBody)V.processRequestEndOfBody()},we=(xe)=>{if(E(V))return;if(xe.name==="AbortError")V.controller.abort();else V.controller.terminate(xe)};oe=async function*(){try{for await(const xe of X.body.stream)yield*ue(xe);ve()}catch(xe){we(xe)}}()}try{const {body:ue,status:ve,statusText:we,headersList:xe,socket:ye}=await te({body:oe});if(ye)ke=g({status:ve,statusText:we,headersList:xe,socket:ye});else{const ze=ue[Symbol.asyncIterator]();V.controller.next=()=>ze.next();ke=g({status:ve,statusText:we,headersList:xe})}}catch(ue){if(ue.name==="AbortError")return V.controller.connection.destroy(),e(V,ue);return d(ue)}const pe=()=>{V.controller.resume()},qe=(ue)=>{V.controller.abort(ue)};if(!Wd)Wd=__require("stream/web").ReadableStream;const re=new Wd({async start(ue){V.controller.controller=ue},async pull(ue){await pe(ue)},async cancel(ue){await qe(ue)}},{highWaterMark:0,size(){return 1}});ke.body={stream:re};V.controller.on("terminated",se);V.controller.resume=async()=>{while(!0){let ue,ve;try{const {done:we,value:xe}=await V.controller.next();if(F(V))break;ue=we?void 0:xe}catch(we){if(V.controller.ended&&!le.encodedBodySize)ue=void 0;else ue=we,ve=!0}if(ue===void 0){I(V.controller.controller);de(V,ke);return}le.decodedBodySize+=ue?.byteLength??0;if(ve){V.controller.terminate(ue);return}V.controller.controller.enqueue(new Uint8Array(ue));if(Md(re)){V.controller.terminate();return}if(!V.controller.controller.desiredSize)return}};function se(ue){if(F(V)){if(ke.aborted=!0,Nd(re))V.controller.controller.error(V.controller.serializedAbortReason)}else if(Nd(re))V.controller.controller.error(new TypeError("terminated",{cause:G(ue)?ue:void 0}));V.controller.connection.destroy()}return ke;async function te({body:ue}){const ve=s(X),we=V.controller.dispatcher;return new Promise((xe,ye)=>we.dispatch({path:ve.pathname+ve.search,origin:ve.origin,method:X.method,body:V.controller.dispatcher.isMockActive?X.body&&(X.body.source||X.body.stream):ue,headers:X.headersList.entries,maxRedirections:0,upgrade:X.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(ze){const {connection:Ae}=V.controller;if(Ae.destroyed)ze(new Hd("The operation was aborted.","AbortError"));else V.controller.on("terminated",ze),this.abort=Ae.abort=ze},onHeaders(ze,Ae,Be,Ce){if(ze<200)return;let De=[],Ee="";const Fe=new h();if(Array.isArray(Ae))for(let Ie=0;IeLe.trim());else if(Je.toLowerCase()==="location")Ee=Ke;Fe[S].append(Je,Ke)}else{const Ie=Object.keys(Ae);for(const Je of Ie){const Ke=Ae[Je];if(Je.toLowerCase()==="content-encoding")De=Ke.toLowerCase().split(",").map((Le)=>Le.trim()).reverse();else if(Je.toLowerCase()==="location")Ee=Ke;Fe[S].append(Je,Ke)}}this.body=new Jd({read:Be});const Ge=[],He=X.redirect==="follow"&&Ee&&P.has(ze);if(X.method!=="HEAD"&&X.method!=="CONNECT"&&!Fd.includes(ze)&&!He)for(const Ie of De)if(Ie==="x-gzip"||Ie==="gzip")Ge.push(k.createGunzip({flush:k.constants.Z_SYNC_FLUSH,finishFlush:k.constants.Z_SYNC_FLUSH}));else if(Ie==="deflate")Ge.push(k.createInflate());else if(Ie==="br")Ge.push(k.createBrotliDecompress());else{Ge.length=0;break}xe({status:ze,statusText:Ce,headersList:Fe[S],body:Ge.length?Kd(this.body,...Ge,()=>{}):this.body.on("error",()=>{})});return!0},onData(ze){if(V.controller.dump)return;const Ae=ze;le.encodedBodySize+=Ae.byteLength;return this.body.push(Ae)},onComplete(){if(this.abort)V.controller.off("terminated",this.abort);V.controller.ended=!0;this.body.push(null)},onError(ze){if(this.abort)V.controller.off("terminated",this.abort);this.body?.destroy(ze);V.controller.terminate(ze);ye(ze)},onUpgrade(ze,Ae,Be){if(ze!==101)return;const Ce=new h();for(let De=0;De{b.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")}}),require_progressevent=__commonJSMin((exports,b)=>{const {webidl:c}=require_webidl(),d=Symbol("ProgressEvent state");var e=class f extends Event{constructor(g,h={}){g=c.converters.DOMString(g),h=c.converters.ProgressEventInit(h??{}),super(g,h),this[d]={lengthComputable:h.lengthComputable,loaded:h.loaded,total:h.total}}get lengthComputable(){return c.brandCheck(this,f),this[d].lengthComputable}get loaded(){return c.brandCheck(this,f),this[d].loaded}get total(){return c.brandCheck(this,f),this[d].total}};c.converters.ProgressEventInit=c.dictionaryConverter([{key:"lengthComputable",converter:c.converters.boolean,defaultValue:!1},{key:"loaded",converter:c.converters["unsigned long long"],defaultValue:0},{key:"total",converter:c.converters["unsigned long long"],defaultValue:0},{key:"bubbles",converter:c.converters.boolean,defaultValue:!1},{key:"cancelable",converter:c.converters.boolean,defaultValue:!1},{key:"composed",converter:c.converters.boolean,defaultValue:!1}]);b.exports={ProgressEvent:e}}),require_encoding=__commonJSMin((exports,b)=>{function c(d){if(!d)return"failure";switch(d.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"}}b.exports={getEncoding:c}}),require_util$3=__commonJSMin((exports,b)=>{const {kState:c,kError:d,kResult:e,kAborted:f,kLastProgressEventFired:g}=require_symbols$2(),{ProgressEvent:h}=require_progressevent(),{getEncoding:i}=require_encoding(),{DOMException:j}=require_constants$3(),{serializeAMimeType:k,parseMIMEType:l}=require_dataURL(),{types:m}=__require("util"),{StringDecoder:n}=__require("string_decoder"),{btoa:o}=__require("buffer"),p={enumerable:!0,writable:!1,configurable:!1};function q(w,x,y,z){if(w[c]==="loading")throw new j("Invalid state","InvalidStateError");w[c]="loading";w[e]=null;w[d]=null;const A=x.stream(),B=A.getReader(),C=[];let D=B.read(),E=!0;(async()=>{while(!w[f])try{const {done:F,value:G}=await D;if(E&&!w[f])queueMicrotask(()=>{r("loadstart",w)});E=!1;if(!F&&m.isUint8Array(G)){C.push(G);if((w[g]===void 0||Date.now()-w[g]>=50)&&!w[f])w[g]=Date.now(),queueMicrotask(()=>{r("progress",w)});D=B.read()}else if(F){queueMicrotask(()=>{w[c]="done";try{const H=s(C,y,x.type,z);if(w[f])return;w[e]=H;r("load",w)}catch(H){w[d]=H,r("error",w)}if(w[c]!=="loading")r("loadend",w)});break}}catch(F){if(w[f])return;queueMicrotask(()=>{if(w[c]="done",w[d]=F,r("error",w),w[c]!=="loading")r("loadend",w)});break}})()}function r(w,x){const y=new h(w,{bubbles:!1,cancelable:!1});x.dispatchEvent(y)}function s(w,x,y,z){switch(x){case "DataURL":{let A="data:";const B=l(y||"application/octet-stream");if(B!=="failure")A+=k(B);A+=";base64,";const C=new n("latin1");for(const D of w)A+=o(C.write(D));A+=o(C.end());return A}case "Text":{let A="failure";if(z)A=i(z);if(A==="failure"&&y){const B=l(y);if(B!=="failure")A=i(B.parameters.get("charset"))}if(A==="failure")A="UTF-8";return t(w,A)}case "ArrayBuffer":{const A=v(w);return A.buffer}case "BinaryString":{let A="";const B=new n("latin1");for(const C of w)A+=B.write(C);A+=B.end();return A}}}function t(w,x){const y=v(w),z=u(y);let A=0;if(z!==null)x=z,A=z==="UTF-8"?3:2;const B=y.slice(A);return new TextDecoder(x).decode(B)}function u(w){const [x,y,z]=w;if(x===239&&y===187&&z===191)return"UTF-8";else if(x===254&&y===255)return"UTF-16BE";else if(x===255&&y===254)return"UTF-16LE";return null}function v(w){const x=w.reduce((z,A)=>z+A.byteLength,0);let y=0;return w.reduce((z,A)=>(z.set(A,y),y+=A.byteLength,z),new Uint8Array(x))}b.exports={staticPropertyDescriptors:p,readOperation:q,fireAProgressEvent:r}}),require_filereader=__commonJSMin((exports,b)=>{const {staticPropertyDescriptors:c,readOperation:d,fireAProgressEvent:e}=require_util$3(),{kState:f,kError:g,kResult:h,kEvents:i,kAborted:j}=require_symbols$2(),{webidl:k}=require_webidl(),{kEnumerableProperty:l}=require_util$6();var m=class n extends EventTarget{constructor(){super(),this[f]="empty",this[h]=null,this[g]=null,this[i]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(o){k.brandCheck(this,n),k.argumentLengthCheck(arguments,1,{header:"FileReader.readAsArrayBuffer"}),o=k.converters.Blob(o,{strict:!1}),d(this,o,"ArrayBuffer")}readAsBinaryString(o){k.brandCheck(this,n),k.argumentLengthCheck(arguments,1,{header:"FileReader.readAsBinaryString"}),o=k.converters.Blob(o,{strict:!1}),d(this,o,"BinaryString")}readAsText(o,p=void 0){k.brandCheck(this,n);k.argumentLengthCheck(arguments,1,{header:"FileReader.readAsText"});o=k.converters.Blob(o,{strict:!1});if(p!==void 0)p=k.converters.DOMString(p);d(this,o,"Text",p)}readAsDataURL(o){k.brandCheck(this,n),k.argumentLengthCheck(arguments,1,{header:"FileReader.readAsDataURL"}),o=k.converters.Blob(o,{strict:!1}),d(this,o,"DataURL")}abort(){if(this[f]==="empty"||this[f]==="done"){this[h]=null;return}if(this[f]==="loading")this[f]="done",this[h]=null;this[j]=!0;e("abort",this);if(this[f]!=="loading")e("loadend",this)}get readyState(){switch(k.brandCheck(this,n),this[f]){case "empty":return this.EMPTY;case "loading":return this.LOADING;case "done":return this.DONE}}get result(){return k.brandCheck(this,n),this[h]}get error(){return k.brandCheck(this,n),this[g]}get onloadend(){return k.brandCheck(this,n),this[i].loadend}set onloadend(o){k.brandCheck(this,n);if(this[i].loadend)this.removeEventListener("loadend",this[i].loadend);if(typeof o==="function")this[i].loadend=o,this.addEventListener("loadend",o);else this[i].loadend=null}get onerror(){return k.brandCheck(this,n),this[i].error}set onerror(o){k.brandCheck(this,n);if(this[i].error)this.removeEventListener("error",this[i].error);if(typeof o==="function")this[i].error=o,this.addEventListener("error",o);else this[i].error=null}get onloadstart(){return k.brandCheck(this,n),this[i].loadstart}set onloadstart(o){k.brandCheck(this,n);if(this[i].loadstart)this.removeEventListener("loadstart",this[i].loadstart);if(typeof o==="function")this[i].loadstart=o,this.addEventListener("loadstart",o);else this[i].loadstart=null}get onprogress(){return k.brandCheck(this,n),this[i].progress}set onprogress(o){k.brandCheck(this,n);if(this[i].progress)this.removeEventListener("progress",this[i].progress);if(typeof o==="function")this[i].progress=o,this.addEventListener("progress",o);else this[i].progress=null}get onload(){return k.brandCheck(this,n),this[i].load}set onload(o){k.brandCheck(this,n);if(this[i].load)this.removeEventListener("load",this[i].load);if(typeof o==="function")this[i].load=o,this.addEventListener("load",o);else this[i].load=null}get onabort(){return k.brandCheck(this,n),this[i].abort}set onabort(o){k.brandCheck(this,n);if(this[i].abort)this.removeEventListener("abort",this[i].abort);if(typeof o==="function")this[i].abort=o,this.addEventListener("abort",o);else this[i].abort=null}};m.EMPTY=m.prototype.EMPTY=0;m.LOADING=m.prototype.LOADING=1;m.DONE=m.prototype.DONE=2;Object.defineProperties(m.prototype,{EMPTY:c,LOADING:c,DONE:c,readAsArrayBuffer:l,readAsBinaryString:l,readAsText:l,readAsDataURL:l,abort:l,readyState:l,result:l,error:l,onloadstart:l,onprogress:l,onload:l,onabort:l,onerror:l,onloadend:l,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(m,{EMPTY:c,LOADING:c,DONE:c});b.exports={FileReader:m}}),require_symbols$1=__commonJSMin((exports,b)=>{b.exports={kConstruct:require_symbols$4().kConstruct}}),require_util$2=__commonJSMin((exports,b)=>{const c=__require("assert"),{URLSerializer:d}=require_dataURL(),{isValidHeaderName:e}=require_util$5();function f(h,i,j=!1){const k=d(h,j),l=d(i,j);return k===l}function g(h){c(h!==null);const i=[];for(let j of h.split(",")){j=j.trim();if(!j.length)continue;else if(!e(j))continue;i.push(j)}return i}b.exports={urlEquals:f,fieldValues:g}}),require_cache=__commonJSMin((exports,b)=>{const {kConstruct:c}=require_symbols$1(),{urlEquals:d,fieldValues:e}=require_util$2(),{kEnumerableProperty:f,isDisturbed:g}=require_util$6(),{kHeadersList:h}=require_symbols$4(),{webidl:i}=require_webidl(),{Response:j,cloneResponse:k}=require_response(),{Request:l}=require_request(),{kState:m,kHeaders:n,kGuard:o,kRealm:p}=require_symbols$3(),{fetching:q}=require_fetch(),{urlIsHttpHttpsScheme:r,createDeferredPromise:s,readAllBytes:t}=require_util$5(),u=__require("assert"),{getGlobalDispatcher:v}=require_global();var w=class y{#relevantRequestResponseList;constructor(){if(arguments[0]!==c)i.illegalConstructor();this.#relevantRequestResponseList=arguments[1]}async match(z,A={}){i.brandCheck(this,y);i.argumentLengthCheck(arguments,1,{header:"Cache.match"});z=i.converters.RequestInfo(z);A=i.converters.CacheQueryOptions(A);const B=await this.matchAll(z,A);if(B.length===0)return;return B[0]}async matchAll(z=void 0,A={}){i.brandCheck(this,y);if(z!==void 0)z=i.converters.RequestInfo(z);A=i.converters.CacheQueryOptions(A);let B=null;if(z!==void 0){if(z instanceof l){if(B=z[m],B.method!=="GET"&&!A.ignoreMethod)return[]}else if(typeof z==="string")B=new l(z)[m]}const C=[];if(z===void 0)for(const E of this.#relevantRequestResponseList)C.push(E[1]);else{const E=this.#queryCache(B,A);for(const F of E)C.push(F[1])}const D=[];for(const E of C){const F=new j(E.body?.source??null),G=F[m].body;F[m]=E;F[m].body=G;F[n][h]=E.headersList;F[n][o]="immutable";D.push(F)}return Object.freeze(D)}async add(z){i.brandCheck(this,y);i.argumentLengthCheck(arguments,1,{header:"Cache.add"});z=i.converters.RequestInfo(z);const A=[z],B=this.addAll(A);return await B}async addAll(z){i.brandCheck(this,y);i.argumentLengthCheck(arguments,1,{header:"Cache.addAll"});z=i.converters["sequence"](z);const A=[],B=[];for(const J of z){if(typeof J==="string")continue;const K=J[m];if(!r(K.url)||K.method!=="GET")throw i.errors.exception({header:"Cache.addAll",message:"Expected http/s scheme when method is not GET."})}const C=[];for(const J of z){const K=new l(J)[m];if(!r(K.url))throw i.errors.exception({header:"Cache.addAll",message:"Expected http/s scheme."});K.initiator="fetch";K.destination="subresource";B.push(K);const Bd=s();C.push(q({request:K,dispatcher:v(),processResponse(Cd){if(Cd.type==="error"||Cd.status===206||Cd.status<200||Cd.status>299)Bd.reject(i.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(Cd.headersList.contains("vary")){const Dd=e(Cd.headersList.get("vary"));for(const Ed of Dd)if(Ed==="*"){Bd.reject(i.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(const L of C)L.abort();return}}},processResponseEndOfBody(Cd){if(Cd.aborted){Bd.reject(new DOMException("aborted","AbortError"));return}Bd.resolve(Cd)}}));A.push(Bd.promise)}const D=Promise.all(A),E=await D,F=[];let G=0;for(const J of E){const K={type:"put",request:B[G],response:J};F.push(K);G++}const H=s();let I=null;try{this.#batchCacheOperations(F)}catch(J){I=J}queueMicrotask(()=>{if(I===null)H.resolve(void 0);else H.reject(I)});return H.promise}async put(z,A){i.brandCheck(this,y);i.argumentLengthCheck(arguments,2,{header:"Cache.put"});z=i.converters.RequestInfo(z);A=i.converters.Response(A);let B=null;if(z instanceof l)B=z[m];else B=new l(z)[m];if(!r(B.url)||B.method!=="GET")throw i.errors.exception({header:"Cache.put",message:"Expected an http/s scheme when method is not GET"});const C=A[m];if(C.status===206)throw i.errors.exception({header:"Cache.put",message:"Got 206 status"});if(C.headersList.contains("vary")){const K=e(C.headersList.get("vary"));for(const Bd of K)if(Bd==="*")throw i.errors.exception({header:"Cache.put",message:"Got * vary field value"})}if(C.body&&(g(C.body.stream)||C.body.stream.locked))throw i.errors.exception({header:"Cache.put",message:"Response body is locked or disturbed"});const D=k(C),E=s();if(C.body!=null){const K=C.body.stream,Bd=K.getReader();t(Bd).then(E.resolve,E.reject)}else E.resolve(void 0);const F=[],G={type:"put",request:B,response:D};F.push(G);const H=await E.promise;if(D.body!=null)D.body.source=H;const I=s();let J=null;try{this.#batchCacheOperations(F)}catch(K){J=K}queueMicrotask(()=>{if(J===null)I.resolve();else I.reject(J)});return I.promise}async delete(z,A={}){i.brandCheck(this,y);i.argumentLengthCheck(arguments,1,{header:"Cache.delete"});z=i.converters.RequestInfo(z);A=i.converters.CacheQueryOptions(A);let B=null;if(z instanceof l){if(B=z[m],B.method!=="GET"&&!A.ignoreMethod)return!1}else u(typeof z==="string"),B=new l(z)[m];const C=[],D={type:"delete",request:B,options:A};C.push(D);const E=s();let F=null,G;try{G=this.#batchCacheOperations(C)}catch(H){F=H}queueMicrotask(()=>{if(F===null)E.resolve(!!G?.length);else E.reject(F)});return E.promise}async keys(z=void 0,A={}){i.brandCheck(this,y);if(z!==void 0)z=i.converters.RequestInfo(z);A=i.converters.CacheQueryOptions(A);let B=null;if(z!==void 0){if(z instanceof l){if(B=z[m],B.method!=="GET"&&!A.ignoreMethod)return[]}else if(typeof z==="string")B=new l(z)[m]}const C=s(),D=[];if(z===void 0)for(const E of this.#relevantRequestResponseList)D.push(E[0]);else{const E=this.#queryCache(B,A);for(const F of E)D.push(F[0])}queueMicrotask(()=>{const E=[];for(const F of D){const G=new l("https://a");G[m]=F;G[n][h]=F.headersList;G[n][o]="immutable";G[p]=F.client;E.push(G)}C.resolve(Object.freeze(E))});return C.promise}#batchCacheOperations(z){const A=this.#relevantRequestResponseList,B=[...A],C=[],D=[];try{for(const E of z){if(E.type!=="delete"&&E.type!=="put")throw i.errors.exception({header:"Cache.#batchCacheOperations",message:"operation type does not match \"delete\" or \"put\""});if(E.type==="delete"&&E.response!=null)throw i.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#queryCache(E.request,E.options,C).length)throw new DOMException("???","InvalidStateError");let F;if(E.type==="delete"){F=this.#queryCache(E.request,E.options);if(F.length===0)return[];for(const G of F){const H=A.indexOf(G);u(H!==-1);A.splice(H,1)}}else if(E.type==="put"){if(E.response==null)throw i.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});const G=E.request;if(!r(G.url))throw i.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(G.method!=="GET")throw i.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(E.options!=null)throw i.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});F=this.#queryCache(E.request);for(const H of F){const I=A.indexOf(H);u(I!==-1);A.splice(I,1)}A.push([E.request,E.response]);C.push([E.request,E.response])}D.push([E.request,E.response])}return D}catch(E){throw this.#relevantRequestResponseList.length=0,this.#relevantRequestResponseList=B,E}}#queryCache(z,A,B){const C=[],D=B??this.#relevantRequestResponseList;for(const E of D){const [F,G]=E;if(this.#requestMatchesCachedItem(z,F,G,A))C.push(E)}return C}#requestMatchesCachedItem(z,A,B=null,C){const D=new URL(z.url),E=new URL(A.url);if(C?.ignoreSearch)E.search="",D.search="";if(!d(D,E,!0))return!1;if(B==null||C?.ignoreVary||!B.headersList.contains("vary"))return!0;const F=e(B.headersList.get("vary"));for(const G of F){if(G==="*")return!1;const H=A.headersList.get(G),I=z.headersList.get(G);if(H!==I)return!1}return!0}};Object.defineProperties(w.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:f,matchAll:f,add:f,addAll:f,put:f,delete:f,keys:f});const x=[{key:"ignoreSearch",converter:i.converters.boolean,defaultValue:!1},{key:"ignoreMethod",converter:i.converters.boolean,defaultValue:!1},{key:"ignoreVary",converter:i.converters.boolean,defaultValue:!1}];i.converters.CacheQueryOptions=i.dictionaryConverter(x);i.converters.MultiCacheQueryOptions=i.dictionaryConverter([...x,{key:"cacheName",converter:i.converters.DOMString}]);i.converters.Response=i.interfaceConverter(j);i.converters["sequence"]=i.sequenceConverter(i.converters.RequestInfo);b.exports={Cache:w}}),require_cachestorage=__commonJSMin((exports,b)=>{const {kConstruct:c}=require_symbols$1(),{Cache:d}=require_cache(),{webidl:e}=require_webidl(),{kEnumerableProperty:f}=require_util$6();var g=class h{#caches=new Map();constructor(){if(arguments[0]!==c)e.illegalConstructor()}async match(i,j={}){if(e.brandCheck(this,h),e.argumentLengthCheck(arguments,1,{header:"CacheStorage.match"}),i=e.converters.RequestInfo(i),j=e.converters.MultiCacheQueryOptions(j),j.cacheName!=null){if(this.#caches.has(j.cacheName)){const k=this.#caches.get(j.cacheName),l=new d(c,k);return await l.match(i,j)}}else for(const k of this.#caches.values()){const l=new d(c,k),m=await l.match(i,j);if(m!==void 0)return m}}async has(i){return e.brandCheck(this,h),e.argumentLengthCheck(arguments,1,{header:"CacheStorage.has"}),i=e.converters.DOMString(i),this.#caches.has(i)}async open(i){e.brandCheck(this,h);e.argumentLengthCheck(arguments,1,{header:"CacheStorage.open"});i=e.converters.DOMString(i);if(this.#caches.has(i)){const k=this.#caches.get(i);return new d(c,k)}const j=[];this.#caches.set(i,j);return new d(c,j)}async delete(i){return e.brandCheck(this,h),e.argumentLengthCheck(arguments,1,{header:"CacheStorage.delete"}),i=e.converters.DOMString(i),this.#caches.delete(i)}async keys(){e.brandCheck(this,h);const i=this.#caches.keys();return[...i]}};Object.defineProperties(g.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:f,has:f,open:f,delete:f,keys:f});b.exports={CacheStorage:g}}),require_constants$1=__commonJSMin((exports,b)=>{const c=1024,d=4096;b.exports={maxAttributeValueSize:c,maxNameValuePairSize:d}}),require_util$1=__commonJSMin((exports,b)=>{const c=__require("assert"),{kHeadersList:d}=require_symbols$4();function e(o){if(o.length===0)return!1;for(const p of o){const q=p.charCodeAt(0);if(q>=0||q<=8||q>=10||q<=31||q===127)return!1}}function f(o){for(const p of o){const q=p.charCodeAt(0);if(q<=32||q>127||p==="("||p===")"||p===">"||p==="<"||p==="@"||p===","||p===";"||p===":"||p==="\\"||p==="\""||p==="/"||p==="["||p==="]"||p==="?"||p==="="||p==="{"||p==="}")throw new Error("Invalid cookie name")}}function g(o){for(const p of o){const q=p.charCodeAt(0);if(q<33||q===34||q===44||q===59||q===92||q>126)throw new Error("Invalid header value")}}function h(o){for(const p of o){const q=p.charCodeAt(0);if(q<33||p===";")throw new Error("Invalid cookie path")}}function i(o){if(o.startsWith("-")||o.endsWith(".")||o.endsWith("-"))throw new Error("Invalid cookie domain")}function j(o){if(typeof o==="number")o=new Date(o);const p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=p[o.getUTCDay()],s=o.getUTCDate().toString().padStart(2,"0"),t=q[o.getUTCMonth()],u=o.getUTCFullYear(),v=o.getUTCHours().toString().padStart(2,"0"),w=o.getUTCMinutes().toString().padStart(2,"0"),x=o.getUTCSeconds().toString().padStart(2,"0");return`${r}, ${s} ${t} ${u} ${v}:${w}:${x} GMT`}function k(o){if(o<0)throw new Error("Invalid cookie max-age")}function l(o){if(o.name.length===0)return null;f(o.name);g(o.value);const p=[`${o.name}=${o.value}`];if(o.name.startsWith("__Secure-"))o.secure=!0;if(o.name.startsWith("__Host-"))o.secure=!0,o.domain=null,o.path="/";if(o.secure)p.push("Secure");if(o.httpOnly)p.push("HttpOnly");if(typeof o.maxAge==="number")k(o.maxAge),p.push(`Max-Age=${o.maxAge}`);if(o.domain)i(o.domain),p.push(`Domain=${o.domain}`);if(o.path)h(o.path),p.push(`Path=${o.path}`);if(o.expires&&o.expires.toString()!=="Invalid Date")p.push(`Expires=${j(o.expires)}`);if(o.sameSite)p.push(`SameSite=${o.sameSite}`);for(const q of o.unparsed){if(!q.includes("="))throw new Error("Invalid unparsed");const [r,...s]=q.split("=");p.push(`${r.trim()}=${s.join("=")}`)}return p.join("; ")}let m;function n(o){if(o[d])return o[d];if(!m)m=Object.getOwnPropertySymbols(o).find((q)=>q.description==="headers list"),c(m,"Headers cannot be parsed");const p=o[m];c(p);return p}b.exports={isCTLExcludingHtab:e,stringify:l,getHeadersList:n}}),require_parse=__commonJSMin((exports,b)=>{const {maxNameValuePairSize:c,maxAttributeValueSize:d}=require_constants$1(),{isCTLExcludingHtab:e}=require_util$1(),{collectASequenceOfCodePointsFast:f}=require_dataURL(),g=__require("assert");function h(j){if(e(j))return null;let k="",l="",m="",n="";if(j.includes(";")){const o={position:0};k=f(";",j,o);l=j.slice(o.position)}else k=j;if(!k.includes("="))n=k;else{const o={position:0};m=f("=",k,o);n=k.slice(o.position+1)}m=m.trim();n=n.trim();if(m.length+n.length>c)return null;return{name:m,value:n,...i(l)}}function i(j,k={}){if(j.length===0)return k;g(j[0]===";");j=j.slice(1);let l="";if(j.includes(";"))l=f(";",j,{position:0}),j=j.slice(l.length);else l=j,j="";let m="",n="";if(l.includes("=")){const p={position:0};m=f("=",l,p);n=l.slice(p.position+1)}else m=l;m=m.trim();n=n.trim();if(n.length>d)return i(j,k);const o=m.toLowerCase();if(o==="expires"){const p=new Date(n);k.expires=p}else if(o==="max-age"){const p=n.charCodeAt(0);if((p<48||p>57)&&n[0]!=="-")return i(j,k);if(!/^\d+$/.test(n))return i(j,k);const q=Number(n);k.maxAge=q}else if(o==="domain"){let p=n;if(p[0]===".")p=p.slice(1);p=p.toLowerCase();k.domain=p}else if(o==="path"){let p="";if(n.length===0||n[0]!=="/")p="/";else p=n;k.path=p}else if(o==="secure")k.secure=!0;else if(o==="httponly")k.httpOnly=!0;else if(o==="samesite"){let p="Default";const q=n.toLowerCase();if(q.includes("none"))p="None";if(q.includes("strict"))p="Strict";if(q.includes("lax"))p="Lax";k.sameSite=p}else k.unparsed??=[],k.unparsed.push(`${m}=${n}`);return i(j,k)}b.exports={parseSetCookie:h,parseUnparsedAttributes:i}}),require_cookies=__commonJSMin((exports,b)=>{const {parseSetCookie:c}=require_parse(),{stringify:d,getHeadersList:e}=require_util$1(),{webidl:f}=require_webidl(),{Headers:g}=require_headers();function h(l){f.argumentLengthCheck(arguments,1,{header:"getCookies"});f.brandCheck(l,g,{strict:!1});const m=l.get("cookie"),n={};if(!m)return n;for(const o of m.split(";")){const [p,...q]=o.split("=");n[p.trim()]=q.join("=")}return n}function i(l,m,n){f.argumentLengthCheck(arguments,2,{header:"deleteCookie"}),f.brandCheck(l,g,{strict:!1}),m=f.converters.DOMString(m),n=f.converters.DeleteCookieAttributes(n),k(l,{name:m,value:"",expires:new Date(0),...n})}function j(l){f.argumentLengthCheck(arguments,1,{header:"getSetCookies"});f.brandCheck(l,g,{strict:!1});const m=e(l).cookies;if(!m)return[];return m.map((n)=>c(Array.isArray(n)?n[1]:n))}function k(l,m){f.argumentLengthCheck(arguments,2,{header:"setCookie"});f.brandCheck(l,g,{strict:!1});m=f.converters.Cookie(m);const n=d(m);if(n)l.append("Set-Cookie",d(m))}f.converters.DeleteCookieAttributes=f.dictionaryConverter([{converter:f.nullableConverter(f.converters.DOMString),key:"path",defaultValue:null},{converter:f.nullableConverter(f.converters.DOMString),key:"domain",defaultValue:null}]);f.converters.Cookie=f.dictionaryConverter([{converter:f.converters.DOMString,key:"name"},{converter:f.converters.DOMString,key:"value"},{converter:f.nullableConverter((l)=>{if(typeof l==="number")return f.converters["unsigned long long"](l);return new Date(l)}),key:"expires",defaultValue:null},{converter:f.nullableConverter(f.converters["long long"]),key:"maxAge",defaultValue:null},{converter:f.nullableConverter(f.converters.DOMString),key:"domain",defaultValue:null},{converter:f.nullableConverter(f.converters.DOMString),key:"path",defaultValue:null},{converter:f.nullableConverter(f.converters.boolean),key:"secure",defaultValue:null},{converter:f.nullableConverter(f.converters.boolean),key:"httpOnly",defaultValue:null},{converter:f.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:f.sequenceConverter(f.converters.DOMString),key:"unparsed",defaultValue:[]}]);b.exports={getCookies:h,deleteCookie:i,getSetCookies:j,setCookie:k}}),require_constants=__commonJSMin((exports,b)=>{const c="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",d={enumerable:!0,writable:!1,configurable:!1},e={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},f={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},g=65535,h={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},i=Buffer.allocUnsafe(0);b.exports={uid:c,staticPropertyDescriptors:d,states:e,opcodes:f,maxUnsigned16Bit:g,parserStates:h,emptyBuffer:i}}),require_symbols=__commonJSMin((exports,b)=>{b.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")}}),require_events=__commonJSMin((exports,b)=>{const {webidl:c}=require_webidl(),{kEnumerableProperty:d}=require_util$6(),{MessagePort:e}=__require("worker_threads");var f=class j extends Event{#eventInit;constructor(k,l={}){c.argumentLengthCheck(arguments,1,{header:"MessageEvent constructor"}),k=c.converters.DOMString(k),l=c.converters.MessageEventInit(l),super(k,l),this.#eventInit=l}get data(){return c.brandCheck(this,j),this.#eventInit.data}get origin(){return c.brandCheck(this,j),this.#eventInit.origin}get lastEventId(){return c.brandCheck(this,j),this.#eventInit.lastEventId}get source(){return c.brandCheck(this,j),this.#eventInit.source}get ports(){c.brandCheck(this,j);if(!Object.isFrozen(this.#eventInit.ports))Object.freeze(this.#eventInit.ports);return this.#eventInit.ports}initMessageEvent(k,l=!1,m=!1,n=null,o="",p="",q=null,r=[]){return c.brandCheck(this,j),c.argumentLengthCheck(arguments,1,{header:"MessageEvent.initMessageEvent"}),new j(k,{bubbles:l,cancelable:m,data:n,origin:o,lastEventId:p,source:q,ports:r})}},g=class j extends Event{#eventInit;constructor(k,l={}){c.argumentLengthCheck(arguments,1,{header:"CloseEvent constructor"}),k=c.converters.DOMString(k),l=c.converters.CloseEventInit(l),super(k,l),this.#eventInit=l}get wasClean(){return c.brandCheck(this,j),this.#eventInit.wasClean}get code(){return c.brandCheck(this,j),this.#eventInit.code}get reason(){return c.brandCheck(this,j),this.#eventInit.reason}},h=class j extends Event{#eventInit;constructor(k,l){c.argumentLengthCheck(arguments,1,{header:"ErrorEvent constructor"}),super(k,l),k=c.converters.DOMString(k),l=c.converters.ErrorEventInit(l??{}),this.#eventInit=l}get message(){return c.brandCheck(this,j),this.#eventInit.message}get filename(){return c.brandCheck(this,j),this.#eventInit.filename}get lineno(){return c.brandCheck(this,j),this.#eventInit.lineno}get colno(){return c.brandCheck(this,j),this.#eventInit.colno}get error(){return c.brandCheck(this,j),this.#eventInit.error}};Object.defineProperties(f.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:d,origin:d,lastEventId:d,source:d,ports:d,initMessageEvent:d});Object.defineProperties(g.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:d,code:d,wasClean:d});Object.defineProperties(h.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:d,filename:d,lineno:d,colno:d,error:d});c.converters.MessagePort=c.interfaceConverter(e);c.converters["sequence"]=c.sequenceConverter(c.converters.MessagePort);const i=[{key:"bubbles",converter:c.converters.boolean,defaultValue:!1},{key:"cancelable",converter:c.converters.boolean,defaultValue:!1},{key:"composed",converter:c.converters.boolean,defaultValue:!1}];c.converters.MessageEventInit=c.dictionaryConverter([...i,{key:"data",converter:c.converters.any,defaultValue:null},{key:"origin",converter:c.converters.USVString,defaultValue:""},{key:"lastEventId",converter:c.converters.DOMString,defaultValue:""},{key:"source",converter:c.nullableConverter(c.converters.MessagePort),defaultValue:null},{key:"ports",converter:c.converters["sequence"],get defaultValue(){return[]}}]);c.converters.CloseEventInit=c.dictionaryConverter([...i,{key:"wasClean",converter:c.converters.boolean,defaultValue:!1},{key:"code",converter:c.converters["unsigned short"],defaultValue:0},{key:"reason",converter:c.converters.USVString,defaultValue:""}]);c.converters.ErrorEventInit=c.dictionaryConverter([...i,{key:"message",converter:c.converters.DOMString,defaultValue:""},{key:"filename",converter:c.converters.USVString,defaultValue:""},{key:"lineno",converter:c.converters["unsigned long"],defaultValue:0},{key:"colno",converter:c.converters["unsigned long"],defaultValue:0},{key:"error",converter:c.converters.any}]);b.exports={MessageEvent:f,CloseEvent:g,ErrorEvent:h}}),require_util=__commonJSMin((exports,b)=>{const {kReadyState:c,kController:d,kResponse:e,kBinaryType:f,kWebSocketURL:g}=require_symbols(),{states:h,opcodes:i}=require_constants(),{MessageEvent:j,ErrorEvent:k}=require_events();function l(t){return t[c]===h.OPEN}function m(t){return t[c]===h.CLOSING}function n(t){return t[c]===h.CLOSED}function o(t,u,v=Event,w){const x=new v(t,w);u.dispatchEvent(x)}function p(t,u,v){if(t[c]!==h.OPEN)return;let w;if(u===i.TEXT)try{w=new TextDecoder("utf-8",{fatal:!0}).decode(v)}catch{s(t,"Received invalid UTF-8 in text frame.");return}else if(u===i.BINARY)if(t[f]==="blob")w=new Blob([v]);else w=new Uint8Array(v).buffer;o("message",t,j,{origin:t[g].origin,data:w})}function q(t){if(t.length===0)return!1;for(const u of t){const v=u.charCodeAt(0);if(v<33||v>126||u==="("||u===")"||u==="<"||u===">"||u==="@"||u===","||u===";"||u===":"||u==="\\"||u==="\""||u==="/"||u==="["||u==="]"||u==="?"||u==="="||u==="{"||u==="}"||v===32||v===9)return!1}return!0}function r(t){if(t>=1e3&&t<1015)return t!==1004&&t!==1005&&t!==1006;return t>=3e3&&t<=4999}function s(t,u){const {[d]:v,[e]:w}=t;v.abort();if(w?.socket&&!w.socket.destroyed)w.socket.destroy();if(u)o("error",t,k,{error:new Error(u)})}b.exports={isEstablished:l,isClosing:m,isClosed:n,fireEvent:o,isValidSubprotocol:q,isValidStatusCode:r,failWebsocketConnection:s,websocketMessageReceived:p}}),require_connection=__commonJSMin((exports,b)=>{const c=__require("diagnostics_channel"),{uid:d,states:e}=require_constants(),{kReadyState:f,kSentClose:g,kByteParser:h,kReceivedClose:i}=require_symbols(),{fireEvent:j,failWebsocketConnection:k}=require_util(),{CloseEvent:l}=require_events(),{makeRequest:m}=require_request(),{fetching:n}=require_fetch(),{Headers:o}=require_headers(),{getGlobalDispatcher:p}=require_global(),{kHeadersList:q}=require_symbols$4(),r={};r.open=c.channel("undici:websocket:open");r.close=c.channel("undici:websocket:close");r.socketError=c.channel("undici:websocket:socket_error");let s;try{s=__require("crypto")}catch{}function t(x,y,z,A,B){const C=x;C.protocol=x.protocol==="ws:"?"http:":"https:";const D=m({urlList:[C],serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(B.headers){const H=new o(B.headers)[q];D.headersList=H}const E=s.randomBytes(16).toString("base64");D.headersList.append("sec-websocket-key",E);D.headersList.append("sec-websocket-version","13");for(const H of y)D.headersList.append("sec-websocket-protocol",H);const F="",G=n({request:D,useParallelQueue:!0,dispatcher:B.dispatcher??p(),processResponse(H){if(H.type==="error"||H.status!==101){k(z,"Received network error or non-101 status code.");return}if(y.length!==0&&!H.headersList.get("Sec-WebSocket-Protocol")){k(z,"Server did not respond with sent protocols.");return}if(H.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){k(z,"Server did not set Upgrade header to \"websocket\".");return}if(H.headersList.get("Connection")?.toLowerCase()!=="upgrade"){k(z,"Server did not set Connection header to \"upgrade\".");return}const I=H.headersList.get("Sec-WebSocket-Accept"),J=s.createHash("sha1").update(E+d).digest("base64");if(I!==J){k(z,"Incorrect hash received in Sec-WebSocket-Accept header.");return}const K=H.headersList.get("Sec-WebSocket-Extensions");if(K!==null&&K!==F){k(z,"Received different permessage-deflate than the one set.");return}const Bd=H.headersList.get("Sec-WebSocket-Protocol");if(Bd!==null&&Bd!==D.headersList.get("Sec-WebSocket-Protocol")){k(z,"Protocol was not set in the opening handshake.");return}H.socket.on("data",u);H.socket.on("close",v);H.socket.on("error",w);if(r.open.hasSubscribers)r.open.publish({address:H.socket.address(),protocol:Bd,extensions:K});A(H)}});return G}function u(x){if(!this.ws[h].write(x))this.pause()}function v(){const {ws:x}=this,y=x[g]&&x[i];let z=1005,A="";const B=x[h].closingInfo;if(B)z=B.code??1005,A=B.reason;else if(!x[g])z=1006;x[f]=e.CLOSED;j("close",x,l,{wasClean:y,code:z,reason:A});if(r.close.hasSubscribers)r.close.publish({websocket:x,code:z,reason:A})}function w(x){const {ws:y}=this;y[f]=e.CLOSING;if(r.socketError.hasSubscribers)r.socketError.publish(x);this.destroy()}b.exports={establishWebSocketConnection:t}}),require_frame=__commonJSMin((exports,b)=>{const {maxUnsigned16Bit:c}=require_constants();let d;try{d=__require("crypto")}catch{}var e=class{constructor(f){this.frameData=f,this.maskKey=d.randomBytes(4)}createFrame(f){const g=this.frameData?.byteLength??0;let h=g,i=6;if(g>c)i+=8,h=127;else if(g>125)i+=2,h=126;const j=Buffer.allocUnsafe(g+i);j[0]=j[1]=0;j[0]|=128;j[0]=(j[0]&240)+f;j[i-4]=this.maskKey[0];j[i-3]=this.maskKey[1];j[i-2]=this.maskKey[2];j[i-1]=this.maskKey[3];j[1]=h;if(h===126)j.writeUInt16BE(g,2);else if(h===127)j[2]=j[3]=0,j.writeUIntBE(g,4,6);j[1]|=128;for(let k=0;k{const {Writable:c}=__require("stream"),d=__require("diagnostics_channel"),{parserStates:e,opcodes:f,states:g,emptyBuffer:h}=require_constants(),{kReadyState:i,kSentClose:j,kResponse:k,kReceivedClose:l}=require_symbols(),{isValidStatusCode:m,failWebsocketConnection:n,websocketMessageReceived:o}=require_util(),{WebsocketFrameSend:p}=require_frame(),q={};q.ping=d.channel("undici:websocket:ping");q.pong=d.channel("undici:websocket:pong");var r=class extends c{#buffers=[];#byteOffset=0;#state=e.INFO;#info={};#fragments=[];constructor(s){super(),this.ws=s}_write(s,t,u){this.#buffers.push(s),this.#byteOffset+=s.length,this.run(u)}run(s){while(!0){if(this.#state===e.INFO){if(this.#byteOffset<2)return s();const t=this.consume(2);this.#info.fin=(t[0]&128)!==0;this.#info.opcode=t[0]&15;this.#info.originalOpcode??=this.#info.opcode;this.#info.fragmented=!this.#info.fin&&this.#info.opcode!==f.CONTINUATION;if(this.#info.fragmented&&this.#info.opcode!==f.BINARY&&this.#info.opcode!==f.TEXT){n(this.ws,"Invalid frame type was fragmented.");return}const u=t[1]&127;if(u<=125)this.#info.payloadLength=u,this.#state=e.READ_DATA;else if(u===126)this.#state=e.PAYLOADLENGTH_16;else if(u===127)this.#state=e.PAYLOADLENGTH_64;if(this.#info.fragmented&&u>125){n(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#info.opcode===f.PING||this.#info.opcode===f.PONG||this.#info.opcode===f.CLOSE)&&u>125){n(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#info.opcode===f.CLOSE){if(u===1){n(this.ws,"Received close frame with a 1-byte body.");return}const v=this.consume(u);this.#info.closeInfo=this.parseCloseBody(!1,v);if(!this.ws[j]){const w=Buffer.allocUnsafe(2);w.writeUInt16BE(this.#info.closeInfo.code,0);const x=new p(w);this.ws[k].socket.write(x.createFrame(f.CLOSE),(y)=>{if(!y)this.ws[j]=!0})}this.ws[i]=g.CLOSING;this.ws[l]=!0;this.end();return}else if(this.#info.opcode===f.PING){const v=this.consume(u);if(!this.ws[l]){const w=new p(v);this.ws[k].socket.write(w.createFrame(f.PONG));if(q.ping.hasSubscribers)q.ping.publish({payload:v})}this.#state=e.INFO;if(this.#byteOffset>0)continue;else{s();return}}else if(this.#info.opcode===f.PONG){const v=this.consume(u);if(q.pong.hasSubscribers)q.pong.publish({payload:v});if(this.#byteOffset>0)continue;else{s();return}}}else if(this.#state===e.PAYLOADLENGTH_16){if(this.#byteOffset<2)return s();const t=this.consume(2);this.#info.payloadLength=t.readUInt16BE(0);this.#state=e.READ_DATA}else if(this.#state===e.PAYLOADLENGTH_64){if(this.#byteOffset<8)return s();const t=this.consume(8),u=t.readUInt32BE(0);if(u>2147483647){n(this.ws,"Received payload length > 2^31 bytes.");return}const v=t.readUInt32BE(4);this.#info.payloadLength=(u<<8)+v;this.#state=e.READ_DATA}else if(this.#state===e.READ_DATA){if(this.#byteOffset=this.#info.payloadLength){const t=this.consume(this.#info.payloadLength);this.#fragments.push(t);if(!this.#info.fragmented||this.#info.fin&&this.#info.opcode===f.CONTINUATION){const u=Buffer.concat(this.#fragments);o(this.ws,this.#info.originalOpcode,u);this.#info={};this.#fragments.length=0}this.#state=e.INFO}}if(this.#byteOffset>0)continue;else{s();break}}}consume(s){if(s>this.#byteOffset)return null;else if(s===0)return h;if(this.#buffers[0].length===s)return this.#byteOffset-=this.#buffers[0].length,this.#buffers.shift();const t=Buffer.allocUnsafe(s);let u=0;while(u!==s){const v=this.#buffers[0],{length:w}=v;if(w+u===s){t.set(this.#buffers.shift(),u);break}else if(w+u>s){t.set(v.subarray(0,s-u),u);this.#buffers[0]=v.subarray(s-u);break}else t.set(this.#buffers.shift(),u),u+=v.length}this.#byteOffset-=s;return t}parseCloseBody(s,t){let u;if(t.length>=2)u=t.readUInt16BE(0);if(s){if(!m(u))return null;return{code:u}}let v=t.subarray(2);if(v[0]===239&&v[1]===187&&v[2]===191)v=v.subarray(3);if(u!==void 0&&!m(u))return null;try{v=new TextDecoder("utf-8",{fatal:!0}).decode(v)}catch{return null}return{code:u,reason:v}}get closingInfo(){return this.#info.closeInfo}};b.exports={ByteParser:r}}),require_websocket=__commonJSMin((exports,b)=>{const {webidl:c}=require_webidl(),{DOMException:d}=require_constants$3(),{URLSerializer:e}=require_dataURL(),{getGlobalOrigin:f}=require_global$1(),{staticPropertyDescriptors:g,states:h,opcodes:i,emptyBuffer:j}=require_constants(),{kWebSocketURL:k,kReadyState:l,kController:m,kBinaryType:n,kResponse:o,kSentClose:p,kByteParser:q}=require_symbols(),{isEstablished:r,isClosing:s,isValidSubprotocol:t,failWebsocketConnection:u,fireEvent:v}=require_util(),{establishWebSocketConnection:w}=require_connection(),{WebsocketFrameSend:x}=require_frame(),{ByteParser:y}=require_receiver(),{kEnumerableProperty:z,isBlobLike:A}=require_util$6(),{getGlobalDispatcher:B}=require_global(),{types:C}=__require("util");let D=!1;var E=class F extends EventTarget{#events={open:null,error:null,close:null,message:null};#bufferedAmount=0;#protocol="";#extensions="";constructor(G,H=[]){super();c.argumentLengthCheck(arguments,1,{header:"WebSocket constructor"});if(!D)D=!0,process.emitWarning("WebSockets are experimental, expect them to change at any time.",{code:"UNDICI-WS"});const I=c.converters["DOMString or sequence or WebSocketInit"](H);G=c.converters.USVString(G);H=I.protocols;const J=f();let K;try{K=new URL(G,J)}catch(Bd){throw new d(Bd,"SyntaxError")}if(K.protocol==="http:")K.protocol="ws:";else if(K.protocol==="https:")K.protocol="wss:";if(K.protocol!=="ws:"&&K.protocol!=="wss:")throw new d(`Expected a ws: or wss: protocol, got ${K.protocol}`,"SyntaxError");if(K.hash||K.href.endsWith("#"))throw new d("Got fragment","SyntaxError");if(typeof H==="string")H=[H];if(H.length!==new Set(H.map((Bd)=>Bd.toLowerCase())).size)throw new d("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(H.length>0&&!H.every((Bd)=>t(Bd)))throw new d("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[k]=new URL(K.href);this[m]=w(K,H,this,(Bd)=>this.#onConnectionEstablished(Bd),I);this[l]=F.CONNECTING;this[n]="blob"}close(G=void 0,H=void 0){c.brandCheck(this,F);if(G!==void 0)G=c.converters["unsigned short"](G,{clamp:!0});if(H!==void 0)H=c.converters.USVString(H);if(G!==void 0){if(G!==1e3&&(G<3e3||G>4999))throw new d("invalid code","InvalidAccessError")}let I=0;if(H!==void 0){if(I=Buffer.byteLength(H),I>123)throw new d(`Reason must be less than 123 bytes; received ${I}`,"SyntaxError")}if(this[l]===F.CLOSING||this[l]===F.CLOSED){}else if(!r(this))u(this,"Connection was closed before it was established."),this[l]=F.CLOSING;else if(!s(this)){const J=new x();if(G!==void 0&&H===void 0)J.frameData=Buffer.allocUnsafe(2),J.frameData.writeUInt16BE(G,0);else if(G!==void 0&&H!==void 0)J.frameData=Buffer.allocUnsafe(2+I),J.frameData.writeUInt16BE(G,0),J.frameData.write(H,2,"utf-8");else J.frameData=j;const K=this[o].socket;K.write(J.createFrame(i.CLOSE),(Bd)=>{if(!Bd)this[p]=!0});this[l]=h.CLOSING}else this[l]=F.CLOSING}send(G){c.brandCheck(this,F);c.argumentLengthCheck(arguments,1,{header:"WebSocket.send"});G=c.converters.WebSocketSendData(G);if(this[l]===F.CONNECTING)throw new d("Sent before connected.","InvalidStateError");if(!r(this)||s(this))return;const H=this[o].socket;if(typeof G==="string"){const I=Buffer.from(G),J=new x(I),K=J.createFrame(i.TEXT);this.#bufferedAmount+=I.byteLength;H.write(K,()=>{this.#bufferedAmount-=I.byteLength})}else if(C.isArrayBuffer(G)){const I=Buffer.from(G),J=new x(I),K=J.createFrame(i.BINARY);this.#bufferedAmount+=I.byteLength;H.write(K,()=>{this.#bufferedAmount-=I.byteLength})}else if(ArrayBuffer.isView(G)){const I=Buffer.from(G,G.byteOffset,G.byteLength),J=new x(I),K=J.createFrame(i.BINARY);this.#bufferedAmount+=I.byteLength;H.write(K,()=>{this.#bufferedAmount-=I.byteLength})}else if(A(G)){const I=new x();G.arrayBuffer().then((J)=>{const K=Buffer.from(J);I.frameData=K;const Bd=I.createFrame(i.BINARY);this.#bufferedAmount+=K.byteLength;H.write(Bd,()=>{this.#bufferedAmount-=K.byteLength})})}}get readyState(){return c.brandCheck(this,F),this[l]}get bufferedAmount(){return c.brandCheck(this,F),this.#bufferedAmount}get url(){return c.brandCheck(this,F),e(this[k])}get extensions(){return c.brandCheck(this,F),this.#extensions}get protocol(){return c.brandCheck(this,F),this.#protocol}get onopen(){return c.brandCheck(this,F),this.#events.open}set onopen(G){c.brandCheck(this,F);if(this.#events.open)this.removeEventListener("open",this.#events.open);if(typeof G==="function")this.#events.open=G,this.addEventListener("open",G);else this.#events.open=null}get onerror(){return c.brandCheck(this,F),this.#events.error}set onerror(G){c.brandCheck(this,F);if(this.#events.error)this.removeEventListener("error",this.#events.error);if(typeof G==="function")this.#events.error=G,this.addEventListener("error",G);else this.#events.error=null}get onclose(){return c.brandCheck(this,F),this.#events.close}set onclose(G){c.brandCheck(this,F);if(this.#events.close)this.removeEventListener("close",this.#events.close);if(typeof G==="function")this.#events.close=G,this.addEventListener("close",G);else this.#events.close=null}get onmessage(){return c.brandCheck(this,F),this.#events.message}set onmessage(G){c.brandCheck(this,F);if(this.#events.message)this.removeEventListener("message",this.#events.message);if(typeof G==="function")this.#events.message=G,this.addEventListener("message",G);else this.#events.message=null}get binaryType(){return c.brandCheck(this,F),this[n]}set binaryType(G){if(c.brandCheck(this,F),G!=="blob"&&G!=="arraybuffer")this[n]="blob";else this[n]=G}#onConnectionEstablished(G){this[o]=G;const H=new y(this);H.on("drain",function K(){this.ws[o].socket.resume()});G.socket.ws=this;this[q]=H;this[l]=h.OPEN;const I=G.headersList.get("sec-websocket-extensions");if(I!==null)this.#extensions=I;const J=G.headersList.get("sec-websocket-protocol");if(J!==null)this.#protocol=J;v("open",this)}};E.CONNECTING=E.prototype.CONNECTING=h.CONNECTING;E.OPEN=E.prototype.OPEN=h.OPEN;E.CLOSING=E.prototype.CLOSING=h.CLOSING;E.CLOSED=E.prototype.CLOSED=h.CLOSED;Object.defineProperties(E.prototype,{CONNECTING:g,OPEN:g,CLOSING:g,CLOSED:g,url:z,readyState:z,bufferedAmount:z,onopen:z,onerror:z,onclose:z,close:z,onmessage:z,binaryType:z,send:z,extensions:z,protocol:z,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(E,{CONNECTING:g,OPEN:g,CLOSING:g,CLOSED:g});c.converters["sequence"]=c.sequenceConverter(c.converters.DOMString);c.converters["DOMString or sequence"]=function(F){if(c.util.Type(F)==="Object"&&Symbol.iterator in F)return c.converters["sequence"](F);return c.converters.DOMString(F)};c.converters.WebSocketInit=c.dictionaryConverter([{key:"protocols",converter:c.converters["DOMString or sequence"],get defaultValue(){return[]}},{key:"dispatcher",converter:(F)=>F,get defaultValue(){return B()}},{key:"headers",converter:c.nullableConverter(c.converters.HeadersInit)}]);c.converters["DOMString or sequence or WebSocketInit"]=function(F){if(c.util.Type(F)==="Object"&&!(Symbol.iterator in F))return c.converters.WebSocketInit(F);return{protocols:c.converters["DOMString or sequence"](F)}};c.converters.WebSocketSendData=function(F){if(c.util.Type(F)==="Object"){if(A(F))return c.converters.Blob(F,{strict:!1});if(ArrayBuffer.isView(F)||C.isAnyArrayBuffer(F))return c.converters.BufferSource(F)}return c.converters.USVString(F)};b.exports={WebSocket:E}}),require_undici=__commonJSMin((exports,b)=>{const c=require_client(),d=require_dispatcher(),e=require_errors(),f=require_pool(),g=require_balanced_pool(),h=require_agent(),i=require_util$6(),{InvalidArgumentError:j}=e,k=require_api(),l=require_connect(),m=require_mock_client(),n=require_mock_agent(),o=require_mock_pool(),p=require_mock_errors(),q=require_proxy_agent(),r=require_RetryHandler(),{getGlobalDispatcher:s,setGlobalDispatcher:t}=require_global(),u=require_DecoratorHandler(),v=require_RedirectHandler(),w=require_redirectInterceptor();let x;try{__require("crypto"),x=!0}catch{x=!1}Object.assign(d.prototype,k);b.exports.Dispatcher=d;b.exports.Client=c;b.exports.Pool=f;b.exports.BalancedPool=g;b.exports.Agent=h;b.exports.ProxyAgent=q;b.exports.RetryHandler=r;b.exports.DecoratorHandler=u;b.exports.RedirectHandler=v;b.exports.createRedirectInterceptor=w;b.exports.buildConnector=l;b.exports.errors=e;function y(z){return(A,B,C)=>{if(typeof B==="function")C=B,B=null;if(!A||typeof A!=="string"&&typeof A!=="object"&&!(A instanceof URL))throw new j("invalid url");if(B!=null&&typeof B!=="object")throw new j("invalid opts");if(B&&B.path!=null){if(typeof B.path!=="string")throw new j("invalid opts.path");let F=B.path;if(!B.path.startsWith("/"))F=`/${F}`;A=new URL(i.parseOrigin(A).origin+F)}else{if(!B)B=typeof A==="object"?A:{};A=i.parseURL(A)}const {agent:D,dispatcher:E=s()}=B;if(D)throw new j("unsupported opts.agent. Did you mean opts.client?");return z.call(E,{...B,origin:A.origin,path:A.search?`${A.pathname}${A.search}`:A.pathname,method:B.method||(B.body?"PUT":"GET")},C)}}b.exports.setGlobalDispatcher=t;b.exports.getGlobalDispatcher=s;if(i.nodeMajor>16||i.nodeMajor===16&&i.nodeMinor>=8){let z=null;b.exports.fetch=async function E(F){if(!z)z=require_fetch().fetch;try{return await z(...arguments)}catch(G){if(typeof G==="object")Error.captureStackTrace(G,this);throw G}};b.exports.Headers=require_headers().Headers;b.exports.Response=require_response().Response;b.exports.Request=require_request().Request;b.exports.FormData=require_formdata().FormData;b.exports.File=require_file().File;b.exports.FileReader=require_filereader().FileReader;const {setGlobalOrigin:A,getGlobalOrigin:B}=require_global$1();b.exports.setGlobalOrigin=A;b.exports.getGlobalOrigin=B;const {CacheStorage:C}=require_cachestorage(),{kConstruct:D}=require_symbols$1();b.exports.caches=new C(D)}if(i.nodeMajor>=16){const {deleteCookie:z,getCookies:A,getSetCookies:B,setCookie:C}=require_cookies();b.exports.deleteCookie=z;b.exports.getCookies=A;b.exports.getSetCookies=B;b.exports.setCookie=C;const {parseMIMEType:D,serializeAMimeType:E}=require_dataURL();b.exports.parseMIMEType=D;b.exports.serializeAMimeType=E}if(i.nodeMajor>=18&&x){const {WebSocket:z}=require_websocket();b.exports.WebSocket=z}b.exports.request=y(k.request);b.exports.stream=y(k.stream);b.exports.pipeline=y(k.pipeline);b.exports.connect=y(k.connect);b.exports.upgrade=y(k.upgrade);b.exports.MockClient=m;b.exports.MockPool=o;b.exports.MockAgent=n;b.exports.mockErrors=p}),require_lib=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(y,z,A,B){if(B===void 0)B=A;var C=Object.getOwnPropertyDescriptor(z,A);if(!C||("get"in C?!z.__esModule:C.writable||C.configurable))C={enumerable:!0,get:function(){return z[A]}};Object.defineProperty(y,B,C)}:function(y,z,A,B){if(B===void 0)B=A;y[B]=z[A]}),c=exports&&exports.__setModuleDefault||(Object.create?function(y,z){Object.defineProperty(y,"default",{enumerable:!0,value:z})}:function(y,z){y["default"]=z}),d=exports&&exports.__importStar||function(y){if(y&&y.__esModule)return y;var z={};if(y!=null){for(var A in y)if(A!=="default"&&Object.prototype.hasOwnProperty.call(y,A))b(z,y,A)}c(z,y);return z},e=exports&&exports.__awaiter||function(y,z,A,B){function C(D){return D instanceof A?D:new A(function(E){E(D)})}return new (A||(A=Promise))(function(D,E){function F(I){try{H(B.next(I))}catch(J){E(J)}}function G(I){try{H(B["throw"](I))}catch(J){E(J)}}function H(I){I.done?D(I.value):C(I.value).then(F,G)}H((B=B.apply(y,z||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.HttpClient=exports.isHttps=exports.HttpClientResponse=exports.HttpClientError=exports.getProxyUrl=exports.MediaTypes=exports.Headers=exports.HttpCodes=void 0;const f=d(__require("http")),g=d(__require("https")),h=d(require_proxy()),i=d(require_tunnel()),j=require_undici();var k;(function(y){y[y["OK"]=200]="OK",y[y["MultipleChoices"]=300]="MultipleChoices",y[y["MovedPermanently"]=301]="MovedPermanently",y[y["ResourceMoved"]=302]="ResourceMoved",y[y["SeeOther"]=303]="SeeOther",y[y["NotModified"]=304]="NotModified",y[y["UseProxy"]=305]="UseProxy",y[y["SwitchProxy"]=306]="SwitchProxy",y[y["TemporaryRedirect"]=307]="TemporaryRedirect",y[y["PermanentRedirect"]=308]="PermanentRedirect",y[y["BadRequest"]=400]="BadRequest",y[y["Unauthorized"]=401]="Unauthorized",y[y["PaymentRequired"]=402]="PaymentRequired",y[y["Forbidden"]=403]="Forbidden",y[y["NotFound"]=404]="NotFound",y[y["MethodNotAllowed"]=405]="MethodNotAllowed",y[y["NotAcceptable"]=406]="NotAcceptable",y[y["ProxyAuthenticationRequired"]=407]="ProxyAuthenticationRequired",y[y["RequestTimeout"]=408]="RequestTimeout",y[y["Conflict"]=409]="Conflict",y[y["Gone"]=410]="Gone",y[y["TooManyRequests"]=429]="TooManyRequests",y[y["InternalServerError"]=500]="InternalServerError",y[y["NotImplemented"]=501]="NotImplemented",y[y["BadGateway"]=502]="BadGateway",y[y["ServiceUnavailable"]=503]="ServiceUnavailable",y[y["GatewayTimeout"]=504]="GatewayTimeout"})(k||(exports.HttpCodes=k={}));var l;(function(y){y["Accept"]="accept",y["ContentType"]="content-type"})(l||(exports.Headers=l={}));var m;(function(y){y["ApplicationJson"]="application/json"})(m||(exports.MediaTypes=m={}));function n(y){const z=h.getProxyUrl(new URL(y));return z?z.href:""}exports.getProxyUrl=n;const o=[k.MovedPermanently,k.ResourceMoved,k.SeeOther,k.TemporaryRedirect,k.PermanentRedirect],p=[k.BadGateway,k.ServiceUnavailable,k.GatewayTimeout],q=["OPTIONS","GET","DELETE","HEAD"],r=10,s=5;var t=class y extends Error{constructor(z,A){super(z),this.name="HttpClientError",this.statusCode=A,Object.setPrototypeOf(this,y.prototype)}};exports.HttpClientError=t;var u=class{constructor(y){this.message=y}readBody(){return e(this,void 0,void 0,function*(){return new Promise((y)=>e(this,void 0,void 0,function*(){let z=Buffer.alloc(0);this.message.on("data",(A)=>{z=Buffer.concat([z,A])});this.message.on("end",()=>{y(z.toString())})}))})}readBodyBuffer(){return e(this,void 0,void 0,function*(){return new Promise((y)=>e(this,void 0,void 0,function*(){const z=[];this.message.on("data",(A)=>{z.push(A)});this.message.on("end",()=>{y(Buffer.concat(z))})}))})}};exports.HttpClientResponse=u;function v(y){const z=new URL(y);return z.protocol==="https:"}exports.isHttps=v;var w=class{constructor(y,z,A){if(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=y,this.handlers=z||[],this.requestOptions=A,A){if(A.ignoreSslError!=null)this._ignoreSslError=A.ignoreSslError;this._socketTimeout=A.socketTimeout;if(A.allowRedirects!=null)this._allowRedirects=A.allowRedirects;if(A.allowRedirectDowngrade!=null)this._allowRedirectDowngrade=A.allowRedirectDowngrade;if(A.maxRedirects!=null)this._maxRedirects=Math.max(A.maxRedirects,0);if(A.keepAlive!=null)this._keepAlive=A.keepAlive;if(A.allowRetries!=null)this._allowRetries=A.allowRetries;if(A.maxRetries!=null)this._maxRetries=A.maxRetries}}options(y,z){return e(this,void 0,void 0,function*(){return this.request("OPTIONS",y,null,z||{})})}get(y,z){return e(this,void 0,void 0,function*(){return this.request("GET",y,null,z||{})})}del(y,z){return e(this,void 0,void 0,function*(){return this.request("DELETE",y,null,z||{})})}post(y,z,A){return e(this,void 0,void 0,function*(){return this.request("POST",y,z,A||{})})}patch(y,z,A){return e(this,void 0,void 0,function*(){return this.request("PATCH",y,z,A||{})})}put(y,z,A){return e(this,void 0,void 0,function*(){return this.request("PUT",y,z,A||{})})}head(y,z){return e(this,void 0,void 0,function*(){return this.request("HEAD",y,null,z||{})})}sendStream(y,z,A,B){return e(this,void 0,void 0,function*(){return this.request(y,z,A,B)})}getJson(y,z={}){return e(this,void 0,void 0,function*(){z[l.Accept]=this._getExistingOrDefaultHeader(z,l.Accept,m.ApplicationJson);const A=yield this.get(y,z);return this._processResponse(A,this.requestOptions)})}postJson(y,z,A={}){return e(this,void 0,void 0,function*(){const B=JSON.stringify(z,null,2);A[l.Accept]=this._getExistingOrDefaultHeader(A,l.Accept,m.ApplicationJson);A[l.ContentType]=this._getExistingOrDefaultHeader(A,l.ContentType,m.ApplicationJson);const C=yield this.post(y,B,A);return this._processResponse(C,this.requestOptions)})}putJson(y,z,A={}){return e(this,void 0,void 0,function*(){const B=JSON.stringify(z,null,2);A[l.Accept]=this._getExistingOrDefaultHeader(A,l.Accept,m.ApplicationJson);A[l.ContentType]=this._getExistingOrDefaultHeader(A,l.ContentType,m.ApplicationJson);const C=yield this.put(y,B,A);return this._processResponse(C,this.requestOptions)})}patchJson(y,z,A={}){return e(this,void 0,void 0,function*(){const B=JSON.stringify(z,null,2);A[l.Accept]=this._getExistingOrDefaultHeader(A,l.Accept,m.ApplicationJson);A[l.ContentType]=this._getExistingOrDefaultHeader(A,l.ContentType,m.ApplicationJson);const C=yield this.patch(y,B,A);return this._processResponse(C,this.requestOptions)})}request(y,z,A,B){return e(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");const C=new URL(z);let D=this._prepareRequest(y,C,B);const E=this._allowRetries&&q.includes(y)?this._maxRetries+1:1;let F=0,G;do {G=yield this.requestRaw(D,A);if(G&&G.message&&G.message.statusCode===k.Unauthorized){let I;for(const J of this.handlers)if(J.canHandleAuthentication(G)){I=J;break}if(I)return I.handleAuthentication(this,D,A);else return G}let H=this._maxRedirects;while(G.message.statusCode&&o.includes(G.message.statusCode)&&this._allowRedirects&&H>0){const I=G.message.headers["location"];if(!I)break;const J=new URL(I);if(C.protocol==="https:"&&C.protocol!==J.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.");yield G.readBody();if(J.hostname!==C.hostname){for(const K in B)if(K.toLowerCase()==="authorization")delete B[K]}D=this._prepareRequest(y,J,B);G=yield this.requestRaw(D,A);H--}if(!G.message.statusCode||!p.includes(G.message.statusCode))return G;F+=1;if(F{function C(D,E){if(D)B(D);else if(!E)B(new Error("Unknown error"));else A(E)}this.requestRawWithCallback(y,z,C)})})}requestRawWithCallback(y,z,A){if(typeof z==="string"){if(!y.options.headers)y.options.headers={};y.options.headers["Content-Length"]=Buffer.byteLength(z,"utf8")}let B=!1;function C(F,G){if(!B)B=!0,A(F,G)}const D=y.httpModule.request(y.options,(F)=>{const G=new u(F);C(void 0,G)});let E;D.on("socket",(F)=>{E=F});D.setTimeout(this._socketTimeout||18e4,()=>{if(E)E.end();C(new Error(`Request timeout: ${y.options.path}`))});D.on("error",function(F){C(F)});if(z&&typeof z==="string")D.write(z,"utf8");if(z&&typeof z!=="string")z.on("close",function(){D.end()}),z.pipe(D);else D.end()}getAgent(y){const z=new URL(y);return this._getAgent(z)}getAgentDispatcher(y){const z=new URL(y),A=h.getProxyUrl(z),B=A&&A.hostname;if(!B)return;return this._getProxyAgentDispatcher(z,A)}_prepareRequest(y,z,A){const B={};B.parsedUrl=z;const C=B.parsedUrl.protocol==="https:";B.httpModule=C?g:f;const D=C?443:80;B.options={};B.options.host=B.parsedUrl.hostname;B.options.port=B.parsedUrl.port?parseInt(B.parsedUrl.port):D;B.options.path=(B.parsedUrl.pathname||"")+(B.parsedUrl.search||"");B.options.method=y;B.options.headers=this._mergeHeaders(A);if(this.userAgent!=null)B.options.headers["user-agent"]=this.userAgent;B.options.agent=this._getAgent(B.parsedUrl);if(this.handlers)for(const E of this.handlers)E.prepareRequest(B.options);return B}_mergeHeaders(y){if(this.requestOptions&&this.requestOptions.headers)return Object.assign({},x(this.requestOptions.headers),x(y||{}));return x(y||{})}_getExistingOrDefaultHeader(y,z,A){let B;if(this.requestOptions&&this.requestOptions.headers)B=x(this.requestOptions.headers)[z];return y[z]||B||A}_getAgent(y){let z;const A=h.getProxyUrl(y),B=A&&A.hostname;if(this._keepAlive&&B)z=this._proxyAgent;if(!B)z=this._agent;if(z)return z;const C=y.protocol==="https:";let D=100;if(this.requestOptions)D=this.requestOptions.maxSockets||f.globalAgent.maxSockets;if(A&&A.hostname){const E={maxSockets:D,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(A.username||A.password)&&{proxyAuth:`${A.username}:${A.password}`}),{host:A.hostname,port:A.port})};let F;const G=A.protocol==="https:";if(C)F=G?i.httpsOverHttps:i.httpsOverHttp;else F=G?i.httpOverHttps:i.httpOverHttp;z=F(E);this._proxyAgent=z}if(!z){const E={keepAlive:this._keepAlive,maxSockets:D};z=C?new g.Agent(E):new f.Agent(E);this._agent=z}if(C&&this._ignoreSslError)z.options=Object.assign(z.options||{},{rejectUnauthorized:!1});return z}_getProxyAgentDispatcher(y,z){let A;if(this._keepAlive)A=this._proxyAgentDispatcher;if(A)return A;const B=y.protocol==="https:";A=new j.ProxyAgent(Object.assign({uri:z.href,pipelining:!this._keepAlive?0:1},(z.username||z.password)&&{token:`Basic ${Buffer.from(`${z.username}:${z.password}`).toString("base64")}`}));this._proxyAgentDispatcher=A;if(B&&this._ignoreSslError)A.options=Object.assign(A.options.requestTls||{},{rejectUnauthorized:!1});return A}_performExponentialBackoff(y){return e(this,void 0,void 0,function*(){y=Math.min(r,y);const z=s*Math.pow(2,y);return new Promise((A)=>setTimeout(()=>A(),z))})}_processResponse(y,z){return e(this,void 0,void 0,function*(){return new Promise((A,B)=>e(this,void 0,void 0,function*(){const C=y.message.statusCode||0,D={statusCode:C,result:null,headers:{}};if(C===k.NotFound)A(D);function E(H,I){if(typeof I==="string"){const J=new Date(I);if(!isNaN(J.valueOf()))return J}return I}let F,G;try{G=yield y.readBody();if(G&&G.length>0){if(z&&z.deserializeDates)F=JSON.parse(G,E);else F=JSON.parse(G);D.result=F}D.headers=y.message.headers}catch(H){}if(C>299){let H;if(F&&F.message)H=F.message;else if(G&&G.length>0)H=G;else H=`Failed request: (${C})`;const I=new t(H,C);I.result=D.result;B(I)}else A(D)}))})}};exports.HttpClient=w;const x=(y)=>Object.keys(y).reduce((z,A)=>(z[A.toLowerCase()]=y[A],z),{})}),require_auth=__commonJSMin((exports)=>{var b=exports&&exports.__awaiter||function(f,g,h,i){function j(k){return k instanceof h?k:new h(function(l){l(k)})}return new (h||(h=Promise))(function(k,l){function m(p){try{o(i.next(p))}catch(q){l(q)}}function n(p){try{o(i["throw"](p))}catch(q){l(q)}}function o(p){p.done?k(p.value):j(p.value).then(m,n)}o((i=i.apply(f,g||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.PersonalAccessTokenCredentialHandler=exports.BearerCredentialHandler=exports.BasicCredentialHandler=void 0;var c=class{constructor(f,g){this.username=f,this.password=g}prepareRequest(f){if(!f.headers)throw Error("The request has no headers");f.headers["Authorization"]=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return b(this,void 0,void 0,function*(){throw new Error("not implemented")})}};exports.BasicCredentialHandler=c;var d=class{constructor(f){this.token=f}prepareRequest(f){if(!f.headers)throw Error("The request has no headers");f.headers["Authorization"]=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return b(this,void 0,void 0,function*(){throw new Error("not implemented")})}};exports.BearerCredentialHandler=d;var e=class{constructor(f){this.token=f}prepareRequest(f){if(!f.headers)throw Error("The request has no headers");f.headers["Authorization"]=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return b(this,void 0,void 0,function*(){throw new Error("not implemented")})}};exports.PersonalAccessTokenCredentialHandler=e}),require_oidc_utils=__commonJSMin((exports)=>{var b=exports&&exports.__awaiter||function(g,h,i,j){function k(l){return l instanceof i?l:new i(function(m){m(l)})}return new (i||(i=Promise))(function(l,m){function n(q){try{p(j.next(q))}catch(r){m(r)}}function o(q){try{p(j["throw"](q))}catch(r){m(r)}}function p(q){q.done?l(q.value):k(q.value).then(n,o)}p((j=j.apply(g,h||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.OidcClient=void 0;const c=require_lib(),d=require_auth(),e=require_core();var f=class g{static createHttpClient(h=!0,i=10){const j={allowRetries:h,maxRetries:i};return new c.HttpClient("actions/oidc-client",[new d.BearerCredentialHandler(g.getRequestToken())],j)}static getRequestToken(){const h=process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];if(!h)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return h}static getIDTokenUrl(){const h=process.env["ACTIONS_ID_TOKEN_REQUEST_URL"];if(!h)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return h}static getCall(h){var i;return b(this,void 0,void 0,function*(){const j=g.createHttpClient(),k=yield j.getJson(h).catch((m)=>{throw new Error(`Failed to get ID Token. \n Error Code : ${m.statusCode}\n - Error Message: ${m.message}`)}),l=(i=k.result)===null||i===void 0?void 0:i.value;if(!l)throw new Error("Response json body do not have ID Token field");return l})}static getIDToken(h){return b(this,void 0,void 0,function*(){try{let i=g.getIDTokenUrl();if(h){const k=encodeURIComponent(h);i=`${i}&audience=${k}`}(0,e.debug)(`ID token url is ${i}`);const j=yield g.getCall(i);(0,e.setSecret)(j);return j}catch(i){throw new Error(`Error message: ${i.message}`)}})}};exports.OidcClient=f}),require_summary=__commonJSMin((exports)=>{var b=exports&&exports.__awaiter||function(j,k,l,m){function n(o){return o instanceof l?o:new l(function(p){p(o)})}return new (l||(l=Promise))(function(o,p){function q(t){try{s(m.next(t))}catch(u){p(u)}}function r(t){try{s(m["throw"](t))}catch(u){p(u)}}function s(t){t.done?o(t.value):n(t.value).then(q,r)}s((m=m.apply(j,k||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.summary=exports.markdownSummary=exports.SUMMARY_DOCS_URL=exports.SUMMARY_ENV_VAR=void 0;const c=__require("os"),d=__require("fs"),{access:e,appendFile:f,writeFile:g}=d.promises;exports.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";exports.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var h=class{constructor(){this._buffer=""}filePath(){return b(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const j=process.env[exports.SUMMARY_ENV_VAR];if(!j)throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield e(j,d.constants.R_OK|d.constants.W_OK)}catch(k){throw new Error(`Unable to access summary file: '${j}'. Check if the file has correct read/write permissions.`)}this._filePath=j;return this._filePath})}wrap(j,k,l={}){const m=Object.entries(l).map(([n,o])=>` ${n}="${o}"`).join("");if(!k)return`<${j}${m}>`;return`<${j}${m}>${k}`}write(j){return b(this,void 0,void 0,function*(){const k=!!(j===null||j===void 0?void 0:j.overwrite),l=yield this.filePath(),m=k?g:f;yield m(l,this._buffer,{encoding:"utf8"});return this.emptyBuffer()})}clear(){return b(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(j,k=!1){return this._buffer+=j,k?this.addEOL():this}addEOL(){return this.addRaw(c.EOL)}addCodeBlock(j,k){const l=Object.assign({},k&&{lang:k}),m=this.wrap("pre",this.wrap("code",j),l);return this.addRaw(m).addEOL()}addList(j,k=!1){const l=k?"ol":"ul",m=j.map((o)=>this.wrap("li",o)).join(""),n=this.wrap(l,m);return this.addRaw(n).addEOL()}addTable(j){const k=j.map((m)=>{const n=m.map((o)=>{if(typeof o==="string")return this.wrap("td",o);const {header:p,data:q,colspan:r,rowspan:s}=o,t=p?"th":"td",u=Object.assign(Object.assign({},r&&{colspan:r}),s&&{rowspan:s});return this.wrap(t,q,u)}).join("");return this.wrap("tr",n)}).join(""),l=this.wrap("table",k);return this.addRaw(l).addEOL()}addDetails(j,k){const l=this.wrap("details",this.wrap("summary",j)+k);return this.addRaw(l).addEOL()}addImage(j,k,l){const {width:m,height:n}=l||{},o=Object.assign(Object.assign({},m&&{width:m}),n&&{height:n}),p=this.wrap("img",null,Object.assign({src:j,alt:k},o));return this.addRaw(p).addEOL()}addHeading(j,k){const l=`h${k}`,m=["h1","h2","h3","h4","h5","h6"].includes(l)?l:"h1",n=this.wrap(m,j);return this.addRaw(n).addEOL()}addSeparator(){const j=this.wrap("hr",null);return this.addRaw(j).addEOL()}addBreak(){const j=this.wrap("br",null);return this.addRaw(j).addEOL()}addQuote(j,k){const l=Object.assign({},k&&{cite:k}),m=this.wrap("blockquote",j,l);return this.addRaw(m).addEOL()}addLink(j,k){const l=this.wrap("a",j,{href:k});return this.addRaw(l).addEOL()}};const i=new h();exports.markdownSummary=i;exports.summary=i}),require_path_utils=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(i,j,k,l){if(l===void 0)l=k;var m=Object.getOwnPropertyDescriptor(j,k);if(!m||("get"in m?!j.__esModule:m.writable||m.configurable))m={enumerable:!0,get:function(){return j[k]}};Object.defineProperty(i,l,m)}:function(i,j,k,l){if(l===void 0)l=k;i[l]=j[k]}),c=exports&&exports.__setModuleDefault||(Object.create?function(i,j){Object.defineProperty(i,"default",{enumerable:!0,value:j})}:function(i,j){i["default"]=j}),d=exports&&exports.__importStar||function(i){if(i&&i.__esModule)return i;var j={};if(i!=null){for(var k in i)if(k!=="default"&&Object.prototype.hasOwnProperty.call(i,k))b(j,i,k)}c(j,i);return j};Object.defineProperty(exports,"__esModule",{value:true});exports.toPlatformPath=exports.toWin32Path=exports.toPosixPath=void 0;const e=d(__require("path"));function f(i){return i.replace(/[\\]/g,"/")}exports.toPosixPath=f;function g(i){return i.replace(/[/]/g,"\\")}exports.toWin32Path=g;function h(i){return i.replace(/[/\\]/g,e.sep)}exports.toPlatformPath=h}),require_io_util=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(p,q,r,s){if(s===void 0)s=r;Object.defineProperty(p,s,{enumerable:!0,get:function(){return q[r]}})}:function(p,q,r,s){if(s===void 0)s=r;p[s]=q[r]}),c=exports&&exports.__setModuleDefault||(Object.create?function(p,q){Object.defineProperty(p,"default",{enumerable:!0,value:q})}:function(p,q){p["default"]=q}),d=exports&&exports.__importStar||function(p){if(p&&p.__esModule)return p;var q={};if(p!=null){for(var r in p)if(r!=="default"&&Object.hasOwnProperty.call(p,r))b(q,p,r)}c(q,p);return q},e=exports&&exports.__awaiter||function(p,q,r,s){function t(u){return u instanceof r?u:new r(function(v){v(u)})}return new (r||(r=Promise))(function(u,v){function w(z){try{y(s.next(z))}catch(A){v(A)}}function x(z){try{y(s["throw"](z))}catch(A){v(A)}}function y(z){z.done?u(z.value):t(z.value).then(w,x)}y((s=s.apply(p,q||[])).next())})},f;Object.defineProperty(exports,"__esModule",{value:true});exports.getCmdPath=exports.tryGetExecutablePath=exports.isRooted=exports.isDirectory=exports.exists=exports.READONLY=exports.UV_FS_O_EXLOCK=exports.IS_WINDOWS=exports.unlink=exports.symlink=exports.stat=exports.rmdir=exports.rm=exports.rename=exports.readlink=exports.readdir=exports.open=exports.mkdir=exports.lstat=exports.copyFile=exports.chmod=void 0;const g=d(__require("fs")),h=d(__require("path"));f=g.promises,exports.chmod=f.chmod,exports.copyFile=f.copyFile,exports.lstat=f.lstat,exports.mkdir=f.mkdir,exports.open=f.open,exports.readdir=f.readdir,exports.readlink=f.readlink,exports.rename=f.rename,exports.rm=f.rm,exports.rmdir=f.rmdir,exports.stat=f.stat,exports.symlink=f.symlink,exports.unlink=f.unlink;exports.IS_WINDOWS=process.platform==="win32";exports.UV_FS_O_EXLOCK=268435456;exports.READONLY=g.constants.O_RDONLY;function i(p){return e(this,void 0,void 0,function*(){try{yield exports.stat(p)}catch(q){if(q.code==="ENOENT")return!1;throw q}return!0})}exports.exists=i;function j(p,q=!1){return e(this,void 0,void 0,function*(){const r=q?yield exports.stat(p):yield exports.lstat(p);return r.isDirectory()})}exports.isDirectory=j;function k(p){p=m(p);if(!p)throw new Error("isRooted() parameter \"p\" cannot be empty");if(exports.IS_WINDOWS)return p.startsWith("\\")||/^[A-Z]:/i.test(p);return p.startsWith("/")}exports.isRooted=k;function l(p,q){return e(this,void 0,void 0,function*(){let r;try{r=yield exports.stat(p)}catch(t){if(t.code!=="ENOENT")console.log(`Unexpected error attempting to determine if executable file exists '${p}': ${t}`)}if(r&&r.isFile()){if(exports.IS_WINDOWS){const t=h.extname(p).toUpperCase();if(q.some((u)=>u.toUpperCase()===t))return p}else if(n(r))return p}const s=p;for(const t of q){p=s+t;r=void 0;try{r=yield exports.stat(p)}catch(u){if(u.code!=="ENOENT")console.log(`Unexpected error attempting to determine if executable file exists '${p}': ${u}`)}if(r&&r.isFile()){if(exports.IS_WINDOWS){try{const u=h.dirname(p),v=h.basename(p).toUpperCase();for(const w of yield exports.readdir(u))if(v===w.toUpperCase()){p=h.join(u,w);break}}catch(u){console.log(`Unexpected error attempting to determine the actual case of the file '${p}': ${u}`)}return p}else if(n(r))return p}}return""})}exports.tryGetExecutablePath=l;function m(p){p=p||"";if(exports.IS_WINDOWS)return p=p.replace(/\//g,"\\"),p.replace(/\\\\+/g,"\\");return p.replace(/\/\/+/g,"/")}function n(p){return(p.mode&1)>0||(p.mode&8)>0&&p.gid===process.getgid()||(p.mode&64)>0&&p.uid===process.getuid()}function o(){var p;return(p=process.env["COMSPEC"])!==null&&p!==void 0?p:"cmd.exe"}exports.getCmdPath=o}),require_io=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(r,s,t,u){if(u===void 0)u=t;Object.defineProperty(r,u,{enumerable:!0,get:function(){return s[t]}})}:function(r,s,t,u){if(u===void 0)u=t;r[u]=s[t]}),c=exports&&exports.__setModuleDefault||(Object.create?function(r,s){Object.defineProperty(r,"default",{enumerable:!0,value:s})}:function(r,s){r["default"]=s}),d=exports&&exports.__importStar||function(r){if(r&&r.__esModule)return r;var s={};if(r!=null){for(var t in r)if(t!=="default"&&Object.hasOwnProperty.call(r,t))b(s,r,t)}c(s,r);return s},e=exports&&exports.__awaiter||function(r,s,t,u){function v(w){return w instanceof t?w:new t(function(x){x(w)})}return new (t||(t=Promise))(function(w,x){function y(B){try{A(u.next(B))}catch(C){x(C)}}function z(B){try{A(u["throw"](B))}catch(C){x(C)}}function A(B){B.done?w(B.value):v(B.value).then(y,z)}A((u=u.apply(r,s||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.findInPath=exports.which=exports.mkdirP=exports.rmRF=exports.mv=exports.cp=void 0;const f=__require("assert"),g=d(__require("path")),h=d(require_io_util());function i(r,s,t={}){return e(this,void 0,void 0,function*(){const {force:u,recursive:v,copySourceDirectory:w}=o(t),x=(yield h.exists(s))?yield h.stat(s):null;if(x&&x.isFile()&&!u)return;const y=x&&x.isDirectory()&&w?g.join(s,g.basename(r)):s;if(!(yield h.exists(r)))throw new Error(`no such file or directory: ${r}`);const z=yield h.stat(r);if(z.isDirectory())if(!v)throw new Error(`Failed to copy. ${r} is a directory, but tried to copy without recursive flag.`);else yield p(r,y,0,u);else{if(g.relative(r,y)==="")throw new Error(`'${y}' and '${r}' are the same file`);yield q(r,y,u)}})}exports.cp=i;function j(r,s,t={}){return e(this,void 0,void 0,function*(){if(yield h.exists(s)){let u=!0;if(yield h.isDirectory(s))s=g.join(s,g.basename(r)),u=yield h.exists(s);if(u)if(t.force==null||t.force)yield k(s);else throw new Error("Destination already exists")}yield l(g.dirname(s));yield h.rename(r,s)})}exports.mv=j;function k(r){return e(this,void 0,void 0,function*(){if(h.IS_WINDOWS){if(/[*"<>|]/.test(r))throw new Error("File path must not contain `*`, `\"`, `<`, `>` or `|` on Windows")}try{yield h.rm(r,{force:!0,maxRetries:3,recursive:!0,retryDelay:300})}catch(s){throw new Error(`File was unable to be removed ${s}`)}})}exports.rmRF=k;function l(r){return e(this,void 0,void 0,function*(){f.ok(r,"a path argument must be provided"),yield h.mkdir(r,{recursive:!0})})}exports.mkdirP=l;function m(r,s){return e(this,void 0,void 0,function*(){if(!r)throw new Error("parameter 'tool' is required");if(s){const u=yield m(r,!1);if(!u)if(h.IS_WINDOWS)throw new Error(`Unable to locate executable file: ${r}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);else throw new Error(`Unable to locate executable file: ${r}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);return u}const t=yield n(r);if(t&&t.length>0)return t[0];return""})}exports.which=m;function n(r){return e(this,void 0,void 0,function*(){if(!r)throw new Error("parameter 'tool' is required");const s=[];if(h.IS_WINDOWS&&process.env["PATHEXT"]){for(const v of process.env["PATHEXT"].split(g.delimiter))if(v)s.push(v)}if(h.isRooted(r)){const v=yield h.tryGetExecutablePath(r,s);if(v)return[v];return[]}if(r.includes(g.sep))return[];const t=[];if(process.env.PATH){for(const v of process.env.PATH.split(g.delimiter))if(v)t.push(v)}const u=[];for(const v of t){const w=yield h.tryGetExecutablePath(g.join(v,r),s);if(w)u.push(w)}return u})}exports.findInPath=n;function o(r){const s=r.force==null?!0:r.force,t=!!r.recursive,u=r.copySourceDirectory==null?!0:!!r.copySourceDirectory;return{force:s,recursive:t,copySourceDirectory:u}}function p(r,s,t,u){return e(this,void 0,void 0,function*(){if(t>=255)return;t++;yield l(s);const v=yield h.readdir(r);for(const w of v){const x=`${r}/${w}`,y=`${s}/${w}`,z=yield h.lstat(x);if(z.isDirectory())yield p(x,y,t,u);else yield q(x,y,u)}yield h.chmod(s,(yield h.stat(r)).mode)})}function q(r,s,t){return e(this,void 0,void 0,function*(){if((yield h.lstat(r)).isSymbolicLink()){try{yield h.lstat(s),yield h.unlink(s)}catch(v){if(v.code==="EPERM")yield h.chmod(s,"0666"),yield h.unlink(s)}const u=yield h.readlink(r);yield h.symlink(u,s,h.IS_WINDOWS?"junction":null)}else if(!(yield h.exists(s))||t)yield h.copyFile(r,s)})}}),require_toolrunner=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(q,r,s,t){if(t===void 0)t=s;Object.defineProperty(q,t,{enumerable:!0,get:function(){return r[s]}})}:function(q,r,s,t){if(t===void 0)t=s;q[t]=r[s]}),c=exports&&exports.__setModuleDefault||(Object.create?function(q,r){Object.defineProperty(q,"default",{enumerable:!0,value:r})}:function(q,r){q["default"]=r}),d=exports&&exports.__importStar||function(q){if(q&&q.__esModule)return q;var r={};if(q!=null){for(var s in q)if(s!=="default"&&Object.hasOwnProperty.call(q,s))b(r,q,s)}c(r,q);return r},e=exports&&exports.__awaiter||function(q,r,s,t){function u(v){return v instanceof s?v:new s(function(w){w(v)})}return new (s||(s=Promise))(function(v,w){function x(A){try{z(t.next(A))}catch(B){w(B)}}function y(A){try{z(t["throw"](A))}catch(B){w(B)}}function z(A){A.done?v(A.value):u(A.value).then(x,y)}z((t=t.apply(q,r||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.argStringToArray=exports.ToolRunner=void 0;const f=d(__require("os")),g=d(__require("events")),h=d(__require("child_process")),i=d(__require("path")),j=d(require_io()),k=d(require_io_util()),l=__require("timers"),m=process.platform==="win32";var n=class extends g.EventEmitter{constructor(q,r,s){super();if(!q)throw new Error("Parameter 'toolPath' cannot be null or empty.");this.toolPath=q;this.args=r||[];this.options=s||{}}_debug(q){if(this.options.listeners&&this.options.listeners.debug)this.options.listeners.debug(q)}_getCommandString(q,r){const s=this._getSpawnFileName(),t=this._getSpawnArgs(q);let u=r?"":"[command]";if(m)if(this._isCmdFile()){u+=s;for(const v of t)u+=` ${v}`}else if(q.windowsVerbatimArguments){u+=`"${s}"`;for(const v of t)u+=` ${v}`}else{u+=this._windowsQuoteCmdArg(s);for(const v of t)u+=` ${this._windowsQuoteCmdArg(v)}`}else{u+=s;for(const v of t)u+=` ${v}`}return u}_processLineBuffer(q,r,s){try{let t=r+q.toString(),u=t.indexOf(f.EOL);while(u>-1){const v=t.substring(0,u);s(v);t=t.substring(u+f.EOL.length);u=t.indexOf(f.EOL)}return t}catch(t){return this._debug(`error processing line. Failed with error ${t}`),""}}_getSpawnFileName(){if(m){if(this._isCmdFile())return process.env["COMSPEC"]||"cmd.exe"}return this.toolPath}_getSpawnArgs(q){if(m){if(this._isCmdFile()){let r=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(const s of this.args)r+=" ",r+=q.windowsVerbatimArguments?s:this._windowsQuoteCmdArg(s);r+="\"";return[r]}}return this.args}_endsWith(q,r){return q.endsWith(r)}_isCmdFile(){const q=this.toolPath.toUpperCase();return this._endsWith(q,".CMD")||this._endsWith(q,".BAT")}_windowsQuoteCmdArg(q){if(!this._isCmdFile())return this._uvQuoteCmdArg(q);if(!q)return"\"\"";const r=[" "," ","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">","\""];let s=!1;for(const v of q)if(r.some((w)=>w===v)){s=!0;break}if(!s)return q;let t="\"",u=!0;for(let v=q.length;v>0;v--)if(t+=q[v-1],u&&q[v-1]==="\\")t+="\\";else if(q[v-1]==="\"")u=!0,t+="\"";else u=!1;t+="\"";return t.split("").reverse().join("")}_uvQuoteCmdArg(q){if(!q)return"\"\"";if(!q.includes(" ")&&!q.includes(" ")&&!q.includes("\""))return q;if(!q.includes("\"")&&!q.includes("\\"))return`"${q}"`;let r="\"",s=!0;for(let t=q.length;t>0;t--)if(r+=q[t-1],s&&q[t-1]==="\\")r+="\\";else if(q[t-1]==="\"")s=!0,r+="\\";else s=!1;r+="\"";return r.split("").reverse().join("")}_cloneExecOptions(q){q=q||{};const r={cwd:q.cwd||process.cwd(),env:q.env||process.env,silent:q.silent||!1,windowsVerbatimArguments:q.windowsVerbatimArguments||!1,failOnStdErr:q.failOnStdErr||!1,ignoreReturnCode:q.ignoreReturnCode||!1,delay:q.delay||1e4};r.outStream=q.outStream||process.stdout;r.errStream=q.errStream||process.stderr;return r}_getSpawnOptions(q,r){q=q||{};const s={};s.cwd=q.cwd;s.env=q.env;s["windowsVerbatimArguments"]=q.windowsVerbatimArguments||this._isCmdFile();if(q.windowsVerbatimArguments)s.argv0=`"${r}"`;return s}exec(){return e(this,void 0,void 0,function*(){if(!k.isRooted(this.toolPath)&&(this.toolPath.includes("/")||m&&this.toolPath.includes("\\")))this.toolPath=i.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath);this.toolPath=yield j.which(this.toolPath,!0);return new Promise((q,r)=>e(this,void 0,void 0,function*(){this._debug(`exec tool: ${this.toolPath}`);this._debug("arguments:");for(const y of this.args)this._debug(` ${y}`);const s=this._cloneExecOptions(this.options);if(!s.silent&&s.outStream)s.outStream.write(this._getCommandString(s)+f.EOL);const t=new p(s,this.toolPath);t.on("debug",(y)=>{this._debug(y)});if(this.options.cwd&&!(yield k.exists(this.options.cwd)))return r(new Error(`The cwd: ${this.options.cwd} does not exist!`));const u=this._getSpawnFileName(),v=h.spawn(u,this._getSpawnArgs(s),this._getSpawnOptions(this.options,u));let w="";if(v.stdout)v.stdout.on("data",(y)=>{if(this.options.listeners&&this.options.listeners.stdout)this.options.listeners.stdout(y);if(!s.silent&&s.outStream)s.outStream.write(y);w=this._processLineBuffer(y,w,(z)=>{if(this.options.listeners&&this.options.listeners.stdline)this.options.listeners.stdline(z)})});let x="";if(v.stderr)v.stderr.on("data",(y)=>{t.processStderr=!0;if(this.options.listeners&&this.options.listeners.stderr)this.options.listeners.stderr(y);if(!s.silent&&s.errStream&&s.outStream){const z=s.failOnStdErr?s.errStream:s.outStream;z.write(y)}x=this._processLineBuffer(y,x,(z)=>{if(this.options.listeners&&this.options.listeners.errline)this.options.listeners.errline(z)})});v.on("error",(y)=>{t.processError=y.message,t.processExited=!0,t.processClosed=!0,t.CheckComplete()});v.on("exit",(y)=>{t.processExitCode=y,t.processExited=!0,this._debug(`Exit code ${y} received from tool '${this.toolPath}'`),t.CheckComplete()});v.on("close",(y)=>{t.processExitCode=y,t.processExited=!0,t.processClosed=!0,this._debug(`STDIO streams have closed for tool '${this.toolPath}'`),t.CheckComplete()});t.on("done",(y,z)=>{if(w.length>0)this.emit("stdline",w);if(x.length>0)this.emit("errline",x);v.removeAllListeners();if(y)r(y);else q(z)});if(this.options.input){if(!v.stdin)throw new Error("child process missing stdin");v.stdin.end(this.options.input)}}))})}};exports.ToolRunner=n;function o(q){const r=[];let s=!1,t=!1,u="";function v(w){if(t&&w!=="\"")u+="\\";u+=w;t=!1}for(let w=0;w0)r.push(u),u="";continue}v(x)}if(u.length>0)r.push(u.trim());return r}exports.argStringToArray=o;var p=class q extends g.EventEmitter{constructor(r,s){super();this.processClosed=!1;this.processError="";this.processExitCode=0;this.processExited=!1;this.processStderr=!1;this.delay=1e4;this.done=!1;this.timeout=null;if(!s)throw new Error("toolPath must not be empty");this.options=r;this.toolPath=s;if(r.delay)this.delay=r.delay}CheckComplete(){if(this.done)return;if(this.processClosed)this._setResult();else if(this.processExited)this.timeout=l.setTimeout(q.HandleTimeout,this.delay,this)}_debug(r){this.emit("debug",r)}_setResult(){let r;if(this.processExited){if(this.processError)r=new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);else if(this.processExitCode!==0&&!this.options.ignoreReturnCode)r=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);else if(this.processStderr&&this.options.failOnStdErr)r=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`)}if(this.timeout)clearTimeout(this.timeout),this.timeout=null;this.done=!0;this.emit("done",r,this.processExitCode)}static HandleTimeout(r){if(r.done)return;if(!r.processClosed&&r.processExited){const s=`The STDIO streams did not close within ${r.delay/1e3} seconds of the exit event from process '${r.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;r._debug(s)}r._setResult()}}}),require_exec=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(j,k,l,m){if(m===void 0)m=l;Object.defineProperty(j,m,{enumerable:!0,get:function(){return k[l]}})}:function(j,k,l,m){if(m===void 0)m=l;j[m]=k[l]}),c=exports&&exports.__setModuleDefault||(Object.create?function(j,k){Object.defineProperty(j,"default",{enumerable:!0,value:k})}:function(j,k){j["default"]=k}),d=exports&&exports.__importStar||function(j){if(j&&j.__esModule)return j;var k={};if(j!=null){for(var l in j)if(l!=="default"&&Object.hasOwnProperty.call(j,l))b(k,j,l)}c(k,j);return k},e=exports&&exports.__awaiter||function(j,k,l,m){function n(o){return o instanceof l?o:new l(function(p){p(o)})}return new (l||(l=Promise))(function(o,p){function q(t){try{s(m.next(t))}catch(u){p(u)}}function r(t){try{s(m["throw"](t))}catch(u){p(u)}}function s(t){t.done?o(t.value):n(t.value).then(q,r)}s((m=m.apply(j,k||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.getExecOutput=exports.exec=void 0;const f=__require("string_decoder"),g=d(require_toolrunner());function h(j,k,l){return e(this,void 0,void 0,function*(){const m=g.argStringToArray(j);if(m.length===0)throw new Error("Parameter 'commandLine' cannot be null or empty.");const n=m[0];k=m.slice(1).concat(k||[]);const o=new g.ToolRunner(n,k,l);return o.exec()})}exports.exec=h;function i(j,k,l){var m,n;return e(this,void 0,void 0,function*(){let o="",p="";const q=new f.StringDecoder("utf8"),r=new f.StringDecoder("utf8"),s=(m=l===null||l===void 0?void 0:l.listeners)===null||m===void 0?void 0:m.stdout,t=(n=l===null||l===void 0?void 0:l.listeners)===null||n===void 0?void 0:n.stderr,u=(y)=>{if(p+=r.write(y),t)t(y)},v=(y)=>{if(o+=q.write(y),s)s(y)},w=Object.assign(Object.assign({},l===null||l===void 0?void 0:l.listeners),{stdout:v,stderr:u}),x=yield h(j,k,Object.assign(Object.assign({},l),{listeners:w}));o+=q.end();p+=r.end();return{exitCode:x,stdout:o,stderr:p}})}exports.getExecOutput=i}),require_platform=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(m,n,o,p){if(p===void 0)p=o;var q=Object.getOwnPropertyDescriptor(n,o);if(!q||("get"in q?!n.__esModule:q.writable||q.configurable))q={enumerable:!0,get:function(){return n[o]}};Object.defineProperty(m,p,q)}:function(m,n,o,p){if(p===void 0)p=o;m[p]=n[o]}),c=exports&&exports.__setModuleDefault||(Object.create?function(m,n){Object.defineProperty(m,"default",{enumerable:!0,value:n})}:function(m,n){m["default"]=n}),d=exports&&exports.__importStar||function(m){if(m&&m.__esModule)return m;var n={};if(m!=null){for(var o in m)if(o!=="default"&&Object.prototype.hasOwnProperty.call(m,o))b(n,m,o)}c(n,m);return n},e=exports&&exports.__awaiter||function(m,n,o,p){function q(r){return r instanceof o?r:new o(function(s){s(r)})}return new (o||(o=Promise))(function(r,s){function t(w){try{v(p.next(w))}catch(x){s(x)}}function u(w){try{v(p["throw"](w))}catch(x){s(x)}}function v(w){w.done?r(w.value):q(w.value).then(t,u)}v((p=p.apply(m,n||[])).next())})},f=exports&&exports.__importDefault||function(m){return m&&m.__esModule?m:{"default":m}};Object.defineProperty(exports,"__esModule",{value:true});exports.getDetails=exports.isLinux=exports.isMacOS=exports.isWindows=exports.arch=exports.platform=void 0;const g=f(__require("os")),h=d(require_exec()),i=()=>e(void 0,void 0,void 0,function*(){const {stdout:m}=yield h.getExecOutput("powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Version\"",void 0,{silent:!0}),{stdout:n}=yield h.getExecOutput("powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Caption\"",void 0,{silent:!0});return{name:n.trim(),version:m.trim()}}),j=()=>e(void 0,void 0,void 0,function*(){var m,n,o,p;const {stdout:q}=yield h.getExecOutput("sw_vers",void 0,{silent:!0}),r=(n=(m=q.match(/ProductVersion:\s*(.+)/))===null||m===void 0?void 0:m[1])!==null&&n!==void 0?n:"",s=(p=(o=q.match(/ProductName:\s*(.+)/))===null||o===void 0?void 0:o[1])!==null&&p!==void 0?p:"";return{name:s,version:r}}),k=()=>e(void 0,void 0,void 0,function*(){const {stdout:m}=yield h.getExecOutput("lsb_release",["-i","-r","-s"],{silent:!0}),[n,o]=m.trim().split("\n");return{name:n,version:o}});exports.platform=g.default.platform();exports.arch=g.default.arch();exports.isWindows=exports.platform==="win32";exports.isMacOS=exports.platform==="darwin";exports.isLinux=exports.platform==="linux";function l(){return e(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield exports.isWindows?i():exports.isMacOS?j():k()),{platform:exports.platform,arch:exports.arch,isWindows:exports.isWindows,isMacOS:exports.isMacOS,isLinux:exports.isLinux})})}exports.getDetails=l}),require_core=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(K,Bd,Cd,Dd){if(Dd===void 0)Dd=Cd;var Ed=Object.getOwnPropertyDescriptor(Bd,Cd);if(!Ed||("get"in Ed?!Bd.__esModule:Ed.writable||Ed.configurable))Ed={enumerable:!0,get:function(){return Bd[Cd]}};Object.defineProperty(K,Dd,Ed)}:function(K,Bd,Cd,Dd){if(Dd===void 0)Dd=Cd;K[Dd]=Bd[Cd]}),c=exports&&exports.__setModuleDefault||(Object.create?function(K,Bd){Object.defineProperty(K,"default",{enumerable:!0,value:Bd})}:function(K,Bd){K["default"]=Bd}),d=exports&&exports.__importStar||function(K){if(K&&K.__esModule)return K;var Bd={};if(K!=null){for(var Cd in K)if(Cd!=="default"&&Object.prototype.hasOwnProperty.call(K,Cd))b(Bd,K,Cd)}c(Bd,K);return Bd},e=exports&&exports.__awaiter||function(K,Bd,Cd,Dd){function Ed(L){return L instanceof Cd?L:new Cd(function(M){M(L)})}return new (Cd||(Cd=Promise))(function(L,M){function N(Fd){try{P(Dd.next(Fd))}catch(Q){M(Q)}}function O(Fd){try{P(Dd["throw"](Fd))}catch(Q){M(Q)}}function P(Fd){Fd.done?L(Fd.value):Ed(Fd.value).then(N,O)}P((Dd=Dd.apply(K,Bd||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.platform=exports.toPlatformPath=exports.toWin32Path=exports.toPosixPath=exports.markdownSummary=exports.summary=exports.getIDToken=exports.getState=exports.saveState=exports.group=exports.endGroup=exports.startGroup=exports.info=exports.notice=exports.warning=exports.error=exports.debug=exports.isDebug=exports.setFailed=exports.setCommandEcho=exports.setOutput=exports.getBooleanInput=exports.getMultilineInput=exports.getInput=exports.addPath=exports.setSecret=exports.exportVariable=exports.ExitCode=void 0;const f=require_command(),g=require_file_command(),h=require_utils$1(),i=d(__require("os")),j=d(__require("path")),k=require_oidc_utils();var l;(function(K){K[K["Success"]=0]="Success",K[K["Failure"]=1]="Failure"})(l||(exports.ExitCode=l={}));function m(K,Bd){const Cd=(0,h.toCommandValue)(Bd);process.env[K]=Cd;const Dd=process.env["GITHUB_ENV"]||"";if(Dd)return(0,g.issueFileCommand)("ENV",(0,g.prepareKeyValueMessage)(K,Bd));(0,f.issueCommand)("set-env",{name:K},Cd)}exports.exportVariable=m;function n(K){(0,f.issueCommand)("add-mask",{},K)}exports.setSecret=n;function o(K){const Bd=process.env["GITHUB_PATH"]||"";if(Bd)(0,g.issueFileCommand)("PATH",K);else (0,f.issueCommand)("add-path",{},K);process.env["PATH"]=`${K}${j.delimiter}${process.env["PATH"]}`}exports.addPath=o;function p(K,Bd){const Cd=process.env[`INPUT_${K.replace(/ /g,"_").toUpperCase()}`]||"";if(Bd&&Bd.required&&!Cd)throw new Error(`Input required and not supplied: ${K}`);if(Bd&&Bd.trimWhitespace===!1)return Cd;return Cd.trim()}exports.getInput=p;function q(K,Bd){const Cd=p(K,Bd).split("\n").filter((Dd)=>Dd!=="");if(Bd&&Bd.trimWhitespace===!1)return Cd;return Cd.map((Dd)=>Dd.trim())}exports.getMultilineInput=q;function r(K,Bd){const Cd=["true","True","TRUE"],Dd=["false","False","FALSE"],Ed=p(K,Bd);if(Cd.includes(Ed))return!0;if(Dd.includes(Ed))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${K}\n`+"Support boolean input list: `true | True | TRUE | false | False | FALSE`")}exports.getBooleanInput=r;function s(K,Bd){const Cd=process.env["GITHUB_OUTPUT"]||"";if(Cd)return(0,g.issueFileCommand)("OUTPUT",(0,g.prepareKeyValueMessage)(K,Bd));process.stdout.write(i.EOL);(0,f.issueCommand)("set-output",{name:K},(0,h.toCommandValue)(Bd))}exports.setOutput=s;function t(K){(0,f.issue)("echo",K?"on":"off")}exports.setCommandEcho=t;function u(K){process.exitCode=l.Failure,x(K)}exports.setFailed=u;function v(){return process.env["RUNNER_DEBUG"]==="1"}exports.isDebug=v;function w(K){(0,f.issueCommand)("debug",{},K)}exports.debug=w;function x(K,Bd={}){(0,f.issueCommand)("error",(0,h.toCommandProperties)(Bd),K instanceof Error?K.toString():K)}exports.error=x;function y(K,Bd={}){(0,f.issueCommand)("warning",(0,h.toCommandProperties)(Bd),K instanceof Error?K.toString():K)}exports.warning=y;function z(K,Bd={}){(0,f.issueCommand)("notice",(0,h.toCommandProperties)(Bd),K instanceof Error?K.toString():K)}exports.notice=z;function A(K){process.stdout.write(K+i.EOL)}exports.info=A;function B(K){(0,f.issue)("group",K)}exports.startGroup=B;function C(){(0,f.issue)("endgroup")}exports.endGroup=C;function D(K,Bd){return e(this,void 0,void 0,function*(){B(K);let Cd;try{Cd=yield Bd()}finally{C()}return Cd})}exports.group=D;function E(K,Bd){const Cd=process.env["GITHUB_STATE"]||"";if(Cd)return(0,g.issueFileCommand)("STATE",(0,g.prepareKeyValueMessage)(K,Bd));(0,f.issueCommand)("save-state",{name:K},(0,h.toCommandValue)(Bd))}exports.saveState=E;function F(K){return process.env[`STATE_${K}`]||""}exports.getState=F;function G(K){return e(this,void 0,void 0,function*(){return yield k.OidcClient.getIDToken(K)})}exports.getIDToken=G;var H=require_summary();Object.defineProperty(exports,"summary",{enumerable:true,get:function(){return H.summary}});var I=require_summary();Object.defineProperty(exports,"markdownSummary",{enumerable:true,get:function(){return I.markdownSummary}});var J=require_path_utils();Object.defineProperty(exports,"toPosixPath",{enumerable:true,get:function(){return J.toPosixPath}});Object.defineProperty(exports,"toWin32Path",{enumerable:true,get:function(){return J.toWin32Path}});Object.defineProperty(exports,"toPlatformPath",{enumerable:true,get:function(){return J.toPlatformPath}});exports.platform=d(require_platform())});const ANSI_BACKGROUND_OFFSET=10,wrapAnsi16=(a=0)=>(b)=>`\u001B[${b+a}m`,wrapAnsi256=(a=0)=>(b)=>`\u001B[${38+a};5;${b}m`,wrapAnsi16m=(a=0)=>(b,c,d)=>`\u001B[${38+a};2;${b};${c};${d}m`,styles$1={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},modifierNames=Object.keys(styles$1.modifier),foregroundColorNames=Object.keys(styles$1.color),backgroundColorNames=Object.keys(styles$1.bgColor),colorNames=[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){const a=new Map();for(const [b,c]of Object.entries(styles$1)){for(const [d,e]of Object.entries(c))styles$1[d]={open:`\u001B[${e[0]}m`,close:`\u001B[${e[1]}m`},c[d]=styles$1[d],a.set(e[0],e[1]);Object.defineProperty(styles$1,b,{value:c,enumerable:!1})}Object.defineProperty(styles$1,"codes",{value:a,enumerable:!1});styles$1.color.close="\x1B[39m";styles$1.bgColor.close="\x1B[49m";styles$1.color.ansi=wrapAnsi16();styles$1.color.ansi256=wrapAnsi256();styles$1.color.ansi16m=wrapAnsi16m();styles$1.bgColor.ansi=wrapAnsi16(ANSI_BACKGROUND_OFFSET);styles$1.bgColor.ansi256=wrapAnsi256(ANSI_BACKGROUND_OFFSET);styles$1.bgColor.ansi16m=wrapAnsi16m(ANSI_BACKGROUND_OFFSET);Object.defineProperties(styles$1,{rgbToAnsi256:{value(b,c,d){if(b===c&&c===d){if(b<8)return 16;if(b>248)return 231;return Math.round((b-8)/247*24)+232}return 16+36*Math.round(b/255*5)+6*Math.round(c/255*5)+Math.round(d/255*5)},enumerable:!1},hexToRgb:{value(b){const c=/[a-f\d]{6}|[a-f\d]{3}/i.exec(b.toString(16));if(!c)return[0,0,0];let [d]=c;if(d.length===3)d=[...d].map((f)=>f+f).join("");const e=Number.parseInt(d,16);return[e>>16&255,e>>8&255,e&255]},enumerable:!1},hexToAnsi256:{value:(b)=>styles$1.rgbToAnsi256(...styles$1.hexToRgb(b)),enumerable:!1},ansi256ToAnsi:{value(b){if(b<8)return 30+b;if(b<16)return 90+(b-8);let c,d,e;if(b>=232)c=((b-232)*10+8)/255,d=c,e=c;else{b-=16;const h=b%36;c=Math.floor(b/36)/5;d=Math.floor(h/6)/5;e=h%6/5}const f=Math.max(c,d,e)*2;if(f===0)return 30;let g=30+(Math.round(e)<<2|Math.round(d)<<1|Math.round(c));if(f===2)g+=60;return g},enumerable:!1},rgbToAnsi:{value:(b,c,d)=>styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(b,c,d)),enumerable:!1},hexToAnsi:{value:(b)=>styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(b)),enumerable:!1}});return styles$1}const ansiStyles=assembleStyles();var ansi_styles_default=ansiStyles;function hasFlag(a,b=globalThis.Deno?globalThis.Deno.args:process$1.argv){const c=a.startsWith("-")?"":a.length===1?"-":"--",d=b.indexOf(c+a),e=b.indexOf("--");return d!==-1&&(e===-1||d=2,has16m:a>=3}}function _supportsColor(a,{streamIsTTY:b,sniffFlags:c=!0}={}){const d=envForceColor();if(d!==void 0)flagForceColor=d;const e=c?flagForceColor:d;if(e===0)return 0;if(c){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor"))return 3;if(hasFlag("color=256"))return 2}if("TF_BUILD"in env&&"AGENT_NAME"in env)return 1;if(a&&!b&&e===void 0)return 0;const f=e||0;if(env.TERM==="dumb")return f;if(process$1.platform==="win32"){const g=os.release().split(".");if(Number(g[0])>=10&&Number(g[2])>=10586)return Number(g[2])>=14931?3:2;return 1}if("CI"in env){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((g)=>g in env))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((g)=>g in env)||env.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in env)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if(env.COLORTERM==="truecolor")return 3;if(env.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in env){const g=Number.parseInt((env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(env.TERM_PROGRAM){case "iTerm.app":return g>=3?3:2;case "Apple_Terminal":return 2}}if(/-256(color)?$/i.test(env.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM))return 1;if("COLORTERM"in env)return 1;return f}function createSupportsColor(a,b={}){const c=_supportsColor(a,{streamIsTTY:a&&a.isTTY,...b});return translateLevel(c)}const supportsColor={stdout:createSupportsColor({isTTY:tty.isatty(1)}),stderr:createSupportsColor({isTTY:tty.isatty(2)})};var supports_color_default=supportsColor;function stringReplaceAll(a,b,c){let d=a.indexOf(b);if(d===-1)return a;const e=b.length;let f=0,g="";do g+=a.slice(f,d)+b+c,f=d+e,d=a.indexOf(b,f);while(d!==-1);g+=a.slice(f);return g}function stringEncaseCRLFWithFirstIndex(a,b,c,d){let e=0,f="";do {const g=a[d-1]==="\r";f+=a.slice(e,g?d-1:d)+b+(g?"\r\n":"\n")+c;e=d+1;d=a.indexOf("\n",e)}while(d!==-1);f+=a.slice(e);return f}const {stdout:stdoutColor,stderr:stderrColor}=supports_color_default,GENERATOR=Symbol("GENERATOR"),STYLER=Symbol("STYLER"),IS_EMPTY=Symbol("IS_EMPTY"),levelMapping=["ansi","ansi","ansi256","ansi16m"],styles=Object.create(null),applyOptions=(a,b={})=>{if(b.level&&!(Number.isInteger(b.level)&&b.level>=0&&b.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const c=stdoutColor?stdoutColor.level:0;a.level=b.level===void 0?c:b.level};var Chalk=class{constructor(a){return chalkFactory(a)}};const chalkFactory=(a)=>{const b=(...c)=>c.join(" ");applyOptions(b,a);Object.setPrototypeOf(b,createChalk.prototype);return b};function createChalk(a){return chalkFactory(a)}Object.setPrototypeOf(createChalk.prototype,Function.prototype);for(const [a,b]of Object.entries(ansi_styles_default))styles[a]={get(){const c=createBuilder(this,createStyler(b.open,b.close,this[STYLER]),this[IS_EMPTY]);Object.defineProperty(this,a,{value:c});return c}};styles.visible={get(){const a=createBuilder(this,this[STYLER],!0);Object.defineProperty(this,"visible",{value:a});return a}};const getModelAnsi=(a,b,c,...d)=>{if(a==="rgb"){if(b==="ansi16m")return ansi_styles_default[c].ansi16m(...d);if(b==="ansi256")return ansi_styles_default[c].ansi256(ansi_styles_default.rgbToAnsi256(...d));return ansi_styles_default[c].ansi(ansi_styles_default.rgbToAnsi(...d))}if(a==="hex")return getModelAnsi("rgb",b,c,...ansi_styles_default.hexToRgb(...d));return ansi_styles_default[c][a](...d)},usedModels=["rgb","hex","ansi256"];for(const a of usedModels){styles[a]={get(){const {level:c}=this;return function(...d){const e=createStyler(getModelAnsi(a,levelMapping[c],"color",...d),ansi_styles_default.color.close,this[STYLER]);return createBuilder(this,e,this[IS_EMPTY])}}};const b="bg"+a[0].toUpperCase()+a.slice(1);styles[b]={get(){const {level:c}=this;return function(...d){const e=createStyler(getModelAnsi(a,levelMapping[c],"bgColor",...d),ansi_styles_default.bgColor.close,this[STYLER]);return createBuilder(this,e,this[IS_EMPTY])}}}}const proto=Object.defineProperties(()=>{},{...styles,level:{enumerable:!0,get(){return this[GENERATOR].level},set(a){this[GENERATOR].level=a}}}),createStyler=(a,b,c)=>{let d,e;if(c===void 0)d=a,e=b;else d=c.openAll+a,e=b+c.closeAll;return{open:a,close:b,openAll:d,closeAll:e,parent:c}},createBuilder=(a,b,c)=>{const d=(...e)=>applyStyle(d,e.length===1?""+e[0]:e.join(" "));Object.setPrototypeOf(d,proto);d[GENERATOR]=a;d[STYLER]=b;d[IS_EMPTY]=c;return d},applyStyle=(a,b)=>{if(a.level<=0||!b)return a[IS_EMPTY]?"":b;let c=a[STYLER];if(c===void 0)return b;const {openAll:d,closeAll:e}=c;if(b.includes("\x1B"))while(c!==void 0)b=stringReplaceAll(b,c.close,c.open),c=c.parent;const f=b.indexOf("\n");if(f!==-1)b=stringEncaseCRLFWithFirstIndex(b,e,d,f);return d+b+e};Object.defineProperties(createChalk.prototype,styles);const chalk$1=createChalk(),chalkStderr=createChalk({level:stderrColor?stderrColor.level:0}),TOOLKIT_LOG_LEVEL=process.env.TOOLKIT_LOG_LEVEL||"info",chalk=new Chalk({...(!!process.env.CI||!!process.env.VITEST)&&{level:2}});var LogLevel;(function(a){a["ERROR"]="ERROR",a["INFO"]="INFO",a["WARNING"]="WARN",a["DEBUG"]="DEBUG"})(LogLevel||(LogLevel={}));const getLogColor=(a)=>{switch(a){case LogLevel.INFO:return chalk.green;case LogLevel.ERROR:return chalk.red;case LogLevel.WARNING:return chalk.yellow;case LogLevel.DEBUG:return chalk.magenta}},getMessageWithPrefix=(a,b)=>`[${chalk.blue(new Date().toISOString())}] ${getLogColor(b)(b)} ${a}`,prettifyMessage=(a)=>{if(a instanceof Error)return a.message.concat("\n",a.stack);else if(typeof a==="string")return a;return JSON.stringify(a,null,2)},writeConsole=(a,b=LogLevel.INFO)=>{const c=prettifyMessage(a).split("\n").map((d)=>getMessageWithPrefix(d,b)).join("\n");if(b===LogLevel.INFO||b===LogLevel.DEBUG&&TOOLKIT_LOG_LEVEL==="debug")process.stdout.write(c.concat("\n"));else if(b===LogLevel.ERROR||b===LogLevel.WARNING)process.stderr.write(c.concat("\n"))};var import_core=__toESM(require_core(),1);const IGNORED_BRANCHES=import_core.getInput("branchesToIgnore",{required:!1}).split(","),mainBranch=`origin/${import_core.getInput("mainBranch",{required:!1})}`,{CI_TOKEN,GITHUB_SERVER_URL}=process.env;var Action=function(a){return a[a["Rebase"]=0]="Rebase",a[a["Reset"]=1]="Reset",a}(Action||{});const runGitCommand=(a,b)=>(writeConsole(`Running git command: git ${a.join(" ")}`),new Promise((c,d)=>{const e=spawn("git",a,{stdio:"pipe",...b});let f="",g="";e.stdout.on("data",(h)=>f+=h.toString());e.stderr.on("data",(h)=>g+=h.toString());e.on("close",(h)=>h===0?c(f):d(new Error(`Git command failed with code ${h}: ${g}`)))})),fetchBranches=async()=>{writeConsole("Fetching all branches...");await runGitCommand(["fetch","--all"]);const a=await runGitCommand(["branch","-r"]);return a.split("\n").map((b)=>b.trim()).filter((b)=>!IGNORED_BRANCHES.includes(b.replace("origin/",""))&&b!=="")},getCommitsForBranch=async(a)=>{const b=await runGitCommand(["rev-list",a]);return new Set(b.split("\n").filter(Boolean))},removeIgnoredBranches=(a)=>{let b={};for(const [c,d]of Object.entries(a)){if(d.ignore)continue;b[c]=d}return b},buildRebaseDependencyGraph=async(a)=>{const b={};for(const d of a)b[d]=await getCommitsForBranch(d),writeConsole(`Commits ${d}`,LogLevel.DEBUG),writeConsole(b[d],LogLevel.DEBUG);let c={};for(const d of a)for(const e of a){if(d!==e)continue;const f=b[d].isSupersetOf(b[e]);if(!f)continue;const g=b[d].difference(b[e]);if(e===mainBranch)c[d]={ignore:!0};if(g.size===0){const h=c[d]?.equalBranches??[];c[d]={rebaseBranch:mainBranch,...c[d],equalBranches:[...h,e]}}else if(d!==mainBranch&&(!c[d]||c[d].differenceWithRebase>g.size))c[d]={...c[d],rebaseBranch:e,differenceWithRebase:g.size}}for(const d of a){if(d!==mainBranch)continue;c[d]=c[d]??{rebaseBranch:mainBranch,differenceWithRebase:0}}return removeIgnoredBranches(c)},rebaseOrder=(a)=>{writeConsole("Order everything",LogLevel.DEBUG);let b=[];for(const c of Object.keys(a)){const d=b.find((e)=>a[c].equalBranches?.some((f)=>f===e.branch));if(d)b.push({branch:c,onBranch:d.branch,action:Action.Reset});else b.push({branch:c,onBranch:a[c].rebaseBranch,action:Action.Rebase})}b=b.sort((c,d)=>{const e=a[c.branch].differenceWithRebase,f=a[d.branch].differenceWithRebase;return e-f});b=b.sort((c,d)=>c.action-d.action);return b},rebaseBranch=async({branch:a,onBranch:b,action:c})=>{writeConsole(`${c===Action.Rebase?"Rebasing":"Resetting"} ${a} on ${b}`);await runGitCommand(["checkout",a.replace("origin/","")]);if(c===Action.Rebase)await runGitCommand(["rebase",b]).catch(async(d)=>{writeConsole(`Failed to rebase ${a} on ${b}`,LogLevel.WARNING),writeConsole(d,LogLevel.WARNING),await runGitCommand(["rebase","--abort"])});else if(c===Action.Reset)await runGitCommand(["reset","--hard",b]);await runGitCommand(["push","--force-with-lease"])},setupCIToken=async()=>{writeConsole("Overriding git repository auth with CI_TOKEN");const a=await runGitCommand(["remote","get-url","origin"]),b=a.replace(/https?:\/\//,""),c=`https://MilaBot:${CI_TOKEN}@${b}.git`;await runGitCommand(["remote","set-url","origin",c]);await runGitCommand(["config","--local","--unset",`http.https://${GITHUB_SERVER_URL}/.extraheader`])},setupAutoRebaseGit=async()=>{if(CI_TOKEN)await setupCIToken();else writeConsole("Couldn't find a CI_TOKEN. Using the gitea ghost.",LogLevel.WARNING);await runGitCommand(["config","user.email","auto-rebase@skydust.fr"]);await runGitCommand(["config","user.name","Auto Rebase"])},main=async()=>{try{writeConsole("Setup auto rebase");await setupAutoRebaseGit();const a=await fetchBranches();a.push(mainBranch);writeConsole("Branches");writeConsole(a);writeConsole("Determining dependencies...");const b=await buildRebaseDependencyGraph(a);writeConsole(b,LogLevel.DEBUG);const c=rebaseOrder(b);if(c.length===0)writeConsole("Nothing to rebase");else writeConsole("Rebase order"),writeConsole(c);for(const d of c)await rebaseBranch(d)}catch(a){writeConsole("Error during workflow execution",LogLevel.ERROR),writeConsole(a,LogLevel.ERROR),process.exit(1)}};main(); \ No newline at end of file + Error Message: ${m.message}`)}),l=(i=k.result)===null||i===void 0?void 0:i.value;if(!l)throw new Error("Response json body do not have ID Token field");return l})}static getIDToken(h){return b(this,void 0,void 0,function*(){try{let i=g.getIDTokenUrl();if(h){const k=encodeURIComponent(h);i=`${i}&audience=${k}`}(0,e.debug)(`ID token url is ${i}`);const j=yield g.getCall(i);(0,e.setSecret)(j);return j}catch(i){throw new Error(`Error message: ${i.message}`)}})}};exports.OidcClient=f}),require_summary=__commonJSMin((exports)=>{var b=exports&&exports.__awaiter||function(j,k,l,m){function n(o){return o instanceof l?o:new l(function(p){p(o)})}return new (l||(l=Promise))(function(o,p){function q(t){try{s(m.next(t))}catch(u){p(u)}}function r(t){try{s(m["throw"](t))}catch(u){p(u)}}function s(t){t.done?o(t.value):n(t.value).then(q,r)}s((m=m.apply(j,k||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.summary=exports.markdownSummary=exports.SUMMARY_DOCS_URL=exports.SUMMARY_ENV_VAR=void 0;const c=__require("os"),d=__require("fs"),{access:e,appendFile:f,writeFile:g}=d.promises;exports.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";exports.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var h=class{constructor(){this._buffer=""}filePath(){return b(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const j=process.env[exports.SUMMARY_ENV_VAR];if(!j)throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield e(j,d.constants.R_OK|d.constants.W_OK)}catch(k){throw new Error(`Unable to access summary file: '${j}'. Check if the file has correct read/write permissions.`)}this._filePath=j;return this._filePath})}wrap(j,k,l={}){const m=Object.entries(l).map(([n,o])=>` ${n}="${o}"`).join("");if(!k)return`<${j}${m}>`;return`<${j}${m}>${k}`}write(j){return b(this,void 0,void 0,function*(){const k=!!(j===null||j===void 0?void 0:j.overwrite),l=yield this.filePath(),m=k?g:f;yield m(l,this._buffer,{encoding:"utf8"});return this.emptyBuffer()})}clear(){return b(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(j,k=!1){return this._buffer+=j,k?this.addEOL():this}addEOL(){return this.addRaw(c.EOL)}addCodeBlock(j,k){const l=Object.assign({},k&&{lang:k}),m=this.wrap("pre",this.wrap("code",j),l);return this.addRaw(m).addEOL()}addList(j,k=!1){const l=k?"ol":"ul",m=j.map((o)=>this.wrap("li",o)).join(""),n=this.wrap(l,m);return this.addRaw(n).addEOL()}addTable(j){const k=j.map((m)=>{const n=m.map((o)=>{if(typeof o==="string")return this.wrap("td",o);const {header:p,data:q,colspan:r,rowspan:s}=o,t=p?"th":"td",u=Object.assign(Object.assign({},r&&{colspan:r}),s&&{rowspan:s});return this.wrap(t,q,u)}).join("");return this.wrap("tr",n)}).join(""),l=this.wrap("table",k);return this.addRaw(l).addEOL()}addDetails(j,k){const l=this.wrap("details",this.wrap("summary",j)+k);return this.addRaw(l).addEOL()}addImage(j,k,l){const {width:m,height:n}=l||{},o=Object.assign(Object.assign({},m&&{width:m}),n&&{height:n}),p=this.wrap("img",null,Object.assign({src:j,alt:k},o));return this.addRaw(p).addEOL()}addHeading(j,k){const l=`h${k}`,m=["h1","h2","h3","h4","h5","h6"].includes(l)?l:"h1",n=this.wrap(m,j);return this.addRaw(n).addEOL()}addSeparator(){const j=this.wrap("hr",null);return this.addRaw(j).addEOL()}addBreak(){const j=this.wrap("br",null);return this.addRaw(j).addEOL()}addQuote(j,k){const l=Object.assign({},k&&{cite:k}),m=this.wrap("blockquote",j,l);return this.addRaw(m).addEOL()}addLink(j,k){const l=this.wrap("a",j,{href:k});return this.addRaw(l).addEOL()}};const i=new h();exports.markdownSummary=i;exports.summary=i}),require_path_utils=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(i,j,k,l){if(l===void 0)l=k;var m=Object.getOwnPropertyDescriptor(j,k);if(!m||("get"in m?!j.__esModule:m.writable||m.configurable))m={enumerable:!0,get:function(){return j[k]}};Object.defineProperty(i,l,m)}:function(i,j,k,l){if(l===void 0)l=k;i[l]=j[k]}),c=exports&&exports.__setModuleDefault||(Object.create?function(i,j){Object.defineProperty(i,"default",{enumerable:!0,value:j})}:function(i,j){i["default"]=j}),d=exports&&exports.__importStar||function(i){if(i&&i.__esModule)return i;var j={};if(i!=null){for(var k in i)if(k!=="default"&&Object.prototype.hasOwnProperty.call(i,k))b(j,i,k)}c(j,i);return j};Object.defineProperty(exports,"__esModule",{value:true});exports.toPlatformPath=exports.toWin32Path=exports.toPosixPath=void 0;const e=d(__require("path"));function f(i){return i.replace(/[\\]/g,"/")}exports.toPosixPath=f;function g(i){return i.replace(/[/]/g,"\\")}exports.toWin32Path=g;function h(i){return i.replace(/[/\\]/g,e.sep)}exports.toPlatformPath=h}),require_io_util=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(p,q,r,s){if(s===void 0)s=r;Object.defineProperty(p,s,{enumerable:!0,get:function(){return q[r]}})}:function(p,q,r,s){if(s===void 0)s=r;p[s]=q[r]}),c=exports&&exports.__setModuleDefault||(Object.create?function(p,q){Object.defineProperty(p,"default",{enumerable:!0,value:q})}:function(p,q){p["default"]=q}),d=exports&&exports.__importStar||function(p){if(p&&p.__esModule)return p;var q={};if(p!=null){for(var r in p)if(r!=="default"&&Object.hasOwnProperty.call(p,r))b(q,p,r)}c(q,p);return q},e=exports&&exports.__awaiter||function(p,q,r,s){function t(u){return u instanceof r?u:new r(function(v){v(u)})}return new (r||(r=Promise))(function(u,v){function w(z){try{y(s.next(z))}catch(A){v(A)}}function x(z){try{y(s["throw"](z))}catch(A){v(A)}}function y(z){z.done?u(z.value):t(z.value).then(w,x)}y((s=s.apply(p,q||[])).next())})},f;Object.defineProperty(exports,"__esModule",{value:true});exports.getCmdPath=exports.tryGetExecutablePath=exports.isRooted=exports.isDirectory=exports.exists=exports.READONLY=exports.UV_FS_O_EXLOCK=exports.IS_WINDOWS=exports.unlink=exports.symlink=exports.stat=exports.rmdir=exports.rm=exports.rename=exports.readlink=exports.readdir=exports.open=exports.mkdir=exports.lstat=exports.copyFile=exports.chmod=void 0;const g=d(__require("fs")),h=d(__require("path"));f=g.promises,exports.chmod=f.chmod,exports.copyFile=f.copyFile,exports.lstat=f.lstat,exports.mkdir=f.mkdir,exports.open=f.open,exports.readdir=f.readdir,exports.readlink=f.readlink,exports.rename=f.rename,exports.rm=f.rm,exports.rmdir=f.rmdir,exports.stat=f.stat,exports.symlink=f.symlink,exports.unlink=f.unlink;exports.IS_WINDOWS=process.platform==="win32";exports.UV_FS_O_EXLOCK=268435456;exports.READONLY=g.constants.O_RDONLY;function i(p){return e(this,void 0,void 0,function*(){try{yield exports.stat(p)}catch(q){if(q.code==="ENOENT")return!1;throw q}return!0})}exports.exists=i;function j(p,q=!1){return e(this,void 0,void 0,function*(){const r=q?yield exports.stat(p):yield exports.lstat(p);return r.isDirectory()})}exports.isDirectory=j;function k(p){p=m(p);if(!p)throw new Error("isRooted() parameter \"p\" cannot be empty");if(exports.IS_WINDOWS)return p.startsWith("\\")||/^[A-Z]:/i.test(p);return p.startsWith("/")}exports.isRooted=k;function l(p,q){return e(this,void 0,void 0,function*(){let r;try{r=yield exports.stat(p)}catch(t){if(t.code!=="ENOENT")console.log(`Unexpected error attempting to determine if executable file exists '${p}': ${t}`)}if(r&&r.isFile()){if(exports.IS_WINDOWS){const t=h.extname(p).toUpperCase();if(q.some((u)=>u.toUpperCase()===t))return p}else if(n(r))return p}const s=p;for(const t of q){p=s+t;r=void 0;try{r=yield exports.stat(p)}catch(u){if(u.code!=="ENOENT")console.log(`Unexpected error attempting to determine if executable file exists '${p}': ${u}`)}if(r&&r.isFile()){if(exports.IS_WINDOWS){try{const u=h.dirname(p),v=h.basename(p).toUpperCase();for(const w of yield exports.readdir(u))if(v===w.toUpperCase()){p=h.join(u,w);break}}catch(u){console.log(`Unexpected error attempting to determine the actual case of the file '${p}': ${u}`)}return p}else if(n(r))return p}}return""})}exports.tryGetExecutablePath=l;function m(p){p=p||"";if(exports.IS_WINDOWS)return p=p.replace(/\//g,"\\"),p.replace(/\\\\+/g,"\\");return p.replace(/\/\/+/g,"/")}function n(p){return(p.mode&1)>0||(p.mode&8)>0&&p.gid===process.getgid()||(p.mode&64)>0&&p.uid===process.getuid()}function o(){var p;return(p=process.env["COMSPEC"])!==null&&p!==void 0?p:"cmd.exe"}exports.getCmdPath=o}),require_io=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(r,s,t,u){if(u===void 0)u=t;Object.defineProperty(r,u,{enumerable:!0,get:function(){return s[t]}})}:function(r,s,t,u){if(u===void 0)u=t;r[u]=s[t]}),c=exports&&exports.__setModuleDefault||(Object.create?function(r,s){Object.defineProperty(r,"default",{enumerable:!0,value:s})}:function(r,s){r["default"]=s}),d=exports&&exports.__importStar||function(r){if(r&&r.__esModule)return r;var s={};if(r!=null){for(var t in r)if(t!=="default"&&Object.hasOwnProperty.call(r,t))b(s,r,t)}c(s,r);return s},e=exports&&exports.__awaiter||function(r,s,t,u){function v(w){return w instanceof t?w:new t(function(x){x(w)})}return new (t||(t=Promise))(function(w,x){function y(B){try{A(u.next(B))}catch(C){x(C)}}function z(B){try{A(u["throw"](B))}catch(C){x(C)}}function A(B){B.done?w(B.value):v(B.value).then(y,z)}A((u=u.apply(r,s||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.findInPath=exports.which=exports.mkdirP=exports.rmRF=exports.mv=exports.cp=void 0;const f=__require("assert"),g=d(__require("path")),h=d(require_io_util());function i(r,s,t={}){return e(this,void 0,void 0,function*(){const {force:u,recursive:v,copySourceDirectory:w}=o(t),x=(yield h.exists(s))?yield h.stat(s):null;if(x&&x.isFile()&&!u)return;const y=x&&x.isDirectory()&&w?g.join(s,g.basename(r)):s;if(!(yield h.exists(r)))throw new Error(`no such file or directory: ${r}`);const z=yield h.stat(r);if(z.isDirectory())if(!v)throw new Error(`Failed to copy. ${r} is a directory, but tried to copy without recursive flag.`);else yield p(r,y,0,u);else{if(g.relative(r,y)==="")throw new Error(`'${y}' and '${r}' are the same file`);yield q(r,y,u)}})}exports.cp=i;function j(r,s,t={}){return e(this,void 0,void 0,function*(){if(yield h.exists(s)){let u=!0;if(yield h.isDirectory(s))s=g.join(s,g.basename(r)),u=yield h.exists(s);if(u)if(t.force==null||t.force)yield k(s);else throw new Error("Destination already exists")}yield l(g.dirname(s));yield h.rename(r,s)})}exports.mv=j;function k(r){return e(this,void 0,void 0,function*(){if(h.IS_WINDOWS){if(/[*"<>|]/.test(r))throw new Error("File path must not contain `*`, `\"`, `<`, `>` or `|` on Windows")}try{yield h.rm(r,{force:!0,maxRetries:3,recursive:!0,retryDelay:300})}catch(s){throw new Error(`File was unable to be removed ${s}`)}})}exports.rmRF=k;function l(r){return e(this,void 0,void 0,function*(){f.ok(r,"a path argument must be provided"),yield h.mkdir(r,{recursive:!0})})}exports.mkdirP=l;function m(r,s){return e(this,void 0,void 0,function*(){if(!r)throw new Error("parameter 'tool' is required");if(s){const u=yield m(r,!1);if(!u)if(h.IS_WINDOWS)throw new Error(`Unable to locate executable file: ${r}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);else throw new Error(`Unable to locate executable file: ${r}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);return u}const t=yield n(r);if(t&&t.length>0)return t[0];return""})}exports.which=m;function n(r){return e(this,void 0,void 0,function*(){if(!r)throw new Error("parameter 'tool' is required");const s=[];if(h.IS_WINDOWS&&process.env["PATHEXT"]){for(const v of process.env["PATHEXT"].split(g.delimiter))if(v)s.push(v)}if(h.isRooted(r)){const v=yield h.tryGetExecutablePath(r,s);if(v)return[v];return[]}if(r.includes(g.sep))return[];const t=[];if(process.env.PATH){for(const v of process.env.PATH.split(g.delimiter))if(v)t.push(v)}const u=[];for(const v of t){const w=yield h.tryGetExecutablePath(g.join(v,r),s);if(w)u.push(w)}return u})}exports.findInPath=n;function o(r){const s=r.force==null?!0:r.force,t=!!r.recursive,u=r.copySourceDirectory==null?!0:!!r.copySourceDirectory;return{force:s,recursive:t,copySourceDirectory:u}}function p(r,s,t,u){return e(this,void 0,void 0,function*(){if(t>=255)return;t++;yield l(s);const v=yield h.readdir(r);for(const w of v){const x=`${r}/${w}`,y=`${s}/${w}`,z=yield h.lstat(x);if(z.isDirectory())yield p(x,y,t,u);else yield q(x,y,u)}yield h.chmod(s,(yield h.stat(r)).mode)})}function q(r,s,t){return e(this,void 0,void 0,function*(){if((yield h.lstat(r)).isSymbolicLink()){try{yield h.lstat(s),yield h.unlink(s)}catch(v){if(v.code==="EPERM")yield h.chmod(s,"0666"),yield h.unlink(s)}const u=yield h.readlink(r);yield h.symlink(u,s,h.IS_WINDOWS?"junction":null)}else if(!(yield h.exists(s))||t)yield h.copyFile(r,s)})}}),require_toolrunner=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(q,r,s,t){if(t===void 0)t=s;Object.defineProperty(q,t,{enumerable:!0,get:function(){return r[s]}})}:function(q,r,s,t){if(t===void 0)t=s;q[t]=r[s]}),c=exports&&exports.__setModuleDefault||(Object.create?function(q,r){Object.defineProperty(q,"default",{enumerable:!0,value:r})}:function(q,r){q["default"]=r}),d=exports&&exports.__importStar||function(q){if(q&&q.__esModule)return q;var r={};if(q!=null){for(var s in q)if(s!=="default"&&Object.hasOwnProperty.call(q,s))b(r,q,s)}c(r,q);return r},e=exports&&exports.__awaiter||function(q,r,s,t){function u(v){return v instanceof s?v:new s(function(w){w(v)})}return new (s||(s=Promise))(function(v,w){function x(A){try{z(t.next(A))}catch(B){w(B)}}function y(A){try{z(t["throw"](A))}catch(B){w(B)}}function z(A){A.done?v(A.value):u(A.value).then(x,y)}z((t=t.apply(q,r||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.argStringToArray=exports.ToolRunner=void 0;const f=d(__require("os")),g=d(__require("events")),h=d(__require("child_process")),i=d(__require("path")),j=d(require_io()),k=d(require_io_util()),l=__require("timers"),m=process.platform==="win32";var n=class extends g.EventEmitter{constructor(q,r,s){super();if(!q)throw new Error("Parameter 'toolPath' cannot be null or empty.");this.toolPath=q;this.args=r||[];this.options=s||{}}_debug(q){if(this.options.listeners&&this.options.listeners.debug)this.options.listeners.debug(q)}_getCommandString(q,r){const s=this._getSpawnFileName(),t=this._getSpawnArgs(q);let u=r?"":"[command]";if(m)if(this._isCmdFile()){u+=s;for(const v of t)u+=` ${v}`}else if(q.windowsVerbatimArguments){u+=`"${s}"`;for(const v of t)u+=` ${v}`}else{u+=this._windowsQuoteCmdArg(s);for(const v of t)u+=` ${this._windowsQuoteCmdArg(v)}`}else{u+=s;for(const v of t)u+=` ${v}`}return u}_processLineBuffer(q,r,s){try{let t=r+q.toString(),u=t.indexOf(f.EOL);while(u>-1){const v=t.substring(0,u);s(v);t=t.substring(u+f.EOL.length);u=t.indexOf(f.EOL)}return t}catch(t){return this._debug(`error processing line. Failed with error ${t}`),""}}_getSpawnFileName(){if(m){if(this._isCmdFile())return process.env["COMSPEC"]||"cmd.exe"}return this.toolPath}_getSpawnArgs(q){if(m){if(this._isCmdFile()){let r=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(const s of this.args)r+=" ",r+=q.windowsVerbatimArguments?s:this._windowsQuoteCmdArg(s);r+="\"";return[r]}}return this.args}_endsWith(q,r){return q.endsWith(r)}_isCmdFile(){const q=this.toolPath.toUpperCase();return this._endsWith(q,".CMD")||this._endsWith(q,".BAT")}_windowsQuoteCmdArg(q){if(!this._isCmdFile())return this._uvQuoteCmdArg(q);if(!q)return"\"\"";const r=[" "," ","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">","\""];let s=!1;for(const v of q)if(r.some((w)=>w===v)){s=!0;break}if(!s)return q;let t="\"",u=!0;for(let v=q.length;v>0;v--)if(t+=q[v-1],u&&q[v-1]==="\\")t+="\\";else if(q[v-1]==="\"")u=!0,t+="\"";else u=!1;t+="\"";return t.split("").reverse().join("")}_uvQuoteCmdArg(q){if(!q)return"\"\"";if(!q.includes(" ")&&!q.includes(" ")&&!q.includes("\""))return q;if(!q.includes("\"")&&!q.includes("\\"))return`"${q}"`;let r="\"",s=!0;for(let t=q.length;t>0;t--)if(r+=q[t-1],s&&q[t-1]==="\\")r+="\\";else if(q[t-1]==="\"")s=!0,r+="\\";else s=!1;r+="\"";return r.split("").reverse().join("")}_cloneExecOptions(q){q=q||{};const r={cwd:q.cwd||process.cwd(),env:q.env||process.env,silent:q.silent||!1,windowsVerbatimArguments:q.windowsVerbatimArguments||!1,failOnStdErr:q.failOnStdErr||!1,ignoreReturnCode:q.ignoreReturnCode||!1,delay:q.delay||1e4};r.outStream=q.outStream||process.stdout;r.errStream=q.errStream||process.stderr;return r}_getSpawnOptions(q,r){q=q||{};const s={};s.cwd=q.cwd;s.env=q.env;s["windowsVerbatimArguments"]=q.windowsVerbatimArguments||this._isCmdFile();if(q.windowsVerbatimArguments)s.argv0=`"${r}"`;return s}exec(){return e(this,void 0,void 0,function*(){if(!k.isRooted(this.toolPath)&&(this.toolPath.includes("/")||m&&this.toolPath.includes("\\")))this.toolPath=i.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath);this.toolPath=yield j.which(this.toolPath,!0);return new Promise((q,r)=>e(this,void 0,void 0,function*(){this._debug(`exec tool: ${this.toolPath}`);this._debug("arguments:");for(const y of this.args)this._debug(` ${y}`);const s=this._cloneExecOptions(this.options);if(!s.silent&&s.outStream)s.outStream.write(this._getCommandString(s)+f.EOL);const t=new p(s,this.toolPath);t.on("debug",(y)=>{this._debug(y)});if(this.options.cwd&&!(yield k.exists(this.options.cwd)))return r(new Error(`The cwd: ${this.options.cwd} does not exist!`));const u=this._getSpawnFileName(),v=h.spawn(u,this._getSpawnArgs(s),this._getSpawnOptions(this.options,u));let w="";if(v.stdout)v.stdout.on("data",(y)=>{if(this.options.listeners&&this.options.listeners.stdout)this.options.listeners.stdout(y);if(!s.silent&&s.outStream)s.outStream.write(y);w=this._processLineBuffer(y,w,(z)=>{if(this.options.listeners&&this.options.listeners.stdline)this.options.listeners.stdline(z)})});let x="";if(v.stderr)v.stderr.on("data",(y)=>{t.processStderr=!0;if(this.options.listeners&&this.options.listeners.stderr)this.options.listeners.stderr(y);if(!s.silent&&s.errStream&&s.outStream){const z=s.failOnStdErr?s.errStream:s.outStream;z.write(y)}x=this._processLineBuffer(y,x,(z)=>{if(this.options.listeners&&this.options.listeners.errline)this.options.listeners.errline(z)})});v.on("error",(y)=>{t.processError=y.message,t.processExited=!0,t.processClosed=!0,t.CheckComplete()});v.on("exit",(y)=>{t.processExitCode=y,t.processExited=!0,this._debug(`Exit code ${y} received from tool '${this.toolPath}'`),t.CheckComplete()});v.on("close",(y)=>{t.processExitCode=y,t.processExited=!0,t.processClosed=!0,this._debug(`STDIO streams have closed for tool '${this.toolPath}'`),t.CheckComplete()});t.on("done",(y,z)=>{if(w.length>0)this.emit("stdline",w);if(x.length>0)this.emit("errline",x);v.removeAllListeners();if(y)r(y);else q(z)});if(this.options.input){if(!v.stdin)throw new Error("child process missing stdin");v.stdin.end(this.options.input)}}))})}};exports.ToolRunner=n;function o(q){const r=[];let s=!1,t=!1,u="";function v(w){if(t&&w!=="\"")u+="\\";u+=w;t=!1}for(let w=0;w0)r.push(u),u="";continue}v(x)}if(u.length>0)r.push(u.trim());return r}exports.argStringToArray=o;var p=class q extends g.EventEmitter{constructor(r,s){super();this.processClosed=!1;this.processError="";this.processExitCode=0;this.processExited=!1;this.processStderr=!1;this.delay=1e4;this.done=!1;this.timeout=null;if(!s)throw new Error("toolPath must not be empty");this.options=r;this.toolPath=s;if(r.delay)this.delay=r.delay}CheckComplete(){if(this.done)return;if(this.processClosed)this._setResult();else if(this.processExited)this.timeout=l.setTimeout(q.HandleTimeout,this.delay,this)}_debug(r){this.emit("debug",r)}_setResult(){let r;if(this.processExited){if(this.processError)r=new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);else if(this.processExitCode!==0&&!this.options.ignoreReturnCode)r=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);else if(this.processStderr&&this.options.failOnStdErr)r=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`)}if(this.timeout)clearTimeout(this.timeout),this.timeout=null;this.done=!0;this.emit("done",r,this.processExitCode)}static HandleTimeout(r){if(r.done)return;if(!r.processClosed&&r.processExited){const s=`The STDIO streams did not close within ${r.delay/1e3} seconds of the exit event from process '${r.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;r._debug(s)}r._setResult()}}}),require_exec=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(j,k,l,m){if(m===void 0)m=l;Object.defineProperty(j,m,{enumerable:!0,get:function(){return k[l]}})}:function(j,k,l,m){if(m===void 0)m=l;j[m]=k[l]}),c=exports&&exports.__setModuleDefault||(Object.create?function(j,k){Object.defineProperty(j,"default",{enumerable:!0,value:k})}:function(j,k){j["default"]=k}),d=exports&&exports.__importStar||function(j){if(j&&j.__esModule)return j;var k={};if(j!=null){for(var l in j)if(l!=="default"&&Object.hasOwnProperty.call(j,l))b(k,j,l)}c(k,j);return k},e=exports&&exports.__awaiter||function(j,k,l,m){function n(o){return o instanceof l?o:new l(function(p){p(o)})}return new (l||(l=Promise))(function(o,p){function q(t){try{s(m.next(t))}catch(u){p(u)}}function r(t){try{s(m["throw"](t))}catch(u){p(u)}}function s(t){t.done?o(t.value):n(t.value).then(q,r)}s((m=m.apply(j,k||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.getExecOutput=exports.exec=void 0;const f=__require("string_decoder"),g=d(require_toolrunner());function h(j,k,l){return e(this,void 0,void 0,function*(){const m=g.argStringToArray(j);if(m.length===0)throw new Error("Parameter 'commandLine' cannot be null or empty.");const n=m[0];k=m.slice(1).concat(k||[]);const o=new g.ToolRunner(n,k,l);return o.exec()})}exports.exec=h;function i(j,k,l){var m,n;return e(this,void 0,void 0,function*(){let o="",p="";const q=new f.StringDecoder("utf8"),r=new f.StringDecoder("utf8"),s=(m=l===null||l===void 0?void 0:l.listeners)===null||m===void 0?void 0:m.stdout,t=(n=l===null||l===void 0?void 0:l.listeners)===null||n===void 0?void 0:n.stderr,u=(y)=>{if(p+=r.write(y),t)t(y)},v=(y)=>{if(o+=q.write(y),s)s(y)},w=Object.assign(Object.assign({},l===null||l===void 0?void 0:l.listeners),{stdout:v,stderr:u}),x=yield h(j,k,Object.assign(Object.assign({},l),{listeners:w}));o+=q.end();p+=r.end();return{exitCode:x,stdout:o,stderr:p}})}exports.getExecOutput=i}),require_platform=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(m,n,o,p){if(p===void 0)p=o;var q=Object.getOwnPropertyDescriptor(n,o);if(!q||("get"in q?!n.__esModule:q.writable||q.configurable))q={enumerable:!0,get:function(){return n[o]}};Object.defineProperty(m,p,q)}:function(m,n,o,p){if(p===void 0)p=o;m[p]=n[o]}),c=exports&&exports.__setModuleDefault||(Object.create?function(m,n){Object.defineProperty(m,"default",{enumerable:!0,value:n})}:function(m,n){m["default"]=n}),d=exports&&exports.__importStar||function(m){if(m&&m.__esModule)return m;var n={};if(m!=null){for(var o in m)if(o!=="default"&&Object.prototype.hasOwnProperty.call(m,o))b(n,m,o)}c(n,m);return n},e=exports&&exports.__awaiter||function(m,n,o,p){function q(r){return r instanceof o?r:new o(function(s){s(r)})}return new (o||(o=Promise))(function(r,s){function t(w){try{v(p.next(w))}catch(x){s(x)}}function u(w){try{v(p["throw"](w))}catch(x){s(x)}}function v(w){w.done?r(w.value):q(w.value).then(t,u)}v((p=p.apply(m,n||[])).next())})},f=exports&&exports.__importDefault||function(m){return m&&m.__esModule?m:{"default":m}};Object.defineProperty(exports,"__esModule",{value:true});exports.getDetails=exports.isLinux=exports.isMacOS=exports.isWindows=exports.arch=exports.platform=void 0;const g=f(__require("os")),h=d(require_exec()),i=()=>e(void 0,void 0,void 0,function*(){const {stdout:m}=yield h.getExecOutput("powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Version\"",void 0,{silent:!0}),{stdout:n}=yield h.getExecOutput("powershell -command \"(Get-CimInstance -ClassName Win32_OperatingSystem).Caption\"",void 0,{silent:!0});return{name:n.trim(),version:m.trim()}}),j=()=>e(void 0,void 0,void 0,function*(){var m,n,o,p;const {stdout:q}=yield h.getExecOutput("sw_vers",void 0,{silent:!0}),r=(n=(m=q.match(/ProductVersion:\s*(.+)/))===null||m===void 0?void 0:m[1])!==null&&n!==void 0?n:"",s=(p=(o=q.match(/ProductName:\s*(.+)/))===null||o===void 0?void 0:o[1])!==null&&p!==void 0?p:"";return{name:s,version:r}}),k=()=>e(void 0,void 0,void 0,function*(){const {stdout:m}=yield h.getExecOutput("lsb_release",["-i","-r","-s"],{silent:!0}),[n,o]=m.trim().split("\n");return{name:n,version:o}});exports.platform=g.default.platform();exports.arch=g.default.arch();exports.isWindows=exports.platform==="win32";exports.isMacOS=exports.platform==="darwin";exports.isLinux=exports.platform==="linux";function l(){return e(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield exports.isWindows?i():exports.isMacOS?j():k()),{platform:exports.platform,arch:exports.arch,isWindows:exports.isWindows,isMacOS:exports.isMacOS,isLinux:exports.isLinux})})}exports.getDetails=l}),require_core=__commonJSMin((exports)=>{var b=exports&&exports.__createBinding||(Object.create?function(K,Bd,Cd,Dd){if(Dd===void 0)Dd=Cd;var Ed=Object.getOwnPropertyDescriptor(Bd,Cd);if(!Ed||("get"in Ed?!Bd.__esModule:Ed.writable||Ed.configurable))Ed={enumerable:!0,get:function(){return Bd[Cd]}};Object.defineProperty(K,Dd,Ed)}:function(K,Bd,Cd,Dd){if(Dd===void 0)Dd=Cd;K[Dd]=Bd[Cd]}),c=exports&&exports.__setModuleDefault||(Object.create?function(K,Bd){Object.defineProperty(K,"default",{enumerable:!0,value:Bd})}:function(K,Bd){K["default"]=Bd}),d=exports&&exports.__importStar||function(K){if(K&&K.__esModule)return K;var Bd={};if(K!=null){for(var Cd in K)if(Cd!=="default"&&Object.prototype.hasOwnProperty.call(K,Cd))b(Bd,K,Cd)}c(Bd,K);return Bd},e=exports&&exports.__awaiter||function(K,Bd,Cd,Dd){function Ed(L){return L instanceof Cd?L:new Cd(function(M){M(L)})}return new (Cd||(Cd=Promise))(function(L,M){function N(Fd){try{P(Dd.next(Fd))}catch(Q){M(Q)}}function O(Fd){try{P(Dd["throw"](Fd))}catch(Q){M(Q)}}function P(Fd){Fd.done?L(Fd.value):Ed(Fd.value).then(N,O)}P((Dd=Dd.apply(K,Bd||[])).next())})};Object.defineProperty(exports,"__esModule",{value:true});exports.platform=exports.toPlatformPath=exports.toWin32Path=exports.toPosixPath=exports.markdownSummary=exports.summary=exports.getIDToken=exports.getState=exports.saveState=exports.group=exports.endGroup=exports.startGroup=exports.info=exports.notice=exports.warning=exports.error=exports.debug=exports.isDebug=exports.setFailed=exports.setCommandEcho=exports.setOutput=exports.getBooleanInput=exports.getMultilineInput=exports.getInput=exports.addPath=exports.setSecret=exports.exportVariable=exports.ExitCode=void 0;const f=require_command(),g=require_file_command(),h=require_utils$1(),i=d(__require("os")),j=d(__require("path")),k=require_oidc_utils();var l;(function(K){K[K["Success"]=0]="Success",K[K["Failure"]=1]="Failure"})(l||(exports.ExitCode=l={}));function m(K,Bd){const Cd=(0,h.toCommandValue)(Bd);process.env[K]=Cd;const Dd=process.env["GITHUB_ENV"]||"";if(Dd)return(0,g.issueFileCommand)("ENV",(0,g.prepareKeyValueMessage)(K,Bd));(0,f.issueCommand)("set-env",{name:K},Cd)}exports.exportVariable=m;function n(K){(0,f.issueCommand)("add-mask",{},K)}exports.setSecret=n;function o(K){const Bd=process.env["GITHUB_PATH"]||"";if(Bd)(0,g.issueFileCommand)("PATH",K);else (0,f.issueCommand)("add-path",{},K);process.env["PATH"]=`${K}${j.delimiter}${process.env["PATH"]}`}exports.addPath=o;function p(K,Bd){const Cd=process.env[`INPUT_${K.replace(/ /g,"_").toUpperCase()}`]||"";if(Bd&&Bd.required&&!Cd)throw new Error(`Input required and not supplied: ${K}`);if(Bd&&Bd.trimWhitespace===!1)return Cd;return Cd.trim()}exports.getInput=p;function q(K,Bd){const Cd=p(K,Bd).split("\n").filter((Dd)=>Dd!=="");if(Bd&&Bd.trimWhitespace===!1)return Cd;return Cd.map((Dd)=>Dd.trim())}exports.getMultilineInput=q;function r(K,Bd){const Cd=["true","True","TRUE"],Dd=["false","False","FALSE"],Ed=p(K,Bd);if(Cd.includes(Ed))return!0;if(Dd.includes(Ed))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${K}\n`+"Support boolean input list: `true | True | TRUE | false | False | FALSE`")}exports.getBooleanInput=r;function s(K,Bd){const Cd=process.env["GITHUB_OUTPUT"]||"";if(Cd)return(0,g.issueFileCommand)("OUTPUT",(0,g.prepareKeyValueMessage)(K,Bd));process.stdout.write(i.EOL);(0,f.issueCommand)("set-output",{name:K},(0,h.toCommandValue)(Bd))}exports.setOutput=s;function t(K){(0,f.issue)("echo",K?"on":"off")}exports.setCommandEcho=t;function u(K){process.exitCode=l.Failure,x(K)}exports.setFailed=u;function v(){return process.env["RUNNER_DEBUG"]==="1"}exports.isDebug=v;function w(K){(0,f.issueCommand)("debug",{},K)}exports.debug=w;function x(K,Bd={}){(0,f.issueCommand)("error",(0,h.toCommandProperties)(Bd),K instanceof Error?K.toString():K)}exports.error=x;function y(K,Bd={}){(0,f.issueCommand)("warning",(0,h.toCommandProperties)(Bd),K instanceof Error?K.toString():K)}exports.warning=y;function z(K,Bd={}){(0,f.issueCommand)("notice",(0,h.toCommandProperties)(Bd),K instanceof Error?K.toString():K)}exports.notice=z;function A(K){process.stdout.write(K+i.EOL)}exports.info=A;function B(K){(0,f.issue)("group",K)}exports.startGroup=B;function C(){(0,f.issue)("endgroup")}exports.endGroup=C;function D(K,Bd){return e(this,void 0,void 0,function*(){B(K);let Cd;try{Cd=yield Bd()}finally{C()}return Cd})}exports.group=D;function E(K,Bd){const Cd=process.env["GITHUB_STATE"]||"";if(Cd)return(0,g.issueFileCommand)("STATE",(0,g.prepareKeyValueMessage)(K,Bd));(0,f.issueCommand)("save-state",{name:K},(0,h.toCommandValue)(Bd))}exports.saveState=E;function F(K){return process.env[`STATE_${K}`]||""}exports.getState=F;function G(K){return e(this,void 0,void 0,function*(){return yield k.OidcClient.getIDToken(K)})}exports.getIDToken=G;var H=require_summary();Object.defineProperty(exports,"summary",{enumerable:true,get:function(){return H.summary}});var I=require_summary();Object.defineProperty(exports,"markdownSummary",{enumerable:true,get:function(){return I.markdownSummary}});var J=require_path_utils();Object.defineProperty(exports,"toPosixPath",{enumerable:true,get:function(){return J.toPosixPath}});Object.defineProperty(exports,"toWin32Path",{enumerable:true,get:function(){return J.toWin32Path}});Object.defineProperty(exports,"toPlatformPath",{enumerable:true,get:function(){return J.toPlatformPath}});exports.platform=d(require_platform())});const ANSI_BACKGROUND_OFFSET=10,wrapAnsi16=(a=0)=>(b)=>`\u001B[${b+a}m`,wrapAnsi256=(a=0)=>(b)=>`\u001B[${38+a};5;${b}m`,wrapAnsi16m=(a=0)=>(b,c,d)=>`\u001B[${38+a};2;${b};${c};${d}m`,styles$1={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},modifierNames=Object.keys(styles$1.modifier),foregroundColorNames=Object.keys(styles$1.color),backgroundColorNames=Object.keys(styles$1.bgColor),colorNames=[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){const a=new Map();for(const [b,c]of Object.entries(styles$1)){for(const [d,e]of Object.entries(c))styles$1[d]={open:`\u001B[${e[0]}m`,close:`\u001B[${e[1]}m`},c[d]=styles$1[d],a.set(e[0],e[1]);Object.defineProperty(styles$1,b,{value:c,enumerable:!1})}Object.defineProperty(styles$1,"codes",{value:a,enumerable:!1});styles$1.color.close="\x1B[39m";styles$1.bgColor.close="\x1B[49m";styles$1.color.ansi=wrapAnsi16();styles$1.color.ansi256=wrapAnsi256();styles$1.color.ansi16m=wrapAnsi16m();styles$1.bgColor.ansi=wrapAnsi16(ANSI_BACKGROUND_OFFSET);styles$1.bgColor.ansi256=wrapAnsi256(ANSI_BACKGROUND_OFFSET);styles$1.bgColor.ansi16m=wrapAnsi16m(ANSI_BACKGROUND_OFFSET);Object.defineProperties(styles$1,{rgbToAnsi256:{value(b,c,d){if(b===c&&c===d){if(b<8)return 16;if(b>248)return 231;return Math.round((b-8)/247*24)+232}return 16+36*Math.round(b/255*5)+6*Math.round(c/255*5)+Math.round(d/255*5)},enumerable:!1},hexToRgb:{value(b){const c=/[a-f\d]{6}|[a-f\d]{3}/i.exec(b.toString(16));if(!c)return[0,0,0];let [d]=c;if(d.length===3)d=[...d].map((f)=>f+f).join("");const e=Number.parseInt(d,16);return[e>>16&255,e>>8&255,e&255]},enumerable:!1},hexToAnsi256:{value:(b)=>styles$1.rgbToAnsi256(...styles$1.hexToRgb(b)),enumerable:!1},ansi256ToAnsi:{value(b){if(b<8)return 30+b;if(b<16)return 90+(b-8);let c,d,e;if(b>=232)c=((b-232)*10+8)/255,d=c,e=c;else{b-=16;const h=b%36;c=Math.floor(b/36)/5;d=Math.floor(h/6)/5;e=h%6/5}const f=Math.max(c,d,e)*2;if(f===0)return 30;let g=30+(Math.round(e)<<2|Math.round(d)<<1|Math.round(c));if(f===2)g+=60;return g},enumerable:!1},rgbToAnsi:{value:(b,c,d)=>styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(b,c,d)),enumerable:!1},hexToAnsi:{value:(b)=>styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(b)),enumerable:!1}});return styles$1}const ansiStyles=assembleStyles();var ansi_styles_default=ansiStyles;function hasFlag(a,b=globalThis.Deno?globalThis.Deno.args:process$1.argv){const c=a.startsWith("-")?"":a.length===1?"-":"--",d=b.indexOf(c+a),e=b.indexOf("--");return d!==-1&&(e===-1||d=2,has16m:a>=3}}function _supportsColor(a,{streamIsTTY:b,sniffFlags:c=!0}={}){const d=envForceColor();if(d!==void 0)flagForceColor=d;const e=c?flagForceColor:d;if(e===0)return 0;if(c){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor"))return 3;if(hasFlag("color=256"))return 2}if("TF_BUILD"in env&&"AGENT_NAME"in env)return 1;if(a&&!b&&e===void 0)return 0;const f=e||0;if(env.TERM==="dumb")return f;if(process$1.platform==="win32"){const g=os.release().split(".");if(Number(g[0])>=10&&Number(g[2])>=10586)return Number(g[2])>=14931?3:2;return 1}if("CI"in env){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((g)=>g in env))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((g)=>g in env)||env.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in env)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if(env.COLORTERM==="truecolor")return 3;if(env.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in env){const g=Number.parseInt((env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(env.TERM_PROGRAM){case "iTerm.app":return g>=3?3:2;case "Apple_Terminal":return 2}}if(/-256(color)?$/i.test(env.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM))return 1;if("COLORTERM"in env)return 1;return f}function createSupportsColor(a,b={}){const c=_supportsColor(a,{streamIsTTY:a&&a.isTTY,...b});return translateLevel(c)}const supportsColor={stdout:createSupportsColor({isTTY:tty.isatty(1)}),stderr:createSupportsColor({isTTY:tty.isatty(2)})};var supports_color_default=supportsColor;function stringReplaceAll(a,b,c){let d=a.indexOf(b);if(d===-1)return a;const e=b.length;let f=0,g="";do g+=a.slice(f,d)+b+c,f=d+e,d=a.indexOf(b,f);while(d!==-1);g+=a.slice(f);return g}function stringEncaseCRLFWithFirstIndex(a,b,c,d){let e=0,f="";do {const g=a[d-1]==="\r";f+=a.slice(e,g?d-1:d)+b+(g?"\r\n":"\n")+c;e=d+1;d=a.indexOf("\n",e)}while(d!==-1);f+=a.slice(e);return f}const {stdout:stdoutColor,stderr:stderrColor}=supports_color_default,GENERATOR=Symbol("GENERATOR"),STYLER=Symbol("STYLER"),IS_EMPTY=Symbol("IS_EMPTY"),levelMapping=["ansi","ansi","ansi256","ansi16m"],styles=Object.create(null),applyOptions=(a,b={})=>{if(b.level&&!(Number.isInteger(b.level)&&b.level>=0&&b.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const c=stdoutColor?stdoutColor.level:0;a.level=b.level===void 0?c:b.level};var Chalk=class{constructor(a){return chalkFactory(a)}};const chalkFactory=(a)=>{const b=(...c)=>c.join(" ");applyOptions(b,a);Object.setPrototypeOf(b,createChalk.prototype);return b};function createChalk(a){return chalkFactory(a)}Object.setPrototypeOf(createChalk.prototype,Function.prototype);for(const [a,b]of Object.entries(ansi_styles_default))styles[a]={get(){const c=createBuilder(this,createStyler(b.open,b.close,this[STYLER]),this[IS_EMPTY]);Object.defineProperty(this,a,{value:c});return c}};styles.visible={get(){const a=createBuilder(this,this[STYLER],!0);Object.defineProperty(this,"visible",{value:a});return a}};const getModelAnsi=(a,b,c,...d)=>{if(a==="rgb"){if(b==="ansi16m")return ansi_styles_default[c].ansi16m(...d);if(b==="ansi256")return ansi_styles_default[c].ansi256(ansi_styles_default.rgbToAnsi256(...d));return ansi_styles_default[c].ansi(ansi_styles_default.rgbToAnsi(...d))}if(a==="hex")return getModelAnsi("rgb",b,c,...ansi_styles_default.hexToRgb(...d));return ansi_styles_default[c][a](...d)},usedModels=["rgb","hex","ansi256"];for(const a of usedModels){styles[a]={get(){const {level:c}=this;return function(...d){const e=createStyler(getModelAnsi(a,levelMapping[c],"color",...d),ansi_styles_default.color.close,this[STYLER]);return createBuilder(this,e,this[IS_EMPTY])}}};const b="bg"+a[0].toUpperCase()+a.slice(1);styles[b]={get(){const {level:c}=this;return function(...d){const e=createStyler(getModelAnsi(a,levelMapping[c],"bgColor",...d),ansi_styles_default.bgColor.close,this[STYLER]);return createBuilder(this,e,this[IS_EMPTY])}}}}const proto=Object.defineProperties(()=>{},{...styles,level:{enumerable:!0,get(){return this[GENERATOR].level},set(a){this[GENERATOR].level=a}}}),createStyler=(a,b,c)=>{let d,e;if(c===void 0)d=a,e=b;else d=c.openAll+a,e=b+c.closeAll;return{open:a,close:b,openAll:d,closeAll:e,parent:c}},createBuilder=(a,b,c)=>{const d=(...e)=>applyStyle(d,e.length===1?""+e[0]:e.join(" "));Object.setPrototypeOf(d,proto);d[GENERATOR]=a;d[STYLER]=b;d[IS_EMPTY]=c;return d},applyStyle=(a,b)=>{if(a.level<=0||!b)return a[IS_EMPTY]?"":b;let c=a[STYLER];if(c===void 0)return b;const {openAll:d,closeAll:e}=c;if(b.includes("\x1B"))while(c!==void 0)b=stringReplaceAll(b,c.close,c.open),c=c.parent;const f=b.indexOf("\n");if(f!==-1)b=stringEncaseCRLFWithFirstIndex(b,e,d,f);return d+b+e};Object.defineProperties(createChalk.prototype,styles);const chalk$1=createChalk(),chalkStderr=createChalk({level:stderrColor?stderrColor.level:0}),TOOLKIT_LOG_LEVEL=process.env.TOOLKIT_LOG_LEVEL||"info",chalk=new Chalk({...(!!process.env.CI||!!process.env.VITEST)&&{level:2}});var LogLevel;(function(a){a["ERROR"]="ERROR",a["INFO"]="INFO",a["WARNING"]="WARN",a["DEBUG"]="DEBUG"})(LogLevel||(LogLevel={}));const getLogColor=(a)=>{switch(a){case LogLevel.INFO:return chalk.green;case LogLevel.ERROR:return chalk.red;case LogLevel.WARNING:return chalk.yellow;case LogLevel.DEBUG:return chalk.magenta}},getMessageWithPrefix=(a,b)=>`[${chalk.blue(new Date().toISOString())}] ${getLogColor(b)(b)} ${a}`,prettifyMessage=(a)=>{if(a instanceof Error)return a.message.concat("\n",a.stack);else if(typeof a==="string")return a;return JSON.stringify(a,null,2)},writeConsole=(a,b=LogLevel.INFO)=>{const c=prettifyMessage(a).split("\n").map((d)=>getMessageWithPrefix(d,b)).join("\n");if(b===LogLevel.INFO||b===LogLevel.DEBUG&&TOOLKIT_LOG_LEVEL==="debug")process.stdout.write(c.concat("\n"));else if(b===LogLevel.ERROR||b===LogLevel.WARNING)process.stderr.write(c.concat("\n"))};var import_core=__toESM(require_core(),1);const IGNORED_BRANCHES=import_core.getInput("branchesToIgnore",{required:!1}).split(","),mainBranch=`origin/${import_core.getInput("mainBranch",{required:!1})}`,CI_TOKEN=import_core.getInput("ciToken",{required:!1,trimWhitespace:!0}),{GITHUB_SERVER_URL}=process.env;var Action=function(a){return a[a["Rebase"]=0]="Rebase",a[a["Reset"]=1]="Reset",a}(Action||{});const runGitCommand=(a,b)=>(writeConsole(`Running git command: git ${a.join(" ")}`),new Promise((c,d)=>{const e=spawn("git",a,{stdio:"pipe",...b});let f="",g="";e.stdout.on("data",(h)=>f+=h.toString());e.stderr.on("data",(h)=>g+=h.toString());e.on("close",(h)=>h===0?c(f):d(new Error(`Git command failed with code ${h}: ${g}`)))})),fetchBranches=async()=>{writeConsole("Fetching all branches...");await runGitCommand(["fetch","--all"]);const a=await runGitCommand(["branch","-r"]);return a.split("\n").map((b)=>b.trim()).filter((b)=>!IGNORED_BRANCHES.includes(b.replace("origin/",""))&&b!=="")},getCommitsForBranch=async(a)=>{const b=await runGitCommand(["rev-list",a]);return new Set(b.split("\n").filter(Boolean))},removeIgnoredBranches=(a)=>{let b={};for(const [c,d]of Object.entries(a)){if(d.ignore)continue;b[c]=d}return b},buildRebaseDependencyGraph=async(a)=>{const b={};for(const d of a)b[d]=await getCommitsForBranch(d),writeConsole(`Commits ${d}`,LogLevel.DEBUG),writeConsole(b[d],LogLevel.DEBUG);let c={};for(const d of a)for(const e of a){if(d!==e)continue;const f=b[d].isSupersetOf(b[e]);if(!f)continue;const g=b[d].difference(b[e]);if(e===mainBranch)c[d]={ignore:!0};if(g.size===0){const h=c[d]?.equalBranches??[];c[d]={rebaseBranch:mainBranch,...c[d],equalBranches:[...h,e]}}else if(d!==mainBranch&&(!c[d]||c[d].differenceWithRebase>g.size))c[d]={...c[d],rebaseBranch:e,differenceWithRebase:g.size}}for(const d of a){if(d!==mainBranch)continue;c[d]=c[d]??{rebaseBranch:mainBranch,differenceWithRebase:0}}return removeIgnoredBranches(c)},rebaseOrder=(a)=>{writeConsole("Order everything",LogLevel.DEBUG);let b=[];for(const c of Object.keys(a)){const d=b.find((e)=>a[c].equalBranches?.some((f)=>f===e.branch));if(d)b.push({branch:c,onBranch:d.branch,action:Action.Reset});else b.push({branch:c,onBranch:a[c].rebaseBranch,action:Action.Rebase})}b=b.sort((c,d)=>{const e=a[c.branch].differenceWithRebase,f=a[d.branch].differenceWithRebase;return e-f});b=b.sort((c,d)=>c.action-d.action);return b},rebaseBranch=async({branch:a,onBranch:b,action:c})=>{writeConsole(`${c===Action.Rebase?"Rebasing":"Resetting"} ${a} on ${b}`);await runGitCommand(["checkout",a.replace("origin/","")]);if(c===Action.Rebase)await runGitCommand(["rebase",b]).catch(async(d)=>{writeConsole(`Failed to rebase ${a} on ${b}`,LogLevel.WARNING),writeConsole(d,LogLevel.WARNING),await runGitCommand(["rebase","--abort"])});else if(c===Action.Reset)await runGitCommand(["reset","--hard",b]);await runGitCommand(["push","--force-with-lease"])},setupCIToken=async()=>{writeConsole("Overriding git repository auth with CI_TOKEN");const a=await runGitCommand(["remote","get-url","origin"]),b=a.trim().replace(/https?:\/\//,""),c=`https://MilaBot:${CI_TOKEN}@${b}.git`;await runGitCommand(["remote","set-url","origin",c]);await runGitCommand(["config","--local","--unset",`http.https://${GITHUB_SERVER_URL.replace(/https?:\/\//,"")}/.extraheader`])},setupAutoRebaseGit=async()=>{if(CI_TOKEN)await setupCIToken();else writeConsole("Couldn't find a CI_TOKEN. Using the gitea ghost.",LogLevel.WARNING);await runGitCommand(["config","user.email","auto-rebase@skydust.fr"]);await runGitCommand(["config","user.name","Auto Rebase"])},main=async()=>{try{writeConsole("Setup auto rebase");await setupAutoRebaseGit();const a=await fetchBranches();a.push(mainBranch);writeConsole("Branches");writeConsole(a);writeConsole("Determining dependencies...");const b=await buildRebaseDependencyGraph(a);writeConsole(b,LogLevel.DEBUG);const c=rebaseOrder(b);if(c.length===0)writeConsole("Nothing to rebase");else writeConsole("Rebase order"),writeConsole(c);for(const d of c)await rebaseBranch(d)}catch(a){writeConsole("Error during workflow execution",LogLevel.ERROR),writeConsole(a,LogLevel.ERROR),process.exit(1)}};main(); \ No newline at end of file