=p,r.pending=Ab(r,e));if(f)return;let h=E(d),A=B(o),p=B(l);t.onHeaders?.(s,A,I,Q(s)),t.onData?.(Buffer.from(h)),t.onComplete?.(p),w(r,i)}function I(){}return t.onConnect?.(y,null),"number"==typeof d&&d>0?m=setTimeout(()=>{m=null,b(this[n])},d):b(this[n]),!0}function S(){let e=this[s],t=this[o],i=this[a];return function(n,s){if(e.isMockActive)try{x.call(this,n,s)}catch(a){if("UND_MOCK_ERR_MOCK_NOT_MATCHED"===a.code){let o=e[l]();if(!1===o)throw new r(`${a.message}: subsequent request to origin ${t} was not allowed (net.connect disabled)`);if(k(o,t))i.call(this,n,s);else throw new r(`${a.message}: subsequent request to origin ${t} was not allowed (net.connect is not enabled for this origin)`)}else throw a}else i.call(this,n,s)}}function k(e,t){let i=new URL(t);return!0===e||!!(Array.isArray(e)&&e.some(e=>A(e,i.host)))}t.exports={getResponseData:E,getMockDispatch:C,addMockDispatch:function(e,t,i,r){let n={timesInvoked:0,times:1,persist:!1,consumed:!1,...r},s="function"==typeof i?{callback:i}:{...i},a={...n,...t,pending:!0,data:{error:null,...s}};return e.push(a),a},deleteMockDispatch:w,buildKey:v,generateKeyValues:B,matchValue:A,getResponse:async function(e){let t=[];for await(let i of e)t.push(i);return Buffer.concat(t).toString("utf8")},getStatusText:Q,mockDispatch:x,buildMockDispatch:S,checkNetConnect:k,buildAndValidateMockOptions:function(e){let{agent:t,...i}=e;if("enableCallHistory"in i&&"boolean"!=typeof i.enableCallHistory)throw new h("options.enableCallHistory must to be a boolean");if("acceptNonStandardSearchParameters"in i&&"boolean"!=typeof i.acceptNonStandardSearchParameters)throw new h("options.acceptNonStandardSearchParameters must to be a boolean");if("ignoreTrailingSlash"in i&&"boolean"!=typeof i.ignoreTrailingSlash)throw new h("options.ignoreTrailingSlash must to be a boolean");return i},getHeaderByName:f,buildHeadersFromArray:g,normalizeSearchParams:function(e){if("string"!=typeof e)return e;let t=new URLSearchParams(e),i=new URLSearchParams;for(let[e,r]of t.entries()){if(e=e.replace("[]",""),/^(['"]).*\1$/.test(r)){i.append(e,r);continue}if(r.includes(",")){for(let t of r.split(","))i.append(e,t);continue}i.append(e,r)}return i},normalizeOrigin:function(e){return"string"==typeof e||e instanceof URL?e instanceof URL?e.origin:e.toLowerCase():e}}},862710,(e,t,i)=>{"use strict";let{getResponseData:r,buildKey:n,addMockDispatch:s}=e.r(682708),{kDispatches:a,kDispatchKey:o,kDefaultHeaders:l,kDefaultTrailers:c,kContentLength:d,kMockDispatch:u,kIgnoreTrailingSlash:h}=e.r(688525),{InvalidArgumentError:A}=e.r(450178),{serializePathWithQuery:p}=e.r(122857);class f{constructor(e){this[u]=e}delay(e){if("number"!=typeof e||!Number.isInteger(e)||e<=0)throw new A("waitInMs must be a valid integer > 0");return this[u].delay=e,this}persist(){return this[u].persist=!0,this}times(e){if("number"!=typeof e||!Number.isInteger(e)||e<=0)throw new A("repeatTimes must be a valid integer > 0");return this[u].times=e,this}}class g{constructor(e,t){if("object"!=typeof e)throw new A("opts must be an object");if(void 0===e.path)throw new A("opts.path must be defined");if(void 0===e.method&&(e.method="GET"),"string"==typeof e.path)if(e.query)e.path=p(e.path,e.query);else{const t=new URL(e.path,"data://");e.path=t.pathname+t.search}"string"==typeof e.method&&(e.method=e.method.toUpperCase()),this[o]=n(e),this[a]=t,this[h]=e.ignoreTrailingSlash??!1,this[l]={},this[c]={},this[d]=!1}createMockScopeDispatchData({statusCode:e,data:t,responseOptions:i}){let n=r(t),s=this[d]?{"content-length":n.length}:{};return{statusCode:e,data:t,headers:{...this[l],...s,...i.headers},trailers:{...this[c],...i.trailers}}}validateReplyParameters(e){if(void 0===e.statusCode)throw new A("statusCode must be defined");if("object"!=typeof e.responseOptions||null===e.responseOptions)throw new A("responseOptions must be an object")}reply(e){if("function"==typeof e){let t=t=>{let i=e(t);if("object"!=typeof i||null===i)throw new A("reply options callback must return an object");let r={data:"",responseOptions:{},...i};return this.validateReplyParameters(r),{...this.createMockScopeDispatchData(r)}};return new f(s(this[a],this[o],t,{ignoreTrailingSlash:this[h]}))}let t={statusCode:e,data:void 0===arguments[1]?"":arguments[1],responseOptions:void 0===arguments[2]?{}:arguments[2]};this.validateReplyParameters(t);let i=this.createMockScopeDispatchData(t);return new f(s(this[a],this[o],i,{ignoreTrailingSlash:this[h]}))}replyWithError(e){if(void 0===e)throw new A("error must be defined");return new f(s(this[a],this[o],{error:e},{ignoreTrailingSlash:this[h]}))}defaultReplyHeaders(e){if(void 0===e)throw new A("headers must be defined");return this[l]=e,this}defaultReplyTrailers(e){if(void 0===e)throw new A("trailers must be defined");return this[c]=e,this}replyContentLength(){return this[d]=!0,this}}t.exports.MockInterceptor=g,t.exports.MockScope=f},102729,(e,t,i)=>{"use strict";let{promisify:r}=e.r(812057),n=e.r(217365),{buildMockDispatch:s}=e.r(682708),{kDispatches:a,kMockAgent:o,kClose:l,kOriginalClose:c,kOrigin:d,kOriginalDispatch:u,kConnected:h,kIgnoreTrailingSlash:A}=e.r(688525),{MockInterceptor:p}=e.r(862710),f=e.r(954673),{InvalidArgumentError:g}=e.r(450178);class m extends n{constructor(e,t){if(!t||!t.agent||"function"!=typeof t.agent.dispatch)throw new g("Argument opts.agent must implement Agent");super(e,t),this[o]=t.agent,this[d]=e,this[A]=t.ignoreTrailingSlash??!1,this[a]=[],this[h]=1,this[u]=this.dispatch,this[c]=this.close.bind(this),this.dispatch=s.call(this),this.close=this[l]}get[f.kConnected](){return this[h]}intercept(e){return new p(e&&{ignoreTrailingSlash:this[A],...e},this[a])}cleanMocks(){this[a]=[]}async [l](){await r(this[c])(),this[h]=0,this[o][f.kClients].delete(this[d])}}t.exports=m},406177,(e,t,i)=>{"use strict";let{kMockCallHistoryAddLog:r}=e.r(688525),{InvalidArgumentError:n}=e.r(450178);function s(e,t,i,r){switch(t.operator){case"OR":return r.push(...i(e)),r;case"AND":return i.call({logs:r},e);default:throw new n("options.operator must to be a case insensitive string equal to 'OR' or 'AND'")}}function a(e={}){let t={};if("operator"in e){if("string"!=typeof e.operator||"OR"!==e.operator.toUpperCase()&&"AND"!==e.operator.toUpperCase())throw new n("options.operator must to be a case insensitive string equal to 'OR' or 'AND'");return{...t,operator:e.operator.toUpperCase()}}return t}function o(e){return t=>{if("string"==typeof t||null==t)return this.logs.filter(i=>i[e]===t);if(t instanceof RegExp)return this.logs.filter(i=>t.test(i[e]));throw new n(`${e} parameter should be one of string, regexp, undefined or null`)}}function l(e){try{let t=new URL(e.path,e.origin);if(0!==t.search.length)return t;return t.search=new URLSearchParams(e.query).toString(),t}catch(e){throw new n("An error occurred when computing MockCallHistoryLog.url",{cause:e})}}class c{constructor(e={}){this.body=e.body,this.headers=e.headers,this.method=e.method;const t=l(e);this.fullUrl=t.toString(),this.origin=t.origin,this.path=t.pathname,this.searchParams=Object.fromEntries(t.searchParams),this.protocol=t.protocol,this.host=t.host,this.port=t.port,this.hash=t.hash}toMap(){return new Map([["protocol",this.protocol],["host",this.host],["port",this.port],["origin",this.origin],["path",this.path],["hash",this.hash],["searchParams",this.searchParams],["fullUrl",this.fullUrl],["method",this.method],["body",this.body],["headers",this.headers]])}toString(){let e="->",t="|",i="";return this.toMap().forEach((r,n)=>{("string"==typeof r||null==r)&&(i=`${i}${n}${e}${r}${t}`),("object"==typeof r&&null!==r||Array.isArray(r))&&(i=`${i}${n}${e}${JSON.stringify(r)}${t}`)}),i.slice(0,-1)}}class d{logs=[];calls(){return this.logs}firstCall(){return this.logs.at(0)}lastCall(){return this.logs.at(-1)}nthCall(e){if("number"!=typeof e)throw new n("nthCall must be called with a number");if(!Number.isInteger(e))throw new n("nthCall must be called with an integer");if(1!==Math.sign(e))throw new n("nthCall must be called with a positive value. use firstCall or lastCall instead");return this.logs.at(e-1)}filterCalls(e,t){if(0===this.logs.length)return this.logs;if("function"==typeof e)return this.logs.filter(e);if(e instanceof RegExp)return this.logs.filter(t=>e.test(t.toString()));if("object"==typeof e&&null!==e){if(0===Object.keys(e).length)return this.logs;let i={operator:"OR",...a(t)},r=[];return"protocol"in e&&(r=s(e.protocol,i,this.filterCallsByProtocol,r)),"host"in e&&(r=s(e.host,i,this.filterCallsByHost,r)),"port"in e&&(r=s(e.port,i,this.filterCallsByPort,r)),"origin"in e&&(r=s(e.origin,i,this.filterCallsByOrigin,r)),"path"in e&&(r=s(e.path,i,this.filterCallsByPath,r)),"hash"in e&&(r=s(e.hash,i,this.filterCallsByHash,r)),"fullUrl"in e&&(r=s(e.fullUrl,i,this.filterCallsByFullUrl,r)),"method"in e&&(r=s(e.method,i,this.filterCallsByMethod,r)),[...new Set(r)]}throw new n("criteria parameter should be one of function, regexp, or object")}filterCallsByProtocol=o.call(this,"protocol");filterCallsByHost=o.call(this,"host");filterCallsByPort=o.call(this,"port");filterCallsByOrigin=o.call(this,"origin");filterCallsByPath=o.call(this,"path");filterCallsByHash=o.call(this,"hash");filterCallsByFullUrl=o.call(this,"fullUrl");filterCallsByMethod=o.call(this,"method");clear(){this.logs=[]}[r](e){let t=new c(e);return this.logs.push(t),t}*[Symbol.iterator](){for(let e of this.calls())yield e}}t.exports.MockCallHistory=d,t.exports.MockCallHistoryLog=c},509805,(e,t,i)=>{"use strict";let{promisify:r}=e.r(812057),n=e.r(682850),{buildMockDispatch:s}=e.r(682708),{kDispatches:a,kMockAgent:o,kClose:l,kOriginalClose:c,kOrigin:d,kOriginalDispatch:u,kConnected:h,kIgnoreTrailingSlash:A}=e.r(688525),{MockInterceptor:p}=e.r(862710),f=e.r(954673),{InvalidArgumentError:g}=e.r(450178);class m extends n{constructor(e,t){if(!t||!t.agent||"function"!=typeof t.agent.dispatch)throw new g("Argument opts.agent must implement Agent");super(e,t),this[o]=t.agent,this[d]=e,this[A]=t.ignoreTrailingSlash??!1,this[a]=[],this[h]=1,this[u]=this.dispatch,this[c]=this.close.bind(this),this.dispatch=s.call(this),this.close=this[l]}get[f.kConnected](){return this[h]}intercept(e){return new p(e&&{ignoreTrailingSlash:this[A],...e},this[a])}cleanMocks(){this[a]=[]}async [l](){await r(this[c])(),this[h]=0,this[o][f.kClients].delete(this[d])}}t.exports=m},200781,(e,t,i)=>{"use strict";let{Transform:r}=e.r(81111),{Console:n}=e.r(241293),s=process.versions.icu?"✅":"Y ",a=process.versions.icu?"❌":"N ";t.exports=class{constructor({disableColors:e}={}){this.transform=new r({transform(e,t,i){i(null,e)}}),this.logger=new n({stdout:this.transform,inspectOptions:{colors:!e&&!process.env.CI}})}format(e){let t=e.map(({method:e,path:t,data:{statusCode:i},persist:r,times:n,timesInvoked:o,origin:l})=>({Method:e,Origin:l,Path:t,"Status code":i,Persistent:r?s:a,Invocations:o,Remaining:r?1/0:n-o}));return this.logger.table(t),this.transform.read().toString()}}},665015,(e,t,i)=>{"use strict";let{kClients:r}=e.r(954673),n=e.r(542122),{kAgent:s,kMockAgentSet:a,kMockAgentGet:o,kDispatches:l,kIsMockActive:c,kNetConnect:d,kGetNetConnect:u,kOptions:h,kFactory:A,kMockAgentRegisterCallHistory:p,kMockAgentIsCallHistoryEnabled:f,kMockAgentAddCallHistoryLog:g,kMockAgentMockCallHistoryInstance:m,kMockAgentAcceptsNonStandardSearchParameters:y,kMockCallHistoryAddLog:b,kIgnoreTrailingSlash:E}=e.r(688525),C=e.r(102729),w=e.r(509805),{matchValue:I,normalizeSearchParams:v,buildAndValidateMockOptions:B,normalizeOrigin:Q}=e.r(682708),{InvalidArgumentError:x,UndiciError:S}=e.r(450178),k=e.r(10918),T=e.r(200781),{MockCallHistory:N}=e.r(406177);class D extends k{constructor(e={}){super(e);const t=B(e);if(this[d]=!0,this[c]=!0,this[f]=t.enableCallHistory??!1,this[y]=t.acceptNonStandardSearchParameters??!1,this[E]=t.ignoreTrailingSlash??!1,e?.agent&&"function"!=typeof e.agent.dispatch)throw new x("Argument opts.agent must implement Agent");const i=e?.agent?e.agent:new n(e);this[s]=i,this[r]=i[r],this[h]=t,this[f]&&this[p]()}get(e){let t=Q(e),i=this[E]?t.replace(/\/$/,""):t,r=this[o](i);return r||(r=this[A](i),this[a](i,r)),r}dispatch(e,t){e.origin=Q(e.origin),this.get(e.origin),this[g](e);let i=this[y],r={...e};if(i&&r.path){let[e,t]=r.path.split("?"),n=v(t,i);r.path=`${e}?${n}`}return this[s].dispatch(r,t)}async close(){this.clearCallHistory(),await this[s].close(),this[r].clear()}deactivate(){this[c]=!1}activate(){this[c]=!0}enableNetConnect(e){if("string"==typeof e||"function"==typeof e||e instanceof RegExp)Array.isArray(this[d])?this[d].push(e):this[d]=[e];else if(void 0===e)this[d]=!0;else throw new x("Unsupported matcher. Must be one of String|Function|RegExp.")}disableNetConnect(){this[d]=!1}enableCallHistory(){return this[f]=!0,this}disableCallHistory(){return this[f]=!1,this}getCallHistory(){return this[m]}clearCallHistory(){void 0!==this[m]&&this[m].clear()}get isMockActive(){return this[c]}[p](){void 0===this[m]&&(this[m]=new N)}[g](e){this[f]&&(this[p](),this[m][b](e))}[a](e,t){this[r].set(e,{count:0,dispatcher:t})}[A](e){let t=Object.assign({agent:this},this[h]);return this[h]&&1===this[h].connections?new C(e,t):new w(e,t)}[o](e){let t=this[r].get(e);if(t?.dispatcher)return t.dispatcher;if("string"!=typeof e){let t=this[A]("http://localhost:9999");return this[a](e,t),t}for(let[t,i]of Array.from(this[r]))if(i&&"string"!=typeof t&&I(t,e)){let t=this[A](e);return this[a](e,t),t[l]=i.dispatcher[l],t}}[u](){return this[d]}pendingInterceptors(){return Array.from(this[r].entries()).flatMap(([e,t])=>t.dispatcher[l].map(t=>({...t,origin:e}))).filter(({pending:e})=>e)}assertNoPendingInterceptors({pendingInterceptorsFormatter:e=new T}={}){let t=this.pendingInterceptors();if(0!==t.length)throw new S(1===t.length?`1 interceptor is pending:
${e.format(t)}`.trim():`${t.length} interceptors are pending:
${e.format(t)}`.trim())}}t.exports=D},38544,(e,t,i)=>{"use strict";let{InvalidArgumentError:r}=e.r(450178),{runtimeFeatures:n}=e.r(350022);function s(e={}){let{ignoreHeaders:t=[],excludeHeaders:i=[],matchHeaders:r=[],caseSensitive:n=!1}=e;return{ignore:new Set(t.map(e=>n?e:e.toLowerCase())),exclude:new Set(i.map(e=>n?e:e.toLowerCase())),match:new Set(r.map(e=>n?e:e.toLowerCase()))}}let a=n.has("crypto")?e.r(666680):null,o=a?.hash?e=>a.hash("sha256",e,"base64url"):e=>Buffer.from(e).toString("base64url");function l(e){return Array.isArray(e)&&(1&e.length)==0}function c(e){let t={};if(!e)return t;if(l(e)){for(let i=0;i!1:function(t){let i;for(let r of e)if("string"==typeof r){if(i||(i=t.toLowerCase()),i.includes(r.toLowerCase()))return!0}else if(r instanceof RegExp&&r.test(t))return!0;return!1}},validateSnapshotMode:function(e){if(!d.includes(e))throw new r(`Invalid snapshot mode: ${e}. Must be one of: ${d.join(", ")}`)}}},466020,(e,t,i)=>{"use strict";let{writeFile:r,readFile:n,mkdir:s}=e.r(912714),{dirname:a,resolve:o}=e.r(750227),{setTimeout:l,clearTimeout:c}=e.r(26910),{InvalidArgumentError:d,UndiciError:u}=e.r(450178),{hashId:h,isUrlExcludedFactory:A,normalizeHeaders:p,createHeaderFilters:f}=e.r(38544);function g(e,t,i={}){let r=new URL(e.path,e.origin),n=e._normalizedHeaders||p(e.headers);return e._normalizedHeaders||(e._normalizedHeaders=n),{method:e.method||"GET",url:!1!==i.matchQuery?r.toString():`${r.origin}${r.pathname}`,headers:m(n,t,i),body:!1!==i.matchBody&&e.body?String(e.body):""}}function m(e,t,i={}){if(!e||"object"!=typeof e)return{};let{caseSensitive:r=!1}=i,n={},{ignore:s,exclude:a,match:o}=t;for(let[t,i]of Object.entries(e)){let e=r?t:t.toLowerCase();!(a.has(e)||s.has(e))&&(0===o.size||o.has(e))&&(n[e]=i)}return n}function y(e,t,i={}){if(!e||"object"!=typeof e)return{};let{caseSensitive:r=!1}=i,n={},{exclude:s}=t;for(let[t,i]of Object.entries(e)){let e=r?t:t.toLowerCase();s.has(e)||(n[e]=i)}return n}function b(e){let t=[e.method,e.url];if(e.headers&&"object"==typeof e.headers)for(let i of Object.keys(e.headers).sort()){let r=Array.isArray(e.headers[i])?e.headers[i]:[e.headers[i]];for(let e of(t.push(i),r.sort()))t.push(String(e))}return t.push(e.body),h(t.join("|"))}class E{#B;#Q;#x=new Map;#S;#k=1/0;#T=!1;#N;constructor(e={}){this.#S=e.snapshotPath,this.#k=e.maxSnapshots||1/0,this.#T=e.autoFlush||!1,this.flushInterval=e.flushInterval||3e4,this._flushTimer=null,this.matchOptions={matchHeaders:e.matchHeaders||[],ignoreHeaders:e.ignoreHeaders||[],excludeHeaders:e.excludeHeaders||[],matchBody:!1!==e.matchBody,matchQuery:!1!==e.matchQuery,caseSensitive:e.caseSensitive||!1},this.#N=f(this.matchOptions),this.shouldRecord=e.shouldRecord||(()=>!0),this.shouldPlayback=e.shouldPlayback||(()=>!0),this.#Q=A(e.excludeUrls),this.#T&&this.#S&&this.#D()}async record(e,t){if(!this.shouldRecord(e)||this.isUrlExcluded(e))return;let i=g(e,this.#N,this.matchOptions),r=b(i),n=p(t.headers),s={statusCode:t.statusCode,headers:y(n,this.#N,this.matchOptions),body:Buffer.isBuffer(t.body)?t.body.toString("base64"):Buffer.from(String(t.body||"")).toString("base64"),trailers:t.trailers};if(this.#x.size>=this.#k&&!this.#x.has(r)){let e=this.#x.keys().next().value;this.#x.delete(e)}let a=this.#x.get(r);a&&a.responses?(a.responses.push(s),a.timestamp=new Date().toISOString()):this.#x.set(r,{request:i,responses:[s],callCount:0,timestamp:new Date().toISOString()}),this.#T&&this.#S&&this.#_()}isUrlExcluded(e){let t=new URL(e.path,e.origin).toString();return this.#Q(t)}findSnapshot(e){if(!this.shouldPlayback(e)||this.isUrlExcluded(e))return;let t=b(g(e,this.#N,this.matchOptions)),i=this.#x.get(t);if(!i)return;let r=i.callCount||0,n=Math.min(r,i.responses.length-1);return i.callCount=r+1,{...i,response:i.responses[n]}}async loadSnapshots(e){let t=e||this.#S;if(!t)throw new d("Snapshot path is required");try{let e=await n(o(t),"utf8"),i=JSON.parse(e);if(Array.isArray(i))for(let{hash:e,snapshot:t}of(this.#x.clear(),i))this.#x.set(e,t);else this.#x=new Map(Object.entries(i))}catch(e){if("ENOENT"===e.code)this.#x.clear();else throw new u(`Failed to load snapshots from ${t}`,{cause:e})}}async saveSnapshots(e){let t=e||this.#S;if(!t)throw new d("Snapshot path is required");let i=o(t);await s(a(i),{recursive:!0});let n=Array.from(this.#x.entries()).map(([e,t])=>({hash:e,snapshot:t}));await r(i,JSON.stringify(n,null,2),{flush:!0})}clear(){this.#x.clear()}getSnapshots(){return Array.from(this.#x.values())}size(){return this.#x.size}resetCallCounts(){for(let e of this.#x.values())e.callCount=0}deleteSnapshot(e){let t=b(g(e,this.#N,this.matchOptions));return this.#x.delete(t)}getSnapshotInfo(e){let t=b(g(e,this.#N,this.matchOptions)),i=this.#x.get(t);return i?{hash:t,request:i.request,responseCount:i.responses?i.responses.length:+!!i.response,callCount:i.callCount||0,timestamp:i.timestamp}:null}replaceSnapshots(e){if(this.#x.clear(),Array.isArray(e))for(let{hash:t,snapshot:i}of e)this.#x.set(t,i);else e&&"object"==typeof e&&(this.#x=new Map(Object.entries(e)))}#D(){return this.#_()}#R(){this.#B&&(c(this.#B),this.saveSnapshots().catch(()=>{}),this.#B=null)}#_(){this.#B=l(()=>{this.saveSnapshots().catch(()=>{}),this.#T?this.#B?.refresh():this.#B=null},1e3)}destroy(){this.#R(),this.#B&&(c(this.#B),this.#B=null)}async close(){this.#S&&0!==this.#x.size&&await this.saveSnapshots(),this.destroy()}}t.exports={SnapshotRecorder:E,formatRequestKey:g,createRequestHash:b,filterHeadersForMatching:m,filterHeadersForStorage:y,createHeaderFilters:f}},525281,(e,t,i)=>{"use strict";let r=e.r(542122),n=e.r(665015),{SnapshotRecorder:s}=e.r(466020),a=e.r(54128),{InvalidArgumentError:o,UndiciError:l}=e.r(450178),{validateSnapshotMode:c}=e.r(38544),d=Symbol("kSnapshotRecorder"),u=Symbol("kSnapshotMode"),h=Symbol("kSnapshotPath"),A=Symbol("kSnapshotLoaded"),p=Symbol("kRealAgent"),f=!1;class g extends n{constructor(e={}){f||(process.emitWarning("SnapshotAgent is experimental and subject to change","ExperimentalWarning"),f=!0);const{mode:t="record",snapshotPath:i=null,...n}=e;if(super(n),c(t),("playback"===t||"update"===t)&&!i)throw new o(`snapshotPath is required when mode is '${t}'`);this[u]=t,this[h]=i,this[d]=new s({snapshotPath:this[h],mode:this[u],maxSnapshots:e.maxSnapshots,autoFlush:e.autoFlush,flushInterval:e.flushInterval,matchHeaders:e.matchHeaders,ignoreHeaders:e.ignoreHeaders,excludeHeaders:e.excludeHeaders,matchBody:e.matchBody,matchQuery:e.matchQuery,caseSensitive:e.caseSensitive,shouldRecord:e.shouldRecord,shouldPlayback:e.shouldPlayback,excludeUrls:e.excludeUrls}),this[A]=!1,("record"===this[u]||"update"===this[u]||"playback"===this[u]&&e.excludeUrls&&e.excludeUrls.length>0)&&(this[p]=new r(e)),("playback"===this[u]||"update"===this[u])&&this[h]&&this.loadSnapshots().catch(()=>{})}dispatch(e,t){t=a.wrap(t);let i=this[u];if(this[d].isUrlExcluded(e))return this[p].dispatch(e,t);if("playback"===i||"update"===i){if(!this[A])return this.#L(e,t);let r=this[d].findSnapshot(e);if(r)return this.#F(r,t);{if("update"===i)return this.#M(e,t);let r=new l(`No snapshot found for ${e.method||"GET"} ${e.path}`);if(t.onError)return void t.onError(r);throw r}}if("record"===i)return this.#M(e,t)}async #L(e,t){return await this.loadSnapshots(),this.dispatch(e,t)}#M(e,t){let i={statusCode:null,headers:{},trailers:{},body:[]},r=this,n={onRequestStart(e,i){return t.onRequestStart(e,{...i,history:this.history})},onRequestUpgrade:(e,i,r,n)=>t.onRequestUpgrade(e,i,r,n),onResponseStart:(e,r,n,s)=>(i.statusCode=r,i.headers=n,t.onResponseStart(e,r,n,s)),onResponseData:(e,r)=>(i.body.push(r),t.onResponseData(e,r)),onResponseEnd(n,s){i.trailers=s;let a=Buffer.concat(i.body);r[d].record(e,{statusCode:i.statusCode,headers:i.headers,body:a,trailers:i.trailers}).then(()=>t.onResponseEnd(n,s)).catch(e=>t.onResponseError(n,e))}};return this[p].dispatch(e,n)}#F(e,t){try{let{response:i}=e,r={pause(){},resume(){},abort(e){this.aborted=!0,this.reason=e},aborted:!1,paused:!1};t.onRequestStart(r),t.onResponseStart(r,i.statusCode,i.headers);let n=Buffer.from(i.body,"base64");t.onResponseData(r,n),t.onResponseEnd(r,i.trailers)}catch(e){t.onError?.(e)}}async loadSnapshots(e){await this[d].loadSnapshots(e||this[h]),this[A]=!0,"playback"===this[u]&&this.#O()}async saveSnapshots(e){return this[d].saveSnapshots(e||this[h])}#O(){for(let e of this[d].getSnapshots()){let{request:t,responses:i,response:r}=e,n=new URL(t.url),s=this.get(n.origin),a=i?i[0]:r;a&&s.intercept({path:n.pathname+n.search,method:t.method,headers:t.headers,body:t.body}).reply(a.statusCode,a.body,{headers:a.headers,trailers:a.trailers}).persist()}}getRecorder(){return this[d]}getMode(){return this[u]}clearSnapshots(){this[d].clear()}resetCallCounts(){this[d].resetCallCounts()}deleteSnapshot(e){return this[d].deleteSnapshot(e)}getSnapshotInfo(e){return this[d].getSnapshotInfo(e)}replaceSnapshots(e){this[d].replaceSnapshots(e)}async close(){await this[d].close(),await this[p]?.close(),await super.close()}}t.exports=g},312706,(e,t,i)=>{"use strict";let r=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:n}=e.r(450178),s=e.r(542122);function a(e){if(!e||"function"!=typeof e.dispatch)throw new n("Argument agent must implement Agent");Object.defineProperty(globalThis,r,{value:e,writable:!0,enumerable:!1,configurable:!1})}function o(){return globalThis[r]}void 0===o()&&a(new s),t.exports={setGlobalDispatcher:a,getGlobalDispatcher:o,installedExports:["fetch","Headers","Response","Request","FormData","WebSocket","CloseEvent","ErrorEvent","MessageEvent","EventSource"]}},201443,(e,t,i)=>{"use strict";let r=e.r(57328),n=e.r(54128);t.exports=class{#t;#U=!1;#P=!1;#$=!1;constructor(e){if("object"!=typeof e||null===e)throw TypeError("handler must be an object");this.#t=n.wrap(e)}onRequestStart(...e){this.#t.onRequestStart?.(...e)}onRequestUpgrade(...e){return r(!this.#U),r(!this.#P),this.#t.onRequestUpgrade?.(...e)}onResponseStart(...e){return r(!this.#U),r(!this.#P),r(!this.#$),this.#$=!0,this.#t.onResponseStart?.(...e)}onResponseData(...e){return r(!this.#U),r(!this.#P),this.#t.onResponseData?.(...e)}onResponseEnd(...e){return r(!this.#U),r(!this.#P),this.#U=!0,this.#t.onResponseEnd?.(...e)}onResponseError(...e){return this.#P=!0,this.#t.onResponseError?.(...e)}onBodySent(){}}},408050,(e,t,i)=>{"use strict";let r=e.r(122857),{kBodyUsed:n}=e.r(954673),s=e.r(57328),{InvalidArgumentError:a}=e.r(450178),o=e.r(687769),l=[300,301,302,303,307,308],c=Symbol("body"),d=()=>{};class u{constructor(e){this[c]=e,this[n]=!1}async *[Symbol.asyncIterator](){s(!this[n],"disturbed"),this[n]=!0,yield*this[c]}}class h{static buildDispatch(e,t){if(null!=t&&(!Number.isInteger(t)||t<0))throw new a("maxRedirections must be a positive number");let i=e.dispatch.bind(e);return(e,r)=>i(e,new h(i,t,e,r))}constructor(e,t,i,l){if(null!=t&&(!Number.isInteger(t)||t<0))throw new a("maxRedirections must be a positive number");this.dispatch=e,this.location=null;const{maxRedirections:c,...d}=i;this.opts=d,this.maxRedirections=t,this.handler=l,this.history=[],r.isStream(this.opts.body)?(0===r.bodyLength(this.opts.body)&&this.opts.body.on("data",function(){s(!1)}),"boolean"!=typeof this.opts.body.readableDidRead&&(this.opts.body[n]=!1,o.prototype.on.call(this.opts.body,"data",function(){this[n]=!0}))):this.opts.body&&"function"==typeof this.opts.body.pipeTo?this.opts.body=new u(this.opts.body):this.opts.body&&"string"!=typeof this.opts.body&&!ArrayBuffer.isView(this.opts.body)&&r.isIterable(this.opts.body)&&!r.isFormDataLike(this.opts.body)&&(this.opts.body=new u(this.opts.body))}onRequestStart(e,t){this.handler.onRequestStart?.(e,{...t,history:this.history})}onRequestUpgrade(e,t,i,r){this.handler.onRequestUpgrade?.(e,t,i,r)}onResponseStart(e,t,i,n){if(this.opts.throwOnMaxRedirect&&this.history.length>=this.maxRedirections)throw Error("max redirects");if((301===t||302===t)&&"POST"===this.opts.method&&(this.opts.method="GET",r.isStream(this.opts.body)&&r.destroy(this.opts.body.on("error",d)),this.opts.body=null),303===t&&"HEAD"!==this.opts.method&&(this.opts.method="GET",r.isStream(this.opts.body)&&r.destroy(this.opts.body.on("error",d)),this.opts.body=null),this.location=this.history.length>=this.maxRedirections||r.isDisturbed(this.opts.body)||-1===l.indexOf(t)?null:i.location,this.opts.origin&&this.history.push(new URL(this.opts.path,this.opts.origin)),!this.location)return void this.handler.onResponseStart?.(e,t,i,n);let{origin:s,pathname:o,search:c}=r.parseURL(new URL(this.location,this.opts.origin&&new URL(this.opts.path,this.opts.origin))),u=c?`${o}${c}`:o,h=`${s}${u}`;for(let e of this.history)if(e.toString()===h)throw new a(`Redirect loop detected. Cannot redirect to ${s}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);this.opts.headers=p(this.opts.headers,303===t,this.opts.origin!==s),this.opts.path=u,this.opts.origin=s,this.opts.query=null}onResponseData(e,t){this.location||this.handler.onResponseData?.(e,t)}onResponseEnd(e,t){this.location?this.dispatch(this.opts,this):this.handler.onResponseEnd(e,t)}onResponseError(e,t){this.handler.onResponseError?.(e,t)}}function A(e,t,i){if(4===e.length)return"host"===r.headerNameToString(e);if(t&&r.headerNameToString(e).startsWith("content-"))return!0;if(i&&(13===e.length||6===e.length||19===e.length)){let t=r.headerNameToString(e);return"authorization"===t||"cookie"===t||"proxy-authorization"===t}return!1}function p(e,t,i){let n=[];if(Array.isArray(e))for(let r=0;r{"use strict";let r=e.r(408050);t.exports=function({maxRedirections:e}={}){return t=>function(i,n){let{maxRedirections:s=e,...a}=i;if(null==s||0===s)return t(i,n);let o={...a},l=new r(t,s,o,n);return t(o,l)}}},391607,(e,t,i)=>{"use strict";let r=e.r(201443),{ResponseError:n}=e.r(450178);class s extends r{#j;#H;#q;#z;#V;constructor(e,{handler:t}){super(t)}#G(e){return 0===(this.#H??"").indexOf(e)}onRequestStart(e,t){return this.#j=0,this.#H=null,this.#q=null,this.#z=null,this.#V="",super.onRequestStart(e,t)}onResponseStart(e,t,i,r){if(this.#j=t,this.#z=i,this.#H=i["content-type"],this.#j<400)return super.onResponseStart(e,t,i,r);(this.#G("application/json")||this.#G("text/plain"))&&(this.#q=new TextDecoder("utf-8"))}onResponseData(e,t){if(this.#j<400)return super.onResponseData(e,t);this.#V+=this.#q?.decode(t,{stream:!0})??""}onResponseEnd(e,t){if(this.#j>=400){let t;if(this.#V+=this.#q?.decode(void 0,{stream:!1})??"",this.#G("application/json"))try{this.#V=JSON.parse(this.#V)}catch{}let i=Error.stackTraceLimit;Error.stackTraceLimit=0;try{t=new n("Response Error",this.#j,{body:this.#V,headers:this.#z})}finally{Error.stackTraceLimit=i}super.onResponseError(e,t)}else super.onResponseEnd(e,t)}onResponseError(e,t){super.onResponseError(e,t)}}t.exports=()=>e=>function(t,i){return e(t,new s(t,{handler:i}))}},27814,(e,t,i)=>{"use strict";let r=e.r(335221);t.exports=e=>t=>function(i,n){return t(i,new r({...i,retryOptions:{...e,...i.retryOptions}},{handler:n,dispatch:t}))}},234412,(e,t,i)=>{"use strict";let{InvalidArgumentError:r,RequestAbortedError:n}=e.r(450178),s=e.r(201443);class a extends s{#Y=1048576;#W=!1;#J=0;#a=null;aborted=!1;reason=!1;constructor({maxSize:e,signal:t},i){if(null!=e&&(!Number.isFinite(e)||e<1))throw new r("maxSize must be a number greater than 0");super(i),this.#Y=e??this.#Y}#s(e){this.aborted=!0,this.reason=e}onRequestStart(e,t){return e.abort=this.#s.bind(this),this.#a=e,super.onRequestStart(e,t)}onResponseStart(e,t,i,r){let s=i["content-length"];if(null!=s&&s>this.#Y)throw new n(`Response size (${s}) larger than maxSize (${this.#Y})`);return!0===this.aborted||super.onResponseStart(e,t,i,r)}onResponseError(e,t){this.#W||(t=this.#a?.reason??t,super.onResponseError(e,t))}onResponseData(e,t){return this.#J=this.#J+t.length,this.#J>=this.#Y&&(this.#W=!0,!0===this.aborted?super.onResponseError(e,this.reason):super.onResponseEnd(e,{})),!0}onResponseEnd(e,t){if(!this.#W){if(!0===this.#a.aborted)return void super.onResponseError(e,this.reason);super.onResponseEnd(e,t)}}}t.exports=function({maxSize:e}={maxSize:1048576}){return t=>function(i,r){let{dumpMaxSize:n=e}=i,s=new a({maxSize:n,signal:i.signal},r);return t(i,s)}}},884656,(e,t,i)=>{"use strict";let{isIP:r}=e.r(761095),{lookup:n}=e.r(495879),s=e.r(201443),{InvalidArgumentError:a,InformationalError:o}=e.r(450178),l=0x7fffffff;function c(e){let t=Object.getPrototypeOf(e);return Object.prototype.hasOwnProperty.call(e,Symbol.iterator)||null!=t&&t!==Object.prototype&&"function"==typeof e[Symbol.iterator]}function d(e){return"string"==typeof e&&"host"===e.toLowerCase()}function u(e){if(null==e)return null;if(Array.isArray(e)){if(0===e.length||!Array.isArray(e[0]))return e;let t=[];for(let i of e)Array.isArray(i)&&2===i.length?t.push(i[0],i[1]):t.push(i);return t}if("object"==typeof e&&c(e)){let t=[];for(let i of e)Array.isArray(i)&&2===i.length?t.push(i[0],i[1]):t.push(i);return t}return e}function h(e){if(null==e)return!1;if(Array.isArray(e)){if(0===e.length)return!1;for(let t=0;t=this.#K}}class f{#X=0;#K=0;dualStack=!0;affinity=null;lookup=null;pick=null;storage=null;constructor(e){this.#X=e.maxTTL,this.#K=e.maxItems,this.dualStack=e.dualStack,this.affinity=e.affinity,this.lookup=e.lookup??this.#ee,this.pick=e.pick??this.#et,this.storage=e.storage??new p(e)}runLookup(e,t,i){let r=this.storage.get(e.hostname);if(null==r&&this.storage.full())return void i(null,e);let n={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...t.dns,maxTTL:this.#X,maxItems:this.#K};if(null==r)this.lookup(e,n,(t,r)=>{let s;if(t||null==r||0===r.length)return void i(t??new o("No DNS entries found"));this.setRecords(e,r);let a=this.storage.get(e.hostname),l=this.pick(e,a,n.affinity);s="number"==typeof l.port?`:${l.port}`:""!==e.port?`:${e.port}`:"",i(null,new URL(`${e.protocol}//${6===l.family?`[${l.address}]`:l.address}${s}`))});else{let s,a=this.pick(e,r,n.affinity);if(null==a){this.storage.delete(e.hostname),this.runLookup(e,t,i);return}s="number"==typeof a.port?`:${a.port}`:""!==e.port?`:${e.port}`:"",i(null,new URL(`${e.protocol}//${6===a.family?`[${a.address}]`:a.address}${s}`))}}#ee(e,t,i){n(e.hostname,{all:!0,family:!1===this.dualStack?this.affinity:0,order:"ipv4first"},(e,t)=>{if(e)return i(e);let r=new Map;for(let e of t)r.set(`${e.address}:${e.family}`,e);i(null,r.values())})}#et(e,t,i){let r,n=null,{records:s,offset:a}=t;if(this.dualStack?(null==i&&(null==a||a===l?(t.offset=0,i=4):(t.offset++,i=(1&t.offset)==1?6:4)),r=null!=s[i]&&s[i].ips.length>0?s[i]:s[4===i?6:4]):r=s[i],null==r||0===r.ips.length)return n;null==r.offset||r.offset===l?r.offset=0:r.offset++;let o=r.offset%r.ips.length;return null==(n=r.ips[o]??null)?n:Date.now()-n.timestamp>n.ttl?(r.ips.splice(o,1),this.pick(e,t,i)):n}pickFamily(e,t){let i=this.storage.get(e.hostname)?.records;if(!i)return null;let r=i[t];if(!r)return null;null==r.offset||r.offset===l?r.offset=0:r.offset++;let n=r.offset%r.ips.length,s=r.ips[n]??null;return null==s||Date.now()-s.timestamp>s.ttl&&r.ips.splice(n,1),s}setRecords(e,t){let i=Date.now(),r={records:{4:null,6:null}},n=this.#X;for(let e of t){e.timestamp=i,"number"==typeof e.ttl?(e.ttl=Math.min(e.ttl,this.#X),n=Math.min(n,e.ttl)):e.ttl=this.#X;let t=r.records[e.family]??{ips:[]};t.ips.push(e),r.records[e.family]=t}this.storage.set(e.hostname,r,{ttl:n})}deleteRecords(e){this.storage.delete(e.hostname)}getHandler(e,t){return new g(this,e,t)}}class g extends s{#A=null;#y=null;#ei=null;#er=null;#a=null;#en=null;#es=!0;constructor(e,{origin:t,handler:i,dispatch:r,newOrigin:n},s){super(i),this.#er=t,this.#en=n,this.#y={...s},this.#A=e,this.#ei=r}onResponseError(e,t){switch(t.code){case"ETIMEDOUT":case"ECONNREFUSED":if(this.#A.dualStack){let i;if(!this.#es)return void super.onResponseError(e,t);this.#es=!1;let r="["===this.#en.hostname[0]?4:6,n=this.#A.pickFamily(this.#er,r);if(null==n)return void super.onResponseError(e,t);i="number"==typeof n.port?`:${n.port}`:""!==this.#er.port?`:${this.#er.port}`:"";let s={...this.#y,origin:`${this.#er.protocol}//${6===n.family?`[${n.address}]`:n.address}${i}`,headers:A(this.#er.host,this.#y.headers)};this.#ei(s,this);return}super.onResponseError(e,t);break;case"ENOTFOUND":this.#A.deleteRecords(this.#er),super.onResponseError(e,t);break;default:super.onResponseError(e,t)}}}t.exports=e=>{let t;if(e?.maxTTL!=null&&("number"!=typeof e?.maxTTL||e?.maxTTL<0))throw new a("Invalid maxTTL. Must be a positive number");if(e?.maxItems!=null&&("number"!=typeof e?.maxItems||e?.maxItems<1))throw new a("Invalid maxItems. Must be a positive number and greater than zero");if(e?.affinity!=null&&e?.affinity!==4&&e?.affinity!==6)throw new a("Invalid affinity. Must be either 4 or 6");if(e?.dualStack!=null&&"boolean"!=typeof e?.dualStack)throw new a("Invalid dualStack. Must be a boolean");if(e?.lookup!=null&&"function"!=typeof e?.lookup)throw new a("Invalid lookup. Must be a function");if(e?.pick!=null&&"function"!=typeof e?.pick)throw new a("Invalid pick. Must be a function");if(e?.storage!=null&&("function"!=typeof e?.storage?.get||"function"!=typeof e?.storage?.set||"function"!=typeof e?.storage?.full||"function"!=typeof e?.storage?.delete))throw new a("Invalid storage. Must be a object with methods: { get, set, full, delete }");let i=e?.dualStack??!0;t=i?e?.affinity??null:e?.affinity??4;let n=new f({maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:i,affinity:t,maxItems:e?.maxItems??1/0,storage:e?.storage});return e=>function(t,i){let s=t.origin.constructor===URL?t.origin:new URL(t.origin);return 0!==r(s.hostname)?e(t,i):(n.runLookup(s,t,(r,a)=>{if(r)return i.onResponseError(null,r);e({...t,servername:s.hostname,origin:a.origin,headers:A(s.host,t.headers)},n.getHandler({origin:s,dispatch:e,handler:i,newOrigin:a},t))}),!0)}}},618763,(e,t,i)=>{"use strict";let{safeHTTPMethods:r,pathHasQueryOrFragment:n,hasSafeIterator:s}=e.r(122857),{serializePathWithQuery:a}=e.r(122857);t.exports={makeCacheKey:function(e){if(!e.origin)throw Error("opts.origin is undefined");let t=e.path||"/";return e.query&&!n(e.path)&&(t=a(t,e.query)),{origin:e.origin.toString(),method:e.method,path:t,headers:e.headers}},normalizeHeaders:function(e){let t;if(null==e.headers)t={};else if("object"==typeof e.headers)if(t={},s(e.headers))for(let i of e.headers){if(!Array.isArray(i))throw Error("opts.headers is not a valid header map");let[e,r]=i;if("string"!=typeof e||"string"!=typeof r)throw Error("opts.headers is not a valid header map");t[e.toLowerCase()]=r}else for(let i of Object.keys(e.headers))t[i.toLowerCase()]=e.headers[i];else throw Error("opts.headers is not an object");return t},assertCacheKey:function(e){if("object"!=typeof e)throw TypeError(`expected key to be object, got ${typeof e}`);for(let t of["origin","method","path"])if("string"!=typeof e[t])throw TypeError(`expected key.${t} to be string, got ${typeof e[t]}`);if(void 0!==e.headers&&"object"!=typeof e.headers)throw TypeError(`expected headers to be object, got ${typeof e}`)},assertCacheValue:function(e){if("object"!=typeof e)throw TypeError(`expected value to be object, got ${typeof e}`);for(let t of["statusCode","cachedAt","staleAt","deleteAt"])if("number"!=typeof e[t])throw TypeError(`expected value.${t} to be number, got ${typeof e[t]}`);if("string"!=typeof e.statusMessage)throw TypeError(`expected value.statusMessage to be string, got ${typeof e.statusMessage}`);if(null!=e.headers&&"object"!=typeof e.headers)throw TypeError(`expected value.rawHeaders to be object, got ${typeof e.headers}`);if(void 0!==e.vary&&"object"!=typeof e.vary)throw TypeError(`expected value.vary to be object, got ${typeof e.vary}`);if(void 0!==e.etag&&"string"!=typeof e.etag)throw TypeError(`expected value.etag to be string, got ${typeof e.etag}`)},parseCacheControlHeader:function(e){let t,i={};if(Array.isArray(e))for(let i of(t=[],e))t.push(...i.split(","));else t=e.split(",");for(let e=0;e=2&&'"'===n[0]&&'"'===n[n.length-1]&&(n=n.substring(1,n.length-1));let e=parseInt(n,10);if(e!=e||"max-age"===r&&r in i&&i[r]>=e)continue;i[r]=e;break}case"private":case"no-cache":if(n){if('"'===n[0]){let s=[n.substring(1)],a='"'===n[n.length-1];if(!a)for(let i=e+1;i{"use strict";function r(e){if(29!==e.length||" "!==e[4]||" "!==e[7]||" "!==e[11]||" "!==e[16]||":"!==e[19]||":"!==e[22]||" "!==e[25]||"G"!==e[26]||"M"!==e[27]||"T"!==e[28])return;let t=-1;if("S"===e[0]&&"u"===e[1]&&"n"===e[2])t=0;else if("M"===e[0]&&"o"===e[1]&&"n"===e[2])t=1;else if("T"===e[0]&&"u"===e[1]&&"e"===e[2])t=2;else if("W"===e[0]&&"e"===e[1]&&"d"===e[2])t=3;else if("T"===e[0]&&"h"===e[1]&&"u"===e[2])t=4;else if("F"===e[0]&&"r"===e[1]&&"i"===e[2])t=5;else{if("S"!==e[0]||"a"!==e[1]||"t"!==e[2])return;t=6}let i=0;if("0"===e[5]){let t=e.charCodeAt(6);if(t<49||t>57)return;i=t-48}else{let t=e.charCodeAt(5);if(t<49||t>51)return;let r=e.charCodeAt(6);if(r<48||r>57)return;i=(t-48)*10+(r-48)}let r=-1;if("J"===e[8]&&"a"===e[9]&&"n"===e[10])r=0;else if("F"===e[8]&&"e"===e[9]&&"b"===e[10])r=1;else if("M"===e[8]&&"a"===e[9])if("r"===e[10])r=2;else{if("y"!==e[10])return;r=4}else if("J"===e[8])if("a"===e[9]&&"n"===e[10])r=0;else if("u"!==e[9])return;else if("n"===e[10])r=5;else{if("l"!==e[10])return;r=6}else if("A"===e[8])if("p"===e[9]&&"r"===e[10])r=3;else{if("u"!==e[9]||"g"!==e[10])return;r=7}else if("S"===e[8]&&"e"===e[9]&&"p"===e[10])r=8;else if("O"===e[8]&&"c"===e[9]&&"t"===e[10])r=9;else if("N"===e[8]&&"o"===e[9]&&"v"===e[10])r=10;else{if("D"!==e[8]||"e"!==e[9]||"c"!==e[10])return;r=11}let n=e.charCodeAt(12);if(n<48||n>57)return;let s=e.charCodeAt(13);if(s<48||s>57)return;let a=e.charCodeAt(14);if(a<48||a>57)return;let o=e.charCodeAt(15);if(o<48||o>57)return;let l=(n-48)*1e3+(s-48)*100+(a-48)*10+(o-48),c=0;if("0"===e[17]){let t=e.charCodeAt(18);if(t<48||t>57)return;c=t-48}else{let t=e.charCodeAt(17);if(t<48||t>50)return;let i=e.charCodeAt(18);if(i<48||i>57||50===t&&i>51)return;c=(t-48)*10+(i-48)}let d=0;if("0"===e[20]){let t=e.charCodeAt(21);if(t<48||t>57)return;d=t-48}else{let t=e.charCodeAt(20);if(t<48||t>53)return;let i=e.charCodeAt(21);if(i<48||i>57)return;d=(t-48)*10+(i-48)}let u=0;if("0"===e[23]){let t=e.charCodeAt(24);if(t<48||t>57)return;u=t-48}else{let t=e.charCodeAt(23);if(t<48||t>53)return;let i=e.charCodeAt(24);if(i<48||i>57)return;u=(t-48)*10+(i-48)}let h=new Date(Date.UTC(l,r,i,c,d,u));return h.getUTCDay()===t?h:void 0}function n(e){if(24!==e.length||" "!==e[7]||" "!==e[10]||" "!==e[19])return;let t=-1;if("S"===e[0]&&"u"===e[1]&&"n"===e[2])t=0;else if("M"===e[0]&&"o"===e[1]&&"n"===e[2])t=1;else if("T"===e[0]&&"u"===e[1]&&"e"===e[2])t=2;else if("W"===e[0]&&"e"===e[1]&&"d"===e[2])t=3;else if("T"===e[0]&&"h"===e[1]&&"u"===e[2])t=4;else if("F"===e[0]&&"r"===e[1]&&"i"===e[2])t=5;else{if("S"!==e[0]||"a"!==e[1]||"t"!==e[2])return;t=6}let i=-1;if("J"===e[4]&&"a"===e[5]&&"n"===e[6])i=0;else if("F"===e[4]&&"e"===e[5]&&"b"===e[6])i=1;else if("M"===e[4]&&"a"===e[5])if("r"===e[6])i=2;else{if("y"!==e[6])return;i=4}else if("J"===e[4])if("a"===e[5]&&"n"===e[6])i=0;else if("u"!==e[5])return;else if("n"===e[6])i=5;else{if("l"!==e[6])return;i=6}else if("A"===e[4])if("p"===e[5]&&"r"===e[6])i=3;else{if("u"!==e[5]||"g"!==e[6])return;i=7}else if("S"===e[4]&&"e"===e[5]&&"p"===e[6])i=8;else if("O"===e[4]&&"c"===e[5]&&"t"===e[6])i=9;else if("N"===e[4]&&"o"===e[5]&&"v"===e[6])i=10;else{if("D"!==e[4]||"e"!==e[5]||"c"!==e[6])return;i=11}let r=0;if(" "===e[8]){let t=e.charCodeAt(9);if(t<49||t>57)return;r=t-48}else{let t=e.charCodeAt(8);if(t<49||t>51)return;let i=e.charCodeAt(9);if(i<48||i>57)return;r=(t-48)*10+(i-48)}let n=0;if("0"===e[11]){let t=e.charCodeAt(12);if(t<48||t>57)return;n=t-48}else{let t=e.charCodeAt(11);if(t<48||t>50)return;let i=e.charCodeAt(12);if(i<48||i>57||50===t&&i>51)return;n=(t-48)*10+(i-48)}let s=0;if("0"===e[14]){let t=e.charCodeAt(15);if(t<48||t>57)return;s=t-48}else{let t=e.charCodeAt(14);if(t<48||t>53)return;let i=e.charCodeAt(15);if(i<48||i>57)return;s=(t-48)*10+(i-48)}let a=0;if("0"===e[17]){let t=e.charCodeAt(18);if(t<48||t>57)return;a=t-48}else{let t=e.charCodeAt(17);if(t<48||t>53)return;let i=e.charCodeAt(18);if(i<48||i>57)return;a=(t-48)*10+(i-48)}let o=e.charCodeAt(20);if(o<48||o>57)return;let l=e.charCodeAt(21);if(l<48||l>57)return;let c=e.charCodeAt(22);if(c<48||c>57)return;let d=e.charCodeAt(23);if(d<48||d>57)return;let u=new Date(Date.UTC((o-48)*1e3+(l-48)*100+(c-48)*10+(d-48),i,r,n,s,a));return u.getUTCDay()===t?u:void 0}function s(e){let t=-1,i=-1;if("S"===e[0])"u"===e[1]&&"n"===e[2]&&"d"===e[3]&&"a"===e[4]&&"y"===e[5]?(i=0,t=6):"a"===e[1]&&"t"===e[2]&&"u"===e[3]&&"r"===e[4]&&"d"===e[5]&&"a"===e[6]&&"y"===e[7]&&(i=6,t=8);else if("M"===e[0]&&"o"===e[1]&&"n"===e[2]&&"d"===e[3]&&"a"===e[4]&&"y"===e[5])i=1,t=6;else if("T"===e[0])"u"===e[1]&&"e"===e[2]&&"s"===e[3]&&"d"===e[4]&&"a"===e[5]&&"y"===e[6]?(i=2,t=7):"h"===e[1]&&"u"===e[2]&&"r"===e[3]&&"s"===e[4]&&"d"===e[5]&&"a"===e[6]&&"y"===e[7]&&(i=4,t=8);else if("W"===e[0]&&"e"===e[1]&&"d"===e[2]&&"n"===e[3]&&"e"===e[4]&&"s"===e[5]&&"d"===e[6]&&"a"===e[7]&&"y"===e[8])i=3,t=9;else{if("F"!==e[0]||"r"!==e[1]||"i"!==e[2]||"d"!==e[3]||"a"!==e[4]||"y"!==e[5])return;i=5,t=6}if(","!==e[t]||e.length-t-1!=23||" "!==e[t+1]||"-"!==e[t+4]||"-"!==e[t+8]||" "!==e[t+11]||":"!==e[t+14]||":"!==e[t+17]||" "!==e[t+20]||"G"!==e[t+21]||"M"!==e[t+22]||"T"!==e[t+23])return;let r=0;if("0"===e[t+2]){let i=e.charCodeAt(t+3);if(i<49||i>57)return;r=i-48}else{let i=e.charCodeAt(t+2);if(i<49||i>51)return;let n=e.charCodeAt(t+3);if(n<48||n>57)return;r=(i-48)*10+(n-48)}let n=-1;if("J"===e[t+5]&&"a"===e[t+6]&&"n"===e[t+7])n=0;else if("F"===e[t+5]&&"e"===e[t+6]&&"b"===e[t+7])n=1;else if("M"===e[t+5]&&"a"===e[t+6]&&"r"===e[t+7])n=2;else if("A"===e[t+5]&&"p"===e[t+6]&&"r"===e[t+7])n=3;else if("M"===e[t+5]&&"a"===e[t+6]&&"y"===e[t+7])n=4;else if("J"===e[t+5]&&"u"===e[t+6]&&"n"===e[t+7])n=5;else if("J"===e[t+5]&&"u"===e[t+6]&&"l"===e[t+7])n=6;else if("A"===e[t+5]&&"u"===e[t+6]&&"g"===e[t+7])n=7;else if("S"===e[t+5]&&"e"===e[t+6]&&"p"===e[t+7])n=8;else if("O"===e[t+5]&&"c"===e[t+6]&&"t"===e[t+7])n=9;else if("N"===e[t+5]&&"o"===e[t+6]&&"v"===e[t+7])n=10;else{if("D"!==e[t+5]||"e"!==e[t+6]||"c"!==e[t+7])return;n=11}let s=e.charCodeAt(t+9);if(s<48||s>57)return;let a=e.charCodeAt(t+10);if(a<48||a>57)return;let o=(s-48)*10+(a-48);o+=o<70?2e3:1900;let l=0;if("0"===e[t+12]){let i=e.charCodeAt(t+13);if(i<48||i>57)return;l=i-48}else{let i=e.charCodeAt(t+12);if(i<48||i>50)return;let r=e.charCodeAt(t+13);if(r<48||r>57||50===i&&r>51)return;l=(i-48)*10+(r-48)}let c=0;if("0"===e[t+15]){let i=e.charCodeAt(t+16);if(i<48||i>57)return;c=i-48}else{let i=e.charCodeAt(t+15);if(i<48||i>53)return;let r=e.charCodeAt(t+16);if(r<48||r>57)return;c=(i-48)*10+(r-48)}let d=0;if("0"===e[t+18]){let i=e.charCodeAt(t+19);if(i<48||i>57)return;d=i-48}else{let i=e.charCodeAt(t+18);if(i<48||i>53)return;let r=e.charCodeAt(t+19);if(r<48||r>57)return;d=(i-48)*10+(r-48)}let u=new Date(Date.UTC(o,n,r,l,c,d));return u.getUTCDay()===i?u:void 0}t.exports={parseHttpDate:function(e){switch(e[3]){case",":return r(e);case" ":return n(e);default:return s(e)}}}},620645,(e,t,i)=>{"use strict";let r=e.r(122857),{parseCacheControlHeader:n,parseVaryHeader:s,isEtagUsable:a}=e.r(618763),{parseHttpDate:o}=e.r(575749);function l(){}let c=[200,203,204,206,300,301,308,404,405,410,414,501],d=[206],u=2147483647e3;class h{#ea;#eo;#el;#ec;#t;#ed;constructor({store:e,type:t,cacheByDefault:i},r,n){this.#ec=e,this.#eo=t,this.#el=i,this.#ea=r,this.#t=n}onRequestStart(e,t){this.#ed?.destroy(),this.#ed=void 0,this.#t.onRequestStart?.(e,t)}onRequestUpgrade(e,t,i,r){this.#t.onRequestUpgrade?.(e,t,i,r)}onResponseStart(e,t,i,d){let h,y=()=>this.#t.onResponseStart?.(e,t,i,d),b=this;if(!r.safeHTTPMethods.includes(this.#ea.method)&&t>=200&&t<=399){try{this.#ec.delete(this.#ea)?.catch?.(l)}catch{}return y()}let E=i["cache-control"],C=i["last-modified"]&&c.includes(t);if(!E&&!i.expires&&!C&&!this.#el)return y();let w=E?n(E):{};if(!A(this.#eo,t,i,w))return y();let I=Date.now(),v=i.age?p(i.age):void 0;if(v&&v>=u)return y();let B="string"==typeof i.date?o(i.date):void 0,Q=f(this.#eo,I,v,i,B,w)??this.#el;if(void 0===Q||v&&v>Q)return y();let x=B?B.getTime():I,S=Q+x;if(I>=S||this.#ea.headers&&i.vary&&!(h=s(i.vary,this.#ea.headers)))return y();let k=g(x,w,S),T=m(i,w),N={statusCode:t,statusMessage:d,headers:T,vary:h,cacheControlDirectives:w,cachedAt:v?I-v:I,staleAt:S,deleteAt:k};if(304===t){let t=t=>{if(!t)return y();if(N.statusCode=t.statusCode,N.statusMessage=t.statusMessage,N.etag=t.etag,N.headers={...t.headers,...T},y(),this.#ed=this.#ec.createWriteStream(this.#ea,N),this.#ed&&t?.body)if("function"==typeof t.body.values){let i=t.body.values(),r=()=>{for(let t of i){let i=!1===this.#ed.write(t);if(this.#t.onResponseData?.(e,t),i)break}};this.#ed.on("error",function(){b.#ed=void 0,b.#ec.delete(b.#ea)}).on("drain",()=>{r()}).on("close",function(){b.#ed===this&&(b.#ed=void 0)}),r()}else"function"==typeof t.body.on&&(t.body.on("data",t=>{this.#ed.write(t),this.#t.onResponseData?.(e,t)}).on("end",()=>{this.#ed.end()}).on("error",()=>{this.#ed=void 0,this.#ec.delete(this.#ea)}),this.#ed.on("error",function(){b.#ed=void 0,b.#ec.delete(b.#ea)}).on("close",function(){b.#ed===this&&(b.#ed=void 0)}))},i=this.#ec.get(this.#ea);i&&"function"==typeof i.then?i.then(t):t(i)}else{if("string"==typeof i.etag&&a(i.etag)&&(N.etag=i.etag),this.#ed=this.#ec.createWriteStream(this.#ea,N),!this.#ed)return y();this.#ed.on("drain",()=>e.resume()).on("error",function(){b.#ed=void 0,b.#ec.delete(b.#ea)}).on("close",function(){b.#ed===this&&(b.#ed=void 0),e.resume()}),y()}}onResponseData(e,t){this.#ed?.write(t)===!1&&e.pause(),this.#t.onResponseData?.(e,t)}onResponseEnd(e,t){this.#ed?.end(),this.#t.onResponseEnd?.(e,t)}onResponseError(e,t){this.#ed?.destroy(t),this.#ed=void 0,this.#t.onResponseError?.(e,t)}}function A(e,t,i,r){return!(t<200||d.includes(t)||!c.includes(t)&&!i.expires&&!r.public&&void 0===r["max-age"]&&!(r.private&&"private"===e)&&(void 0===r["s-maxage"]||"shared"!==e)||r["no-store"]||"shared"===e&&!0===r.private||i.vary?.includes("*")||i.authorization&&(!r.public||"string"!=typeof i.authorization||Array.isArray(r["no-cache"])&&r["no-cache"].includes("authorization")||Array.isArray(r.private)&&r.private.includes("authorization")))&&!0}function p(e){let t=parseInt(Array.isArray(e)?e[0]:e);return isNaN(t)?void 0:1e3*t}function f(e,t,i,r,n,s){if("shared"===e){let e=s["s-maxage"];if(void 0!==e)return e>0?1e3*e:void 0}let a=s["max-age"];if(void 0!==a)return a>0?1e3*a:void 0;if("string"==typeof r.expires){let e=o(r.expires);if(e){if(t>=e.getTime()||n&&(n>=e||void 0!==i&&i>e-n))return;return e.getTime()-t}}if("string"==typeof r["last-modified"]){let e=new Date(r["last-modified"]);if(y(e)){if(e.getTime()>=t)return;return .1*(t-e.getTime())}}if(s.immutable)return 31536e3}function g(e,t,i){let r=-1/0,n=-1/0,s=-1/0;return t["stale-while-revalidate"]&&(r=i+1e3*t["stale-while-revalidate"]),t["stale-if-error"]&&(n=i+1e3*t["stale-if-error"]),r===-1/0&&n===-1/0&&(s=e+31536e6),Math.max(i,r,n,s)}function m(e,t){let i,r=["connection","proxy-authenticate","proxy-authentication-info","proxy-authorization","proxy-connection","te","transfer-encoding","upgrade","age"];for(let n of(e.connection&&(Array.isArray(e.connection)?r.push(...e.connection.map(e=>e.trim())):r.push(...e.connection.split(",").map(e=>e.trim()))),Array.isArray(t["no-cache"])&&r.push(...t["no-cache"]),Array.isArray(t.private)&&r.push(...t.private),r))e[n]&&(i??={...e},delete i[n]);return i??e}function y(e){return e instanceof Date&&Number.isFinite(e.valueOf())}t.exports=h},29867,(e,t,i)=>{"use strict";let{Writable:r}=e.r(81111),{EventEmitter:n}=e.r(687769),{assertCacheKey:s,assertCacheValue:a}=e.r(618763);class o extends n{#eu=1024;#Y=0x6400000;#eh=5242880;#J=0;#eA=0;#ep=new Map;#ef=!1;constructor(e){if(super(),e){if("object"!=typeof e)throw TypeError("MemoryCacheStore options must be an object");if(void 0!==e.maxCount){if("number"!=typeof e.maxCount||!Number.isInteger(e.maxCount)||e.maxCount<0)throw TypeError("MemoryCacheStore options.maxCount must be a non-negative integer");this.#eu=e.maxCount}if(void 0!==e.maxSize){if("number"!=typeof e.maxSize||!Number.isInteger(e.maxSize)||e.maxSize<0)throw TypeError("MemoryCacheStore options.maxSize must be a non-negative integer");this.#Y=e.maxSize}if(void 0!==e.maxEntrySize){if("number"!=typeof e.maxEntrySize||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw TypeError("MemoryCacheStore options.maxEntrySize must be a non-negative integer");this.#eh=e.maxEntrySize}}}get size(){return this.#J}isFull(){return this.#J>=this.#Y||this.#eA>=this.#eu}get(e){s(e);let t=`${e.origin}:${e.path}`,i=Date.now(),r=this.#ep.get(t),n=r?l(e,r,i):null;return null==n?void 0:{statusMessage:n.statusMessage,statusCode:n.statusCode,headers:n.headers,body:n.body,vary:n.vary?n.vary:void 0,etag:n.etag,cacheControlDirectives:n.cacheControlDirectives,cachedAt:n.cachedAt,staleAt:n.staleAt,deleteAt:n.deleteAt}}createWriteStream(e,t){s(e),a(t);let i=`${e.origin}:${e.path}`,n=this,o={...e,...t,body:[],size:0};return new r({write(e,t,i){"string"==typeof e&&(e=Buffer.from(e,t)),o.size+=e.byteLength,o.size>=n.#eh?this.destroy():o.body.push(e),i(null)},final(t){let r=n.#ep.get(i);r||(r=[],n.#ep.set(i,r));let s=l(e,r,Date.now());if(s){let e=r.indexOf(s);r.splice(e,1,o),n.#J-=s.size}else r.push(o),n.#eA+=1;if(n.#J+=o.size,n.#J>n.#Y||n.#eA>n.#eu){for(let[e,t]of(n.#ef||(n.emit("maxSizeExceeded",{size:n.#J,maxSize:n.#Y,count:n.#eA,maxCount:n.#eu}),n.#ef=!0),n.#ep)){for(let e of t.splice(0,t.length/2))n.#J-=e.size,n.#eA-=1;0===t.length&&n.#ep.delete(e)}n.#Jt.deleteAt>i&&t.method===e.method&&(null==t.vary||Object.keys(t.vary).every(i=>null===t.vary[i]?void 0===e.headers[i]:t.vary[i]===e.headers[i])))}t.exports=o},72324,(e,t,i)=>{"use strict";let r=e.r(57328);class n{#eg=!1;#em;#t;#ey;#eb;constructor(e,t,i){if("function"!=typeof e)throw TypeError("callback must be a function");this.#em=e,this.#t=t,this.#eb=i}onRequestStart(e,t){this.#eg=!1,this.#ey=t}onRequestUpgrade(e,t,i,r){this.#t.onRequestUpgrade?.(e,t,i,r)}onResponseStart(e,t,i,n){if(r(null!=this.#em),this.#eg=304===t||this.#eb&&t>=500&&t<=504,this.#em(this.#eg,this.#ey),this.#em=null,this.#eg)return!0;this.#t.onRequestStart?.(e,this.#ey),this.#t.onResponseStart?.(e,t,i,n)}onResponseData(e,t){if(!this.#eg)return this.#t.onResponseData?.(e,t)}onResponseEnd(e,t){this.#eg||this.#t.onResponseEnd?.(e,t)}onResponseError(e,t){if(!this.#eg)if(this.#em&&(this.#em(!1),this.#em=null),"function"==typeof this.#t.onResponseError)this.#t.onResponseError(e,t);else throw t}}t.exports=n},207639,(e,t,i)=>{"use strict";let r=e.r(57328),{Readable:n}=e.r(81111),s=e.r(122857),a=e.r(620645),o=e.r(29867),l=e.r(72324),{assertCacheStore:c,assertCacheMethods:d,makeCacheKey:u,normalizeHeaders:h,parseCacheControlHeader:A}=e.r(618763),{AbortError:p}=e.r(450178);function f(e,t){if(void 0!==e){if(!Array.isArray(e))throw TypeError(`expected ${t} to be an array or undefined, got ${typeof e}`);for(let i=0;i{};function m(e,t,{headers:i={}}){return!!(t?.["no-cache"]||e.cacheControlDirectives?.["no-cache"]&&!Array.isArray(e.cacheControlDirectives["no-cache"]))||!!i["if-modified-since"]||!!i["if-none-match"]}function y(e,t){let i=Date.now();return i>e.staleAt?!t?.["max-stale"]||i>e.staleAt+1e3*t["max-stale"]:!!t?.["min-fresh"]&&e.staleAt-i<=1e3*t["min-fresh"]}function b(e){let t=e.cacheControlDirectives?.["stale-while-revalidate"];return!!t&&Date.now()<=e.staleAt+1e3*t}function E(e,t,i,r,n,s){if(s?.["only-if-cached"]){let e=!1;try{if("function"==typeof r.onConnect&&(r.onConnect(()=>{e=!0}),e)||"function"==typeof r.onHeaders&&(r.onHeaders(504,[],g,"Gateway Timeout"),e))return;"function"==typeof r.onComplete&&r.onComplete([])}catch(e){"function"==typeof r.onError&&r.onError(e)}return!0}return e(n,new a(t,i,r))}function C(e,t,i,a,o,l){let c=s.isStream(i.body)?i.body:n.from(i.body??[]);r(!c.destroyed,"stream should not be destroyed"),r(!c.readableDidRead,"stream should not be readableDidRead");let d={resume(){c.resume()},pause(){c.pause()},get paused(){return c.isPaused()},get aborted(){return c.destroyed},get reason(){return c.errored},abort(e){c.destroy(e??new p)}};if(c.on("error",function(t){if(!this.readableEnded)if("function"==typeof e.onResponseError)e.onResponseError(d,t);else throw t}).on("close",function(){this.errored||e.onResponseEnd?.(d,{})}),e.onRequestStart?.(d,o),c.destroyed)return;let u={...i.headers,age:String(a)};l&&(u.warning='110 - "response is stale"'),e.onResponseStart?.(d,i.statusCode,u,i.statusMessage),"HEAD"===t.method?c.destroy():c.on("data",function(t){e.onResponseData?.(d,t)})}function w(e,t,i,r,n,o,c){if(!c)return E(e,t,i,r,n,o);let d=Date.now();if(d>c.deleteAt)return e(n,new a(t,i,r));let u=Math.round((d-c.cachedAt)/1e3);if(o?.["max-age"]&&u>=o["max-age"])return e(n,r);let h=y(c,o),A=m(c,o,n);if(h||A){if(s.isStream(n.body)&&0!==s.bodyLength(n.body))return e(n,new a(t,i,r));if(!A&&b(c))return C(r,n,c,u,null,!0),queueMicrotask(()=>{let r={...n.headers,"if-modified-since":new Date(c.cachedAt).toUTCString()};if(c.etag&&(r["if-none-match"]=c.etag),c.vary)for(let e in c.vary)null!=c.vary[e]&&(r[e]=c.vary[e]);e({...n,headers:r},new a(t,i,{onRequestStart(){},onRequestUpgrade(){},onResponseStart(){},onResponseData(){},onResponseEnd(){},onResponseError(){}}))}),!0;let p=!1,f=c.cacheControlDirectives["stale-if-error"]??o?.["stale-if-error"];f&&(p=d{e?C(r,n,c,u,t,h):s.isStream(c.body)&&c.body.on("error",g).destroy()},new a(t,i,r),p))}s.isStream(n.body)&&n.body.on("error",g).destroy(),C(r,n,c,u,null,!1)}t.exports=(e={})=>{let{store:t=new o,methods:i=["GET"],cacheByDefault:r,type:n="shared",origins:a}=e;if("object"!=typeof e||null===e)throw TypeError(`expected type of opts to be an Object, got ${null===e?"null":typeof e}`);if(c(t,"opts.store"),d(i,"opts.methods"),f(a,"opts.origins"),void 0!==r&&"number"!=typeof r)throw TypeError(`expected opts.cacheByDefault to be number or undefined, got ${typeof r}`);if(void 0!==n&&"shared"!==n&&"private"!==n)throw TypeError(`expected opts.type to be shared, private, or undefined, got ${typeof n}`);let l={store:t,methods:i,cacheByDefault:r,type:n},p=s.safeHTTPMethods.filter(e=>!1===i.includes(e));return e=>(i,r)=>{if(!i.origin||p.includes(i.method))return e(i,r);if(void 0!==a){let t=i.origin.toString().toLowerCase(),n=!1;for(let e=0;ew(e,l,s,r,i,n,t)):w(e,l,s,r,i,n,o)}}},707755,(e,t,i)=>{"use strict";let{createInflate:r,createGunzip:n,createBrotliDecompress:s,createZstdDecompress:a}=e.r(727028),{pipeline:o}=e.r(81111),l=e.r(201443),{runtimeFeatures:c}=e.r(350022),d={gzip:n,"x-gzip":n,br:s,deflate:r,compress:r,"x-compress":r,...c.has("zstd")?{zstd:a}:{}},u=[204,304],h=!1;class A extends l{#eE=[];#eC;#ew;constructor(e,{skipStatusCodes:t=u,skipErrorResponses:i=!0}={}){super(e),this.#eC=t,this.#ew=i}#eI(e,t){return!!(!e||t<200||this.#eC.includes(t))||!!this.#ew&&!!(t>=400)}#ev(e){let t=e.split(","),i=5;if(t.length>i)throw Error(`too many content-encodings in response: ${t.length}, maximum allowed is ${i}`);let r=[];for(let e=t.length-1;e>=0;e--){let i=t[e].trim();if(i){if(!d[i])return r.length=0,r;r.push(d[i]())}}return r}#eB(e,t){e.on("readable",()=>{let i;for(;null!==(i=e.read())&&!1!==super.onResponseData(t,i););}),e.on("error",e=>{super.onResponseError(t,e)})}#eQ(e){let t=this.#eE[0];this.#eB(t,e),t.on("end",()=>{super.onResponseEnd(e,{})})}#ex(e){let t=this.#eE[this.#eE.length-1];this.#eB(t,e),o(this.#eE,t=>{t?super.onResponseError(e,t):super.onResponseEnd(e,{})})}#eS(){this.#eE.length=0}onResponseStart(e,t,i,r){let n=i["content-encoding"];if(this.#eI(n,t))return super.onResponseStart(e,t,i,r);let s=this.#ev(n.toLowerCase());if(0===s.length)return this.#eS(),super.onResponseStart(e,t,i,r);this.#eE=s;let{"content-encoding":a,"content-length":o,...l}=i;return 1===this.#eE.length?this.#eQ(e):this.#ex(e),super.onResponseStart(e,t,l,r)}onResponseData(e,t){this.#eE.length>0?this.#eE[0].write(t):super.onResponseData(e,t)}onResponseEnd(e,t){if(this.#eE.length>0){this.#eE[0].end(),this.#eS();return}super.onResponseEnd(e,t)}onResponseError(e,t){if(this.#eE.length>0){for(let e of this.#eE)e.destroy(t);this.#eS()}super.onResponseError(e,t)}}t.exports=function(e={}){return h||(process.emitWarning("DecompressInterceptor is experimental and subject to change","ExperimentalWarning"),h=!0),t=>(i,r)=>t(i,new A(r,e))}},848217,(e,t,i)=>{"use strict";let{RequestAbortedError:r}=e.r(450178),n=5242880;class s{#ek;#eT=[];#eN=n;#j=0;#z={};#eD="";#n=!1;#e_=!1;#eR=!1;#eL=!1;#a=null;#eF=null;constructor(e,t,i=n){this.#ek=e,this.#eF=t,this.#eN=i}addWaitingHandler(e){if(this.#eL||this.#eR)return!1;let t=this.#eM(e),i=t.controller;try{if(e.onRequestStart?.(i,null),i.aborted)return t.done=!0,!0;this.#e_&&e.onResponseStart?.(i,this.#j,this.#z,this.#eD)}catch{return t.done=!0,!0}return i.aborted||this.#eT.push(t),!0}onRequestStart(e,t){this.#a=e,this.#ek.onRequestStart?.(e,t)}onRequestUpgrade(e,t,i,r){this.#ek.onRequestUpgrade?.(e,t,i,r)}onResponseStart(e,t,i,r){for(let n of(this.#e_=!0,this.#j=t,this.#z=i,this.#eD=r,this.#ek.onResponseStart?.(e,t,i,r),this.#eT)){let{handler:e,controller:s}=n;if(n.done||s.aborted){n.done=!0;continue}try{e.onResponseStart?.(s,t,i,r)}catch{}s.aborted&&(n.done=!0)}this.#eO()}onResponseData(e,t){if(!this.#n&&!this.#eL){for(let i of(this.#eR=!0,this.#ek.onResponseData?.(e,t),this.#eT)){let{handler:e,controller:r}=i;if(i.done||r.aborted){i.done=!0;continue}if(r.paused){this.#eU(i,t);continue}try{e.onResponseData?.(r,t)}catch{}r.aborted&&(i.done=!0,i.bufferedChunks=[],i.bufferedBytes=0)}this.#eO()}}onResponseEnd(e,t){if(!this.#n&&!this.#eL){for(let i of(this.#eL=!0,this.#ek.onResponseEnd?.(e,t),this.#eT)){if(i.done||i.controller.aborted||(this.#eP(i),i.done||i.controller.aborted)){i.done=!0;continue}if(i.controller.paused&&i.bufferedChunks.length>0){i.pendingTrailers=t;continue}try{i.handler.onResponseEnd?.(i.controller,t)}catch{}i.done=!0}this.#eO(),this.#eF?.()}}onResponseError(e,t){if(!this.#eL){for(let i of(this.#n=!0,this.#eL=!0,this.#ek.onResponseError?.(e,t),this.#eT))this.#e$(i,t);this.#eT=[],this.#eF?.()}}#eM(e){let t={handler:e,controller:null,bufferedChunks:[],bufferedBytes:0,pendingTrailers:null,done:!1},i={aborted:!1,paused:!1,reason:null};return t.controller={resume:()=>{if(!i.aborted){if(i.paused=!1,this.#eP(t),this.#eL&&t.pendingTrailers&&0===t.bufferedChunks.length&&!i.paused&&!i.aborted){try{t.handler.onResponseEnd?.(t.controller,t.pendingTrailers)}catch{}t.pendingTrailers=null,t.done=!0}this.#eO()}},pause:()=>{i.aborted||(i.paused=!0)},get paused(){return i.paused},get aborted(){return i.aborted},get reason(){return i.reason},abort:e=>{i.aborted=!0,i.reason=e??null,t.done=!0,t.pendingTrailers=null,t.bufferedChunks=[],t.bufferedBytes=0}},t}#eU(e,t){if(e.done||e.controller.aborted){e.done=!0,e.bufferedChunks=[],e.bufferedBytes=0;return}let i=Buffer.from(t);if(e.bufferedChunks.push(i),e.bufferedBytes+=i.length,e.bufferedBytes>this.#eN){let t=new r(`Deduplicated waiting handler exceeded maxBufferSize (${this.#eN} bytes) while paused`);this.#e$(e,t)}}#eP(e){let{handler:t,controller:i}=e;for(;!e.done&&!i.aborted&&!i.paused&&e.bufferedChunks.length>0;){let r=e.bufferedChunks.shift();e.bufferedBytes-=r.length;try{t.onResponseData?.(i,r)}catch{}if(i.aborted){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;break}}}#e$(e,t){if(!e.done){e.done=!0,e.pendingTrailers=null,e.bufferedChunks=[],e.bufferedBytes=0;try{e.controller.abort(t),e.handler.onResponseError?.(e.controller,t)}catch{}}}#eO(){this.#eT=this.#eT.filter(e=>!1===e.done)}}t.exports=s},380308,(e,t,i)=>{"use strict";let r=e.r(677652),n=e.r(122857),s=e.r(848217),{normalizeHeaders:a,makeCacheKey:o,makeDeduplicationKey:l}=e.r(618763),c=r.channel("undici:request:pending-requests");t.exports=(e={})=>{let{methods:t=["GET"],skipHeaderNames:i=[],excludeHeaderNames:r=[],maxBufferSize:d=5242880}=e;if("object"!=typeof e||null===e)throw TypeError(`expected type of opts to be an Object, got ${null===e?"null":typeof e}`);if(!Array.isArray(t))throw TypeError(`expected opts.methods to be an array, got ${typeof t}`);for(let e of t)if(!n.safeHTTPMethods.includes(e))throw TypeError(`expected opts.methods to only contain safe HTTP methods, got ${e}`);if(!Array.isArray(i))throw TypeError(`expected opts.skipHeaderNames to be an array, got ${typeof i}`);if(!Array.isArray(r))throw TypeError(`expected opts.excludeHeaderNames to be an array, got ${typeof r}`);if(!Number.isFinite(d)||d<=0)throw TypeError(`expected opts.maxBufferSize to be a positive finite number, got ${d}`);let u=new Set(i.map(e=>e.toLowerCase())),h=new Set(r.map(e=>e.toLowerCase())),A=new Map;return e=>(i,r)=>{if(!i.origin||!1===t.includes(i.method))return e(i,r);if(i={...i,headers:a(i)},u.size>0){for(let t of Object.keys(i.headers))if(u.has(t.toLowerCase()))return e(i,r)}let n=l(o(i),h),p=A.get(n);if(p)return!!p.addWaitingHandler(r)||e(i,r);let f=new s(r,()=>{A.delete(n),c.hasSubscribers&&c.publish({size:A.size,key:n,type:"removed"})},d);return A.set(n,f),c.hasSubscribers&&c.publish({size:A.size,key:n,type:"added"}),e(i,f)}}},269140,(e,t,i)=>{"use strict";let r,{Writable:n}=e.r(81111),{assertCacheKey:s,assertCacheValue:a}=e.r(618763),o=3,l=2e9;function c(e,t){return null==e&&null==t||(null!=e||null==t)&&(null==e||null!=t)&&(Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,i)=>e===t[i]):e===t)}t.exports=class{#eh=l;#eu=1/0;#ej;#eH;#eq;#ez;#eV;#eG;#eY;#eW;constructor(e){if(e){if("object"!=typeof e)throw TypeError("SqliteCacheStore options must be an object");if(void 0!==e.maxEntrySize){if("number"!=typeof e.maxEntrySize||!Number.isInteger(e.maxEntrySize)||e.maxEntrySize<0)throw TypeError("SqliteCacheStore options.maxEntrySize must be a non-negative integer");if(e.maxEntrySize>l)throw TypeError("SqliteCacheStore options.maxEntrySize must be less than 2gb");this.#eh=e.maxEntrySize}if(void 0!==e.maxCount){if("number"!=typeof e.maxCount||!Number.isInteger(e.maxCount)||e.maxCount<0)throw TypeError("SqliteCacheStore options.maxCount must be a non-negative integer");this.#eu=e.maxCount}}r||(r=(()=>{let e=Error("Cannot find module 'node:sqlite': Unsupported external type Url for commonjs reference");throw e.code="MODULE_NOT_FOUND",e})().DatabaseSync),this.#ej=new r(e?.location??":memory:"),this.#ej.exec(`
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA temp_store = memory;
PRAGMA optimize;
CREATE TABLE IF NOT EXISTS cacheInterceptorV${o} (
-- Data specific to us
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT NOT NULL,
method TEXT NOT NULL,
-- Data returned to the interceptor
body BUF NULL,
deleteAt INTEGER NOT NULL,
statusCode INTEGER NOT NULL,
statusMessage TEXT NOT NULL,
headers TEXT NULL,
cacheControlDirectives TEXT NULL,
etag TEXT NULL,
vary TEXT NULL,
cachedAt INTEGER NOT NULL,
staleAt INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${o}_getValuesQuery ON cacheInterceptorV${o}(url, method, deleteAt);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${o}_deleteByUrlQuery ON cacheInterceptorV${o}(deleteAt);
`),this.#eH=this.#ej.prepare(`
SELECT
id,
body,
deleteAt,
statusCode,
statusMessage,
headers,
etag,
cacheControlDirectives,
vary,
cachedAt,
staleAt
FROM cacheInterceptorV${o}
WHERE
url = ?
AND method = ?
ORDER BY
deleteAt ASC
`),this.#eq=this.#ej.prepare(`
UPDATE cacheInterceptorV${o} SET
body = ?,
deleteAt = ?,
statusCode = ?,
statusMessage = ?,
headers = ?,
etag = ?,
cacheControlDirectives = ?,
cachedAt = ?,
staleAt = ?
WHERE
id = ?
`),this.#ez=this.#ej.prepare(`
INSERT INTO cacheInterceptorV${o} (
url,
method,
body,
deleteAt,
statusCode,
statusMessage,
headers,
etag,
cacheControlDirectives,
vary,
cachedAt,
staleAt
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`),this.#eG=this.#ej.prepare(`DELETE FROM cacheInterceptorV${o} WHERE url = ?`),this.#eY=this.#ej.prepare(`SELECT COUNT(*) AS total FROM cacheInterceptorV${o}`),this.#eV=this.#ej.prepare(`DELETE FROM cacheInterceptorV${o} WHERE deleteAt <= ?`),this.#eW=this.#eu===1/0?null:this.#ej.prepare(`
DELETE FROM cacheInterceptorV${o}
WHERE id IN (
SELECT
id
FROM cacheInterceptorV${o}
ORDER BY cachedAt DESC
LIMIT ?
)
`)}close(){this.#ej.close()}get(e){s(e);let t=this.#eJ(e);return t?{body:t.body?Buffer.from(t.body.buffer,t.body.byteOffset,t.body.byteLength):void 0,statusCode:t.statusCode,statusMessage:t.statusMessage,headers:t.headers?JSON.parse(t.headers):void 0,etag:t.etag?t.etag:void 0,vary:t.vary?JSON.parse(t.vary):void 0,cacheControlDirectives:t.cacheControlDirectives?JSON.parse(t.cacheControlDirectives):void 0,cachedAt:t.cachedAt,staleAt:t.staleAt,deleteAt:t.deleteAt}:void 0}set(e,t){s(e);let i=this.#eK(e),r=Array.isArray(t.body)?Buffer.concat(t.body):t.body,n=r?.byteLength;if(n&&n>this.#eh)return;let a=this.#eJ(e,!0);a?this.#eq.run(r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.cachedAt,t.staleAt,a.id):(this.#eZ(),this.#ez.run(i,e.method,r,t.deleteAt,t.statusCode,t.statusMessage,t.headers?JSON.stringify(t.headers):null,t.etag?t.etag:null,t.cacheControlDirectives?JSON.stringify(t.cacheControlDirectives):null,t.vary?JSON.stringify(t.vary):null,t.cachedAt,t.staleAt))}createWriteStream(e,t){s(e),a(t);let i=0,r=[],o=this;return new n({decodeStrings:!0,write(e,t,n){(i+=e.byteLength)=e.deleteAt&&!t)break;let i=!0;if(e.vary){let t=JSON.parse(e.vary);for(let e in t)if(!c(r[e],t[e])){i=!1;break}}if(i)return e}}}},302260,(e,t,i)=>{"use strict";let{kConstruct:r}=e.r(954673),{kEnumerableProperty:n}=e.r(122857),{iteratorMixin:s,isValidHeaderName:a,isValidHeaderValue:o}=e.r(402649),{webidl:l}=e.r(192321),c=e.r(57328),d=e.r(812057);function u(e){return 10===e||13===e||9===e||32===e}function h(e){let t=0,i=e.length;for(;i>t&&u(e.charCodeAt(i-1));)--i;for(;i>t&&u(e.charCodeAt(t));)++t;return 0===t&&i===e.length?e:e.substring(t,i)}function A(e,t){if(Array.isArray(t))for(let i=0;i>","record"]})}function p(e,t,i){if(i=h(i),a(t)){if(!o(i))throw l.errors.invalidArgument({prefix:"Headers.append",value:i,type:"header value"})}else throw l.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header name"});if("immutable"===b(e))throw TypeError("immutable");return C(e).append(t,i,!1)}function f(e){let t=C(e);if(!t)return[];if(t.sortedMap)return t.sortedMap;let i=[],r=t.toSortedArray(),n=t.cookies;if(null===n||1===n.length)return t.sortedMap=r;for(let e=0;e>1)][0]<=l[0]?a=o+1:s=o;if(r!==o){for(n=r;n>a;)t[n]=t[--n];t[a]=l}}if(!i.next().done)throw TypeError("Unreachable");return t}{let e=0;for(let{0:i,1:{value:r}}of this.headersMap)t[e++]=[i,r],c(null!==r);return t.sort(g)}}}class y{#eX;#e0;constructor(e){if(l.util.markAsUncloneable(this),e===r)return;this.#e0=new m,this.#eX="none",void 0!==e&&A(this,e=l.converters.HeadersInit(e,"Headers constructor","init"))}append(e,t){l.brandCheck(this,y),l.argumentLengthCheck(arguments,2,"Headers.append");let i="Headers.append";return e=l.converters.ByteString(e,i,"name"),t=l.converters.ByteString(t,i,"value"),p(this,e,t)}delete(e){l.brandCheck(this,y),l.argumentLengthCheck(arguments,1,"Headers.delete");let t="Headers.delete";if(!a(e=l.converters.ByteString(e,t,"name")))throw l.errors.invalidArgument({prefix:"Headers.delete",value:e,type:"header name"});if("immutable"===this.#eX)throw TypeError("immutable");this.#e0.contains(e,!1)&&this.#e0.delete(e,!1)}get(e){l.brandCheck(this,y),l.argumentLengthCheck(arguments,1,"Headers.get");let t="Headers.get";if(!a(e=l.converters.ByteString(e,t,"name")))throw l.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#e0.get(e,!1)}has(e){l.brandCheck(this,y),l.argumentLengthCheck(arguments,1,"Headers.has");let t="Headers.has";if(!a(e=l.converters.ByteString(e,t,"name")))throw l.errors.invalidArgument({prefix:t,value:e,type:"header name"});return this.#e0.contains(e,!1)}set(e,t){l.brandCheck(this,y),l.argumentLengthCheck(arguments,2,"Headers.set");let i="Headers.set";if(e=l.converters.ByteString(e,i,"name"),t=h(t=l.converters.ByteString(t,i,"value")),a(e)){if(!o(t))throw l.errors.invalidArgument({prefix:i,value:t,type:"header value"})}else throw l.errors.invalidArgument({prefix:i,value:e,type:"header name"});if("immutable"===this.#eX)throw TypeError("immutable");this.#e0.set(e,t,!1)}getSetCookie(){l.brandCheck(this,y);let e=this.#e0.cookies;return e?[...e]:[]}[d.inspect.custom](e,t){return t.depth??=e,`Headers ${d.formatWithOptions(t,this.#e0.entries)}`}static getHeadersGuard(e){return e.#eX}static setHeadersGuard(e,t){e.#eX=t}static getHeadersList(e){return e.#e0}static setHeadersList(e,t){e.#e0=t}}let{getHeadersGuard:b,setHeadersGuard:E,getHeadersList:C,setHeadersList:w}=y;Reflect.deleteProperty(y,"getHeadersGuard"),Reflect.deleteProperty(y,"setHeadersGuard"),Reflect.deleteProperty(y,"getHeadersList"),Reflect.deleteProperty(y,"setHeadersList"),s("Headers",y,f,0,1),Object.defineProperties(y.prototype,{append:n,delete:n,get:n,has:n,set:n,getSetCookie:n,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[d.inspect.custom]:{enumerable:!1}}),l.converters.HeadersInit=function(e,t,i){if(l.util.Type(e)===l.util.Types.OBJECT){let r=Reflect.get(e,Symbol.iterator);if(!d.types.isProxy(e)&&r===y.prototype.entries)try{return C(e).entriesList}catch{}return"function"==typeof r?l.converters["sequence>"](e,t,i,r.bind(e)):l.converters["record"](e,t,i)}throw l.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence>","record"]})},t.exports={fill:A,compareHeaderName:g,Headers:y,HeadersList:m,getHeadersGuard:b,setHeadersGuard:E,setHeadersList:w,getHeadersList:C}},144796,(e,t,i)=>{"use strict";let{Headers:r,HeadersList:n,fill:s,getHeadersGuard:a,setHeadersGuard:o,setHeadersList:l}=e.r(302260),{extractBody:c,cloneBody:d,mixinBody:u,streamRegistry:h,bodyUnusable:A}=e.r(154718),p=e.r(122857),f=e.r(812057),{kEnumerableProperty:g}=p,{isValidReasonPhrase:m,isCancelled:y,isAborted:b,isErrorLike:E,environmentSettingsObject:C}=e.r(402649),{redirectStatusSet:w,nullBodyStatus:I}=e.r(267267),{webidl:v}=e.r(192321),{URLSerializer:B}=e.r(441628),{kConstruct:Q}=e.r(954673),x=e.r(57328),{isomorphicEncode:S,serializeJavascriptValueToJSONString:k}=e.r(142677),T=new TextEncoder("utf-8");class N{#z;#A;static error(){return q(O(),"immutable")}static json(e,t){v.argumentLengthCheck(arguments,1,"Response.json"),null!==t&&(t=v.converters.ResponseInit(t));let i=c(T.encode(k(e))),r=q(M({}),"response");return H(r,t,{body:i[0],type:"application/json"}),r}static redirect(e,t=302){let i;v.argumentLengthCheck(arguments,1,"Response.redirect"),e=v.converters.USVString(e),t=v.converters["unsigned short"](t);try{i=new URL(e,C.settingsObject.baseUrl)}catch(t){throw TypeError(`Failed to parse URL from ${e}`,{cause:t})}if(!w.has(t))throw RangeError(`Invalid status code ${t}`);let r=q(M({}),"immutable");r.#A.status=t;let n=S(B(i));return r.#A.headersList.append("location",n,!0),r}constructor(e=null,t){if(v.util.markAsUncloneable(this),e===Q)return;null!==e&&(e=v.converters.BodyInit(e,"Response","body")),t=v.converters.ResponseInit(t),this.#A=M({}),this.#z=new r(Q),o(this.#z,"response"),l(this.#z,this.#A.headersList);let i=null;if(null!=e){const[t,r]=c(e);i={body:t,type:r}}H(this,t,i)}get type(){return v.brandCheck(this,N),this.#A.type}get url(){v.brandCheck(this,N);let e=this.#A.urlList,t=e[e.length-1]??null;return null===t?"":B(t,!0)}get redirected(){return v.brandCheck(this,N),this.#A.urlList.length>1}get status(){return v.brandCheck(this,N),this.#A.status}get ok(){return v.brandCheck(this,N),this.#A.status>=200&&this.#A.status<=299}get statusText(){return v.brandCheck(this,N),this.#A.statusText}get headers(){return v.brandCheck(this,N),this.#z}get body(){return v.brandCheck(this,N),this.#A.body?this.#A.body.stream:null}get bodyUsed(){return v.brandCheck(this,N),!!this.#A.body&&p.isDisturbed(this.#A.body.stream)}clone(){if(v.brandCheck(this,N),A(this.#A))throw v.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let e=F(this.#A);return 0!==this.#A.urlList.length&&this.#A.body?.stream&&h.register(this,new WeakRef(this.#A.body.stream)),q(e,a(this.#z))}[f.inspect.custom](e,t){null===t.depth&&(t.depth=2),t.colors??=!0;let i={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${f.formatWithOptions(t,i)}`}static getResponseHeaders(e){return e.#z}static setResponseHeaders(e,t){e.#z=t}static getResponseState(e){return e.#A}static setResponseState(e,t){e.#A=t}}let{getResponseHeaders:D,setResponseHeaders:_,getResponseState:R,setResponseState:L}=N;function F(e){if(e.internalResponse)return $(F(e.internalResponse),e.type);let t=M({...e,body:null});return null!=e.body&&(t.body=d(e.body)),t}function M(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new n(e?.headersList):new n,urlList:e?.urlList?[...e.urlList]:[]}}function O(e){return M({type:"error",status:0,error:E(e)?e:Error(e?String(e):e),aborted:e&&"AbortError"===e.name})}function U(e){return"error"===e.type&&0===e.status}function P(e,t){return t={internalResponse:e,...t},new Proxy(e,{get:(e,i)=>i in t?t[i]:e[i],set:(e,i,r)=>(x(!(i in t)),e[i]=r,!0)})}function $(e,t){return"basic"===t?P(e,{type:"basic",headersList:e.headersList}):"cors"===t?P(e,{type:"cors",headersList:e.headersList}):"opaque"===t?P(e,{type:"opaque",urlList:[],status:0,statusText:"",body:null}):"opaqueredirect"===t?P(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null}):void x(!1)}function j(e,t=null){return x(y(e)),b(e)?O(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:t})):O(Object.assign(new DOMException("Request was cancelled."),{cause:t}))}function H(e,t,i){if(null!==t.status&&(t.status<200||t.status>599))throw RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in t&&null!=t.statusText&&!m(String(t.statusText)))throw TypeError("Invalid statusText");if("status"in t&&null!=t.status&&(R(e).status=t.status),"statusText"in t&&null!=t.statusText&&(R(e).statusText=t.statusText),"headers"in t&&null!=t.headers&&s(D(e),t.headers),i){if(I.includes(e.status))throw v.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});R(e).body=i.body,null==i.type||R(e).headersList.contains("content-type",!0)||R(e).headersList.append("content-type",i.type,!0)}}function q(e,t){let i=new N(Q);L(i,e);let n=new r(Q);return _(i,n),l(n,e.headersList),o(n,t),0!==e.urlList.length&&e.body?.stream&&h.register(i,new WeakRef(e.body.stream)),i}Reflect.deleteProperty(N,"getResponseHeaders"),Reflect.deleteProperty(N,"setResponseHeaders"),Reflect.deleteProperty(N,"getResponseState"),Reflect.deleteProperty(N,"setResponseState"),u(N,R),Object.defineProperties(N.prototype,{type:g,url:g,status:g,ok:g,redirected:g,statusText:g,headers:g,clone:g,body:g,bodyUsed:g,[Symbol.toStringTag]:{value:"Response",configurable:!0}}),Object.defineProperties(N,{json:g,redirect:g,error:g}),v.converters.XMLHttpRequestBodyInit=function(e,t,i){return"string"==typeof e?v.converters.USVString(e,t,i):v.is.Blob(e)||v.is.BufferSource(e)||v.is.FormData(e)||v.is.URLSearchParams(e)?e:v.converters.DOMString(e,t,i)},v.converters.BodyInit=function(e,t,i){return v.is.ReadableStream(e)||e?.[Symbol.asyncIterator]?e:v.converters.XMLHttpRequestBodyInit(e,t,i)},v.converters.ResponseInit=v.dictionaryConverter([{key:"status",converter:v.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:v.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:v.converters.HeadersInit}]),v.is.Response=v.util.MakeTypeAssertion(N),t.exports={isNetworkError:U,makeNetworkError:O,makeResponse:M,makeAppropriateNetworkError:j,filterResponse:$,Response:N,cloneResponse:F,fromInnerResponse:q,getResponseState:R}},625461,(e,t,i)=>{"use strict";let r,{extractBody:n,mixinBody:s,cloneBody:a,bodyUnusable:o}=e.r(154718),{Headers:l,fill:c,HeadersList:d,setHeadersGuard:u,getHeadersGuard:h,setHeadersList:A,getHeadersList:p}=e.r(302260),f=e.r(122857),g=e.r(812057),{isValidHTTPToken:m,sameOrigin:y,environmentSettingsObject:b}=e.r(402649),{forbiddenMethodsSet:E,corsSafeListedMethodsSet:C,referrerPolicy:w,requestRedirect:I,requestMode:v,requestCredentials:B,requestCache:Q,requestDuplex:x}=e.r(267267),{kEnumerableProperty:S,normalizedMethodRecordsBase:k,normalizedMethodRecords:T}=f,{webidl:N}=e.r(192321),{URLSerializer:D}=e.r(441628),{kConstruct:_}=e.r(954673),R=e.r(57328),{getMaxListeners:L,setMaxListeners:F,defaultMaxListeners:M}=e.r(687769),O=Symbol("abortController"),U=new FinalizationRegistry(({signal:e,abort:t})=>{e.removeEventListener("abort",t)}),P=new WeakMap;try{r=L(new AbortController().signal)>0}catch{r=!1}function $(e){return t;function t(){let i=e.deref();if(void 0!==i){U.unregister(t),this.removeEventListener("abort",t),i.abort(this.reason);let e=P.get(i.signal);if(void 0!==e){if(0!==e.size){for(let t of e){let e=t.deref();void 0!==e&&e.abort(this.reason)}e.clear()}P.delete(i.signal)}}}}let j=!1;class H{#e1;#e2;#z;#A;constructor(e,t){let i;if(N.util.markAsUncloneable(this),e===_)return;const s="Request constructor";N.argumentLengthCheck(arguments,1,s),e=N.converters.RequestInfo(e),t=N.converters.RequestInit(t);let a=null,h=null;const g=b.settingsObject.baseUrl;let w=null;if("string"==typeof e){let i;this.#e2=t.dispatcher;try{i=new URL(e,g)}catch(t){throw TypeError("Failed to parse URL from "+e,{cause:t})}if(i.username||i.password)throw TypeError("Request cannot be constructed from a URL that includes credentials: "+e);a=J({urlList:[i]}),h="cors"}else R(N.is.Request(e)),a=e.#A,w=e.#e1,this.#e2=t.dispatcher||e.#e2;const I=b.settingsObject.origin;let v="client";if(a.window?.constructor?.name==="EnvironmentSettingsObject"&&y(a.window,I)&&(v=a.window),null!=t.window)throw TypeError(`'window' option '${v}' must be null`);"window"in t&&(v="no-window"),a=J({method:a.method,headersList:a.headersList,unsafeRequest:a.unsafeRequest,client:b.settingsObject,window:v,priority:a.priority,origin:a.origin,referrer:a.referrer,referrerPolicy:a.referrerPolicy,mode:a.mode,credentials:a.credentials,cache:a.cache,redirect:a.redirect,integrity:a.integrity,keepalive:a.keepalive,reloadNavigation:a.reloadNavigation,historyNavigation:a.historyNavigation,urlList:[...a.urlList]});const B=0!==Object.keys(t).length;if(B&&("navigate"===a.mode&&(a.mode="same-origin"),a.reloadNavigation=!1,a.historyNavigation=!1,a.origin="client",a.referrer="client",a.referrerPolicy="",a.url=a.urlList[a.urlList.length-1],a.urlList=[a.url]),void 0!==t.referrer){const e=t.referrer;if(""===e)a.referrer="no-referrer";else{let t;try{t=new URL(e,g)}catch(t){throw TypeError(`Referrer "${e}" is not a valid URL.`,{cause:t})}"about:"===t.protocol&&"client"===t.hostname||I&&!y(t,b.settingsObject.baseUrl)?a.referrer="client":a.referrer=t}}if(void 0!==t.referrerPolicy&&(a.referrerPolicy=t.referrerPolicy),"navigate"===(i=void 0!==t.mode?t.mode:h))throw N.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(null!=i&&(a.mode=i),void 0!==t.credentials&&(a.credentials=t.credentials),void 0!==t.cache&&(a.cache=t.cache),"only-if-cached"===a.cache&&"same-origin"!==a.mode)throw TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(void 0!==t.redirect&&(a.redirect=t.redirect),null!=t.integrity&&(a.integrity=String(t.integrity)),void 0!==t.keepalive&&(a.keepalive=!!t.keepalive),void 0!==t.method){let e=t.method;const i=T[e];if(void 0!==i)a.method=i;else{if(!m(e))throw TypeError(`'${e}' is not a valid HTTP method.`);const t=e.toUpperCase();if(E.has(t))throw TypeError(`'${e}' HTTP method is unsupported.`);e=k[t]??e,a.method=e}j||"patch"!==a.method||(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),j=!0)}void 0!==t.signal&&(w=t.signal),this.#A=a;const Q=new AbortController;if(this.#e1=Q.signal,null!=w)if(w.aborted)Q.abort(w.reason);else{this[O]=Q;const e=$(new WeakRef(Q));r&&L(w)===M&&F(1500,w),f.addAbortListener(w,e),U.register(Q,{signal:w,abort:e},e)}if(this.#z=new l(_),A(this.#z,a.headersList),u(this.#z,"request"),"no-cors"===i){if(!C.has(a.method))throw TypeError(`'${a.method} is unsupported in no-cors mode.`);u(this.#z,"request-no-cors")}if(B){const e=p(this.#z),i=void 0!==t.headers?t.headers:new d(e);if(e.clear(),i instanceof d){for(const{name:t,value:r}of i.rawValues())e.append(t,r,!1);e.cookies=i.cookies}else c(this.#z,i)}const x=N.is.Request(e)?e.#A.body:null;if((null!=t.body||null!=x)&&("GET"===a.method||"HEAD"===a.method))throw TypeError("Request with GET/HEAD method cannot have body.");let S=null;if(null!=t.body){const[e,i]=n(t.body,a.keepalive);S=e,i&&!p(this.#z).contains("content-type",!0)&&this.#z.append("content-type",i,!0)}const D=S??x;if(null!=D&&null==D.source){if(null!=S&&null==t.duplex)throw TypeError("RequestInit: duplex option is required when sending a body.");if("same-origin"!==a.mode&&"cors"!==a.mode)throw TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');a.useCORSPreflightFlag=!0}let P=D;if(null==S&&null!=x){if(o(e.#A))throw TypeError("Cannot construct a Request with a Request object that has already been used.");const t=new TransformStream;x.stream.pipeThrough(t),P={source:x.source,length:x.length,stream:t.readable}}this.#A.body=P}get method(){return N.brandCheck(this,H),this.#A.method}get url(){return N.brandCheck(this,H),D(this.#A.url)}get headers(){return N.brandCheck(this,H),this.#z}get destination(){return N.brandCheck(this,H),this.#A.destination}get referrer(){return(N.brandCheck(this,H),"no-referrer"===this.#A.referrer)?"":"client"===this.#A.referrer?"about:client":this.#A.referrer.toString()}get referrerPolicy(){return N.brandCheck(this,H),this.#A.referrerPolicy}get mode(){return N.brandCheck(this,H),this.#A.mode}get credentials(){return N.brandCheck(this,H),this.#A.credentials}get cache(){return N.brandCheck(this,H),this.#A.cache}get redirect(){return N.brandCheck(this,H),this.#A.redirect}get integrity(){return N.brandCheck(this,H),this.#A.integrity}get keepalive(){return N.brandCheck(this,H),this.#A.keepalive}get isReloadNavigation(){return N.brandCheck(this,H),this.#A.reloadNavigation}get isHistoryNavigation(){return N.brandCheck(this,H),this.#A.historyNavigation}get signal(){return N.brandCheck(this,H),this.#e1}get body(){return N.brandCheck(this,H),this.#A.body?this.#A.body.stream:null}get bodyUsed(){return N.brandCheck(this,H),!!this.#A.body&&f.isDisturbed(this.#A.body.stream)}get duplex(){return N.brandCheck(this,H),"half"}clone(){if(N.brandCheck(this,H),o(this.#A))throw TypeError("unusable");let e=K(this.#A),t=new AbortController;if(this.signal.aborted)t.abort(this.signal.reason);else{let e=P.get(this.signal);void 0===e&&(e=new Set,P.set(this.signal,e));let i=new WeakRef(t);e.add(i),f.addAbortListener(t.signal,$(i))}return Z(e,this.#e2,t.signal,h(this.#z))}[g.inspect.custom](e,t){null===t.depth&&(t.depth=2),t.colors??=!0;let i={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${g.formatWithOptions(t,i)}`}static setRequestSignal(e,t){return e.#e1=t,e}static getRequestDispatcher(e){return e.#e2}static setRequestDispatcher(e,t){e.#e2=t}static setRequestHeaders(e,t){e.#z=t}static getRequestState(e){return e.#A}static setRequestState(e,t){e.#A=t}}let{setRequestSignal:q,getRequestDispatcher:z,setRequestDispatcher:V,setRequestHeaders:G,getRequestState:Y,setRequestState:W}=H;function J(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,useURLCredentials:e.useURLCredentials??void 0,traversableForUserPrompts:e.traversableForUserPrompts??"client",urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new d(e.headersList):new d}}function K(e){let t=J({...e,body:null});return null!=e.body&&(t.body=a(e.body)),t}function Z(e,t,i,r){let n=new H(_);W(n,e),V(n,t),q(n,i);let s=new l(_);return G(n,s),A(s,e.headersList),u(s,r),n}Reflect.deleteProperty(H,"setRequestSignal"),Reflect.deleteProperty(H,"getRequestDispatcher"),Reflect.deleteProperty(H,"setRequestDispatcher"),Reflect.deleteProperty(H,"setRequestHeaders"),Reflect.deleteProperty(H,"getRequestState"),Reflect.deleteProperty(H,"setRequestState"),s(H,Y),Object.defineProperties(H.prototype,{method:S,url:S,headers:S,redirect:S,clone:S,signal:S,duplex:S,destination:S,body:S,bodyUsed:S,isHistoryNavigation:S,isReloadNavigation:S,keepalive:S,integrity:S,cache:S,credentials:S,attribute:S,referrerPolicy:S,referrer:S,mode:S,[Symbol.toStringTag]:{value:"Request",configurable:!0}}),N.is.Request=N.util.MakeTypeAssertion(H),N.converters.RequestInfo=function(e){return"string"==typeof e?N.converters.USVString(e):N.is.Request(e)?e:N.converters.USVString(e)},N.converters.RequestInit=N.dictionaryConverter([{key:"method",converter:N.converters.ByteString},{key:"headers",converter:N.converters.HeadersInit},{key:"body",converter:N.nullableConverter(N.converters.BodyInit)},{key:"referrer",converter:N.converters.USVString},{key:"referrerPolicy",converter:N.converters.DOMString,allowedValues:w},{key:"mode",converter:N.converters.DOMString,allowedValues:v},{key:"credentials",converter:N.converters.DOMString,allowedValues:B},{key:"cache",converter:N.converters.DOMString,allowedValues:Q},{key:"redirect",converter:N.converters.DOMString,allowedValues:I},{key:"integrity",converter:N.converters.DOMString},{key:"keepalive",converter:N.converters.boolean},{key:"signal",converter:N.nullableConverter(e=>N.converters.AbortSignal(e,"RequestInit","signal"))},{key:"window",converter:N.converters.any},{key:"duplex",converter:N.converters.DOMString,allowedValues:x},{key:"dispatcher",converter:N.converters.any},{key:"priority",converter:N.converters.DOMString,allowedValues:["high","low","auto"],defaultValue:()=>"auto"}]),t.exports={Request:H,makeRequest:J,fromInnerRequest:Z,cloneRequest:K,getRequestDispatcher:z,getRequestState:Y}},839086,(e,t,i)=>{"use strict";let r,n=e.r(57328),{runtimeFeatures:s}=e.r(350022),a=new Map([["sha256",0],["sha384",1],["sha512",2]]);if(s.has("crypto")){let t=(r=e.r(666680)).getHashes();for(let e of(0===t.length&&a.clear(),a.keys()))!1===t.includes(e)&&a.delete(e)}else a.clear();let o=Map.prototype.get.bind(a),l=Map.prototype.has.bind(a),c=!1===s.has("crypto")||0===a.size?()=>!0:(e,t)=>{let i=u(t);if(0===i.length)return!0;for(let t of d(i)){let i=t.alg,r=t.val;if(A(h(i,e),r))return!0}return!1};function d(e){let t=[],i=null;for(let r of e){if(n(l(r.alg),"Invalid SRI hash algorithm token"),0===t.length){t.push(r),i=r;continue}let e=o(i.alg),s=o(r.alg);se?(i=r,t[0]=r,t.length=1):t.push(r))}return t}function u(e){let t=[];for(let i of e.split(" ")){let e=i.split("?",1)[0],r="",n=[e.slice(0,6),e.slice(7)],s=n[0];if(!l(s))continue;n[1]&&(r=n[1]);let a={alg:s,val:r};t.push(a)}return t}let h=(e,t)=>r.hash(e,t,"base64");function A(e,t){let i=e.length;0!==i&&"="===e[i-1]&&(i-=1),0!==i&&"="===e[i-1]&&(i-=1);let r=t.length;if(0!==r&&"="===t[r-1]&&(r-=1),0!==r&&"="===t[r-1]&&(r-=1),i!==r)return!1;for(let r=0;r{"use strict";let r,{makeNetworkError:n,makeAppropriateNetworkError:s,filterResponse:a,makeResponse:o,fromInnerResponse:l,getResponseState:c}=e.r(144796),{HeadersList:d}=e.r(302260),{Request:u,cloneRequest:h,getRequestDispatcher:A,getRequestState:p}=e.r(625461),f=e.r(727028),{makePolicyContainer:g,clonePolicyContainer:m,requestBadPort:y,TAOCheck:b,appendRequestOriginHeader:E,responseLocationURL:C,requestCurrentURL:w,setRequestReferrerPolicyOnRedirect:I,tryUpgradeRequestToAPotentiallyTrustworthyURL:v,createOpaqueTimingInfo:B,appendFetchMetadata:Q,corsCheck:x,crossOriginResourcePolicyCheck:S,determineRequestsReferrer:k,coarsenedSharedCurrentTime:T,sameOrigin:N,isCancelled:D,isAborted:_,isErrorLike:R,fullyReadBody:L,readableStreamClose:F,urlIsLocal:M,urlIsHttpHttpsScheme:O,urlHasHttpsScheme:U,clampAndCoarsenConnectionTimingInfo:P,simpleRangeHeaderValue:$,buildContentRange:j,createInflate:H,extractMimeType:q,hasAuthenticationEntry:z,includesCredentials:V,isTraversableNavigable:G}=e.r(402649),Y=e.r(57328),{safelyExtractBody:W,extractBody:J}=e.r(154718),{redirectStatusSet:K,nullBodyStatus:Z,safeMethodsSet:X,requestBodyHeader:ee,subresourceSet:et}=e.r(267267),ei=e.r(687769),{Readable:er,pipeline:en,finished:es,isErrored:ea,isReadable:eo}=e.r(81111),{addAbortListener:el,bufferToLowerCasedHeaderName:ec}=e.r(122857),{dataURLProcessor:ed,serializeAMimeType:eu,minimizeSupportedMimeType:eh}=e.r(441628),{getGlobalDispatcher:eA}=e.r(312706),{webidl:ep}=e.r(192321),{STATUS_CODES:ef}=e.r(347299),{bytesMatch:eg}=e.r(839086),{createDeferredPromise:em}=e.r(493578),{isomorphicEncode:ey}=e.r(142677),{runtimeFeatures:eb}=e.r(350022),eE=eb.has("zstd"),eC=["GET","HEAD"],ew="u">typeof __UNDICI_IS_NODE__||"u">typeof esbuildDetection?"node":"undici";class eI extends ei{constructor(e){super(),this.dispatcher=e,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(e){"ongoing"===this.state&&(this.state="terminated",this.connection?.destroy(e),this.emit("terminated",e))}abort(e){"ongoing"===this.state&&(this.state="aborted",e||(e=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=e,this.connection?.destroy(e),this.emit("terminated",e))}}function ev(e){eQ(e,"fetch")}function eB(e,t){let i;ep.argumentLengthCheck(arguments,1,"globalThis.fetch");let r=em();try{i=new u(e,t)}catch(e){return r.reject(e),r.promise}let n=p(i);if(i.signal.aborted)return eS(r,n,null,i.signal.reason,null),r.promise;let s=n.client.globalObject;s?.constructor?.name==="ServiceWorkerGlobalScope"&&(n.serviceWorkers="none");let a=null,o=!1,c=null;el(i.signal,()=>{o=!0,Y(null!=c),c.abort(i.signal.reason);let e=a?.deref();eS(r,n,e,i.signal.reason,c.controller)});let d=e=>{if(!o){if(e.aborted)return void eS(r,n,a,c.serializedAbortReason,c.controller);if("error"===e.type)return void r.reject(TypeError("fetch failed",{cause:e.error}));a=new WeakRef(l(e,"immutable")),r.resolve(a.deref()),r=null}};return c=ek({request:n,processResponseEndOfBody:ev,processResponse:d,dispatcher:A(i),requestObject:i}),r.promise}function eQ(e,t="other"){if("error"===e.type&&e.aborted||!e.urlList?.length)return;let i=e.urlList[0],r=e.timingInfo,n=e.cacheState;O(i)&&null!==r&&(e.timingAllowPassed||(r=B({startTime:r.startTime}),n=""),r.endTime=T(),e.timingInfo=r,ex(r,i.href,t,globalThis,n,"",e.status))}let ex=performance.markResourceTiming;function eS(e,t,i,r,n){if(e&&e.reject(r),t.body?.stream!=null&&eo(t.body.stream)&&t.body.stream.cancel(r).catch(e=>{if("ERR_INVALID_STATE"!==e.code)throw e}),null==i)return;let s=c(i);s.body?.stream!=null&&eo(s.body.stream)&&n.error(r)}function ek({request:e,processRequestBodyChunkLength:t,processRequestEndOfBody:i,processResponse:r,processResponseEndOfBody:n,processResponseConsumeBody:s,useParallelQueue:a=!1,dispatcher:o=eA(),requestObject:l=null}){Y(o);let c=null,d=!1;null!=e.client&&(c=e.client.globalObject,d=e.client.crossOriginIsolatedCapability);let u=B({startTime:T(d)}),h={controller:new eI(o),request:e,timingInfo:u,processRequestBodyChunkLength:t,processRequestEndOfBody:i,processResponse:r,processResponseConsumeBody:s,processResponseEndOfBody:n,taskDestination:c,crossOriginIsolatedCapability:d,requestObject:l};if(Y(!e.body||e.body.stream),"client"===e.window&&(e.window=e.client?.globalObject?.constructor?.name==="Window"?e.client:"no-window"),"client"===e.origin&&(e.origin=e.client.origin),"client"===e.policyContainer&&(null!=e.client?e.policyContainer=m(e.client.policyContainer):e.policyContainer=g()),!e.headersList.contains("accept",!0)){let t="*/*";e.headersList.append("accept",t,!0)}return e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,et.has(e.destination),eT(h,!1),h.controller}async function eT(e,t){try{let i=e.request,r=null;if(i.localURLsOnly&&!M(w(i))&&(r=n("local URLs only")),v(i),"blocked"===y(i)&&(r=n("bad port")),""===i.referrerPolicy&&(i.referrerPolicy=i.policyContainer.referrerPolicy),"no-referrer"!==i.referrer&&(i.referrer=k(i)),null===r){let t=w(i);N(t,i.url)&&"basic"===i.responseTainting||"data:"===t.protocol||"navigate"===i.mode||"websocket"===i.mode?(i.responseTainting="basic",r=await eN(e)):"same-origin"===i.mode?r=n('request mode cannot be "same-origin"'):"no-cors"===i.mode?"follow"!==i.redirect?r=n('redirect mode cannot be "follow" for "no-cors" request'):(i.responseTainting="opaque",r=await eN(e)):O(w(i))?(i.responseTainting="cors",r=await eR(e)):r=n("URL scheme must be a HTTP(S) scheme")}if(t)return r;0===r.status||r.internalResponse||(i.responseTainting,"basic"===i.responseTainting?r=a(r,"basic"):"cors"===i.responseTainting?r=a(r,"cors"):"opaque"===i.responseTainting?r=a(r,"opaque"):Y(!1));let s=0===r.status?r:r.internalResponse;if(0===s.urlList.length&&s.urlList.push(...i.urlList),i.timingAllowFailed||(r.timingAllowPassed=!0),"opaque"===r.type&&206===s.status&&s.rangeRequested&&!i.headers.contains("range",!0)&&(r=s=n()),0!==r.status&&("HEAD"===i.method||"CONNECT"===i.method||Z.includes(s.status))&&(s.body=null,e.controller.dump=!0),i.integrity){let t=t=>e_(e,n(t));if("opaque"===i.responseTainting||null==r.body)return void t(r.error);let s=n=>{eg(n,i.integrity)?(r.body=W(n)[0],e_(e,r)):t("integrity mismatch")};L(r.body,s,t)}else e_(e,r)}catch(t){e.controller.terminate(t)}}function eN(t){if(D(t)&&0===t.request.redirectCount)return Promise.resolve(s(t));let{request:i}=t,{protocol:a}=w(i);switch(a){case"about:":return Promise.resolve(n("about scheme is not supported"));case"blob:":{r||(r=e.r(951615).resolveObjectURL);let t=w(i);if(0!==t.search.length)return Promise.resolve(n("NetworkError when attempting to fetch resource."));let s=r(t.toString());if("GET"!==i.method||!ep.is.Blob(s))return Promise.resolve(n("invalid method"));let a=o(),l=s.size,c=ey(`${l}`),d=s.type;if(i.headersList.contains("range",!0)){a.rangeRequested=!0;let e=$(i.headersList.get("range",!0),!0);if("failure"===e)return Promise.resolve(n("failed to fetch the data URL"));let{rangeStartValue:t,rangeEndValue:r}=e;if(null===t)r=(t=l-r)+r-1;else{if(t>=l)return Promise.resolve(n("Range start is greater than the blob's size."));(null===r||r>=l)&&(r=l-1)}let o=s.slice(t,r+1,d);a.body=J(o)[0];let c=ey(`${o.size}`),u=j(t,r,l);a.status=206,a.statusText="Partial Content",a.headersList.set("content-length",c,!0),a.headersList.set("content-type",d,!0),a.headersList.set("content-range",u,!0)}else{let e=J(s);a.statusText="OK",a.body=e[0],a.headersList.set("content-length",c,!0),a.headersList.set("content-type",d,!0)}return Promise.resolve(a)}case"data:":{let e=ed(w(i));if("failure"===e)return Promise.resolve(n("failed to fetch the data URL"));return Promise.resolve(o({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:eu(e.mimeType)}]],body:W(e.body)[0]}))}case"file:":return Promise.resolve(n("not implemented... yet..."));case"http:":case"https:":return eR(t).catch(e=>n(e));default:return Promise.resolve(n("unknown scheme"))}}function eD(e,t){e.request.done=!0,null!=e.processResponseDone&&queueMicrotask(()=>e.processResponseDone(t))}function e_(e,t){let i=e.timingInfo,r=()=>{let r=Date.now();"document"===e.request.destination&&(e.controller.fullTimingInfo=i),e.controller.reportTimingSteps=()=>{if(!O(e.request.url))return;i.endTime=r;let n=t.cacheState,s=t.bodyInfo;t.timingAllowPassed||(i=B(i),n="");let a=0;if("navigator"!==e.request.mode||!t.hasCrossOriginRedirects){a=t.status;let e=q(t.headersList);"failure"!==e&&(s.contentType=eh(e))}null!=e.request.initiatorType&&ex(i,e.request.url.href,e.request.initiatorType,globalThis,n,s,a)};let n=()=>{e.request.done=!0,null!=e.processResponseEndOfBody&&queueMicrotask(()=>e.processResponseEndOfBody(t)),null!=e.request.initiatorType&&e.controller.reportTimingSteps()};queueMicrotask(()=>n())};null!=e.processResponse&&queueMicrotask(()=>{e.processResponse(t),e.processResponse=null});let n="error"===t.type?t:t.internalResponse??t;null==n.body?r():es(n.body.stream,()=>{r()})}async function eR(e){let t=e.request,i=null,r=null,s=e.timingInfo;if(t.serviceWorkers,null===i){if("follow"===t.redirect&&(t.serviceWorkers="none"),r=i=await eF(e),"cors"===t.responseTainting&&"failure"===x(t,i))return n("cors failure");"failure"===b(t,i)&&(t.timingAllowFailed=!0)}return("opaque"===t.responseTainting||"opaque"===i.type)&&"blocked"===S(t.origin,t.client,t.destination,r)?n("blocked"):(K.has(r.status)&&("manual"!==t.redirect&&e.controller.connection.destroy(void 0,!1),"error"===t.redirect?i=n("unexpected redirect"):"manual"===t.redirect?i=r:"follow"===t.redirect?i=await eL(e,i):Y(!1)),i.timingInfo=s,i)}function eL(e,t){let i,r=e.request,s=t.internalResponse?t.internalResponse:t;try{if(i=C(s,w(r).hash),null==i)return t}catch(e){return Promise.resolve(n(e))}if(!O(i))return Promise.resolve(n("URL scheme must be a HTTP(S) scheme"));if(20===r.redirectCount)return Promise.resolve(n("redirect count exceeded"));if(r.redirectCount+=1,"cors"===r.mode&&(i.username||i.password)&&!N(r,i))return Promise.resolve(n('cross origin not allowed for request mode "cors"'));if("cors"===r.responseTainting&&(i.username||i.password))return Promise.resolve(n('URL cannot contain credentials for request mode "cors"'));if(303!==s.status&&null!=r.body&&null==r.body.source)return Promise.resolve(n());if([301,302].includes(s.status)&&"POST"===r.method||303===s.status&&!eC.includes(r.method))for(let e of(r.method="GET",r.body=null,ee))r.headersList.delete(e);N(w(r),i)||(r.headersList.delete("authorization",!0),r.headersList.delete("proxy-authorization",!0),r.headersList.delete("cookie",!0),r.headersList.delete("host",!0)),null!=r.body&&(Y(null!=r.body.source),r.body=W(r.body.source)[0]);let a=e.timingInfo;return a.redirectEndTime=a.postRedirectStartTime=T(e.crossOriginIsolatedCapability),0===a.redirectStartTime&&(a.redirectStartTime=a.startTime),r.urlList.push(i),I(r,s),eT(e,!0)}async function eF(e,t=!1,i=!1){let r=e.request,a=null,o=null,l=null,c=null,d=!1;"no-window"===r.window&&"error"===r.redirect?(a=e,o=r):(o=h(r),(a={...e}).request=o);let u="include"===r.credentials||"same-origin"===r.credentials&&"basic"===r.responseTainting,A=o.body?o.body.length:null,p=null;if(null==o.body&&["POST","PUT"].includes(o.method)&&(p="0"),null!=A&&(p=ey(`${A}`)),null!=p&&o.headersList.append("content-length",p,!0),null!=A&&o.keepalive,ep.is.URL(o.referrer)&&o.headersList.append("referer",ey(o.referrer.href),!0),E(o),Q(o),o.headersList.contains("user-agent",!0)||o.headersList.append("user-agent",ew,!0),"default"===o.cache&&(o.headersList.contains("if-modified-since",!0)||o.headersList.contains("if-none-match",!0)||o.headersList.contains("if-unmodified-since",!0)||o.headersList.contains("if-match",!0)||o.headersList.contains("if-range",!0))&&(o.cache="no-store"),"no-cache"!==o.cache||o.preventNoCacheCacheControlHeaderModification||o.headersList.contains("cache-control",!0)||o.headersList.append("cache-control","max-age=0",!0),("no-store"===o.cache||"reload"===o.cache)&&(o.headersList.contains("pragma",!0)||o.headersList.append("pragma","no-cache",!0),o.headersList.contains("cache-control",!0)||o.headersList.append("cache-control","no-cache",!0)),o.headersList.contains("range",!0)&&o.headersList.append("accept-encoding","identity",!0),o.headersList.contains("accept-encoding",!0)||(U(w(o))?o.headersList.append("accept-encoding","br, gzip, deflate",!0):o.headersList.append("accept-encoding","gzip, deflate",!0)),o.headersList.delete("host",!0),u&&!o.headersList.contains("authorization",!0)){let e=null;if(z(o)&&(void 0===o.useURLCredentials||!V(w(o))));else if(V(w(o))&&t){let{username:t,password:i}=w(o);e=`Basic ${Buffer.from(`${t}:${i}`).toString("base64")}`}null!==e&&o.headersList.append("Authorization",e,!1)}if(null==c&&(o.cache="no-store"),"no-store"!==o.cache&&o.cache,null==l){if("only-if-cached"===o.cache)return n("only if cached");let e=await eM(a,u,i);!X.has(o.method)&&e.status>=200&&e.status,d&&e.status,null==l&&(l=e)}if(l.urlList=[...o.urlList],o.headersList.contains("range",!0)&&(l.rangeRequested=!0),l.requestIncludesCredentials=u,401===l.status&&"cors"!==o.responseTainting&&u&&G(r.traversableForUserPrompts)){if(null!=r.body){if(null==r.body.source)return n("expected non-null body source");r.body=W(r.body.source)[0]}if(void 0===r.useURLCredentials||t)return D(e)?s(e):l;e.controller.connection.destroy(),l=await eF(e,!0)}if(407===l.status)return"no-window"===r.window?n():D(e)?s(e):n("proxy authentication required");if(421===l.status&&!i&&(null==r.body||null!=r.body.source)){if(D(e))return s(e);e.controller.connection.destroy(),l=await eF(e,t,!0)}return l}async function eM(e,t=!1,i=!1){Y(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(e,t=!0){!this.destroyed&&(this.destroyed=!0,t&&this.abort?.(e??new DOMException("The operation was aborted.","AbortError")))}};let r=e.request,a=null,l=e.timingInfo;r.cache="no-store",r.mode;let c=null;if(null==r.body&&e.processRequestEndOfBody)queueMicrotask(()=>e.processRequestEndOfBody());else if(null!=r.body){let t=async function*(t){D(e)||(yield t,e.processRequestBodyChunkLength?.(t.byteLength))},i=()=>{!D(e)&&e.processRequestEndOfBody&&e.processRequestEndOfBody()},n=t=>{D(e)||("AbortError"===t.name?e.controller.abort():e.controller.terminate(t))};c=async function*(){try{for await(let e of r.body.stream)yield*t(e);i()}catch(e){n(e)}}()}try{let{body:t,status:i,statusText:r,headersList:n,socket:s}=await A({body:c});if(s)a=o({status:i,statusText:r,headersList:n,socket:s});else{let s=t[Symbol.asyncIterator]();e.controller.next=()=>s.next(),a=o({status:i,statusText:r,headersList:n})}}catch(t){if("AbortError"===t.name)return e.controller.connection.destroy(),s(e,t);return n(t)}let u=new ReadableStream({start(t){e.controller.controller=t},pull:()=>e.controller.resume(),cancel:t=>{D(e)||e.controller.abort(t)},type:"bytes"});function h(t){_(e)?(a.aborted=!0,eo(u)&&e.controller.controller.error(e.controller.serializedAbortReason)):eo(u)&&e.controller.controller.error(TypeError("terminated",{cause:R(t)?t:void 0})),e.controller.connection.destroy()}return a.body={stream:u,source:null,length:null},e.controller.resume||e.controller.on("terminated",h),e.controller.resume=async()=>{for(;;){let t,i;try{let{done:i,value:r}=await e.controller.next();if(_(e))break;t=i?void 0:r}catch(r){e.controller.ended&&!l.encodedBodySize?t=void 0:(t=r,i=!0)}if(void 0===t){F(e.controller.controller),eD(e,a);return}if(l.decodedBodySize+=t?.byteLength??0,i)return void e.controller.terminate(t);let r=new Uint8Array(t);if(r.byteLength&&e.controller.controller.enqueue(r),ea(u))return void e.controller.terminate();if(e.controller.controller.desiredSize<=0)return}},a;function A({body:t}){let i=w(r),n=e.controller.dispatcher,s=i.pathname+i.search,a=0===i.search.length&&"?"===i.href[i.href.length-i.hash.length-1];return new Promise((o,c)=>n.dispatch({path:a?`${s}?`:s,origin:i.origin,method:r.method,body:n.isMockActive?r.body&&(r.body.source||r.body.stream):t,headers:r.headersList.entries,maxRedirections:0,upgrade:"websocket"===r.mode?"websocket":void 0},{body:null,abort:null,onConnect(t){let{connection:i}=e.controller;l.finalConnectionTimingInfo=P(void 0,l.postRedirectStartTime,e.crossOriginIsolatedCapability),i.destroyed?t(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",t),this.abort=i.abort=t),l.finalNetworkRequestStartTime=T(e.crossOriginIsolatedCapability)},onResponseStarted(){l.finalNetworkResponseStartTime=T(e.crossOriginIsolatedCapability)},onHeaders(e,t,i,n){if(e<200)return!1;let s=new d;for(let e=0;ei)return c(Error(`too many content-encodings in response: ${t.length}, maximum allowed is ${i}`)),!0;for(let e=t.length-1;e>=0;--e){let i=t[e].trim();if("x-gzip"===i||"gzip"===i)u.push(f.createGunzip({flush:f.constants.Z_SYNC_FLUSH,finishFlush:f.constants.Z_SYNC_FLUSH}));else if("deflate"===i)u.push(H({flush:f.constants.Z_SYNC_FLUSH,finishFlush:f.constants.Z_SYNC_FLUSH}));else if("br"===i)u.push(f.createBrotliDecompress({flush:f.constants.BROTLI_OPERATION_FLUSH,finishFlush:f.constants.BROTLI_OPERATION_FLUSH}));else if("zstd"===i&&eE)u.push(f.createZstdDecompress({flush:f.constants.ZSTD_e_continue,finishFlush:f.constants.ZSTD_e_end}));else{u.length=0;break}}}let h=this.onError.bind(this);return o({status:e,statusText:n,headersList:s,body:u.length?en(this.body,...u,e=>{e&&this.onError(e)}).on("error",h):this.body.on("error",h)}),!0},onData(t){if(e.controller.dump)return;let i=t;return l.encodedBodySize+=i.byteLength,this.body.push(i)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.ended=!0,this.body.push(null)},onError(t){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(t),e.controller.terminate(t),c(t)},onRequestUpgrade(e,t,i,r){if(null!=r.session&&200!==t||null==r.session&&101!==t)return!1;let n=new d;for(let[e,t]of Object.entries(i)){if(null==t)continue;let i=e.toLowerCase();if(Array.isArray(t))for(let e of t)n.append(i,String(e),!0);else n.append(i,String(t),!0)}return o({status:t,statusText:ef[t],headersList:n,socket:r}),!0},onUpgrade(e,t,i){if(null!=i.session&&200!==e||null==i.session&&101!==e)return!1;let r=new d;for(let e=0;e{"use strict";let r=e.r(57328),{URLSerializer:n}=e.r(441628),{isValidHeaderName:s}=e.r(402649);t.exports={urlEquals:function(e,t,i=!1){return n(e,i)===n(t,i)},getFieldValues:function(e){r(null!==e);let t=[];for(let i of e.split(","))s(i=i.trim())&&t.push(i);return t}}},947769,(e,t,i)=>{"use strict";let r=e.r(57328),{kConstruct:n}=e.r(954673),{urlEquals:s,getFieldValues:a}=e.r(576801),{kEnumerableProperty:o,isDisturbed:l}=e.r(122857),{webidl:c}=e.r(192321),{cloneResponse:d,fromInnerResponse:u,getResponseState:h}=e.r(144796),{Request:A,fromInnerRequest:p,getRequestState:f}=e.r(625461),{fetching:g}=e.r(258548),{urlIsHttpHttpsScheme:m,readAllBytes:y}=e.r(402649),{createDeferredPromise:b}=e.r(493578);class E{#e4;constructor(){arguments[0]!==n&&c.illegalConstructor(),c.util.markAsUncloneable(this),this.#e4=arguments[1]}async match(e,t={}){c.brandCheck(this,E);let i="Cache.match";c.argumentLengthCheck(arguments,1,i),e=c.converters.RequestInfo(e),t=c.converters.CacheQueryOptions(t,i,"options");let r=this.#e5(e,t,1);if(0!==r.length)return r[0]}async matchAll(e,t={}){c.brandCheck(this,E);let i="Cache.matchAll";return void 0!==e&&(e=c.converters.RequestInfo(e)),t=c.converters.CacheQueryOptions(t,i,"options"),this.#e5(e,t)}async add(e){c.brandCheck(this,E);let t="Cache.add";c.argumentLengthCheck(arguments,1,t);let i=[e=c.converters.RequestInfo(e)],r=this.addAll(i);return await r}async addAll(e){c.brandCheck(this,E);let t="Cache.addAll";c.argumentLengthCheck(arguments,1,t);let i=[],r=[];for(let i of e){if(void 0===i)throw c.errors.conversionFailed({prefix:t,argument:"Argument 1",types:["undefined is not allowed"]});if("string"==typeof(i=c.converters.RequestInfo(i)))continue;let e=f(i);if(!m(e.url)||"GET"!==e.method)throw c.errors.exception({header:t,message:"Expected http/s scheme when method is not GET."})}let n=[];for(let s of e){let e=f(new A(s));if(!m(e.url))throw c.errors.exception({header:t,message:"Expected http/s scheme."});e.initiator="fetch",e.destination="subresource",r.push(e);let o=b();n.push(g({request:e,processResponse(e){if("error"===e.type||206===e.status||e.status<200||e.status>299)o.reject(c.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(e.headersList.contains("vary")){for(let t of a(e.headersList.get("vary")))if("*"===t){for(let e of(o.reject(c.errors.exception({header:"Cache.addAll",message:"invalid vary field value"})),n))e.abort();return}}},processResponseEndOfBody(e){e.aborted?o.reject(new DOMException("aborted","AbortError")):o.resolve(e)}})),i.push(o.promise)}let s=Promise.all(i),o=await s,l=[],d=0;for(let e of o){let t={type:"put",request:r[d],response:e};l.push(t),d++}let u=b(),h=null;try{this.#e3(l)}catch(e){h=e}return queueMicrotask(()=>{null===h?u.resolve(void 0):u.reject(h)}),u.promise}async put(e,t){c.brandCheck(this,E);let i="Cache.put";c.argumentLengthCheck(arguments,2,i),e=c.converters.RequestInfo(e),t=c.converters.Response(t,i,"response");let r=null;if(!m((r=c.is.Request(e)?f(e):f(new A(e))).url)||"GET"!==r.method)throw c.errors.exception({header:i,message:"Expected an http/s scheme when method is not GET"});let n=h(t);if(206===n.status)throw c.errors.exception({header:i,message:"Got 206 status"});if(n.headersList.contains("vary")){for(let e of a(n.headersList.get("vary")))if("*"===e)throw c.errors.exception({header:i,message:"Got * vary field value"})}if(n.body&&(l(n.body.stream)||n.body.stream.locked))throw c.errors.exception({header:i,message:"Response body is locked or disturbed"});let s=d(n),o=b();null!=n.body?y(n.body.stream.getReader(),o.resolve,o.reject):o.resolve(void 0);let u=[],p={type:"put",request:r,response:s};u.push(p);let g=await o.promise;null!=s.body&&(s.body.source=g);let C=b(),w=null;try{this.#e3(u)}catch(e){w=e}return queueMicrotask(()=>{null===w?C.resolve():C.reject(w)}),C.promise}async delete(e,t={}){let i;c.brandCheck(this,E);let n="Cache.delete";c.argumentLengthCheck(arguments,1,n),e=c.converters.RequestInfo(e),t=c.converters.CacheQueryOptions(t,n,"options");let s=null;if(c.is.Request(e)){if("GET"!==(s=f(e)).method&&!t.ignoreMethod)return!1}else r("string"==typeof e),s=f(new A(e));let a=[],o={type:"delete",request:s,options:t};a.push(o);let l=b(),d=null;try{i=this.#e3(a)}catch(e){d=e}return queueMicrotask(()=>{null===d?l.resolve(!!i?.length):l.reject(d)}),l.promise}async keys(e,t={}){c.brandCheck(this,E);let i="Cache.keys";void 0!==e&&(e=c.converters.RequestInfo(e)),t=c.converters.CacheQueryOptions(t,i,"options");let r=null;if(void 0!==e)if(c.is.Request(e)){if("GET"!==(r=f(e)).method&&!t.ignoreMethod)return[]}else"string"==typeof e&&(r=f(new A(e)));let n=b(),s=[];if(void 0===e)for(let e of this.#e4)s.push(e[0]);else for(let e of this.#e8(r,t))s.push(e[0]);return queueMicrotask(()=>{let e=[];for(let t of s){let i=p(t,void 0,new AbortController().signal,"immutable");e.push(i)}n.resolve(Object.freeze(e))}),n.promise}#e3(e){let t=this.#e4,i=[...t],n=[],s=[];try{for(let i of e){let e;if("delete"!==i.type&&"put"!==i.type)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if("delete"===i.type&&null!=i.response)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#e8(i.request,i.options,n).length)throw new DOMException("???","InvalidStateError");if("delete"===i.type){if(e=this.#e8(i.request,i.options),0===e.length)return[];for(let i of e){let e=t.indexOf(i);r(-1!==e),t.splice(e,1)}}else if("put"===i.type){if(null==i.response)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let s=i.request;if(!m(s.url))throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if("GET"!==s.method)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(null!=i.options)throw c.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});for(let n of e=this.#e8(i.request)){let e=t.indexOf(n);r(-1!==e),t.splice(e,1)}t.push([i.request,i.response]),n.push([i.request,i.response])}s.push([i.request,i.response])}return s}catch(e){throw this.#e4.length=0,this.#e4=i,e}}#e8(e,t,i){let r=[];for(let n of i??this.#e4){let[i,s]=n;this.#e9(e,i,s,t)&&r.push(n)}return r}#e9(e,t,i=null,r){let n=new URL(e.url),o=new URL(t.url);if(r?.ignoreSearch&&(o.search="",n.search=""),!s(n,o,!0))return!1;if(null==i||r?.ignoreVary||!i.headersList.contains("vary"))return!0;for(let r of a(i.headersList.get("vary")))if("*"===r||t.headersList.get(r)!==e.headersList.get(r))return!1;return!0}#e5(e,t,i=1/0){let r=null;if(void 0!==e)if(c.is.Request(e)){if("GET"!==(r=f(e)).method&&!t.ignoreMethod)return[]}else"string"==typeof e&&(r=f(new A(e)));let n=[];if(void 0===e)for(let e of this.#e4)n.push(e[1]);else for(let e of this.#e8(r,t))n.push(e[1]);let s=[];for(let e of n){let t=u(d(e),"immutable");if(s.push(t),s.length>=i)break}return Object.freeze(s)}}Object.defineProperties(E.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:o,matchAll:o,add:o,addAll:o,put:o,delete:o,keys:o});let C=[{key:"ignoreSearch",converter:c.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:c.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:c.converters.boolean,defaultValue:()=>!1}];c.converters.CacheQueryOptions=c.dictionaryConverter(C),c.converters.MultiCacheQueryOptions=c.dictionaryConverter([...C,{key:"cacheName",converter:c.converters.DOMString}]),c.converters.Response=c.interfaceConverter(c.is.Response,"Response"),c.converters["sequence"]=c.sequenceConverter(c.converters.RequestInfo),t.exports={Cache:E}},446161,(e,t,i)=>{"use strict";let{Cache:r}=e.r(947769),{webidl:n}=e.r(192321),{kEnumerableProperty:s}=e.r(122857),{kConstruct:a}=e.r(954673);class o{#e6=new Map;constructor(){arguments[0]!==a&&n.illegalConstructor(),n.util.markAsUncloneable(this)}async match(e,t={}){if(n.brandCheck(this,o),n.argumentLengthCheck(arguments,1,"CacheStorage.match"),e=n.converters.RequestInfo(e),null!=(t=n.converters.MultiCacheQueryOptions(t)).cacheName){if(this.#e6.has(t.cacheName)){let i=new r(a,this.#e6.get(t.cacheName));return await i.match(e,t)}}else for(let i of this.#e6.values()){let n=new r(a,i),s=await n.match(e,t);if(void 0!==s)return s}}async has(e){n.brandCheck(this,o);let t="CacheStorage.has";return n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#e6.has(e)}async open(e){n.brandCheck(this,o);let t="CacheStorage.open";if(n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#e6.has(e))return new r(a,this.#e6.get(e));let i=[];return this.#e6.set(e,i),new r(a,i)}async delete(e){n.brandCheck(this,o);let t="CacheStorage.delete";return n.argumentLengthCheck(arguments,1,t),e=n.converters.DOMString(e,t,"cacheName"),this.#e6.delete(e)}async keys(){return n.brandCheck(this,o),[...this.#e6.keys()]}}Object.defineProperties(o.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:s,has:s,open:s,delete:s,keys:s}),t.exports={CacheStorage:o}},839599,(e,t,i)=>{"use strict";t.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}},756139,(e,t,i)=>{"use strict";function r(e){for(let t=0;t=0&&i<=8||i>=10&&i<=31||127===i)return!0}return!1}function n(e){for(let t=0;t126||34===i||40===i||41===i||60===i||62===i||64===i||44===i||59===i||58===i||92===i||47===i||91===i||93===i||63===i||61===i||123===i||125===i)throw Error("Invalid cookie name")}}function s(e){let t=e.length,i=0;if('"'===e[0]){if(1===t||'"'!==e[t-1])throw Error("Invalid cookie value");--t,++i}for(;i126||34===t||44===t||59===t||92===t)throw Error("Invalid cookie value")}}function a(e){for(let t=0;tt.toString().padStart(2,"0"));function u(e){return"number"==typeof e&&(e=new Date(e)),`${l[e.getUTCDay()]}, ${d[e.getUTCDate()]} ${c[e.getUTCMonth()]} ${e.getUTCFullYear()} ${d[e.getUTCHours()]}:${d[e.getUTCMinutes()]}:${d[e.getUTCSeconds()]} GMT`}function h(e){if(e<0)throw Error("Invalid cookie max-age")}function A(e){if(0===e.name.length)return null;n(e.name),s(e.value);let t=[`${e.name}=${e.value}`];for(let i of(e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&t.push("Secure"),e.httpOnly&&t.push("HttpOnly"),"number"==typeof e.maxAge&&(h(e.maxAge),t.push(`Max-Age=${e.maxAge}`)),e.domain&&(o(e.domain),t.push(`Domain=${e.domain}`)),e.path&&(a(e.path),t.push(`Path=${e.path}`)),e.expires&&"Invalid Date"!==e.expires.toString()&&t.push(`Expires=${u(e.expires)}`),e.sameSite&&t.push(`SameSite=${e.sameSite}`),e.unparsed)){if(!i.includes("="))throw Error("Invalid unparsed");let[e,...r]=i.split("=");t.push(`${e.trim()}=${r.join("=")}`)}return t.join("; ")}t.exports={isCTLExcludingHtab:r,validateCookieName:n,validateCookiePath:a,validateCookieValue:s,toIMFDate:u,stringify:A}},1796,(e,t,i)=>{"use strict";let{collectASequenceOfCodePointsFast:r}=e.r(142677),{maxNameValuePairSize:n,maxAttributeValueSize:s}=e.r(839599),{isCTLExcludingHtab:a}=e.r(756139),o=e.r(57328),{unescape:l}=e.r(483324);function c(e,t={}){if(0===e.length)return t;o(";"===e[0]);let i="";(e=e.slice(1)).includes(";")?(i=r(";",e,{position:0}),e=e.slice(i.length)):(i=e,e="");let n="",a="";if(i.includes("=")){let e={position:0};n=r("=",i,e),a=i.slice(e.position+1)}else n=i;if(n=n.trim(),(a=a.trim()).length>s)return c(e,t);let l=n.toLowerCase();if("expires"===l)t.expires=new Date(a);else if("max-age"===l){let i=a.charCodeAt(0);if((i<48||i>57)&&"-"!==a[0]||!/^\d+$/.test(a))return c(e,t);t.maxAge=Number(a)}else if("domain"===l){let e=a;"."===e[0]&&(e=e.slice(1)),t.domain=e=e.toLowerCase()}else if("path"===l){let e="";t.path=e=0===a.length||"/"!==a[0]?"/":a}else if("secure"===l)t.secure=!0;else if("httponly"===l)t.httpOnly=!0;else if("samesite"===l){let e="Default",i=a.toLowerCase();i.includes("none")&&(e="None"),i.includes("strict")&&(e="Strict"),i.includes("lax")&&(e="Lax"),t.sameSite=e}else t.unparsed??=[],t.unparsed.push(`${n}=${a}`);return c(e,t)}t.exports={parseSetCookie:function(e){if(a(e))return null;let t="",i="",s="",o="";if(e.includes(";")){let n={position:0};t=r(";",e,n),i=e.slice(n.position)}else t=e;if(t.includes("=")){let e={position:0};s=r("=",t,e),o=t.slice(e.position+1)}else o=t;return(s=s.trim(),o=o.trim(),s.length+o.length>n)?null:{name:s,value:l(o),...c(i)}},parseUnparsedAttributes:c}},929077,(e,t,i)=>{"use strict";let{parseSetCookie:r}=e.r(1796),{stringify:n}=e.r(756139),{webidl:s}=e.r(192321),{Headers:a}=e.r(302260),o=s.brandCheckMultiple([a,globalThis.Headers].filter(Boolean));function l(e){s.argumentLengthCheck(arguments,1,"getCookies"),o(e);let t=e.get("cookie"),i={};if(!t)return i;for(let e of t.split(";")){let[t,...r]=e.split("=");i[t.trim()]=r.join("=")}return i}function c(e,t,i){o(e);let r="deleteCookie";s.argumentLengthCheck(arguments,2,r),t=s.converters.DOMString(t,r,"name"),i=s.converters.DeleteCookieAttributes(i),h(e,{name:t,value:"",expires:new Date(0),...i})}function d(e){s.argumentLengthCheck(arguments,1,"getSetCookies"),o(e);let t=e.getSetCookie();return t?t.map(e=>r(e)):[]}function u(e){return r(e=s.converters.DOMString(e))}function h(e,t){s.argumentLengthCheck(arguments,2,"setCookie"),o(e);let i=n(t=s.converters.Cookie(t));i&&e.append("set-cookie",i,!0)}s.converters.DeleteCookieAttributes=s.dictionaryConverter([{converter:s.nullableConverter(s.converters.DOMString),key:"path",defaultValue:()=>null},{converter:s.nullableConverter(s.converters.DOMString),key:"domain",defaultValue:()=>null}]),s.converters.Cookie=s.dictionaryConverter([{converter:s.converters.DOMString,key:"name"},{converter:s.converters.DOMString,key:"value"},{converter:s.nullableConverter(e=>"number"==typeof e?s.converters["unsigned long long"](e):new Date(e)),key:"expires",defaultValue:()=>null},{converter:s.nullableConverter(s.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:s.nullableConverter(s.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:s.nullableConverter(s.converters.DOMString),key:"path",defaultValue:()=>null},{converter:s.nullableConverter(s.converters.boolean),key:"secure",defaultValue:()=>null},{converter:s.nullableConverter(s.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:s.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:s.sequenceConverter(s.converters.DOMString),key:"unparsed",defaultValue:()=>[]}]),t.exports={getCookies:l,deleteCookie:c,getSetCookies:d,setCookie:h,parseCookie:u}},925087,(e,t,i)=>{"use strict";let{webidl:r}=e.r(192321),{kEnumerableProperty:n}=e.r(122857),{kConstruct:s}=e.r(954673);class a extends Event{#e7;constructor(e,t={}){if(e===s){super(arguments[1],arguments[2]),r.util.markAsUncloneable(this);return}const i="MessageEvent constructor";r.argumentLengthCheck(arguments,1,i),super(e=r.converters.DOMString(e,i,"type"),t=r.converters.MessageEventInit(t,i,"eventInitDict")),this.#e7=t,r.util.markAsUncloneable(this)}get data(){return r.brandCheck(this,a),this.#e7.data}get origin(){return r.brandCheck(this,a),this.#e7.origin}get lastEventId(){return r.brandCheck(this,a),this.#e7.lastEventId}get source(){return r.brandCheck(this,a),this.#e7.source}get ports(){return r.brandCheck(this,a),Object.isFrozen(this.#e7.ports)||Object.freeze(this.#e7.ports),this.#e7.ports}initMessageEvent(e,t=!1,i=!1,n=null,s="",o="",l=null,c=[]){return r.brandCheck(this,a),r.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new a(e,{bubbles:t,cancelable:i,data:n,origin:s,lastEventId:o,source:l,ports:c})}static createFastMessageEvent(e,t){let i=new a(s,e,t);return i.#e7=t,i.#e7.data??=null,i.#e7.origin??="",i.#e7.lastEventId??="",i.#e7.source??=null,i.#e7.ports??=[],i}}let{createFastMessageEvent:o}=a;delete a.createFastMessageEvent;class l extends Event{#e7;constructor(e,t={}){const i="CloseEvent constructor";r.argumentLengthCheck(arguments,1,i),super(e=r.converters.DOMString(e,i,"type"),t=r.converters.CloseEventInit(t)),this.#e7=t,r.util.markAsUncloneable(this)}get wasClean(){return r.brandCheck(this,l),this.#e7.wasClean}get code(){return r.brandCheck(this,l),this.#e7.code}get reason(){return r.brandCheck(this,l),this.#e7.reason}}class c extends Event{#e7;constructor(e,t){const i="ErrorEvent constructor";r.argumentLengthCheck(arguments,1,i),super(e,t),r.util.markAsUncloneable(this),e=r.converters.DOMString(e,i,"type"),t=r.converters.ErrorEventInit(t??{}),this.#e7=t}get message(){return r.brandCheck(this,c),this.#e7.message}get filename(){return r.brandCheck(this,c),this.#e7.filename}get lineno(){return r.brandCheck(this,c),this.#e7.lineno}get colno(){return r.brandCheck(this,c),this.#e7.colno}get error(){return r.brandCheck(this,c),this.#e7.error}}Object.defineProperties(a.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:n,origin:n,lastEventId:n,source:n,ports:n,initMessageEvent:n}),Object.defineProperties(l.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:n,code:n,wasClean:n}),Object.defineProperties(c.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:n,filename:n,lineno:n,colno:n,error:n}),r.converters.MessagePort=r.interfaceConverter(r.is.MessagePort,"MessagePort"),r.converters["sequence"]=r.sequenceConverter(r.converters.MessagePort);let d=[{key:"bubbles",converter:r.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:r.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:r.converters.boolean,defaultValue:()=>!1}];r.converters.MessageEventInit=r.dictionaryConverter([...d,{key:"data",converter:r.converters.any,defaultValue:()=>null},{key:"origin",converter:r.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:r.converters.DOMString,defaultValue:()=>""},{key:"source",converter:r.nullableConverter(r.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:r.converters["sequence"],defaultValue:()=>[]}]),r.converters.CloseEventInit=r.dictionaryConverter([...d,{key:"wasClean",converter:r.converters.boolean,defaultValue:()=>!1},{key:"code",converter:r.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:r.converters.USVString,defaultValue:()=>""}]),r.converters.ErrorEventInit=r.dictionaryConverter([...d,{key:"message",converter:r.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:r.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:r.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:r.converters.any}]),t.exports={MessageEvent:a,CloseEvent:l,ErrorEvent:c,createFastMessageEvent:o}},984741,(e,t,i)=>{"use strict";let r="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",n={enumerable:!0,writable:!1,configurable:!1},s={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},a={SENT:1,RECEIVED:2},o={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},l=65535,c={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4};t.exports={uid:r,sentCloseFrameState:a,staticPropertyDescriptors:n,states:s,opcodes:o,maxUnsigned16Bit:l,parserStates:c,emptyBuffer:Buffer.allocUnsafe(0),sendHints:{text:1,typedArray:2,arrayBuffer:3,blob:4}}},459977,(e,t,i)=>{"use strict";let{states:r,opcodes:n}=e.r(984741),{isUtf8:s}=e.r(951615),{removeHTTPWhitespace:a}=e.r(441628),{collectASequenceOfCodePointsFast:o}=e.r(142677);function l(e){return e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function c(e){return e===n.CLOSE||e===n.PING||e===n.PONG}function d(e){return e===n.CONTINUATION}function u(e){return e===n.TEXT||e===n.BINARY}function h(e){return u(e)||d(e)||c(e)}function A(e){let t={position:0},i=new Map;for(;t.position57)return!1}let t=Number.parseInt(e,10);return t>=8&&t<=15}function f(e,t){let i;try{i=new URL(e,t)}catch(e){throw new DOMException(e,"SyntaxError")}if("http:"===i.protocol?i.protocol="ws:":"https:"===i.protocol&&(i.protocol="wss:"),"ws:"!==i.protocol&&"wss:"!==i.protocol)throw new DOMException("expected a ws: or wss: url","SyntaxError");if(i.hash.length||i.href.endsWith("#"))throw new DOMException("hash","SyntaxError");return i}function g(e,t){if(null!==e&&1e3!==e&&(e<3e3||e>4999))throw new DOMException("invalid code","InvalidAccessError");if(null!==t){let e=Buffer.byteLength(t);if(e>123)throw new DOMException(`Reason must be less than 123 bytes; received ${e}`,"SyntaxError")}}t.exports={isConnecting:function e(e){return e===r.CONNECTING},isEstablished:function e(e){return e===r.OPEN},isClosing:function e(e){return e===r.CLOSING},isClosed:function e(e){return e===r.CLOSED},fireEvent:function e(t,i,r=(e,t)=>new Event(e,t),n={}){let s=r(t,n);i.dispatchEvent(s)},isValidSubprotocol:function e(e){if(0===e.length)return!1;for(let t=0;t126||34===i||40===i||41===i||44===i||47===i||58===i||59===i||60===i||61===i||62===i||63===i||64===i||91===i||92===i||93===i||123===i||125===i)return!1}return!0},isValidStatusCode:function e(e){return e>=1e3&&e<1015?1004!==e&&1005!==e&&1006!==e:e>=3e3&&e<=4999},websocketMessageReceived:function e(e,t,i){e.onMessage(t,i)},utf8Decode:(()=>{if("string"==typeof process.versions.icu){let e=new TextDecoder("utf-8",{fatal:!0});return e.decode.bind(e)}return function(e){if(s(e))return e.toString("utf-8");throw TypeError("Invalid utf-8 received.")}})(),isControlFrame:c,isContinuationFrame:d,isTextBinaryFrame:u,isValidOpcode:h,parseExtensions:A,isValidClientWindowBits:p,toArrayBuffer:l,getURLRecord:f,validateCloseCodeAndReason:g}},714257,(e,t,i)=>{"use strict";let{runtimeFeatures:r}=e.r(350022),{maxUnsigned16Bit:n,opcodes:s}=e.r(984741),a=8192,o=null,l=8192,c=r.has("crypto")?e.r(666680).randomFillSync:function(e,t,i){for(let t=0;tn?(a+=8,s=127):r>125&&(a+=2,s=126);let o=Buffer.allocUnsafe(r+a);o[0]=o[1]=0,o[0]|=128,o[0]=(240&o[0])+e,o[a-4]=i[0],o[a-3]=i[1],o[a-2]=i[2],o[a-1]=i[3],o[1]=s,126===s?o.writeUInt16BE(r,2):127===s&&(o[2]=o[3]=0,o.writeUIntBE(r,4,6)),o[1]|=128;for(let e=0;en?(a+=8,r=127):i>125&&(a+=2,r=126);let o=Buffer.allocUnsafeSlow(a);return o[0]=128|s.TEXT,o[1]=128|r,o[a-4]=t[0],o[a-3]=t[1],o[a-2]=t[2],o[a-1]=t[3],126===r?o.writeUInt16BE(i,2):127===r&&(o[2]=o[3]=0,o.writeUIntBE(i,4,6)),[o,e]}}t.exports={WebsocketFrameSend:u,generateMask:d}},469344,(e,t,i)=>{"use strict";let{uid:r,states:n,sentCloseFrameState:s,emptyBuffer:a,opcodes:o}=e.r(984741),{parseExtensions:l,isClosed:c,isClosing:d,isEstablished:u,isConnecting:h,validateCloseCodeAndReason:A}=e.r(459977),{makeRequest:p}=e.r(625461),{fetching:f}=e.r(258548),{Headers:g,getHeadersList:m}=e.r(302260),{getDecodeSplit:y}=e.r(402649),{WebsocketFrameSend:b}=e.r(714257),E=e.r(57328),{runtimeFeatures:C}=e.r(350022),w=C.has("crypto")?e.r(666680):null,I=!1;function v(e,t,i,r=!1){if(t??=null,i??="",r&&A(t,i),c(e.readyState)||d(e.readyState));else if(u(e.readyState))if(e.closeState.has(s.SENT)||e.closeState.has(s.RECEIVED))e.readyState=n.CLOSING;else{let r=new b;0!==i.length&&null===t&&(t=1e3),E(null===t||Number.isInteger(t)),null===t&&0===i.length?r.frameData=a:null!==t&&null===i?(r.frameData=Buffer.allocUnsafe(2),r.frameData.writeUInt16BE(t,0)):null!==t&&null!==i?(r.frameData=Buffer.allocUnsafe(2+Buffer.byteLength(i)),r.frameData.writeUInt16BE(t,0),r.frameData.write(i,2,"utf-8")):r.frameData=a,e.socket.write(r.createFrame(o.CLOSE)),e.closeState.add(s.SENT),e.readyState=n.CLOSING}else B(e),e.readyState=n.CLOSING}function B(e,t,i,r){u(e.readyState)&&v(e,t,i,!1),e.controller.abort(),h(e.readyState)?e.onSocketClose():e.socket?.destroyed===!1&&e.socket.destroy()}t.exports={establishWebSocketConnection:function(e,t,i,n,s){let a=e;a.protocol="ws:"===e.protocol?"http:":"https:";let o=p({urlList:[a],client:i,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error",useURLCredentials:!0});s.headers&&(o.headersList=m(new g(s.headers)));let c=w.randomBytes(16).toString("base64");for(let e of(o.headersList.append("sec-websocket-key",c,!0),o.headersList.append("sec-websocket-version","13",!0),t))o.headersList.append("sec-websocket-protocol",e,!0);let d="permessage-deflate; client_max_window_bits";return o.headersList.append("sec-websocket-extensions",d,!0),f({request:o,useParallelQueue:!0,dispatcher:s.dispatcher,processResponse(e){let i;if("error"===e.type||101!==e.status){if(e.socket?.session==null)return void B(n,1002,"Received network error or non-101 status code.",e.error);if(200!==e.status)return void B(n,1002,"Received network error or non-200 status code.",e.error)}if(!1===I&&e.socket?.session!=null&&(process.emitWarning("WebSocket over HTTP2 is experimental, and subject to change.","ExperimentalWarning"),I=!0),0!==t.length&&!e.headersList.get("Sec-WebSocket-Protocol"))return void B(n,1002,"Server did not respond with sent protocols.");if(null==e.socket.session&&e.headersList.get("Upgrade")?.toLowerCase()!=="websocket")return void B(n,1002,'Server did not set Upgrade header to "websocket".');if(null==e.socket.session&&e.headersList.get("Connection")?.toLowerCase()!=="upgrade")return void B(n,1002,'Server did not set Connection header to "upgrade".');if(e.headersList.get("Sec-WebSocket-Accept")!==w.hash("sha1",c+r,"base64"))return void B(n,1002,"Incorrect hash received in Sec-WebSocket-Accept header.");let s=e.headersList.get("Sec-WebSocket-Extensions");if(null!==s&&!(i=l(s)).has("permessage-deflate"))return void B(n,1002,"Sec-WebSocket-Extensions header does not match.");let a=e.headersList.get("Sec-WebSocket-Protocol");null===a||y("sec-websocket-protocol",o.headersList).includes(a)?(e.socket.on("data",n.onSocketData),e.socket.on("close",n.onSocketClose),e.socket.on("error",n.onSocketError),n.wasEverConnected=!0,n.onConnectionEstablished(e,i)):B(n,1002,"Protocol was not set in the opening handshake.")}})},failWebsocketConnection:B,closeWebSocketConnection:v}},938904,(e,t,i)=>{"use strict";let{createInflateRaw:r,Z_DEFAULT_WINDOWBITS:n}=e.r(727028),{isValidClientWindowBits:s}=e.r(459977),{MessageSizeExceededError:a}=e.r(450178),o=Buffer.from([0,0,255,255]),l=Symbol("kBuffer"),c=Symbol("kLength"),d=4194304;class u{#te;#e={};#n=!1;#tt=null;constructor(e){this.#e.serverNoContextTakeover=e.has("server_no_context_takeover"),this.#e.serverMaxWindowBits=e.get("server_max_window_bits")}decompress(e,t,i){if(this.#n)return void i(new a);if(!this.#te){let e=n;if(this.#e.serverMaxWindowBits){if(!s(this.#e.serverMaxWindowBits))return void i(Error("Invalid server_max_window_bits"));e=Number.parseInt(this.#e.serverMaxWindowBits)}try{this.#te=r({windowBits:e})}catch(e){i(e);return}this.#te[l]=[],this.#te[c]=0,this.#te.on("data",e=>{if(!this.#n){if(this.#te[c]+=e.length,this.#te[c]>d){if(this.#n=!0,this.#te.removeAllListeners(),this.#te.destroy(),this.#te=null,this.#tt){let e=this.#tt;this.#tt=null,e(new a)}return}this.#te[l].push(e)}}),this.#te.on("error",e=>{this.#te=null,i(e)})}this.#tt=i,this.#te.write(e),t&&this.#te.write(o),this.#te.flush(()=>{if(this.#n||!this.#te)return;let e=Buffer.concat(this.#te[l],this.#te[c]);this.#te[l].length=0,this.#te[c]=0,this.#tt=null,i(null,e)})}}t.exports={PerMessageDeflate:u}},139180,(e,t,i)=>{"use strict";let{Writable:r}=e.r(81111),n=e.r(57328),{parserStates:s,opcodes:a,states:o,emptyBuffer:l,sentCloseFrameState:c}=e.r(984741),{isValidStatusCode:d,isValidOpcode:u,websocketMessageReceived:h,utf8Decode:A,isControlFrame:p,isTextBinaryFrame:f,isContinuationFrame:g}=e.r(459977),{failWebsocketConnection:m}=e.r(469344),{WebsocketFrameSend:y}=e.r(714257),{PerMessageDeflate:b}=e.r(938904),{MessageSizeExceededError:E}=e.r(450178);class C extends r{#ti=[];#tr=0;#tn=0;#ts=!1;#A=s.INFO;#ta={};#to=[];#tl;#t;constructor(e,t){super(),this.#t=e,this.#tl=null==t?new Map:t,this.#tl.has("permessage-deflate")&&this.#tl.set("permessage-deflate",new b(t))}_write(e,t,i){this.#ti.push(e),this.#tn+=e.length,this.#ts=!0,this.run(i)}run(e){for(;this.#ts;)if(this.#A===s.INFO){if(this.#tn<2)return e();let t=this.consume(2),i=(128&t[0])!=0,r=15&t[0],n=(128&t[1])==128,o=!i&&r!==a.CONTINUATION,l=127&t[1],c=64&t[0],d=32&t[0],h=16&t[0];if(!u(r))return m(this.#t,1002,"Invalid opcode received"),e();if(n)return m(this.#t,1002,"Frame cannot be masked"),e();if(0!==c&&!this.#tl.has("permessage-deflate"))return void m(this.#t,1002,"Expected RSV1 to be clear.");if(0!==d||0!==h)return void m(this.#t,1002,"RSV1, RSV2, RSV3 must be clear");if(o&&!f(r))return void m(this.#t,1002,"Invalid frame type was fragmented.");if(f(r)&&this.#to.length>0)return void m(this.#t,1002,"Expected continuation frame");if(this.#ta.fragmented&&o)return void m(this.#t,1002,"Fragmented frame exceeded 125 bytes.");if((l>125||o)&&p(r))return void m(this.#t,1002,"Control frame either too large or fragmented");if(g(r)&&0===this.#to.length&&!this.#ta.compressed)return void m(this.#t,1002,"Unexpected continuation frame");l<=125?(this.#ta.payloadLength=l,this.#A=s.READ_DATA):126===l?this.#A=s.PAYLOADLENGTH_16:127===l&&(this.#A=s.PAYLOADLENGTH_64),f(r)&&(this.#ta.binaryType=r,this.#ta.compressed=0!==c),this.#ta.opcode=r,this.#ta.masked=n,this.#ta.fin=i,this.#ta.fragmented=o}else if(this.#A===s.PAYLOADLENGTH_16){if(this.#tn<2)return e();let t=this.consume(2);this.#ta.payloadLength=t.readUInt16BE(0),this.#A=s.READ_DATA}else if(this.#A===s.PAYLOADLENGTH_64){if(this.#tn<8)return e();let t=this.consume(8),i=t.readUInt32BE(0),r=t.readUInt32BE(4);if(0!==i||r>0x80000000-1)return void m(this.#t,1009,"Received payload length > 2^31 bytes.");this.#ta.payloadLength=r,this.#A=s.READ_DATA}else if(this.#A===s.READ_DATA){if(this.#tn{if(t){let e=t instanceof E?1009:1007;m(this.#t,e,t.message);return}if(this.writeFragments(i),!this.#ta.fin){this.#A=s.INFO,this.#ts=!0,this.run(e);return}h(this.#t,this.#ta.binaryType,this.consumeFragments()),this.#ts=!0,this.#A=s.INFO,this.run(e)}),this.#ts=!1;break}else this.writeFragments(t),!this.#ta.fragmented&&this.#ta.fin&&h(this.#t,this.#ta.binaryType,this.consumeFragments()),this.#A=s.INFO}}consume(e){if(e>this.#tn)throw Error("Called consume() before buffers satiated.");if(0===e)return l;this.#tn-=e;let t=this.#ti[0];if(t.length>e)return this.#ti[0]=t.subarray(e,t.length),t.subarray(0,e);{if(t.length===e)return this.#ti.shift();let i=0,r=Buffer.allocUnsafeSlow(e);for(;i!==e;){let t=this.#ti[0],n=t.length;if(n+i===e){r.set(this.#ti.shift(),i);break}if(n+i>e){r.set(t.subarray(0,e-i),i),this.#ti[0]=t.subarray(e-i);break}r.set(this.#ti.shift(),i),i+=n}return r}}writeFragments(e){this.#tr+=e.length,this.#to.push(e)}consumeFragments(){let e=this.#to;if(1===e.length)return this.#tr=0,e.shift();let t=0,i=Buffer.allocUnsafeSlow(this.#tr);for(let r=0;r=2&&(t=e.readUInt16BE(0)),void 0!==t&&!d(t))return{code:1002,reason:"Invalid status code",error:!0};let i=e.subarray(2);239===i[0]&&187===i[1]&&191===i[2]&&(i=i.subarray(3));try{i=A(i)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:t,reason:i,error:!1}}parseControlFrame(e){let{opcode:t,payloadLength:i}=this.#ta;if(t===a.CLOSE){if(1===i)return m(this.#t,1002,"Received close frame with a 1-byte body."),!1;if(this.#ta.closeInfo=this.parseCloseBody(e),this.#ta.closeInfo.error){let{code:e,reason:t}=this.#ta.closeInfo;return m(this.#t,e,t),!1}if(!this.#t.closeState.has(c.SENT)&&!this.#t.closeState.has(c.RECEIVED)){let e=l;this.#ta.closeInfo.code&&(e=Buffer.allocUnsafe(2)).writeUInt16BE(this.#ta.closeInfo.code,0);let t=new y(e);this.#t.socket.write(t.createFrame(a.CLOSE)),this.#t.closeState.add(c.SENT)}return this.#t.readyState=o.CLOSING,this.#t.closeState.add(c.RECEIVED),!1}if(t===a.PING){if(!this.#t.closeState.has(c.RECEIVED)){let t=new y(e);this.#t.socket.write(t.createFrame(a.PONG)),this.#t.onPing(e)}}else t===a.PONG&&this.#t.onPong(e);return!0}get closingInfo(){return this.#ta.closeInfo}}t.exports={ByteParser:C}},184641,(e,t,i)=>{"use strict";let{WebsocketFrameSend:r}=e.r(714257),{opcodes:n,sendHints:s}=e.r(984741),a=e.r(636528);class o{#tc=new a;#td=!1;#tu;constructor(e){this.#tu=e}add(e,t,i){if(i!==s.blob){if(this.#td){let r={promise:null,callback:t,frame:l(e,i)};this.#tc.push(r)}else if(i===s.text){let{0:i,1:n}=r.createFastTextFrame(e);this.#tu.cork(),this.#tu.write(i),this.#tu.write(n,t),this.#tu.uncork()}else this.#tu.write(l(e,i),t);return}let n={promise:e.arrayBuffer().then(e=>{n.promise=null,n.frame=l(e,i)}),callback:t,frame:null};this.#tc.push(n),this.#td||this.#th()}async #th(){this.#td=!0;let e=this.#tc;for(;!e.isEmpty();){let t=e.shift();null!==t.promise&&await t.promise,this.#tu.write(t.frame,t.callback),t.callback=t.frame=null}this.#td=!1}}function l(e,t){return new r(c(e,t)).createFrame(t===s.text?n.TEXT:n.BINARY)}function c(e,t){switch(t){case s.text:case s.typedArray:return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);case s.arrayBuffer:case s.blob:return new Uint8Array(e)}}t.exports={SendQueue:o}},697150,(e,t,i)=>{"use strict";let{isArrayBuffer:r}=e.r(107417),{webidl:n}=e.r(192321),{URLSerializer:s}=e.r(441628),{environmentSettingsObject:a}=e.r(402649),{staticPropertyDescriptors:o,states:l,sentCloseFrameState:c,sendHints:d,opcodes:u}=e.r(984741),{isConnecting:h,isEstablished:A,isClosing:p,isClosed:f,isValidSubprotocol:g,fireEvent:m,utf8Decode:y,toArrayBuffer:b,getURLRecord:E}=e.r(459977),{establishWebSocketConnection:C,closeWebSocketConnection:w,failWebsocketConnection:I}=e.r(469344),{ByteParser:v}=e.r(139180),{kEnumerableProperty:B}=e.r(122857),{getGlobalDispatcher:Q}=e.r(312706),{ErrorEvent:x,CloseEvent:S,createFastMessageEvent:k}=e.r(925087),{SendQueue:T}=e.r(184641),{WebsocketFrameSend:N}=e.r(714257),{channels:D}=e.r(500078);class _ extends EventTarget{#tA={open:null,error:null,close:null,message:null};#tp=0;#tf="";#tl="";#tg;#t={onConnectionEstablished:(e,t)=>this.#tm(e,t),onMessage:(e,t)=>this.#ty(e,t),onParserError:e=>I(this.#t,null,e.message),onParserDrain:()=>this.#tb(),onSocketData:e=>{this.#tE.write(e)||this.#t.socket.pause()},onSocketError:e=>{this.#t.readyState=l.CLOSING,D.socketError.hasSubscribers&&D.socketError.publish(e),this.#t.socket.destroy()},onSocketClose:()=>this.#tC(),onPing:e=>{D.ping.hasSubscribers&&D.ping.publish({payload:e,websocket:this})},onPong:e=>{D.pong.hasSubscribers&&D.pong.publish({payload:e,websocket:this})},readyState:l.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#tw;#tI;#tE;constructor(e,t=[]){super(),n.util.markAsUncloneable(this);const i="WebSocket constructor";n.argumentLengthCheck(arguments,1,i);const r=n.converters["DOMString or sequence or WebSocketInit"](t,i,"options");e=n.converters.USVString(e),t=r.protocols;const s=E(e,a.settingsObject.baseUrl);if("string"==typeof t&&(t=[t]),t.length!==new Set(t.map(e=>e.toLowerCase())).size||t.length>0&&!t.every(e=>g(e)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this.#tw=new URL(s.href);const o=a.settingsObject;this.#t.controller=C(s,t,o,this.#t,r),this.#t.readyState=_.CONNECTING,this.#tI="blob"}close(e,t){n.brandCheck(this,_);let i="WebSocket.close";void 0!==e&&(e=n.converters["unsigned short"](e,i,"code",n.attributes.Clamp)),void 0!==t&&(t=n.converters.USVString(t)),e??=null,t??="",w(this.#t,e,t,!0)}send(e){n.brandCheck(this,_);let t="WebSocket.send";if(n.argumentLengthCheck(arguments,1,t),e=n.converters.WebSocketSendData(e,t,"data"),h(this.#t.readyState))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!A(this.#t.readyState)||p(this.#t.readyState)))if("string"==typeof e){let t=Buffer.from(e);this.#tp+=t.byteLength,this.#tg.add(t,()=>{this.#tp-=t.byteLength},d.text)}else r(e)?(this.#tp+=e.byteLength,this.#tg.add(e,()=>{this.#tp-=e.byteLength},d.arrayBuffer)):ArrayBuffer.isView(e)?(this.#tp+=e.byteLength,this.#tg.add(e,()=>{this.#tp-=e.byteLength},d.typedArray)):n.is.Blob(e)&&(this.#tp+=e.size,this.#tg.add(e,()=>{this.#tp-=e.size},d.blob))}get readyState(){return n.brandCheck(this,_),this.#t.readyState}get bufferedAmount(){return n.brandCheck(this,_),this.#tp}get url(){return n.brandCheck(this,_),s(this.#tw)}get extensions(){return n.brandCheck(this,_),this.#tl}get protocol(){return n.brandCheck(this,_),this.#tf}get onopen(){return n.brandCheck(this,_),this.#tA.open}set onopen(e){n.brandCheck(this,_),this.#tA.open&&this.removeEventListener("open",this.#tA.open);let t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("open",t),this.#tA.open=e):this.#tA.open=null}get onerror(){return n.brandCheck(this,_),this.#tA.error}set onerror(e){n.brandCheck(this,_),this.#tA.error&&this.removeEventListener("error",this.#tA.error);let t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("error",t),this.#tA.error=e):this.#tA.error=null}get onclose(){return n.brandCheck(this,_),this.#tA.close}set onclose(e){n.brandCheck(this,_),this.#tA.close&&this.removeEventListener("close",this.#tA.close);let t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("close",t),this.#tA.close=e):this.#tA.close=null}get onmessage(){return n.brandCheck(this,_),this.#tA.message}set onmessage(e){n.brandCheck(this,_),this.#tA.message&&this.removeEventListener("message",this.#tA.message);let t=n.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("message",t),this.#tA.message=e):this.#tA.message=null}get binaryType(){return n.brandCheck(this,_),this.#tI}set binaryType(e){n.brandCheck(this,_),"blob"!==e&&"arraybuffer"!==e?this.#tI="blob":this.#tI=e}#tm(e,t){this.#t.socket=e.socket;let i=new v(this.#t,t);i.on("drain",()=>this.#t.onParserDrain()),i.on("error",e=>this.#t.onParserError(e)),this.#tE=i,this.#tg=new T(e.socket),this.#t.readyState=l.OPEN;let r=e.headersList.get("sec-websocket-extensions");null!==r&&(this.#tl=r);let n=e.headersList.get("sec-websocket-protocol");if(null!==n&&(this.#tf=n),m("open",this),D.open.hasSubscribers){let t=e.headersList.entries;D.open.publish({address:e.socket.address(),protocol:this.#tf,extensions:this.#tl,websocket:this,handshakeResponse:{status:e.status,statusText:e.statusText,headers:t}})}}#ty(e,t){let i;if(this.#t.readyState===l.OPEN){if(e===u.TEXT)try{i=y(t)}catch{I(this.#t,1007,"Received invalid UTF-8 in text frame.");return}else e===u.BINARY&&(i="blob"===this.#tI?new Blob([t]):b(t));m("message",this,k,{origin:this.#tw.origin,data:i})}}#tb(){this.#t.socket.resume()}#tC(){let e=this.#t.closeState.has(c.SENT)&&this.#t.closeState.has(c.RECEIVED),t=1005,i="",r=this.#tE?.closingInfo;r&&!r.error&&(t=r.code??1005,i=r.reason),this.#t.readyState=l.CLOSED,this.#t.closeState.has(c.RECEIVED)||(t=1006,m("error",this,(e,t)=>new x(e,t),{error:TypeError(i)})),m("close",this,(e,t)=>new S(e,t),{wasClean:e,code:t,reason:i}),D.close.hasSubscribers&&D.close.publish({websocket:this,code:t,reason:i})}static ping(e,t){if(Buffer.isBuffer(t)){if(t.length>125)throw TypeError("A PING frame cannot have a body larger than 125 bytes.")}else if(void 0!==t)throw TypeError("Expected buffer payload");let i=e.#t.readyState;if(A(i)&&!p(i)&&!f(i)){let i=new N(t);e.#t.socket.write(i.createFrame(u.PING))}}}let{ping:R}=_;Reflect.deleteProperty(_,"ping"),_.CONNECTING=_.prototype.CONNECTING=l.CONNECTING,_.OPEN=_.prototype.OPEN=l.OPEN,_.CLOSING=_.prototype.CLOSING=l.CLOSING,_.CLOSED=_.prototype.CLOSED=l.CLOSED,Object.defineProperties(_.prototype,{CONNECTING:o,OPEN:o,CLOSING:o,CLOSED:o,url:B,readyState:B,bufferedAmount:B,onopen:B,onerror:B,onclose:B,close:B,onmessage:B,binaryType:B,send:B,extensions:B,protocol:B,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}}),Object.defineProperties(_,{CONNECTING:o,OPEN:o,CLOSING:o,CLOSED:o}),n.converters["sequence"]=n.sequenceConverter(n.converters.DOMString),n.converters["DOMString or sequence"]=function(e,t,i){return n.util.Type(e)===n.util.Types.OBJECT&&Symbol.iterator in e?n.converters["sequence"](e):n.converters.DOMString(e,t,i)},n.converters.WebSocketInit=n.dictionaryConverter([{key:"protocols",converter:n.converters["DOMString or sequence"],defaultValue:()=>[]},{key:"dispatcher",converter:n.converters.any,defaultValue:()=>Q()},{key:"headers",converter:n.nullableConverter(n.converters.HeadersInit)}]),n.converters["DOMString or sequence or WebSocketInit"]=function(e){return n.util.Type(e)!==n.util.Types.OBJECT||Symbol.iterator in e?{protocols:n.converters["DOMString or sequence"](e)}:n.converters.WebSocketInit(e)},n.converters.WebSocketSendData=function(e){return n.util.Type(e)===n.util.Types.OBJECT&&(n.is.Blob(e)||n.is.BufferSource(e))?e:n.converters.USVString(e)},t.exports={WebSocket:_,ping:R}},894026,(e,t,i)=>{"use strict";let{webidl:r}=e.r(192321),{validateCloseCodeAndReason:n}=e.r(459977),{kConstruct:s}=e.r(954673),{kEnumerableProperty:a}=e.r(122857);function o(){class e extends DOMException{get reason(){return""}}return void 0!==new e().reason?DOMException:new Proxy(DOMException,{construct(e,t,i){let r=Reflect.construct(e,t,e);return Object.setPrototypeOf(r,i.prototype),r}})}class l extends o(){#tv;#r;constructor(e="",t){if(super(e=r.converters.DOMString(e,"WebSocketError","message"),"WebSocketError"),t===s)return;null!==t&&(t=r.converters.WebSocketCloseInfo(t));let i=t.closeCode??null;const a=t.reason??"";n(i,a),0!==a.length&&null===i&&(i=1e3),this.#tv=i,this.#r=a}get closeCode(){return this.#tv}get reason(){return this.#r}static createUnvalidatedWebSocketError(e,t,i){let r=new l(e,s);return r.#tv=t,r.#r=i,r}}let{createUnvalidatedWebSocketError:c}=l;delete l.createUnvalidatedWebSocketError,Object.defineProperties(l.prototype,{closeCode:a,reason:a,[Symbol.toStringTag]:{value:"WebSocketError",writable:!1,enumerable:!1,configurable:!0}}),r.is.WebSocketError=r.util.MakeTypeAssertion(l),t.exports={WebSocketError:l,createUnvalidatedWebSocketError:c}},103565,(e,t,i)=>{"use strict";let{createDeferredPromise:r}=e.r(493578),{environmentSettingsObject:n}=e.r(402649),{states:s,opcodes:a,sentCloseFrameState:o}=e.r(984741),{webidl:l}=e.r(192321),{getURLRecord:c,isValidSubprotocol:d,isEstablished:u,utf8Decode:h}=e.r(459977),{establishWebSocketConnection:A,failWebsocketConnection:p,closeWebSocketConnection:f}=e.r(469344),{channels:g}=e.r(500078),{WebsocketFrameSend:m}=e.r(714257),{ByteParser:y}=e.r(139180),{WebSocketError:b,createUnvalidatedWebSocketError:E}=e.r(894026),{kEnumerableProperty:C}=e.r(122857),{utf8DecodeBytes:w}=e.r(107944),I=!1;class v{#tw;#tB;#tQ;#tx;#tS;#tk;#tT=!1;#t={onConnectionEstablished:(e,t)=>this.#tm(e,t),onMessage:(e,t)=>this.#ty(e,t),onParserError:e=>p(this.#t,null,e.message),onParserDrain:()=>this.#t.socket.resume(),onSocketData:e=>{this.#tE.write(e)||this.#t.socket.pause()},onSocketError:e=>{this.#t.readyState=s.CLOSING,g.socketError.hasSubscribers&&g.socketError.publish(e),this.#t.socket.destroy()},onSocketClose:()=>this.#tC(),onPing:()=>{},onPong:()=>{},readyState:s.CONNECTING,socket:null,closeState:new Set,controller:null,wasEverConnected:!1};#tE;constructor(e,t){I||(process.emitWarning("WebSocketStream is experimental! Expect it to change at any time.",{code:"UNDICI-WSS"}),I=!0),l.argumentLengthCheck(arguments,1,"WebSocket"),e=l.converters.USVString(e),null!==t&&(t=l.converters.WebSocketStreamOptions(t));const i=c(e,n.settingsObject.baseUrl),a=t.protocols;if(a.length!==new Set(a.map(e=>e.toLowerCase())).size||a.length>0&&!a.every(e=>d(e)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(this.#tw=i.toString(),this.#tB=r(),this.#tQ=r(),null!=t.signal){const e=t.signal;if(e.aborted){this.#tB.reject(e.reason),this.#tQ.reject(e.reason);return}e.addEventListener("abort",()=>{u(this.#t.readyState)||(p(this.#t),this.#t.readyState=s.CLOSING,this.#tB.reject(e.reason),this.#tQ.reject(e.reason),this.#tT=!0)},{once:!0})}const o=n.settingsObject;this.#t.controller=A(i,a,o,this.#t,t)}get url(){return this.#tw.toString()}get opened(){return this.#tB.promise}get closed(){return this.#tQ.promise}close(e){null!==e&&(e=l.converters.WebSocketCloseInfo(e));let t=e.closeCode??null,i=e.reason;f(this.#t,t,i,!0)}#tN(e){e=l.converters.WebSocketStreamWrite(e);let t=r(),i=null,n=null;if(l.is.BufferSource(e))i=new Uint8Array(ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e.slice()),n=a.BINARY;else{let r;try{r=l.converters.DOMString(e)}catch(e){return t.reject(e),t.promise}i=new TextEncoder().encode(r),n=a.TEXT}if(!this.#t.closeState.has(o.SENT)&&!this.#t.closeState.has(o.RECEIVED)){let e=new m(i);this.#t.socket.write(e.createFrame(n),()=>{t.resolve(void 0)})}return t.promise}#tm(e,t){this.#t.socket=e.socket;let i=new y(this.#t,t);i.on("drain",()=>this.#t.onParserDrain()),i.on("error",e=>this.#t.onParserError(e)),this.#tE=i,this.#t.readyState=s.OPEN;let r=t??"",n=e.headersList.get("sec-websocket-protocol")??"",a=new ReadableStream({start:e=>{this.#tS=e},pull(t){let i;for(;t.desiredSize>0&&null!==(i=e.socket.read());)t.enqueue(i)},cancel:e=>this.#tD(e)}),o=new WritableStream({write:e=>this.#tN(e),close:()=>f(this.#t,null,null),abort:e=>this.#t_(e)});this.#tx=a,this.#tk=o,this.#tB.resolve({extensions:r,protocol:n,readable:a,writable:o})}#ty(e,t){let i;if(this.#t.readyState===s.OPEN){if(e===a.TEXT)try{i=h(t)}catch{p(this.#t,"Received invalid UTF-8 in text frame.");return}else e===a.BINARY&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength));this.#tS.enqueue(i)}}#tC(){let e=this.#t.closeState.has(o.SENT)&&this.#t.closeState.has(o.RECEIVED);if(this.#t.readyState=s.CLOSED,this.#tT)return;this.#t.wasEverConnected||this.#tB.reject(new b("Socket never opened"));let t=this.#tE?.closingInfo,i=t?.code??1005;this.#t.closeState.has(o.SENT)||this.#t.closeState.has(o.RECEIVED)||(i=1006);let r=t?.reason==null?"":w(Buffer.from(t.reason));if(e)this.#tS.close(),this.#tk.locked||this.#tk.abort(new DOMException("A closed WebSocketStream cannot be written to","InvalidStateError")),this.#tQ.resolve({closeCode:i,reason:r});else{let e=E("unclean close",i,r);this.#tS?.error(e),this.#tk?.abort(e),this.#tQ.reject(e)}}#t_(e){let t=null,i="";l.is.WebSocketError(e)&&(t=e.closeCode,i=e.reason),f(this.#t,t,i)}#tD(e){this.#t_(e)}}Object.defineProperties(v.prototype,{url:C,opened:C,closed:C,close:C,[Symbol.toStringTag]:{value:"WebSocketStream",writable:!1,enumerable:!1,configurable:!0}}),l.converters.WebSocketStreamOptions=l.dictionaryConverter([{key:"protocols",converter:l.sequenceConverter(l.converters.USVString),defaultValue:()=>[]},{key:"signal",converter:l.nullableConverter(l.converters.AbortSignal),defaultValue:()=>null}]),l.converters.WebSocketCloseInfo=l.dictionaryConverter([{key:"closeCode",converter:e=>l.converters["unsigned short"](e,l.attributes.EnforceRange)},{key:"reason",converter:l.converters.USVString,defaultValue:()=>""}]),l.converters.WebSocketStreamWrite=function(e){return"string"==typeof e?l.converters.USVString(e):l.converters.BufferSource(e)},t.exports={WebSocketStream:v}},694414,(e,t,i)=>{"use strict";t.exports={isValidLastEventId:function(e){return -1===e.indexOf("\0")},isASCIINumber:function(e){if(0===e.length)return!1;for(let t=0;te.charCodeAt(t)||e.charCodeAt(t)>57)return!1;return!0}}},911214,(e,t,i)=>{"use strict";let{Transform:r}=e.r(81111),{isASCIINumber:n,isValidLastEventId:s}=e.r(694414),a=[239,187,191],o=10,l=13,c=58,d=32;class u extends r{state;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(e={}){e.readableObjectMode=!0,super(e),this.state=e.eventSourceSettings||{},e.push&&(this.push=e.push)}_transform(e,t,i){if(0===e.length)return void i();if(this.buffer?this.buffer=Buffer.concat([this.buffer,e]):this.buffer=e,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===a[0])return void i();this.checkBOM=!1,i();return;case 2:if(this.buffer[0]===a[0]&&this.buffer[1]===a[1])return void i();this.checkBOM=!1;break;case 3:if(this.buffer[0]===a[0]&&this.buffer[1]===a[1]&&this.buffer[2]===a[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,i();return}this.checkBOM=!1;break;default:this.buffer[0]===a[0]&&this.buffer[1]===a[1]&&this.buffer[2]===a[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1}for(;this.pos0&&(t[r]=a)}}processEvent(e){e.retry&&n(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),void 0!==e.id&&s(e.id)&&(this.state.lastEventId=e.id),void 0!==e.data&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}}t.exports={EventSourceStream:u}},287413,(e,t,i)=>{"use strict";let{pipeline:r}=e.r(81111),{fetching:n}=e.r(258548),{makeRequest:s}=e.r(625461),{webidl:a}=e.r(192321),{EventSourceStream:o}=e.r(911214),{parseMIMEType:l}=e.r(441628),{createFastMessageEvent:c}=e.r(925087),{isNetworkError:d}=e.r(144796),{kEnumerableProperty:u}=e.r(122857),{environmentSettingsObject:h}=e.r(402649),A=!1,p=3e3,f=0,g=1,m=2,y="anonymous",b="use-credentials";class E extends EventTarget{#tA={open:null,error:null,message:null};#tw;#tR=!1;#tL=f;#tF=null;#a=null;#e2;#A;constructor(e,t={}){let i;super(),a.util.markAsUncloneable(this);const r="EventSource constructor";a.argumentLengthCheck(arguments,1,r),A||(A=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=a.converters.USVString(e),t=a.converters.EventSourceInitDict(t,r,"eventSourceInitDict"),this.#e2=t.node.dispatcher||t.dispatcher,this.#A={lastEventId:"",reconnectionTime:t.node.reconnectionTime};const n=h;try{i=new URL(e,n.settingsObject.baseUrl),this.#A.origin=i.origin}catch(e){throw new DOMException(e,"SyntaxError")}this.#tw=i.href;let o=y;!0===t.withCredentials&&(o=b,this.#tR=!0);const l={redirect:"follow",keepalive:!0,mode:"cors",credentials:"anonymous"===o?"same-origin":"omit",referrer:"no-referrer"};l.client=h.settingsObject,l.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],l.cache="no-store",l.initiator="other",l.urlList=[new URL(this.#tw)],this.#tF=s(l),this.#tM()}get readyState(){return this.#tL}get url(){return this.#tw}get withCredentials(){return this.#tR}#tM(){if(this.#tL===m)return;this.#tL=f;let e={request:this.#tF,dispatcher:this.#e2};e.processResponseEndOfBody=e=>{if(!d(e))return this.#tO()},e.processResponse=e=>{if(d(e))if(!e.aborted)return void this.#tO();else{this.close(),this.dispatchEvent(new Event("error"));return}let t=e.headersList.get("content-type",!0),i=null!==t?l(t):"failure",n="failure"!==i&&"text/event-stream"===i.essence;if(200!==e.status||!1===n){this.close(),this.dispatchEvent(new Event("error"));return}this.#tL=g,this.dispatchEvent(new Event("open")),this.#A.origin=e.urlList[e.urlList.length-1].origin;let s=new o({eventSourceSettings:this.#A,push:e=>{this.dispatchEvent(c(e.type,e.options))}});r(e.body.stream,s,e=>{e?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#a=n(e)}#tO(){this.#tL!==m&&(this.#tL=f,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#tL===f&&(this.#A.lastEventId.length&&this.#tF.headersList.set("last-event-id",this.#A.lastEventId,!0),this.#tM())},this.#A.reconnectionTime)?.unref())}close(){a.brandCheck(this,E),this.#tL!==m&&(this.#tL=m,this.#a.abort(),this.#tF=null)}get onopen(){return this.#tA.open}set onopen(e){this.#tA.open&&this.removeEventListener("open",this.#tA.open);let t=a.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("open",t),this.#tA.open=e):this.#tA.open=null}get onmessage(){return this.#tA.message}set onmessage(e){this.#tA.message&&this.removeEventListener("message",this.#tA.message);let t=a.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("message",t),this.#tA.message=e):this.#tA.message=null}get onerror(){return this.#tA.error}set onerror(e){this.#tA.error&&this.removeEventListener("error",this.#tA.error);let t=a.converters.EventHandlerNonNull(e);null!==t?(this.addEventListener("error",t),this.#tA.error=e):this.#tA.error=null}}let C={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:f,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:g,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:m,writable:!1}};Object.defineProperties(E,C),Object.defineProperties(E.prototype,C),Object.defineProperties(E.prototype,{close:u,onerror:u,onmessage:u,onopen:u,readyState:u,url:u,withCredentials:u}),a.converters.EventSourceInitDict=a.dictionaryConverter([{key:"withCredentials",converter:a.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:a.converters.any},{key:"node",converter:a.dictionaryConverter([{key:"reconnectionTime",converter:a.converters["unsigned long"],defaultValue:()=>p},{key:"dispatcher",converter:a.converters.any}]),defaultValue:()=>({})}]),t.exports={EventSource:E,defaultReconnectionTime:p}},169959,(e,t,i)=>{"use strict";let r=e.r(217365),n=e.r(10918),s=e.r(682850),a=e.r(524013),o=e.r(753108),l=e.r(542122),c=e.r(469494),d=e.r(334806),u=e.r(410974),h=e.r(567934),A=e.r(889567),p=e.r(450178),f=e.r(122857),{InvalidArgumentError:g}=p,m=e.r(222611),y=e.r(977155),b=e.r(102729),{MockCallHistory:E,MockCallHistoryLog:C}=e.r(406177),w=e.r(665015),I=e.r(509805),v=e.r(525281),B=e.r(491433),Q=e.r(335221),{getGlobalDispatcher:x,setGlobalDispatcher:S}=e.r(312706),k=e.r(201443),T=e.r(408050);Object.assign(n.prototype,m),t.exports.Dispatcher=n,t.exports.Client=r,t.exports.Pool=s,t.exports.BalancedPool=a,t.exports.RoundRobinPool=o,t.exports.Agent=l,t.exports.ProxyAgent=c,t.exports.Socks5ProxyAgent=d,t.exports.EnvHttpProxyAgent=u,t.exports.RetryAgent=h,t.exports.H2CClient=A,t.exports.RetryHandler=Q,t.exports.DecoratorHandler=k,t.exports.RedirectHandler=T,t.exports.interceptors={redirect:e.r(539424),responseError:e.r(391607),retry:e.r(27814),dump:e.r(234412),dns:e.r(884656),cache:e.r(207639),decompress:e.r(707755),deduplicate:e.r(380308)},t.exports.cacheStores={MemoryCacheStore:e.r(29867)};let N=e.r(269140);function D(e){return(t,i,r)=>{if("function"==typeof i&&(r=i,i=null),!t||"string"!=typeof t&&"object"!=typeof t&&!(t instanceof URL))throw new g("invalid url");if(null!=i&&"object"!=typeof i)throw new g("invalid opts");if(i&&null!=i.path){if("string"!=typeof i.path)throw new g("invalid opts.path");let e=i.path;i.path.startsWith("/")||(e=`/${e}`),t=new URL(f.parseOrigin(t).origin+e)}else i||(i="object"==typeof t?t:{}),t=f.parseURL(t);let{agent:n,dispatcher:s=x()}=i;if(n)throw new g("unsupported opts.agent. Did you mean opts.client?");return e.call(s,{...i,origin:t.origin,path:t.search?`${t.pathname}${t.search}`:t.pathname,method:i.method||(i.body?"PUT":"GET")},r)}}t.exports.cacheStores.SqliteCacheStore=N,t.exports.buildConnector=y,t.exports.errors=p,t.exports.util={parseHeaders:f.parseHeaders,headerNameToString:f.headerNameToString},t.exports.setGlobalDispatcher=S,t.exports.getGlobalDispatcher=x;let _=e.r(258548).fetch,R="/ROOT/node_modules/.pnpm/undici@7.24.4/node_modules/undici/index.js";function L(e,t){if(!e||"object"!=typeof e)return;let i="string"==typeof e.stack?e.stack:"",r=t.replace(/\\/g,"/");if(i&&(i.includes(t)||i.includes(r)))return;let n={};if(Error.captureStackTrace(n,L),!n.stack)return;let s=n.stack.split("\n").slice(1).join("\n");e.stack=i?`${i}
${s}`:n.stack}t.exports.fetch=function(e,i){return _(e,i).catch(e=>{throw R?L(e,R):e&&"object"==typeof e&&Error.captureStackTrace(e,t.exports.fetch),e})},t.exports.Headers=e.r(302260).Headers,t.exports.Response=e.r(144796).Response,t.exports.Request=e.r(625461).Request,t.exports.FormData=e.r(943159).FormData;let{setGlobalOrigin:F,getGlobalOrigin:M}=e.r(364065);t.exports.setGlobalOrigin=F,t.exports.getGlobalOrigin=M;let{CacheStorage:O}=e.r(446161),{kConstruct:U}=e.r(954673);t.exports.caches=new O(U);let{deleteCookie:P,getCookies:$,getSetCookies:j,setCookie:H,parseCookie:q}=e.r(929077);t.exports.deleteCookie=P,t.exports.getCookies=$,t.exports.getSetCookies=j,t.exports.setCookie=H,t.exports.parseCookie=q;let{parseMIMEType:z,serializeAMimeType:V}=e.r(441628);t.exports.parseMIMEType=z,t.exports.serializeAMimeType=V;let{CloseEvent:G,ErrorEvent:Y,MessageEvent:W}=e.r(925087),{WebSocket:J,ping:K}=e.r(697150);t.exports.WebSocket=J,t.exports.CloseEvent=G,t.exports.ErrorEvent=Y,t.exports.MessageEvent=W,t.exports.ping=K,t.exports.WebSocketStream=e.r(103565).WebSocketStream,t.exports.WebSocketError=e.r(894026).WebSocketError,t.exports.request=D(m.request),t.exports.stream=D(m.stream),t.exports.pipeline=D(m.pipeline),t.exports.connect=D(m.connect),t.exports.upgrade=D(m.upgrade),t.exports.MockClient=b,t.exports.MockCallHistory=E,t.exports.MockCallHistoryLog=C,t.exports.MockPool=I,t.exports.MockAgent=w,t.exports.SnapshotAgent=v,t.exports.mockErrors=B;let{EventSource:Z}=e.r(287413);function X(){globalThis.fetch=t.exports.fetch,globalThis.Headers=t.exports.Headers,globalThis.Response=t.exports.Response,globalThis.Request=t.exports.Request,globalThis.FormData=t.exports.FormData,globalThis.WebSocket=t.exports.WebSocket,globalThis.CloseEvent=t.exports.CloseEvent,globalThis.ErrorEvent=t.exports.ErrorEvent,globalThis.MessageEvent=t.exports.MessageEvent,globalThis.EventSource=t.exports.EventSource}t.exports.EventSource=Z,t.exports.install=X},786559,265943,e=>{"use strict";let t=(e,t)=>{try{let i=new URL(e);return t.some(e=>Object.entries(e).every(([e,t])=>{if(!t)return!0;if("protocol"===e)return"string"==typeof t&&i.protocol===`${t}:`;if("pathname"===e){let e=t.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\/$/,"(/)?");return RegExp(`^${e}$`).test(i.pathname)}return i[e]===t}))}catch{return!1}};e.s(["isURLAllowed",0,t],786559);var i=e.i(679594),r=e.i(902525),n=e.i(169959);let s={lookup:i.lookup},a=e=>{try{if(!e||!r.default.isValid(e))return!1;let t=r.default.parse(e).range();if("unicast"!==t)return!1}catch(e){return!1}return!0},o=(e,t,i)=>{s.lookup(e,t,(t,r,n)=>{if(t)i(t,r,n);else{let t=[];if((t=Array.isArray(r)?r.map(e=>e.address):[r]).some(e=>!a(e)))return void i(Error(`Blocked unsafe attempt to ${e}`),r,n);i(null,r,n)}})},l=new n.Agent({connect:{lookup:o}}),c=async(...e)=>{let[t,i]=e;try{let e=new URL(t),s=e.hostname;if(s.startsWith("[")&&s.endsWith("]")&&(s=s.slice(1,-1)),r.default.isValid(s)&&!a(s))throw Error(`Blocked unsafe attempt to ${s}`);return await (0,n.fetch)(e,{...i,dispatcher:l,redirect:"manual"})}catch(e){if(e instanceof Error)if(e.cause instanceof Error&&e.cause.message.includes("unsafe"))throw Error(e.cause.message);else{let i;throw"string"==typeof t?i=t:t instanceof URL?i=t.toString():t instanceof Request&&(i=t.url),Error(`Failed to fetch from ${i}, ${e.message}`)}throw e}};e.s(["safeFetch",0,c],265943)},438635,e=>{"use strict";let t=(e,t)=>0===t.length||t.map(e=>e.replace("*","")).some(t=>e.startsWith(t));e.s(["validateMimeType",0,t])},74460,e=>{"use strict";let t=[{label:({t:e})=>e("version:draft"),value:"draft"},{label:({t:e})=>e("version:published"),value:"published"}],i=({localized:e})=>[{name:"_status",type:"select",admin:{components:{Field:!1},disableBulkEdit:!0},defaultValue:"draft",index:!0,label:({t:e})=>e("version:status"),localized:!!e,options:t}],r={name:"snapshot",type:"checkbox",admin:{disableBulkEdit:!0,disabled:!0},index:!0};e.s(["baseVersionFields",0,i,"versionSnapshotField",0,r])},88665,799028,e=>{"use strict";e.i(10188);var t=e.i(785867),i=e.i(700859);class r extends i.APIError{constructor(e){const i=`The following path${1===e.length?"":"s"} cannot be queried:`;super(`${i} ${e.map(e=>e.path).join(", ")}`,t.status.BAD_REQUEST,e)}}e.s(["QueryError",()=>r],88665);let n=new Set(["equals","contains","not_equals","in","all","not_in","exists","greater_than","greater_than_equal","less_than","less_than_equal","like","not_like","within","intersects","near"]),s=/^\w+(?:\.\w+)*$/;e.s(["SAFE_FIELD_PATH_REGEX",0,s,"validOperatorSet",0,n],799028)},837209,451038,90602,e=>{"use strict";var t=e.i(42625),i=e.i(617997);e.s(["validateQueryPaths",()=>p],451038);var r=e.i(88665),n=e.i(799028),s=e.i(186725),a=n,o=e.i(809175),l=e.i(393203),c=s,d=e.i(700859),u=n;function h({collectionSlug:e,fields:t,globalSlug:i,incomingPath:r,locale:n,overrideAccess:s=!1,parentIsLocalized:a,payload:o}){let l=r.split("."),A=o.config.localization,p=[{collectionSlug:e,complete:!1,field:void 0,fields:t,globalSlug:i,invalid:!1,parentIsLocalized:a,path:""}];for(let e=0;e!e);if(r){let f,g,{path:m}=r,y=m?`${m}.${t}`:t,b=a;if(r?.field?.type==="blocks")if("blockType"===t)g={name:"blockType",type:"text"};else for(let e of r.field.blockReferences??r.field.blocks){let i;if(g=(i="string"==typeof e?o.blocks[e]:e).flattenedFields.find(e=>e.name===t))break}else f=r?.field&&"flattenedFields"in r.field?r.field.flattenedFields:r.fields,b=a||r.field?.localized,g=f.find(e=>e.name===t);if(r.field=g,"globalType"===y&&i)return r.path=y,r.complete=!0,r.field={name:"globalType",type:"text"},p;if("relationTo"===y)return r.path=y,r.complete=!0,r.field={name:"relationTo",type:"select",options:Object.keys(o.collections)},p;if(!g&&"id"===y&&e===l.length-1)return r.path=y,r.field={name:"id",type:o.db.defaultIDType},r.complete=!0,p;if(g){"hidden"in g&&g.hidden&&!s&&(r.invalid=!0);let t=l[e+1],a=(0,c.fieldShouldBeLocalized)({field:g,parentIsLocalized:b}),f=A&&A.localeCodes.includes(t)&&a;switch(f?(e+=1,y=`${y}.${t}`):A&&a&&(y=`${y}.${n}`),g.type){case"join":case"relationship":case"upload":if("join"!==g.type&&"string"!=typeof g.relationTo)r.path=l.join("."),[g.name,"relationTo","value"].includes(l.at(-1))?r.complete=!0:r.invalid=!0;else{r.complete=!0,r.path=y;let t=l.slice(f?e+2:e+1).join(".");if(t){let e;if("join"===g.type){if(Array.isArray(g.collection))throw new d.APIError("Not supported");e=o.collections[g.collection].config}else e=o.collections[g.relationTo].config;p=[...p,...h({collectionSlug:e.slug,fields:e.flattenedFields,globalSlug:i,incomingPath:t,locale:n,parentIsLocalized:!1,payload:o})]}return p}break;case"json":case"richText":{let t=l.slice(e+1).join(".");return l.forEach(e=>{u.SAFE_FIELD_PATH_REGEX.test(e)||(r.invalid=!0)}),r.complete=!0,r.path=t?`${y}.${t}`:y,p}default:e+1===l.length&&(r.complete=!0),r.path=y}}else{r.invalid=!0,r.path=y;break}}}return p}async function A({collectionConfig:e,constraint:t,errors:i,fields:r,globalConfig:n,operator:c,overrideAccess:d,parentIsLocalized:u,path:A,policies:f,polymorphicJoin:g,req:m,val:y,versionFields:b}){let E;E="_id"===A?"id":A.replace(/__/g,".");let C=[],{slug:w}=e||n,I={};n&&!f.globals[w]&&(f.globals[w]=await (0,o.getEntityPermissions)({blockReferencesPermissions:I,entity:n,entityType:"global",fetchData:!1,operations:["read"],req:m})),"id"!==E&&(C=h({collectionSlug:e?.slug,fields:r,globalSlug:n?.slug,incomingPath:E,locale:m.locale,overrideAccess:d,parentIsLocalized:u,payload:m.payload}));let v=[];if(C.at(-1)?.path==="id"){let e=C.at(-2)?.field;e&&("relationship"===e.type||"upload"===e.type)&&"string"==typeof e.relationTo&&C.pop()}v.push(...C.map(async({collectionSlug:r,field:u,invalid:h,path:E},w)=>{if(h){g&&a.SAFE_FIELD_PATH_REGEX.test(A)||i.push({path:E});return}if("join"===u.type&&E===A&&(t[`${E}.id`]=t[E],delete t[E]),"virtual"in u&&u.virtual&&!0===u.virtual&&i.push({path:E}),!g||"relationTo"!==E){if(!d&&(0,s.fieldAffectsData)(u)){let t;r&&(f.collections[r]||(f.collections[r]=await (0,o.getEntityPermissions)({blockReferencesPermissions:I,entity:m.payload.collections[r].config,entityType:"collection",fetchData:!1,operations:["read"],req:(0,l.isolateObjectProperty)(m,"transactionID")})),["hash","salt"].includes(A)&&e.auth&&!e.auth?.disableLocalStrategy&&i.push({path:A}));let s=E;E.endsWith(`.${m.locale}`)&&(s=E.slice(0,-(m.locale.length+1))),("relationship"===u.type||"upload"===u.type)&&Array.isArray(u.relationTo)&&(s=s.replace(".value",""));let a=n?"globals":"collections",c=r||n.slug,d=s.split(".");b?(t=f[a][c].fields,("parent"===d[0]||"version"===d[0]||"snapshot"===d[0]||"latest"===d[0])&&d.shift()):t=f[a][c].fields,d.length&&(d.forEach(e=>{t[e]&&(t="fields"in t[e]?t[e].fields:t[e])}),t?.read?.permission||i.push({path:s}))}w>1&&C.slice(1).reverse().forEach(({collectionSlug:e,path:t},r)=>{0===r&&v.push(p({collectionConfig:m.payload.collections[e].config,errors:i,globalConfig:void 0,overrideAccess:d,policies:f,req:m,where:{[t]:{[c]:y}}}))})}})),await Promise.all(v)}async function p({collectionConfig:e,errors:t=[],globalConfig:i,overrideAccess:s,policies:a={collections:{},globals:{}},polymorphicJoin:o,req:l,versionFields:c,where:d}){let u=c||(i||e).flattenedFields;if("object"==typeof d){let h=[];for(let r in d){let f=d[r];if(("and"===r||"or"===r)&&Array.isArray(f))for(let r of f)e?h.push(p({collectionConfig:e,errors:t,overrideAccess:s,policies:a,polymorphicJoin:o,req:l,versionFields:c,where:r})):h.push(p({errors:t,globalConfig:i,overrideAccess:s,policies:a,polymorphicJoin:o,req:l,versionFields:c,where:r}));else if(!Array.isArray(f))for(let p in f){let g=f[p];n.validOperatorSet.has(p)?h.push(A({collectionConfig:e,constraint:d,errors:t,fields:u,globalConfig:i,operator:p,overrideAccess:s,path:r,policies:a,polymorphicJoin:o,req:l,val:g,versionFields:c})):t.push({path:`${r}.${p}`})}}if(await Promise.all(h),t.length>0)throw new r.QueryError(t)}}let f=({fields:e,payload:t,where:i})=>{for(let r in i){let n=i[r];if(["and","or"].includes(r.toLowerCase())&&Array.isArray(n)){for(let i of n)f({fields:e,payload:t,where:i});continue}let s=r.split("."),a=!1,o=e;for(let e=0;ee.name===i);if(!r)break;if("virtual"in r&&r.virtual&&"string"==typeof r.virtual&&(s[e]=r.virtual,a=!0),"flattenedFields"in r&&(o=r.flattenedFields),("relationship"===r.type||"upload"===r.type)&&"string"==typeof r.relationTo){let e=t.collections[r.relationTo];e&&(o=e.config.flattenedFields)}}a&&(i[s.join(".")]=i[r],delete i[r])}};e.s(["sanitizeWhereQuery",0,f],90602);var g=e.i(516808),m=e.i(893961),y=e.i(252016),b=e.i(668473);let E=async e=>{let r=e;try{let e,n,{collection:{config:s},disableErrors:a,overrideAccess:o,req:l,trash:c=!1,where:d}=r=await (0,b.buildBeforeOperation)({args:r,collection:r.collection.config,operation:"count",overrideAccess:r.overrideAccess}),{payload:u}=l;if(!o&&(e=await (0,t.executeAccess)({disableErrors:a,req:l},s.access.read),!1===e))return{totalDocs:0};let h=(0,i.combineQueries)(d,e);return f({fields:s.flattenedFields,payload:u,where:h}),h=(0,g.appendNonTrashedFilter)({enableTrash:s.trash,trash:c,where:h}),await p({collectionConfig:s,overrideAccess:o,req:l,where:d}),n=await u.db.count({collection:s.slug,req:l,where:h}),n=await (0,y.buildAfterOperation)({args:r,collection:s,operation:"count",overrideAccess:o,result:n})}catch(e){throw await (0,m.killTransaction)(r.req),e}};e.s(["countOperation",0,E],837209)},303539,55115,709926,843385,e=>{"use strict";var t=e.i(248836);let i=Symbol.for("react.client.reference");function r(e){return"function"==typeof e&&e.$$typeof!==i}function n(e){return"function"==typeof e}function s(e){return!n(e)&&"object"==typeof e&&null!==e&&!(e instanceof RegExp)&&!(e instanceof Date)}function a(e,i){return(0,t.default)(e,i,{arrayMerge:(e,t)=>t})}function o(e,i){return(0,t.default)(e,i,{isMergeableObject:s})}e.s(["isReactComponentOrFunction",()=>n,"isReactServerComponentOrFunction",()=>r],55115),e.s(["isPlainObject",()=>s],709926),e.s(["deepMergeWithReactComponents",()=>o,"deepMergeWithSourceArrays",()=>a],303539);let l=(e,t)=>{if("object"==typeof e&&!Object.prototype.hasOwnProperty.call(e,"$$typeof")){if(e[t.language])return e[t.language];let i=[];"string"==typeof t.fallbackLanguage?i=[t.fallbackLanguage]:Array.isArray(t.fallbackLanguage)&&(i=t.fallbackLanguage);let r=i.find(t=>e[t]);return r&&e[r]?e[r]:e[Object.keys(e)[0]]}return"function"==typeof e?e({i18n:t,t:t.t}):e};e.s(["getTranslation",0,l],843385)},974605,145908,e=>{"use strict";let t={autosaveInterval:2e3};e.s(["versionDefaults",0,t],145908);let i=e=>!!(e?.versions&&"object"==typeof e.versions&&e.versions.drafts),r=e=>!!(e?.versions&&"object"==typeof e.versions&&e.versions.drafts&&"object"==typeof e.versions.drafts&&e.versions.drafts.localizeStatus),n=e=>!!(e?.versions&&"object"==typeof e.versions&&e.versions.drafts&&"object"==typeof e.versions.drafts&&e.versions.drafts.autosave),s=e=>!!(e?.versions&&"object"==typeof e.versions&&e.versions.drafts&&"object"==typeof e.versions.drafts&&e.versions.drafts.validate),a=e=>!!(e?.versions&&"object"==typeof e.versions&&e.versions.drafts&&"object"==typeof e.versions.drafts&&e.versions.drafts.schedulePublish),o=e=>e?.versions&&"object"==typeof e.versions?"maxPerDoc"in e.versions?e.versions.maxPerDoc??100:"max"in e.versions?e.versions.max??100:0:0;e.s(["getVersionsMax",0,o,"hasAutosaveEnabled",0,n,"hasDraftValidationEnabled",0,s,"hasDraftsEnabled",0,i,"hasLocalizeStatusEnabled",0,r,"hasScheduledPublishEnabled",0,a],974605)},747016,e=>{"use strict";e.s(["traverseFields",()=>s],747016);var t=e.i(674921),i=e.i(186725),r=e.i(951020);let n=async({blockData:e,collection:n,context:a,data:o,doc:l,field:c,fieldIndex:d,global:u,operation:h,parentIndexPath:A,parentIsLocalized:p,parentPath:f,parentSchemaPath:g,previousDoc:m,previousSiblingDoc:y,req:b,siblingData:E,siblingDoc:C,siblingFields:w})=>{let{indexPath:I,path:v,schemaPath:B}=(0,r.getFieldPaths)({field:c,index:d,parentIndexPath:A,parentPath:f,parentSchemaPath:g}),Q=v?v.split("."):[],x=B?B.split("."):[],S=I?I.split("-").filter(Boolean)?.map(Number):[],k=(e,t)=>t.reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e),T=y&&Object.keys(y).length>0?y:m;if((0,i.fieldAffectsData)(c)&&"hooks"in c&&c.hooks?.afterChange)for(let t of c.hooks.afterChange){let i=await t({blockData:e,collection:n,context:a,data:o,field:c,global:u,indexPath:S,operation:h,originalDoc:l,path:Q,previousDoc:m,previousSiblingDoc:y,previousValue:k(T,Q)??T?.[c.name],req:b,schemaPath:x,siblingData:E,siblingFields:w,value:k(C,Q)??C?.[c.name]});void 0!==i&&(C[c.name]=i)}switch(c.type){case"array":{let t=C[c.name];if(Array.isArray(t)){let i=[];t.forEach((t,r)=>{i.push(s({blockData:e,collection:n,context:a,data:o,doc:l,fields:c.fields,global:u,operation:h,parentIndexPath:"",parentIsLocalized:p||c.localized,parentPath:v+"."+r,parentSchemaPath:B,previousDoc:m,previousSiblingDoc:m?.[c.name]?.[r]||{},req:b,siblingData:E?.[c.name]?.[r]||{},siblingDoc:t?{...t}:{}}))}),await Promise.all(i)}break}case"blocks":{let e=C[c.name];if(Array.isArray(e)){let t=[];e.forEach((e,i)=>{let r=e.blockType,d=b.payload.blocks[r]??(c.blockReferences??c.blocks).find(e=>"string"!=typeof e&&e.slug===r);d&&t.push(s({blockData:E?.[c.name]?.[i],collection:n,context:a,data:o,doc:l,fields:d.fields,global:u,operation:h,parentIndexPath:"",parentIsLocalized:p||c.localized,parentPath:v+"."+i,parentSchemaPath:B+"."+d.slug,previousDoc:m,previousSiblingDoc:T?.[c.name]?.[i]||{},req:b,siblingData:E?.[c.name]?.[i]||{},siblingDoc:e?{...e}:{}}))}),await Promise.all(t)}break}case"collapsible":case"row":await s({blockData:e,collection:n,context:a,data:o,doc:l,fields:c.fields,global:u,operation:h,parentIndexPath:I,parentIsLocalized:p,parentPath:f,parentSchemaPath:B,previousDoc:m,previousSiblingDoc:{...y},req:b,siblingData:E||{},siblingDoc:{...C}});break;case"group":(0,i.fieldAffectsData)(c)?await s({blockData:e,collection:n,context:a,data:o,doc:l,fields:c.fields,global:u,operation:h,parentIndexPath:"",parentIsLocalized:p||c.localized,parentPath:v,parentSchemaPath:B,previousDoc:m,previousSiblingDoc:m?.[c.name]||{},req:b,siblingData:E?.[c.name]||{},siblingDoc:C?.[c.name]||{}}):await s({blockData:e,collection:n,context:a,data:o,doc:l,fields:c.fields,global:u,operation:h,parentIndexPath:I,parentIsLocalized:p,parentPath:f,parentSchemaPath:B,previousDoc:m,previousSiblingDoc:{...y},req:b,siblingData:E||{},siblingDoc:{...C}});break;case"richText":{if(!c?.editor)throw new t.MissingEditorProp(c);if("function"==typeof c.editor)throw Error("Attempted to access unsanitized rich text editor.");let e=c.editor;if(e?.hooks?.afterChange?.length)for(let t of e.hooks.afterChange){let e=await t({collection:n,context:a,data:o,field:c,global:u,indexPath:S,operation:h,originalDoc:l,parentIsLocalized:p,path:Q,previousDoc:m,previousSiblingDoc:y,previousValue:k(T,Q)??T?.[c.name],req:b,schemaPath:x,siblingData:E,value:C?.[c.name]});void 0!==e&&(C[c.name]=e)}break}case"tab":{let t=E,r=C,d={...m},A=(0,i.tabHasName)(c);A&&(t=E?.[c.name]??{},r=C?.[c.name]??{},d=y?.[c.name]??{}),await s({blockData:e,collection:n,context:a,data:o,doc:l,fields:c.fields,global:u,operation:h,parentIndexPath:A?"":I,parentIsLocalized:p||c.localized,parentPath:A?v:f,parentSchemaPath:B,previousDoc:m,previousSiblingDoc:d,req:b,siblingData:t,siblingDoc:r});break}case"tabs":await s({blockData:e,collection:n,context:a,data:o,doc:l,fields:c.tabs.map(e=>({...e,type:"tab"})),global:u,operation:h,parentIndexPath:I,parentIsLocalized:p,parentPath:v,parentSchemaPath:B,previousDoc:m,previousSiblingDoc:{...y},req:b,siblingData:E||{},siblingDoc:{...C}})}},s=async({blockData:e,collection:t,context:i,data:r,doc:s,fields:a,global:o,operation:l,parentIndexPath:c,parentIsLocalized:d,parentPath:u,parentSchemaPath:h,previousDoc:A,previousSiblingDoc:p,req:f,siblingData:g,siblingDoc:m,siblingFields:y})=>{let b=[];a.forEach((a,E)=>{b.push(n({blockData:e,collection:t,context:i,data:r,doc:s,field:a,fieldIndex:E,global:o,operation:l,parentIndexPath:c,parentIsLocalized:d,parentPath:u,parentSchemaPath:h,previousDoc:A,previousSiblingDoc:p,req:f,siblingData:g,siblingDoc:m,siblingFields:y}))}),await Promise.all(b)}},875798,731161,494663,e=>{"use strict";e.s(["traverseFields",()=>u],875798);var t=e.i(674921),i=e.i(350261),r=e.i(303539),n=e.i(843385);let s=(e,t)=>"function"==typeof e?e({i18n:t,t:t.t}):"object"==typeof e?(0,n.getTranslation)(e,t):e;e.s(["getTranslatedLabel",0,s],731161);var a=e.i(186725),o=e.i(951020);let l=(e,t)=>{if(e.id&&Array.isArray(t)){let i=t.find(t=>"object"==typeof t&&"id"in t&&t.id===e.id&&t);if(i)return i}return{}};function c(e,t){if(!t)return e;let i=t.charAt(0).toUpperCase()+t.slice(1);return e&&i?`${e} > ${i}`:i||e}let d=async({id:e,blockData:n,collection:d,context:h,data:A,doc:p,docWithLocales:f,errors:g,field:m,fieldIndex:y,fieldLabelPath:b,global:E,mergeLocaleActions:C,operation:w,overrideAccess:I,parentIndexPath:v,parentIsLocalized:B,parentPath:Q,parentSchemaPath:x,req:S,siblingData:k,siblingDoc:T,siblingDocWithLocales:N,siblingFields:D,skipValidation:_})=>{let{indexPath:R,path:L,schemaPath:F}=(0,o.getFieldPaths)({field:m,index:y,parentIndexPath:v,parentPath:Q,parentSchemaPath:x}),{localization:M}=S.payload.config,O=M?M?.defaultLocale:"en",U=S.locale||O,P=L?L.split("."):[],$=F?F.split("."):[],j=R?R.split("-").filter(Boolean)?.map(Number):[],H=!m.admin?.condition||!!m.admin.condition(A,k,{blockData:n,operation:w,path:P,user:S.user}),q=_||!H;if((0,a.fieldAffectsData)(m)){if((0,a.fieldShouldBeLocalized)({field:m,parentIsLocalized:B})&&U!==O&&["array","blocks"].includes(m.type)&&null===k[m.name]&&(q=!0),"hooks"in m&&m.hooks?.beforeChange)for(let e of m.hooks.beforeChange){let t=await e({blockData:n,collection:d,context:h,data:A,field:m,global:E,indexPath:j,operation:w,originalDoc:p,path:P,previousSiblingDoc:T,previousValue:T[m.name],req:S,schemaPath:$,siblingData:k,siblingDocWithLocales:N,siblingFields:D,value:k[m.name]});void 0!==t&&(k[m.name]=t)}if(!q&&"validate"in m&&m.validate){let t,a=k[m.name];if("json"===m.type&&"string"==typeof k[m.name])try{JSON.parse(k[m.name])}catch(e){t=e}let o=m.validate,l=await o(a,{...m,id:e,blockData:n,collectionSlug:d?.slug,data:(0,r.deepMergeWithSourceArrays)(p,A),event:"submit",jsonError:t,operation:w,overrideAccess:I,path:P,preferences:{fields:{}},previousValue:T[m.name],req:S,siblingData:(0,r.deepMergeWithSourceArrays)(T,k)});if("string"==typeof l){let t=!1;if("blocks"===m.type&&m.filterOptions){let r=await (0,i.validateBlocksFilterOptions)({id:e,data:A,filterOptions:m.filterOptions,req:S,siblingData:k,value:k[m.name]});if(r?.invalidBlockSlugs?.length){t=!0;let e=-1;for(let t of k[m.name])if(e++,r.invalidBlockSlugs.includes(t.blockType)){let i=(m.blockReferences??m.blocks).find(e=>"string"==typeof e?e===t.blockType:e.slug===t.blockType),r="string"!=typeof i?i:S.payload.config?.blocks?.[i],n=m?.label===!1?b:c(b,`${s(m?.label||m?.name,S.i18n)} > ${S.t("fields:block")} ${e+1} (${s(r?.labels?.singular||t.blockType,S.i18n)})`);g.push({label:n,message:S.t("validation:invalidBlock",{block:t.blockType}),path:`${L}.${e}.id`})}}}if(!t){let e=c(b,s(m?.label||m?.name,S.i18n));g.push({label:e,message:l,path:L})}}}M&&(0,a.fieldShouldBeLocalized)({field:m,parentIsLocalized:B})&&C.push(()=>{let e={};for(let t of M.localeCodes){let i=t===S.locale?k[m.name]:N?.[m.name]?.[t];void 0!==i&&(e[t]=i)}Object.keys(e).length>0&&(k[m.name]=e)})}switch(m.type){case"array":{let t=k[m.name];if(Array.isArray(t)){let i=[];t.forEach((t,r)=>{i.push(u({id:e,blockData:n,collection:d,context:h,data:A,doc:p,docWithLocales:f,errors:g,fieldLabelPath:m?.label===!1?b:c(b,`${s(m?.label||m?.name,S.i18n)} ${r+1}`),fields:m.fields,global:E,mergeLocaleActions:C,operation:w,overrideAccess:I,parentIndexPath:"",parentIsLocalized:B||m.localized,parentPath:L+"."+r,parentSchemaPath:F,req:S,siblingData:t,siblingDoc:l(t,T[m.name]),siblingDocWithLocales:l(t,N?.[m.name]),skipValidation:q}))}),await Promise.all(i)}break}case"blocks":{let t=k[m.name];if(Array.isArray(t)){let i=[];t.forEach((t,r)=>{let n=l(t,T[m.name]),a=l(t,N?N[m.name]:{}),o=t.blockType||n.blockType,y=S.payload.blocks[o]??(m.blockReferences??m.blocks).find(e=>"string"!=typeof e&&e.slug===o),v=m?.label===!1?b:c(b,`${s(m?.label||m?.name,S.i18n)} > ${S.t("fields:block")} ${r+1} (${s(y?.labels?.singular||o,S.i18n)})`);y&&i.push(u({id:e,blockData:t,collection:d,context:h,data:A,doc:p,docWithLocales:f,errors:g,fieldLabelPath:v,fields:y.fields,global:E,mergeLocaleActions:C,operation:w,overrideAccess:I,parentIndexPath:"",parentIsLocalized:B||m.localized,parentPath:L+"."+r,parentSchemaPath:F+"."+y.slug,req:S,siblingData:t,siblingDoc:n,siblingDocWithLocales:a,skipValidation:q}))}),await Promise.all(i)}break}case"collapsible":case"row":await u({id:e,blockData:n,collection:d,context:h,data:A,doc:p,docWithLocales:f,errors:g,fieldLabelPath:"row"===m.type||m?.label===!1?b:c(b,s(m?.label||m?.type,S.i18n)),fields:m.fields,global:E,mergeLocaleActions:C,operation:w,overrideAccess:I,parentIndexPath:R,parentIsLocalized:B,parentPath:Q,parentSchemaPath:F,req:S,siblingData:k,siblingDoc:T,siblingDocWithLocales:N,skipValidation:q});break;case"group":{let t=k,i=T,r=N,o=(0,a.fieldAffectsData)(m);o&&("object"!=typeof k[m.name]&&(k[m.name]={}),"object"!=typeof T[m.name]&&(T[m.name]={}),"object"!=typeof N[m.name]&&(N[m.name]={}),"object"!=typeof k[m.name]&&(k[m.name]={}),"object"!=typeof T[m.name]&&(T[m.name]={}),"object"!=typeof N[m.name]&&(N[m.name]={}),t=k[m.name],i=T[m.name],r=N[m.name]);let l=m?.label||(o?m.name:m?.type);await u({id:e,blockData:n,collection:d,context:h,data:A,doc:p,docWithLocales:f,errors:g,fieldLabelPath:m?.label===!1?b:c(b,s(l,S.i18n)),fields:m.fields,global:E,mergeLocaleActions:C,operation:w,overrideAccess:I,parentIndexPath:o?"":R,parentIsLocalized:B||m.localized,parentPath:o?L:Q,parentSchemaPath:F,req:S,siblingData:t,siblingDoc:i,siblingDocWithLocales:r,skipValidation:q});break}case"point":Array.isArray(k[m.name])&&null!==k[m.name][0]&&null!==k[m.name][1]&&(k[m.name]={type:"Point",coordinates:[parseFloat(k[m.name][0]),parseFloat(k[m.name][1])]});break;case"richText":{if(!m?.editor)throw new t.MissingEditorProp(m);if("function"==typeof m?.editor)throw Error("Attempted to access unsanitized rich text editor.");let e=m?.editor;if(e?.hooks?.beforeChange?.length)for(let t of e.hooks.beforeChange){let e=await t({collection:d,context:h,data:A,docWithLocales:f,errors:g,field:m,fieldLabelPath:m?.label===!1?b:c(b,s(m?.label||m?.name,S.i18n)),global:E,indexPath:j,mergeLocaleActions:C,operation:w,originalDoc:p,overrideAccess:I,parentIsLocalized:B,path:P,previousSiblingDoc:T,previousValue:T[m.name],req:S,schemaPath:$,siblingData:k,siblingDocWithLocales:N,skipValidation:_,value:k[m.name]});void 0!==e&&(k[m.name]=e)}break}case"tab":{let t=k,i=T,r=N,o=(0,a.tabHasName)(m);o&&("object"!=typeof k[m.name]&&(k[m.name]={}),"object"!=typeof T[m.name]&&(T[m.name]={}),"object"!=typeof N[m.name]&&(N[m.name]={}),t=k[m.name],i=T[m.name],r=N[m.name]),await u({id:e,blockData:n,collection:d,context:h,data:A,doc:p,docWithLocales:f,errors:g,fieldLabelPath:m?.label===!1?b:c(b,s(m?.label||m.name,S.i18n)),fields:m.fields,global:E,mergeLocaleActions:C,operation:w,overrideAccess:I,parentIndexPath:o?"":R,parentIsLocalized:B||m.localized,parentPath:o?L:Q,parentSchemaPath:F,req:S,siblingData:t,siblingDoc:i,siblingDocWithLocales:r,skipValidation:q});break}case"tabs":await u({id:e,blockData:n,collection:d,context:h,data:A,doc:p,docWithLocales:f,errors:g,fieldLabelPath:m?.label===!1?b:c(b,s(m?.label||"",S.i18n)),fields:m.tabs.map(e=>({...e,type:"tab"})),global:E,mergeLocaleActions:C,operation:w,overrideAccess:I,parentIndexPath:R,parentIsLocalized:B,parentPath:L,parentSchemaPath:F,req:S,siblingData:k,siblingDoc:T,siblingDocWithLocales:N,skipValidation:q})}},u=async({id:e,blockData:t,collection:i,context:r,data:n,doc:s,docWithLocales:a,errors:o,fieldLabelPath:l,fields:c,global:u,mergeLocaleActions:h,operation:A,overrideAccess:p,parentIndexPath:f,parentIsLocalized:g,parentPath:m,parentSchemaPath:y,req:b,siblingData:E,siblingDoc:C,siblingDocWithLocales:w,skipValidation:I})=>{let v=[];c.forEach((B,Q)=>{v.push(d({id:e,blockData:t,collection:i,context:r,data:n,doc:s,docWithLocales:a,errors:o,field:B,fieldIndex:Q,fieldLabelPath:l,global:u,mergeLocaleActions:h,operation:A,overrideAccess:p,parentIndexPath:f,parentIsLocalized:g,parentPath:m,parentSchemaPath:y,req:b,siblingData:E,siblingDoc:C,siblingDocWithLocales:w,siblingFields:c,skipValidation:I}))}),await Promise.all(v)};e.s(["traverseFields",()=>b],494663);var h=t,A=a,p=o,f=e.i(744237);let g=e=>Array.isArray(e)?e.map(e=>"object"==typeof e&&null!=e?{...e}:e):"object"==typeof e&&null!==e?{...e}:e;async function m({field:e,req:t,siblingDoc:i}){let r;return"name"in e&&e.name&&(void 0!==i[e.name]?r=g(i[e.name]):"defaultValue"in e&&void 0!==e.defaultValue&&(r=await (0,f.getDefaultValue)({defaultValue:e.defaultValue,locale:t.locale||"",req:t,user:t.user}))),r}let y=async({id:e,blockData:t,collection:i,context:r,data:n,doc:s,field:a,fieldIndex:o,global:c,operation:d,overrideAccess:u,parentIndexPath:f,parentIsLocalized:g,parentPath:y,parentSchemaPath:E,req:C,siblingData:w,siblingDoc:I,siblingFields:v})=>{let{indexPath:B,path:Q,schemaPath:x}=(0,p.getFieldPaths)({field:a,index:o,parentIndexPath:f,parentPath:y,parentSchemaPath:E}),S=Q?Q.split("."):[],k=x?x.split("."):[],T=B?B.split("-").filter(Boolean)?.map(Number):[];if((0,A.fieldAffectsData)(a)){if("id"===a.name){if("number"===a.type&&"string"==typeof w[a.name]){let e=w[a.name];w[a.name]=parseFloat(e)}"text"===a.type&&"function"==typeof w[a.name]?.toString&&"string"!=typeof w[a.name]&&(w[a.name]=w[a.name].toString())}switch(a.type){case"array":case"blocks":("0"===w[a.name]||0===w[a.name])&&(w[a.name]=[]);break;case"checkbox":"true"===w[a.name]&&(w[a.name]=!0),"false"===w[a.name]&&(w[a.name]=!1),""===w[a.name]&&(w[a.name]=!1);break;case"number":if("string"==typeof w[a.name]){let e=w[a.name].trim();w[a.name]=0===e.length?null:parseFloat(e)}break;case"point":Array.isArray(w[a.name])&&(w[a.name]=w[a.name].map((e,t)=>{if("string"==typeof e){let e=w[a.name][t].trim();return 0===e.length?null:parseFloat(e)}return e}));break;case"relationship":case"upload":{(""===w[a.name]||"none"===w[a.name]||"null"===w[a.name]||null===w[a.name])&&(!0===a.hasMany?w[a.name]=[]:w[a.name]=null);let e=w[a.name];if(Array.isArray(a.relationTo)){if(Array.isArray(e)&&e.forEach((e,t)=>{let i=C.payload.collections?.[e.relationTo]?.config;if("object"==typeof e.value&&e.value&&"id"in e.value&&(e.value=e.value.id),i?.fields){let r=i.fields.find(e=>(0,A.fieldAffectsData)(e)&&"id"===e.name);r?.type==="number"&&(w[a.name][t]={...e,value:parseFloat(e.value)})}}),!0!==a.hasMany&&(0,A.valueIsValueWithRelation)(e)){let t=C.payload.collections?.[e.relationTo]?.config;if("object"==typeof e.value&&e.value&&"id"in e.value&&(e.value=e.value.id),t?.fields){let i=t.fields.find(e=>(0,A.fieldAffectsData)(e)&&"id"===e.name);i?.type==="number"&&(w[a.name]={...e,value:parseFloat(e.value)})}}}else if(Array.isArray(e)&&e.forEach((t,i)=>{let r=Array.isArray(a.relationTo)?void 0:C.payload.collections?.[a.relationTo]?.config;if("object"==typeof t&&t&&"id"in t&&(e[i]=t.id),r?.fields){let e=r.fields.find(e=>(0,A.fieldAffectsData)(e)&&"id"===e.name);e?.type==="number"&&(w[a.name][i]=parseFloat(t))}}),!0!==a.hasMany&&e){let t=C.payload.collections?.[a.relationTo]?.config;if("object"==typeof e&&e&&"id"in e&&(w[a.name]=e.id),t?.fields){let i=t.fields.find(e=>(0,A.fieldAffectsData)(e)&&"id"===e.name);i?.type==="number"&&(w[a.name]=parseFloat(e))}}break}case"richText":if("string"==typeof w[a.name])try{let e=JSON.parse(w[a.name]);w[a.name]=e}catch{}}let o={executed:!1,value:void 0};if(void 0===w[a.name]&&(o.value=await m({field:a,req:C,siblingDoc:I}),o.executed=!0),"hooks"in a&&a.hooks?.beforeValidate)for(let e of a.hooks.beforeValidate){let l=await e({blockData:t,collection:i,context:r,data:n,field:a,global:c,indexPath:T,operation:d,originalDoc:s,overrideAccess:u,path:S,previousSiblingDoc:I,previousValue:I[a.name],req:C,schemaPath:k,siblingData:w,siblingFields:v,value:void 0===w[a.name]?o.value:w[a.name]});void 0!==l&&(w[a.name]=l)}a.access&&a.access[d]&&(u||await a.access[d]({id:e,blockData:t,data:n,doc:s,req:C,siblingData:w})||delete w[a.name]),void 0===w[a.name]&&(w[a.name]=o.executed?o.value:await m({field:a,req:C,siblingDoc:I}))}switch(a.type){case"array":{let o=w[a.name];if(Array.isArray(o)){let h=[];o.forEach((o,A)=>{h.push(b({id:e,blockData:t,collection:i,context:r,data:n,doc:s,fields:a.fields,global:c,operation:d,overrideAccess:u,parentIndexPath:"",parentIsLocalized:g||a.localized,parentPath:Q+"."+A,parentSchemaPath:x,req:C,siblingData:o,siblingDoc:l(o,I[a.name])}))}),await Promise.all(h)}break}case"blocks":{let t=w[a.name];if(Array.isArray(t)){let o=[];t.forEach((t,h)=>{let A=l(t,I[a.name]),p=t.blockType||A.blockType,f=C.payload.blocks[p]??(a.blockReferences??a.blocks).find(e=>"string"!=typeof e&&e.slug===p);f&&(t.blockType=p,o.push(b({id:e,blockData:t,collection:i,context:r,data:n,doc:s,fields:f.fields,global:c,operation:d,overrideAccess:u,parentIndexPath:"",parentIsLocalized:g||a.localized,parentPath:Q+"."+h,parentSchemaPath:x+"."+f.slug,req:C,siblingData:t,siblingDoc:A})))}),await Promise.all(o)}break}case"collapsible":case"row":await b({id:e,blockData:t,collection:i,context:r,data:n,doc:s,fields:a.fields,global:c,operation:d,overrideAccess:u,parentIndexPath:B,parentIsLocalized:g,parentPath:y,parentSchemaPath:x,req:C,siblingData:w,siblingDoc:I});break;case"group":{let o=w,l=I,h=(0,A.fieldAffectsData)(a);h&&("object"!=typeof w[a.name]&&(w[a.name]={}),"object"!=typeof I[a.name]&&(I[a.name]={}),o=w[a.name],l=I[a.name]),await b({id:e,blockData:t,collection:i,context:r,data:n,doc:s,fields:a.fields,global:c,operation:d,overrideAccess:u,parentIndexPath:h?"":B,parentIsLocalized:g||a.localized,parentPath:h?Q:y,parentSchemaPath:x,req:C,siblingData:o,siblingDoc:l});break}case"richText":{if(!a?.editor)throw new h.MissingEditorProp(a);if("function"==typeof a?.editor)throw Error("Attempted to access unsanitized rich text editor.");let e=a?.editor;if(e?.hooks?.beforeValidate?.length)for(let t of e.hooks.beforeValidate){let e=await t({collection:i,context:r,data:n,field:a,global:c,indexPath:T,operation:d,originalDoc:s,overrideAccess:u,parentIsLocalized:g,path:S,previousSiblingDoc:I,previousValue:w[a.name],req:C,schemaPath:k,siblingData:w,value:w[a.name]});void 0!==e&&(w[a.name]=e)}break}case"tab":{let o,l,h=(0,A.tabHasName)(a);h?("object"!=typeof w[a.name]&&(w[a.name]={}),"object"!=typeof I[a.name]&&(I[a.name]={}),o=w[a.name],l=I[a.name]):(o=w,l=I),await b({id:e,blockData:t,collection:i,context:r,data:n,doc:s,fields:a.fields,global:c,operation:d,overrideAccess:u,parentIndexPath:h?"":B,parentIsLocalized:g||a.localized,parentPath:h?Q:y,parentSchemaPath:x,req:C,siblingData:o,siblingDoc:l});break}case"tabs":await b({id:e,blockData:t,collection:i,context:r,data:n,doc:s,fields:a.tabs.map(e=>({...e,type:"tab"})),global:c,operation:d,overrideAccess:u,parentIndexPath:B,parentIsLocalized:g,parentPath:Q,parentSchemaPath:x,req:C,siblingData:w,siblingDoc:I})}},b=async({id:e,blockData:t,collection:i,context:r,data:n,doc:s,fields:a,global:o,operation:l,overrideAccess:c,parentIndexPath:d,parentIsLocalized:u,parentPath:h,parentSchemaPath:A,req:p,siblingData:f,siblingDoc:g})=>{let m=[];a.forEach((b,E)=>{m.push(y({id:e,blockData:t,collection:i,context:r,data:n,doc:s,field:b,fieldIndex:E,global:o,operation:l,overrideAccess:c,parentIndexPath:d,parentIsLocalized:u,parentPath:h,parentSchemaPath:A,req:p,siblingData:f,siblingDoc:g,siblingFields:a}))}),await Promise.all(m)}},833131,(e,t,i)=>{"use strict";function r(e){return e>=55296&&e<=56319}function n(e){return e>=56320&&e<=57343}t.exports=function(e,t,i){if("string"!=typeof t)throw Error("Input must be string");for(var s,a,o=t.length,l=0,c=0;ci)return t.slice(0,c-a.length+1)}return t}},881816,(e,t,i)=>{"use strict";var r=e.r(833131),n=Buffer.byteLength.bind(Buffer);t.exports=r.bind(null,n)},370167,(e,t,i)=>{"use strict";var r=e.r(881816),n=/[\/\?<>\\:\*\|"]/g,s=/[\x00-\x1f\x80-\x9f]/g,a=/^\.+$/,o=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,l=/[\. ]+$/;function c(e,t){if("string"!=typeof e)throw Error("Input must be string");return r(e.replace(n,t).replace(s,t).replace(a,t).replace(o,t).replace(l,t),255)}t.exports=function(e,t){var i=t&&t.replacement||"",r=c(e,i);return""===i?r:c(r,"")}},453028,464639,743699,371031,749591,117429,212329,148968,830263,999733,999676,7244,994674,71457,e=>{"use strict";var t=e.i(839875),i=e.i(541046);async function r(e){let{collection:{config:r},config:n,disableEmail:s,email:a,req:o,token:l,user:c}=e;if(!s){let e=(0,i.getRequestOrigin)({config:n,req:o}),s=(0,t.formatAdminURL)({adminRoute:n.routes.admin,path:`/${r.slug}/verify/${l}`,serverURL:e}),d=`${o.t("authentication:newAccountCreated",{serverURL:n.serverURL,verificationURL:s})}`,u=r.auth.verify;"function"==typeof u.generateEmailHTML&&(d=await u.generateEmailHTML({req:o,token:l,user:c}));let h=o.t("authentication:verifyYourEmail");"function"==typeof u.generateEmailSubject&&(h=await u.generateEmailSubject({req:o,token:l,user:c})),await a.sendEmail({from:`"${a.defaultFromName}" <${a.defaultFromAddress}>`,html:d,subject:h,to:c.email})}}e.s(["sendVerificationEmail",()=>r],453028);var n=e.i(546712),s=e.i(427510),a=e.i(911908);let o=async({collection:e,doc:t,password:i,payload:r,req:o})=>{let l,c=e?.auth?.loginWithUsername,{canLoginWithEmail:d,canLoginWithUsername:u}=(0,s.getLoginOptions)(c);if(u?(l={or:[]},d&&t.email&&l.or?.push({email:{equals:t.email}}),t.username&&l.or?.push({username:{equals:t.username}})):l={email:{equals:t.email}},(await r.find({collection:e.slug,depth:0,limit:1,pagination:!1,req:o,where:l})).docs.length>0)throw new n.ValidationError({collection:e.slug,errors:[u?{message:o.t("error:usernameAlreadyRegistered"),path:"username"}:{message:o.t("error:userEmailAlreadyRegistered"),path:"email"}]});let{hash:h,salt:A}=await (0,a.generatePasswordSaltHash)({collection:e,password:i,req:o}),p={...t};return p.password&&delete p.password,r.db.create({collection:e.slug,data:{...p,hash:h,salt:A},req:o})};e.s(["registerLocalStrategy",0,o],464639);var l=e.i(42625),c=e.i(144832),d=e.i(617997),u=e.i(295694),h=e.i(195884);e.i(10188);var A=e.i(785867),p=e.i(700859);class f extends p.APIError{constructor(e){super(e?e("general:notFound"):h.en.translations.general.notFound,A.status.NOT_FOUND)}}e.s(["NotFound",()=>f],743699);var g=e.i(488889),m=e.i(186725),y=e.i(951020);let b=async({id:e,blockData:t,collection:i,context:r,doc:n,field:s,fieldIndex:a,overrideAccess:o,parentIndexPath:l,parentIsLocalized:c,parentPath:d,parentSchemaPath:u,req:h,siblingDoc:A,siblingFields:p})=>{let{indexPath:f,path:g,schemaPath:b}=(0,y.getFieldPaths)({field:s,index:a,parentIndexPath:l,parentPath:d,parentSchemaPath:u}),{localization:C}=h.payload.config,w=g?g.split("."):[],I=b?b.split("."):[],v=f?f.split("-").filter(Boolean)?.map(Number):[];if((0,m.fieldAffectsData)(s)){let a=A?.[s.name],l=C&&(0,m.fieldShouldBeLocalized)({field:s,parentIsLocalized:c});if(Array.isArray("hooks"in s&&s.hooks?.beforeDuplicate))if(l){let e={};for(let a of C.localeCodes){let o,l={blockData:t,collection:i,context:r,data:n,field:s,global:void 0,indexPath:v,path:w,previousSiblingDoc:A,previousValue:A[s.name]?.[a],req:h,schemaPath:I,siblingData:A,siblingDocWithLocales:A,siblingFields:p,value:A[s.name]?.[a]};if("hooks"in s&&s.hooks?.beforeDuplicate)for(let e of s.hooks.beforeDuplicate)o=await e(l);void 0!==o&&(e[a]=o)}A[s.name]=e}else{let e,a={blockData:t,collection:i,context:r,data:n,field:s,global:void 0,indexPath:v,path:w,previousSiblingDoc:A,previousValue:A[s.name],req:h,schemaPath:I,siblingData:A,siblingDocWithLocales:A,siblingFields:p,value:A[s.name]};if("hooks"in s&&s.hooks?.beforeDuplicate)for(let t of s.hooks.beforeDuplicate)e=await t(a);void 0!==e&&(A[s.name]=e)}if(l){("object"!=typeof a||null===a)&&(A[s.name]={},a=A[s.name]);let l=[];C.localeCodes.forEach(d=>{if(a[d])switch(s.type){case"array":{let l=a[d];if(Array.isArray(l)){let a=[];l.forEach((l,d)=>{a.push(E({id:e,blockData:t,collection:i,context:r,doc:n,fields:s.fields,overrideAccess:o,parentIndexPath:"",parentIsLocalized:c||s.localized,parentPath:g+"."+d,parentSchemaPath:b,req:h,siblingDoc:l}))})}break}case"blocks":{let t=a[d];if(Array.isArray(t)){let a=[];t.forEach((t,l)=>{let d=t.blockType,u=h.payload.blocks[d]??(s.blockReferences??s.blocks).find(e=>"string"!=typeof e&&e.slug===d);a.push(E({id:e,blockData:t,collection:i,context:r,doc:n,fields:u.fields,overrideAccess:o,parentIndexPath:"",parentIsLocalized:c||s.localized,parentPath:g+"."+l,parentSchemaPath:b+"."+u.slug,req:h,siblingDoc:t}))})}break}case"group":case"tab":l.push(E({id:e,blockData:t,collection:i,context:r,doc:n,fields:s.fields,overrideAccess:o,parentIndexPath:"",parentIsLocalized:c||s.localized,parentPath:g,parentSchemaPath:b,req:h,siblingDoc:a[d]}))}}),await Promise.all(l)}else switch(s.type){case"array":{let a=A[s.name];if(Array.isArray(a)){let l=[];a.forEach((a,d)=>{l.push(E({id:e,blockData:t,collection:i,context:r,doc:n,fields:s.fields,overrideAccess:o,parentIndexPath:"",parentIsLocalized:c||s.localized,parentPath:g+"."+d,parentSchemaPath:b,req:h,siblingDoc:a}))}),await Promise.all(l)}break}case"blocks":{let t=A[s.name];if(Array.isArray(t)){let a=[];t.forEach((t,l)=>{let d=t.blockType,u=h.payload.blocks[d]??(s.blockReferences??s.blocks).find(e=>"string"!=typeof e&&e.slug===d);u&&(t.blockType=d,a.push(E({id:e,blockData:t,collection:i,context:r,doc:n,fields:u.fields,overrideAccess:o,parentIndexPath:"",parentIsLocalized:c||s.localized,parentPath:g+"."+l,parentSchemaPath:b+"."+u.slug,req:h,siblingDoc:t})))}),await Promise.all(a)}break}case"group":{"object"!=typeof A[s.name]&&(A[s.name]={});let a=A[s.name];await E({id:e,blockData:t,collection:i,context:r,doc:n,fields:s.fields,overrideAccess:o,parentIndexPath:"",parentIsLocalized:c||s.localized,parentPath:g,parentSchemaPath:b,req:h,siblingDoc:a});break}case"tab":{"object"!=typeof A[s.name]&&(A[s.name]={});let a=A[s.name];await E({id:e,blockData:t,collection:i,context:r,doc:n,fields:s.fields,overrideAccess:o,parentIndexPath:"",parentIsLocalized:c||s.localized,parentPath:g,parentSchemaPath:b,req:h,siblingDoc:a})}}}else switch(s.type){case"collapsible":case"group":case"row":case"tab":await E({id:e,blockData:t,collection:i,context:r,doc:n,fields:s.fields,overrideAccess:o,parentIndexPath:f,parentIsLocalized:c,parentPath:d,parentSchemaPath:b,req:h,siblingDoc:A});break;case"tabs":await E({id:e,blockData:t,collection:i,context:r,doc:n,fields:s.tabs.map(e=>({...e,type:"tab"})),overrideAccess:o,parentIndexPath:f,parentIsLocalized:c,parentPath:g,parentSchemaPath:b,req:h,siblingDoc:A})}},E=async({id:e,blockData:t,collection:i,context:r,doc:n,fields:s,overrideAccess:a,parentIndexPath:o,parentIsLocalized:l,parentPath:c,parentSchemaPath:d,req:u,siblingDoc:h})=>{let A=[];s.forEach((p,f)=>{A.push(b({id:e,blockData:t,collection:i,context:r,doc:n,field:p,fieldIndex:f,overrideAccess:a,parentIndexPath:o,parentIsLocalized:l,parentPath:c,parentSchemaPath:d,req:u,siblingDoc:h,siblingFields:s}))}),await Promise.all(A)},C=async({id:e,collection:t,context:i,doc:r,overrideAccess:n,req:s})=>(await E({id:e,collection:t,context:i,doc:r,fields:t.fields,overrideAccess:n,parentIndexPath:"",parentIsLocalized:!1,parentPath:"",parentSchemaPath:"",req:s,siblingDoc:r}),r);var w=e.i(7651),I=m;function v({configBlockReferences:e,docWithLocales:t,fields:i,parentIsLocalized:r=!1,selectedLocales:n}){if(!t||"object"!=typeof t)return t;let s={};for(let a of i)if((0,I.fieldAffectsData)(a)){let i=(0,I.fieldShouldBeLocalized)({field:a,parentIsLocalized:r});switch(a.type){case"array":Array.isArray(t[a.name])&&(s[a.name]=t[a.name].map(t=>v({configBlockReferences:e,docWithLocales:t,fields:a.fields,parentIsLocalized:i,selectedLocales:n})));break;case"blocks":a.name in t&&Array.isArray(t[a.name])&&(s[a.name]=t[a.name].map(t=>{let r;if(e&&a.blockReferences)for(let i of a.blockReferences)r="string"==typeof i?e.find(e=>e.slug===t.blockType):i;else a.blocks&&(r=a.blocks.find(e=>e.slug===t.blockType));if(r){let s=v({configBlockReferences:e,docWithLocales:t,fields:r?.fields||[],parentIsLocalized:i,selectedLocales:n});return s.blockType=t.blockType,s.id=t.id,s.blockName=t.blockName,s}return t}));break;case"group":(0,I.fieldAffectsData)(a)&&a.name in t&&"object"==typeof t[a.name]?s[a.name]=v({configBlockReferences:e,docWithLocales:t[a.name],fields:a.fields,parentIsLocalized:i,selectedLocales:n}):Object.assign(s,v({configBlockReferences:e,docWithLocales:t,fields:a.fields,parentIsLocalized:r,selectedLocales:n}));break;default:if(a.name in t){let e=t[a.name];if(i&&e&&"object"==typeof e&&!Array.isArray(e))if(n&&n.length>0){let t={};for(let i of n)i in e&&(t[i]=e[i]);Object.keys(t).length>0&&(s[a.name]=t)}else s[a.name]=e;else s[a.name]=e}}}else switch(a.type){case"collapsible":case"row":Object.assign(s,v({configBlockReferences:e,docWithLocales:t,fields:a.fields,parentIsLocalized:r,selectedLocales:n}));break;case"tabs":for(let i of a.tabs)(0,I.tabHasName)(i)?i.name in t&&"object"==typeof t[i.name]&&(s[i.name]=v({configBlockReferences:e,docWithLocales:t[i.name],fields:i.fields,parentIsLocalized:r,selectedLocales:n})):Object.assign(s,v({configBlockReferences:e,docWithLocales:t,fields:i.fields,parentIsLocalized:r,selectedLocales:n}))}return s}var B=d,Q=e.i(974605),x=e.i(212827);let S=async({id:e,config:t,payload:i,published:r,query:n,req:s})=>{let a,o=r?{and:[{parent:{equals:e}},{"version._status":{equals:"published"}}]}:{and:[{parent:{equals:e}},{latest:{equals:!0}}]};if((0,Q.hasDraftsEnabled)(t)){let{docs:e}=await i.db.findVersions({collection:t.slug,limit:1,locale:s?.locale||n.locale,pagination:!1,req:s,sort:"-updatedAt",where:(0,B.combineQueries)((0,x.appendVersionToQueryKey)(n.where),o)});a=e[0]}return a?(a.version.id=e,a.version):r?void 0:await i.db.findOne({...n,req:s})??void 0};e.s(["getLatestCollectionVersion",0,S],371031);let k=async({id:e,collectionConfig:t,draftArg:i,overrideAccess:r,req:n,selectedLocales:s})=>{let{payload:a}=n,o=!!r||await (0,l.executeAccess)({id:e,req:n},t.access.read),h=(0,c.hasWhereAccessResult)(o),A={collection:t.slug,locale:n.locale,req:n,where:(0,d.combineQueries)({id:{equals:e}},o)},p=await S({id:e,config:t,payload:a,query:A,req:n});if(s&&s.length>0&&p&&(p=v({configBlockReferences:a.config.blocks,docWithLocales:p,fields:t.fields,selectedLocales:s})),!p&&!h)throw new f(n.t);if(!p&&h)throw new u.Forbidden(n.t);return"createdAt"in p&&delete p.createdAt,"id"in p&&delete p.id,p=await C({id:e,collection:t,context:n.context,doc:p,overrideAccess:r,req:n}),{duplicatedFromDoc:await (0,g.afterRead)({collection:t,context:n.context,depth:0,doc:(0,w.deepCopyObjectSimple)(p),draft:i,fallbackLocale:null,global:null,locale:n.locale,overrideAccess:!0,req:n,showHiddenFields:!0}),duplicatedFromDocWithLocales:p}};e.s(["getDuplicateDocumentData",0,k],749591);var T=e.i(747016);let N=async({collection:e,context:t,data:i,doc:r,global:n,operation:s,previousDoc:a,req:o})=>(await (0,T.traverseFields)({collection:e,context:t,data:i,doc:r,fields:e?.fields||n?.fields,global:n,operation:s,parentIndexPath:"",parentIsLocalized:!1,parentPath:"",parentSchemaPath:"",previousDoc:a,previousSiblingDoc:a,req:o,siblingData:i,siblingDoc:r}),r);e.s(["afterChange",0,N],117429);var D=n,_=w,R=e.i(875798);let L=async({id:e,collection:t,context:i,data:r,doc:n,docWithLocales:s,global:a,operation:o,overrideAccess:l,req:c,skipValidation:d})=>{let u=(0,_.deepCopyObjectSimple)(r),h=[],A=[];if(await (0,R.traverseFields)({id:e,collection:t,context:i,data:u,doc:n,docWithLocales:s,errors:A,fieldLabelPath:"",fields:t?.fields||a?.fields,global:a,mergeLocaleActions:h,operation:o,overrideAccess:l,parentIndexPath:"",parentIsLocalized:!1,parentPath:"",parentSchemaPath:"",req:c,siblingData:u,siblingDoc:n,siblingDocWithLocales:s,skipValidation:d}),A.length>0)throw new D.ValidationError({id:e,collection:t?.slug,errors:A,global:a?.slug,req:c},c.t);for(let e of h)await e();return u};e.s(["beforeChange",0,L],212329);var F=e.i(494663);let M=async({id:e,collection:t,context:i,data:r,doc:n,global:s,operation:a,overrideAccess:o,req:l})=>(await (0,F.traverseFields)({id:e,collection:t,context:i,data:r,doc:n,fields:t?.fields||s?.fields,global:s,operation:a,overrideAccess:o,parentIndexPath:"",parentIsLocalized:!1,parentPath:"",parentSchemaPath:"",req:l,siblingData:r,siblingDoc:n}),r);e.s(["beforeValidate",0,M],148968);var O=w,U=Q,P=e.i(9051),$=e.i(553095);let j=({select:e})=>e?"include"===(0,$.getSelectMode)(e)?{parent:!0,version:e}:{version:e}:void 0;e.s(["getQueryDraftsSelect",0,j],830263);let H=async({id:e,collection:t,global:i,max:r,payload:n,req:s})=>{let a=t?"collection":"global",o=t?t.slug:i?.slug;try{let a,l={};if(t){l.parent={equals:e};let i=await n.db.findVersions({collection:t.slug,limit:1,page:r+1,pagination:!1,req:s,sort:"-updatedAt",where:l});[a]=i.docs}else if(i){let e=await n.db.findGlobalVersions({global:i.slug,limit:1,page:r+1,pagination:!1,req:s,sort:"-updatedAt",where:l});[a]=e.docs}if(a?.updatedAt){let r={updatedAt:{less_than_equal:a.updatedAt}};t&&(r.parent={equals:e});let l={req:s,where:r};i?l.globalSlug=o:l.collection=o,await n.db.deleteVersions(l)}}catch(e){n.logger.error(e),n.logger.error(`There was an error cleaning up old versions for the ${a} ${o}`)}};var q=w;let z=async({id:e,autosave:t,collection:i,data:r,global:n,payload:s,publishSpecificLocale:a,req:o,select:l})=>{let c=(0,q.deepCopyObjectSimple)(r||{});c._id&&delete c._id;let d=new Date().toISOString(),u={autosave:!!t,createdAt:d,publishedLocale:a||void 0,req:o,returning:!1,select:j({select:l}),updatedAt:d,versionData:c};return i&&e?s.db.createVersion({...u,collectionSlug:i.slug,parent:e,snapshot:!0}):n?s.db.createGlobalVersion({...u,globalSlug:n.slug,snapshot:!0}):void 0};async function V({id:e,collection:t,global:i,now:r,payload:n,req:s,shouldUpdate:a=()=>!0,versionData:o}){let l,c={limit:1,pagination:!1,req:s,sort:"-updatedAt"};t?{docs:l}=await n.db.findVersions({...c,collection:t.slug,where:{parent:{equals:e}}}):{docs:l}=await n.db.findGlobalVersions({...c,global:i.slug});let[d]=l;if(!d||!a(d))return;let u={id:d.id,req:s,versionData:{createdAt:new Date(d.createdAt).toISOString(),latest:!0,parent:e,updatedAt:r,version:{...o}}};return t?await n.db.updateVersion({...u,collection:t.slug,req:s}):await n.db.updateGlobalVersion({...u,global:i.slug,req:s})}async function G({id:e,autosave:t,collection:i,docWithLocales:r,draft:n,global:s,operation:a,payload:o,publishSpecificLocale:l,req:c,returning:d,select:u,snapshot:h,unpublish:A}){let p,f=!1,g=new Date().toISOString(),m=(0,O.deepCopyObjectSimple)(r);(i?.timestamps||s)&&n&&(m.updatedAt=g),m._id&&delete m._id;try{if((A||t)&&(p=await V({id:e,collection:i,global:s,now:g,payload:o,req:c,shouldUpdate:t?e=>"autosave"in e&&!0===e.autosave:void 0,versionData:m})),!p){f=!0;let r={autosave:!!t,collectionSlug:void 0,createdAt:"restoreVersion"===a?m.createdAt:g,globalSlug:void 0,parent:i?e:void 0,publishedLocale:l||void 0,req:c,returning:d,select:j({select:u}),updatedAt:g,versionData:m};i&&(r.collectionSlug=i.slug,p=await o.db.createVersion(r)),s&&(r.globalSlug=s.slug,p=await o.db.createGlobalVersion(r)),h&&await z({id:e,autosave:t,collection:i,data:h,global:s,payload:o,publishSpecificLocale:l,req:c,select:u})}}catch(r){let t;i&&(t=`There was an error while saving a version for the ${"string"==typeof i.labels.singular?i.labels.singular:i.slug} with ID ${e}.`),s&&(t=`There was an error while saving a version for the global ${"string"==typeof s.label?s.label:s.slug}.`),o.logger.error({err:r,msg:t});return}let y=(0,U.getVersionsMax)(i||s);if(f&&y>0&&await H({id:e,collection:i,global:s,max:y,payload:o,req:c}),!1===d)return null;let b=p.version;return(b=(0,P.sanitizeInternalFields)(b)).id=p.parent,b}e.s(["saveVersion",()=>G],999733);var Y=A,W=p;class J extends W.APIError{constructor(e,t){let i=e?e("error:problemUploadingFile"):"There was a problem while retrieving the file.";t&&(i+=` ${t}`),super(i,Y.status.INTERNAL_SERVER_ERROR)}}e.s(["FileRetrievalError",()=>J],999676);var K=h,Z=A,X=p;class ee extends X.APIError{constructor(e){super(e?e("error:problemUploadingFile"):K.en.translations.error.problemUploadingFile,Z.status.BAD_REQUEST)}}e.s(["FileUploadError",()=>ee],7244);var et=h,ei=A,er=p;class en extends er.APIError{constructor(e){super(e?e("error:noFilesUploaded"):et.en.translations.error.noFilesUploaded,ei.status.BAD_REQUEST)}}function es(e){return["image/jpeg","image/png","image/gif","image/webp","image/tiff","image/avif"].indexOf(e)>-1}e.s(["MissingFile",()=>en],994674),e.s(["canResizeImage",()=>es],71457)},420186,143706,e=>{"use strict";function t(e){if(!e.subarray(0,8).toString("latin1").startsWith("%PDF-"))return!1;let t=Math.min(1024,e.length),i=e.subarray(e.length-t).toString("latin1");return!!i.includes("%%EOF")&&!!i.includes("xref")}function i(e){try{let t=2048,i=e.toString("utf8",0,Math.min(e.length,t)),r=i.match(/^<\?xml[^>]*encoding=["']([^"']+)["']/i),n=r?.[1]?.toLowerCase();if(n&&!["ascii","utf-8","utf8"].includes(n))return!1;let s=i.replace(/<\?xml[^>]*\?>/gi,"").replace(//g,"").replace(/<\?[^>]*\?>/g,"").trim().match(/^<(\w+)(?:\s|>)/);if(!s||"svg"!==s[1]||!/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/.test(i)||!i.match(/