diff --git a/README.md b/README.md index 9bf44aa..11568f4 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,20 @@ Add this action after your AI agent step to: The action **never fails your workflow** — all API calls and comment posts use `core.warning()` for errors, not `core.setFailed()`. +
+
+
AgentMeter posts a cost summary directly on the PR.
+
+
+
+
+
+ Full token breakdown per run · All runs in one dashboard +
+ --- ## Quickstart @@ -281,7 +295,7 @@ Replace `$INPUT_TOKENS` etc. with however your agent exposes token counts (step | `api_key` | ✅ | — | Your AgentMeter API key (`am_sk_…`). Get it from [agentmeter.app/dashboard/settings](https://agentmeter.app/dashboard/settings). | | `model` | ❌ | `''` | The AI model used (e.g. `claude-sonnet-4-5`). Used for per-token cost display. | | `engine` | ❌ | `claude` | The AI engine (`claude`, `codex`). | -| `status` | ❌ | `success` | Run status: `success`, `failed`, `timed_out`, `cancelled`, `needs_human`. | +| `status` | ❌ | `success` | Run outcome. In companion `workflow_run` mode this is resolved automatically from the triggering workflow's conclusion. In inline mode pass `${{ steps.agent.outcome }}` or a custom value like `needs_human`. See [docs/status-values.md](docs/status-values.md). | | `agent_output` | ❌ | `''` | Raw stdout from the agent step. Used to auto-extract token counts from JSON. | | `input_tokens` | ❌ | `''` | Explicit input token count. Overrides extraction from `agent_output`. | | `output_tokens` | ❌ | `''` | Explicit output token count. | diff --git a/__tests__/comment.test.ts b/__tests__/comment.test.ts index 7ae2680..492981d 100644 --- a/__tests__/comment.test.ts +++ b/__tests__/comment.test.ts @@ -163,6 +163,43 @@ describe('buildCommentBody', () => { expect(body).toContain('approximate'); }); + it('calculates cache hit rate using reads / (reads + writes + input)', () => { + const body = buildCommentBody({ + apiPricing: testPricing, + existingBody: null, + runData: { + ...baseRun, + tokens: { + inputTokens: 50, + outputTokens: 2172, + cacheWriteTokens: 55569, + cacheReadTokens: 124794, + isApproximate: false, + }, + }, + }); + // 124794 / (50 + 55569 + 124794) = 124794 / 180413 ≈ 69% + expect(body).toContain('69% cache hit rate'); + }); + + it('does not show cache hit rate when cacheReadTokens is 0', () => { + const body = buildCommentBody({ + apiPricing: testPricing, + existingBody: null, + runData: { + ...baseRun, + tokens: { + inputTokens: 1000, + outputTokens: 500, + cacheWriteTokens: 0, + cacheReadTokens: 0, + isApproximate: false, + }, + }, + }); + expect(body).not.toContain('cache hit rate'); + }); + it('skips token details when tokens are not provided', () => { const body = buildCommentBody({ apiPricing: testPricing, diff --git a/action.yml b/action.yml index c715046..c321503 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,5 @@ name: 'AgentMeter' description: 'Track token usage and cost for AI agent runs in GitHub Actions' -author: 'Foo.software' branding: icon: 'zap' color: 'green' diff --git a/dist/index.js b/dist/index.js index 7670ad4..fefa4e2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ -(()=>{var e={9144:function(e,A,t){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,A,t,r){if(r===undefined)r=t;var s=Object.getOwnPropertyDescriptor(A,t);if(!s||("get"in s?!A.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return A[t]}}}Object.defineProperty(e,r,s)}:function(e,A,t,r){if(r===undefined)r=t;e[r]=A[t]});var s=this&&this.__setModuleDefault||(Object.create?function(e,A){Object.defineProperty(e,"default",{enumerable:true,value:A})}:function(e,A){e["default"]=A});var o=this&&this.__importStar||function(){var ownKeys=function(e){ownKeys=Object.getOwnPropertyNames||function(e){var A=[];for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))A[A.length]=t;return A};return ownKeys(e)};return function(e){if(e&&e.__esModule)return e;var A={};if(e!=null)for(var t=ownKeys(e),o=0;o0){setTimeout((()=>{handleReply(this[s])}),l)}else{handleReply(this[s])}function handleReply(r,s=n){const c=Array.isArray(e.headers)?buildHeadersFromArray(e.headers):e.headers;const l=typeof s==="function"?s({...e,headers:c}):s;if(E(l)){l.then((e=>handleReply(r,e)));return}const u=getResponseData(l);const h=generateKeyValues(i);const Q=generateKeyValues(a);A.abort=g;A.onHeaders(o,h,resume,getStatusText(o));A.onData(Buffer.from(u));A.onComplete(Q);deleteMockDispatch(r,t)}function resume(){}return true}function buildMockDispatch(){const e=this[o];const A=this[i];const t=this[n];return function dispatch(s,o){if(e.isMockActive){try{mockDispatch.call(this,s,o)}catch(n){if(n instanceof r){const i=e[a]();if(i===false){throw new r(`${n.message}: subsequent request to origin ${A} was not allowed (net.connect disabled)`)}if(checkNetConnect(i,A)){t.call(this,s,o)}else{throw new r(`${n.message}: subsequent request to origin ${A} was not allowed (net.connect is not enabled for this origin)`)}}else{throw n}}}else{t.call(this,s,o)}}}function checkNetConnect(e,A){const t=new URL(A);if(e===true){return true}else if(Array.isArray(e)&&e.some((e=>matchValue(e,t.host)))){return true}return false}function buildMockOptions(e){if(e){const{agent:A,...t}=e;return t}}e.exports={getResponseData:getResponseData,getMockDispatch:getMockDispatch,addMockDispatch:addMockDispatch,deleteMockDispatch:deleteMockDispatch,buildKey:buildKey,generateKeyValues:generateKeyValues,matchValue:matchValue,getResponse:getResponse,getStatusText:getStatusText,mockDispatch:mockDispatch,buildMockDispatch:buildMockDispatch,checkNetConnect:checkNetConnect,buildMockOptions:buildMockOptions,getHeaderByName:getHeaderByName}},6142:(e,A,t)=>{"use strict";const{Transform:r}=t(2203);const{Console:s}=t(4236);e.exports=class PendingInterceptorsFormatter{constructor({disableColors:e}={}){this.transform=new r({transform(e,A,t){t(null,e)}});this.logger=new s({stdout:this.transform,inspectOptions:{colors:!e&&!process.env.CI}})}format(e){const A=e.map((({method:e,path:A,data:{statusCode:t},persist:r,times:s,timesInvoked:o,origin:n})=>({Method:e,Origin:n,Path:A,"Status code":t,Persistent:r?"✅":"❌",Invocations:o,Remaining:r?Infinity:s-o})));this.logger.table(A);return this.transform.read().toString()}}},1529:e=>{"use strict";const A={pronoun:"it",is:"is",was:"was",this:"this"};const t={pronoun:"they",is:"are",was:"were",this:"these"};e.exports=class Pluralizer{constructor(e,A){this.singular=e;this.plural=A}pluralize(e){const r=e===1;const s=r?A:t;const o=r?this.singular:this.plural;return{...s,count:e,noun:o}}}},4869:e=>{"use strict";const A=2048;const t=A-1;class FixedCircularBuffer{constructor(){this.bottom=0;this.top=0;this.list=new Array(A);this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&t)===this.bottom}push(e){this.list[this.top]=e;this.top=this.top+1&t}shift(){const e=this.list[this.bottom];if(e===undefined)return null;this.list[this.bottom]=undefined;this.bottom=this.bottom+1&t;return e}}e.exports=class FixedQueue{constructor(){this.head=this.tail=new FixedCircularBuffer}isEmpty(){return this.head.isEmpty()}push(e){if(this.head.isFull()){this.head=this.head.next=new FixedCircularBuffer}this.head.push(e)}shift(){const e=this.tail;const A=e.shift();if(e.isEmpty()&&e.next!==null){this.tail=e.next}return A}}},8640:(e,A,t)=>{"use strict";const r=t(1);const s=t(4869);const{kConnected:o,kSize:n,kRunning:i,kPending:a,kQueued:c,kBusy:g,kFree:l,kUrl:E,kClose:u,kDestroy:h,kDispatch:Q}=t(6443);const C=t(4622);const B=Symbol("clients");const d=Symbol("needDrain");const I=Symbol("queue");const p=Symbol("closed resolve");const m=Symbol("onDrain");const y=Symbol("onConnect");const b=Symbol("onDisconnect");const R=Symbol("onConnectionError");const k=Symbol("get dispatcher");const D=Symbol("add client");const S=Symbol("remove client");const F=Symbol("stats");class PoolBase extends r{constructor(){super();this[I]=new s;this[B]=[];this[c]=0;const e=this;this[m]=function onDrain(A,t){const r=e[I];let s=false;while(!s){const A=r.shift();if(!A){break}e[c]--;s=!this.dispatch(A.opts,A.handler)}this[d]=s;if(!this[d]&&e[d]){e[d]=false;e.emit("drain",A,[e,...t])}if(e[p]&&r.isEmpty()){Promise.all(e[B].map((e=>e.close()))).then(e[p])}};this[y]=(A,t)=>{e.emit("connect",A,[e,...t])};this[b]=(A,t,r)=>{e.emit("disconnect",A,[e,...t],r)};this[R]=(A,t,r)=>{e.emit("connectionError",A,[e,...t],r)};this[F]=new C(this)}get[g](){return this[d]}get[o](){return this[B].filter((e=>e[o])).length}get[l](){return this[B].filter((e=>e[o]&&!e[d])).length}get[a](){let e=this[c];for(const{[a]:A}of this[B]){e+=A}return e}get[i](){let e=0;for(const{[i]:A}of this[B]){e+=A}return e}get[n](){let e=this[c];for(const{[n]:A}of this[B]){e+=A}return e}get stats(){return this[F]}async[u](){if(this[I].isEmpty()){return Promise.all(this[B].map((e=>e.close())))}else{return new Promise((e=>{this[p]=e}))}}async[h](e){while(true){const A=this[I].shift();if(!A){break}A.handler.onError(e)}return Promise.all(this[B].map((A=>A.destroy(e))))}[Q](e,A){const t=this[k]();if(!t){this[d]=true;this[I].push({opts:e,handler:A});this[c]++}else if(!t.dispatch(e,A)){t[d]=true;this[d]=!this[k]()}return!this[d]}[D](e){e.on("drain",this[m]).on("connect",this[y]).on("disconnect",this[b]).on("connectionError",this[R]);this[B].push(e);if(this[d]){process.nextTick((()=>{if(this[d]){this[m](e[E],[this,e])}}))}return this}[S](e){e.close((()=>{const A=this[B].indexOf(e);if(A!==-1){this[B].splice(A,1)}}));this[d]=this[B].some((e=>!e[d]&&e.closed!==true&&e.destroyed!==true))}}e.exports={PoolBase:PoolBase,kClients:B,kNeedDrain:d,kAddClient:D,kRemoveClient:S,kGetDispatcher:k}},4622:(e,A,t)=>{const{kFree:r,kConnected:s,kPending:o,kQueued:n,kRunning:i,kSize:a}=t(6443);const c=Symbol("pool");class PoolStats{constructor(e){this[c]=e}get connected(){return this[c][s]}get free(){return this[c][r]}get pending(){return this[c][o]}get queued(){return this[c][n]}get running(){return this[c][i]}get size(){return this[c][a]}}e.exports=PoolStats},5076:(e,A,t)=>{"use strict";const{PoolBase:r,kClients:s,kNeedDrain:o,kAddClient:n,kGetDispatcher:i}=t(8640);const a=t(6197);const{InvalidArgumentError:c}=t(8707);const g=t(3440);const{kUrl:l,kInterceptors:E}=t(6443);const u=t(9136);const h=Symbol("options");const Q=Symbol("connections");const C=Symbol("factory");function defaultFactory(e,A){return new a(e,A)}class Pool extends r{constructor(e,{connections:A,factory:t=defaultFactory,connect:r,connectTimeout:o,tls:n,maxCachedSessions:i,socketPath:a,autoSelectFamily:B,autoSelectFamilyAttemptTimeout:d,allowH2:I,...p}={}){super();if(A!=null&&(!Number.isFinite(A)||A<0)){throw new c("invalid connections")}if(typeof t!=="function"){throw new c("factory must be a function.")}if(r!=null&&typeof r!=="function"&&typeof r!=="object"){throw new c("connect must be a function or an object")}if(typeof r!=="function"){r=u({...n,maxCachedSessions:i,allowH2:I,socketPath:a,timeout:o,...g.nodeHasAutoSelectFamily&&B?{autoSelectFamily:B,autoSelectFamilyAttemptTimeout:d}:undefined,...r})}this[E]=p.interceptors&&p.interceptors.Pool&&Array.isArray(p.interceptors.Pool)?p.interceptors.Pool:[];this[Q]=A||null;this[l]=g.parseOrigin(e);this[h]={...g.deepClone(p),connect:r,allowH2:I};this[h].interceptors=p.interceptors?{...p.interceptors}:undefined;this[C]=t;this.on("connectionError",((e,A,t)=>{for(const e of A){const A=this[s].indexOf(e);if(A!==-1){this[s].splice(A,1)}}}))}[i](){let e=this[s].find((e=>!e[o]));if(e){return e}if(!this[Q]||this[s].length{"use strict";const{kProxy:r,kClose:s,kDestroy:o,kInterceptors:n}=t(6443);const{URL:i}=t(7016);const a=t(9965);const c=t(5076);const g=t(1);const{InvalidArgumentError:l,RequestAbortedError:E}=t(8707);const u=t(9136);const h=Symbol("proxy agent");const Q=Symbol("proxy client");const C=Symbol("proxy headers");const B=Symbol("request tls settings");const d=Symbol("proxy tls settings");const I=Symbol("connect endpoint function");function defaultProtocolPort(e){return e==="https:"?443:80}function buildProxyOptions(e){if(typeof e==="string"){e={uri:e}}if(!e||!e.uri){throw new l("Proxy opts.uri is mandatory")}return{uri:e.uri,protocol:e.protocol||"https"}}function defaultFactory(e,A){return new c(e,A)}class ProxyAgent extends g{constructor(e){super(e);this[r]=buildProxyOptions(e);this[h]=new a(e);this[n]=e.interceptors&&e.interceptors.ProxyAgent&&Array.isArray(e.interceptors.ProxyAgent)?e.interceptors.ProxyAgent:[];if(typeof e==="string"){e={uri:e}}if(!e||!e.uri){throw new l("Proxy opts.uri is mandatory")}const{clientFactory:A=defaultFactory}=e;if(typeof A!=="function"){throw new l("Proxy opts.clientFactory must be a function.")}this[B]=e.requestTls;this[d]=e.proxyTls;this[C]=e.headers||{};const t=new i(e.uri);const{origin:s,port:o,host:c,username:g,password:p}=t;if(e.auth&&e.token){throw new l("opts.auth cannot be used in combination with opts.token")}else if(e.auth){this[C]["proxy-authorization"]=`Basic ${e.auth}`}else if(e.token){this[C]["proxy-authorization"]=e.token}else if(g&&p){this[C]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(g)}:${decodeURIComponent(p)}`).toString("base64")}`}const m=u({...e.proxyTls});this[I]=u({...e.requestTls});this[Q]=A(t,{connect:m});this[h]=new a({...e,connect:async(e,A)=>{let t=e.host;if(!e.port){t+=`:${defaultProtocolPort(e.protocol)}`}try{const{socket:r,statusCode:n}=await this[Q].connect({origin:s,port:o,path:t,signal:e.signal,headers:{...this[C],host:c}});if(n!==200){r.on("error",(()=>{})).destroy();A(new E(`Proxy response (${n}) !== 200 when HTTP Tunneling`))}if(e.protocol!=="https:"){A(null,r);return}let i;if(this[B]){i=this[B].servername}else{i=e.servername}this[I]({...e,servername:i,httpSocket:r},A)}catch(e){A(e)}}})}dispatch(e,A){const{host:t}=new i(e.origin);const r=buildHeaders(e.headers);throwIfProxyAuthIsSent(r);return this[h].dispatch({...e,headers:{...r,host:t}},A)}async[s](){await this[h].close();await this[Q].close()}async[o](){await this[h].destroy();await this[Q].destroy()}}function buildHeaders(e){if(Array.isArray(e)){const A={};for(let t=0;t e.toLowerCase()==="proxy-authorization"));if(A){throw new l("Proxy-Authorization should be sent in ProxyAgent constructor")}}e.exports=ProxyAgent},8804:e=>{"use strict";let A=Date.now();let t;const r=[];function onTimeout(){A=Date.now();let e=r.length;let t=0;while(t 0&&A>=s.state){s.state=-1;s.callback(s.opaque)}if(s.state===-1){s.state=-2;if(t!==e-1){r[t]=r.pop()}else{r.pop()}e-=1}else{t+=1}}if(r.length>0){refreshTimeout()}}function refreshTimeout(){if(t&&t.refresh){t.refresh()}else{clearTimeout(t);t=setTimeout(onTimeout,1e3);if(t.unref){t.unref()}}}class Timeout{constructor(e,A,t){this.callback=e;this.delay=A;this.opaque=t;this.state=-2;this.refresh()}refresh(){if(this.state===-2){r.push(this);if(!t||r.length===1){refreshTimeout()}}this.state=0}clear(){this.state=-1}}e.exports={setTimeout(e,A,t){return A<1e3?setTimeout(e,A,t):new Timeout(e,A,t)},clearTimeout(e){if(e instanceof Timeout){e.clear()}else{clearTimeout(e)}}}},8550:(e,A,t)=>{"use strict";const r=t(1637);const{uid:s,states:o}=t(5913);const{kReadyState:n,kSentClose:i,kByteParser:a,kReceivedClose:c}=t(2933);const{fireEvent:g,failWebsocketConnection:l}=t(3574);const{CloseEvent:E}=t(6255);const{makeRequest:u}=t(5194);const{fetching:h}=t(2315);const{Headers:Q}=t(6349);const{getGlobalDispatcher:C}=t(2581);const{kHeadersList:B}=t(6443);const d={};d.open=r.channel("undici:websocket:open");d.close=r.channel("undici:websocket:close");d.socketError=r.channel("undici:websocket:socket_error");let I;try{I=t(6982)}catch{}function establishWebSocketConnection(e,A,t,r,o){const n=e;n.protocol=e.protocol==="ws:"?"http:":"https:";const i=u({urlList:[n],serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(o.headers){const e=new Q(o.headers)[B];i.headersList=e}const a=I.randomBytes(16).toString("base64");i.headersList.append("sec-websocket-key",a);i.headersList.append("sec-websocket-version","13");for(const e of A){i.headersList.append("sec-websocket-protocol",e)}const c="";const g=h({request:i,useParallelQueue:true,dispatcher:o.dispatcher??C(),processResponse(e){if(e.type==="error"||e.status!==101){l(t,"Received network error or non-101 status code.");return}if(A.length!==0&&!e.headersList.get("Sec-WebSocket-Protocol")){l(t,"Server did not respond with sent protocols.");return}if(e.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){l(t,'Server did not set Upgrade header to "websocket".');return}if(e.headersList.get("Connection")?.toLowerCase()!=="upgrade"){l(t,'Server did not set Connection header to "upgrade".');return}const o=e.headersList.get("Sec-WebSocket-Accept");const n=I.createHash("sha1").update(a+s).digest("base64");if(o!==n){l(t,"Incorrect hash received in Sec-WebSocket-Accept header.");return}const g=e.headersList.get("Sec-WebSocket-Extensions");if(g!==null&&g!==c){l(t,"Received different permessage-deflate than the one set.");return}const E=e.headersList.get("Sec-WebSocket-Protocol");if(E!==null&&E!==i.headersList.get("Sec-WebSocket-Protocol")){l(t,"Protocol was not set in the opening handshake.");return}e.socket.on("data",onSocketData);e.socket.on("close",onSocketClose);e.socket.on("error",onSocketError);if(d.open.hasSubscribers){d.open.publish({address:e.socket.address(),protocol:E,extensions:g})}r(e)}});return g}function onSocketData(e){if(!this.ws[a].write(e)){this.pause()}}function onSocketClose(){const{ws:e}=this;const A=e[i]&&e[c];let t=1005;let r="";const s=e[a].closingInfo;if(s){t=s.code??1005;r=s.reason}else if(!e[i]){t=1006}e[n]=o.CLOSED;g("close",e,E,{wasClean:A,code:t,reason:r});if(d.close.hasSubscribers){d.close.publish({websocket:e,code:t,reason:r})}}function onSocketError(e){const{ws:A}=this;A[n]=o.CLOSING;if(d.socketError.hasSubscribers){d.socketError.publish(e)}this.destroy()}e.exports={establishWebSocketConnection:establishWebSocketConnection}},5913:e=>{"use strict";const A="258EAFA5-E914-47DA-95CA-C5AB0DC85B11";const t={enumerable:true,writable:false,configurable:false};const r={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3};const s={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10};const o=2**16-1;const n={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4};const i=Buffer.allocUnsafe(0);e.exports={uid:A,staticPropertyDescriptors:t,states:r,opcodes:s,maxUnsigned16Bit:o,parserStates:n,emptyBuffer:i}},6255:(e,A,t)=>{"use strict";const{webidl:r}=t(4222);const{kEnumerableProperty:s}=t(3440);const{MessagePort:o}=t(8167);class MessageEvent extends Event{#o;constructor(e,A={}){r.argumentLengthCheck(arguments,1,{header:"MessageEvent constructor"});e=r.converters.DOMString(e);A=r.converters.MessageEventInit(A);super(e,A);this.#o=A}get data(){r.brandCheck(this,MessageEvent);return this.#o.data}get origin(){r.brandCheck(this,MessageEvent);return this.#o.origin}get lastEventId(){r.brandCheck(this,MessageEvent);return this.#o.lastEventId}get source(){r.brandCheck(this,MessageEvent);return this.#o.source}get ports(){r.brandCheck(this,MessageEvent);if(!Object.isFrozen(this.#o.ports)){Object.freeze(this.#o.ports)}return this.#o.ports}initMessageEvent(e,A=false,t=false,s=null,o="",n="",i=null,a=[]){r.brandCheck(this,MessageEvent);r.argumentLengthCheck(arguments,1,{header:"MessageEvent.initMessageEvent"});return new MessageEvent(e,{bubbles:A,cancelable:t,data:s,origin:o,lastEventId:n,source:i,ports:a})}}class CloseEvent extends Event{#o;constructor(e,A={}){r.argumentLengthCheck(arguments,1,{header:"CloseEvent constructor"});e=r.converters.DOMString(e);A=r.converters.CloseEventInit(A);super(e,A);this.#o=A}get wasClean(){r.brandCheck(this,CloseEvent);return this.#o.wasClean}get code(){r.brandCheck(this,CloseEvent);return this.#o.code}get reason(){r.brandCheck(this,CloseEvent);return this.#o.reason}}class ErrorEvent extends Event{#o;constructor(e,A){r.argumentLengthCheck(arguments,1,{header:"ErrorEvent constructor"});super(e,A);e=r.converters.DOMString(e);A=r.converters.ErrorEventInit(A??{});this.#o=A}get message(){r.brandCheck(this,ErrorEvent);return this.#o.message}get filename(){r.brandCheck(this,ErrorEvent);return this.#o.filename}get lineno(){r.brandCheck(this,ErrorEvent);return this.#o.lineno}get colno(){r.brandCheck(this,ErrorEvent);return this.#o.colno}get error(){r.brandCheck(this,ErrorEvent);return this.#o.error}}Object.defineProperties(MessageEvent.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:true},data:s,origin:s,lastEventId:s,source:s,ports:s,initMessageEvent:s});Object.defineProperties(CloseEvent.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:true},reason:s,code:s,wasClean:s});Object.defineProperties(ErrorEvent.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:true},message:s,filename:s,lineno:s,colno:s,error:s});r.converters.MessagePort=r.interfaceConverter(o);r.converters["sequence "]=r.sequenceConverter(r.converters.MessagePort);const n=[{key:"bubbles",converter:r.converters.boolean,defaultValue:false},{key:"cancelable",converter:r.converters.boolean,defaultValue:false},{key:"composed",converter:r.converters.boolean,defaultValue:false}];r.converters.MessageEventInit=r.dictionaryConverter([...n,{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 "],get defaultValue(){return[]}}]);r.converters.CloseEventInit=r.dictionaryConverter([...n,{key:"wasClean",converter:r.converters.boolean,defaultValue:false},{key:"code",converter:r.converters["unsigned short"],defaultValue:0},{key:"reason",converter:r.converters.USVString,defaultValue:""}]);r.converters.ErrorEventInit=r.dictionaryConverter([...n,{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}]);e.exports={MessageEvent:MessageEvent,CloseEvent:CloseEvent,ErrorEvent:ErrorEvent}},1237:(e,A,t)=>{"use strict";const{maxUnsigned16Bit:r}=t(5913);let s;try{s=t(6982)}catch{}class WebsocketFrameSend{constructor(e){this.frameData=e;this.maskKey=s.randomBytes(4)}createFrame(e){const A=this.frameData?.byteLength??0;let t=A;let s=6;if(A>r){s+=8;t=127}else if(A>125){s+=2;t=126}const o=Buffer.allocUnsafe(A+s);o[0]=o[1]=0;o[0]|=128;o[0]=(o[0]&240)+e; /*! ws. MIT License. Einar Otto Stangvik */o[s-4]=this.maskKey[0];o[s-3]=this.maskKey[1];o[s-2]=this.maskKey[2];o[s-1]=this.maskKey[3];o[1]=t;if(t===126){o.writeUInt16BE(A,2)}else if(t===127){o[2]=o[3]=0;o.writeUIntBE(A,4,6)}o[1]|=128;for(let e=0;e{"use strict";const{Writable:r}=t(2203);const s=t(1637);const{parserStates:o,opcodes:n,states:i,emptyBuffer:a}=t(5913);const{kReadyState:c,kSentClose:g,kResponse:l,kReceivedClose:E}=t(2933);const{isValidStatusCode:u,failWebsocketConnection:h,websocketMessageReceived:Q}=t(3574);const{WebsocketFrameSend:C}=t(1237);const B={};B.ping=s.channel("undici:websocket:ping");B.pong=s.channel("undici:websocket:pong");class ByteParser extends r{#n=[];#i=0;#a=o.INFO;#c={};#g=[];constructor(e){super();this.ws=e}_write(e,A,t){this.#n.push(e);this.#i+=e.length;this.run(t)}run(e){while(true){if(this.#a===o.INFO){if(this.#i<2){return e()}const A=this.consume(2);this.#c.fin=(A[0]&128)!==0;this.#c.opcode=A[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==n.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==n.BINARY&&this.#c.opcode!==n.TEXT){h(this.ws,"Invalid frame type was fragmented.");return}const t=A[1]&127;if(t<=125){this.#c.payloadLength=t;this.#a=o.READ_DATA}else if(t===126){this.#a=o.PAYLOADLENGTH_16}else if(t===127){this.#a=o.PAYLOADLENGTH_64}if(this.#c.fragmented&&t>125){h(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===n.PING||this.#c.opcode===n.PONG||this.#c.opcode===n.CLOSE)&&t>125){h(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===n.CLOSE){if(t===1){h(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(t);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[g]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const A=new C(e);this.ws[l].socket.write(A.createFrame(n.CLOSE),(e=>{if(!e){this.ws[g]=true}}))}this.ws[c]=i.CLOSING;this.ws[E]=true;this.end();return}else if(this.#c.opcode===n.PING){const A=this.consume(t);if(!this.ws[E]){const e=new C(A);this.ws[l].socket.write(e.createFrame(n.PONG));if(B.ping.hasSubscribers){B.ping.publish({payload:A})}}this.#a=o.INFO;if(this.#i>0){continue}else{e();return}}else if(this.#c.opcode===n.PONG){const A=this.consume(t);if(B.pong.hasSubscribers){B.pong.publish({payload:A})}if(this.#i>0){continue}else{e();return}}}else if(this.#a===o.PAYLOADLENGTH_16){if(this.#i<2){return e()}const A=this.consume(2);this.#c.payloadLength=A.readUInt16BE(0);this.#a=o.READ_DATA}else if(this.#a===o.PAYLOADLENGTH_64){if(this.#i<8){return e()}const A=this.consume(8);const t=A.readUInt32BE(0);if(t>2**31-1){h(this.ws,"Received payload length > 2^31 bytes.");return}const r=A.readUInt32BE(4);this.#c.payloadLength=(t<<8)+r;this.#a=o.READ_DATA}else if(this.#a===o.READ_DATA){if(this.#i =this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#g.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===n.CONTINUATION){const e=Buffer.concat(this.#g);Q(this.ws,this.#c.originalOpcode,e);this.#c={};this.#g.length=0}this.#a=o.INFO}}if(this.#i>0){continue}else{e();break}}}consume(e){if(e>this.#i){return null}else if(e===0){return a}if(this.#n[0].length===e){this.#i-=this.#n[0].length;return this.#n.shift()}const A=Buffer.allocUnsafe(e);let t=0;while(t!==e){const r=this.#n[0];const{length:s}=r;if(s+t===e){A.set(this.#n.shift(),t);break}else if(s+t>e){A.set(r.subarray(0,e-t),t);this.#n[0]=r.subarray(e-t);break}else{A.set(this.#n.shift(),t);t+=r.length}}this.#i-=e;return A}parseCloseBody(e,A){let t;if(A.length>=2){t=A.readUInt16BE(0)}if(e){if(!u(t)){return null}return{code:t}}let r=A.subarray(2);if(r[0]===239&&r[1]===187&&r[2]===191){r=r.subarray(3)}if(t!==undefined&&!u(t)){return null}try{r=new TextDecoder("utf-8",{fatal:true}).decode(r)}catch{return null}return{code:t,reason:r}}get closingInfo(){return this.#c.closeInfo}}e.exports={ByteParser:ByteParser}},2933:e=>{"use strict";e.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},3574:(e,A,t)=>{"use strict";const{kReadyState:r,kController:s,kResponse:o,kBinaryType:n,kWebSocketURL:i}=t(2933);const{states:a,opcodes:c}=t(5913);const{MessageEvent:g,ErrorEvent:l}=t(6255);function isEstablished(e){return e[r]===a.OPEN}function isClosing(e){return e[r]===a.CLOSING}function isClosed(e){return e[r]===a.CLOSED}function fireEvent(e,A,t=Event,r){const s=new t(e,r);A.dispatchEvent(s)}function websocketMessageReceived(e,A,t){if(e[r]!==a.OPEN){return}let s;if(A===c.TEXT){try{s=new TextDecoder("utf-8",{fatal:true}).decode(t)}catch{failWebsocketConnection(e,"Received invalid UTF-8 in text frame.");return}}else if(A===c.BINARY){if(e[n]==="blob"){s=new Blob([t])}else{s=new Uint8Array(t).buffer}}fireEvent("message",e,g,{origin:e[i].origin,data:s})}function isValidSubprotocol(e){if(e.length===0){return false}for(const A of e){const e=A.charCodeAt(0);if(e<33||e>126||A==="("||A===")"||A==="<"||A===">"||A==="@"||A===","||A===";"||A===":"||A==="\\"||A==='"'||A==="/"||A==="["||A==="]"||A==="?"||A==="="||A==="{"||A==="}"||e===32||e===9){return false}}return true}function isValidStatusCode(e){if(e>=1e3&&e<1015){return e!==1004&&e!==1005&&e!==1006}return e>=3e3&&e<=4999}function failWebsocketConnection(e,A){const{[s]:t,[o]:r}=e;t.abort();if(r?.socket&&!r.socket.destroyed){r.socket.destroy()}if(A){fireEvent("error",e,l,{error:new Error(A)})}}e.exports={isEstablished:isEstablished,isClosing:isClosing,isClosed:isClosed,fireEvent:fireEvent,isValidSubprotocol:isValidSubprotocol,isValidStatusCode:isValidStatusCode,failWebsocketConnection:failWebsocketConnection,websocketMessageReceived:websocketMessageReceived}},5171:(e,A,t)=>{"use strict";const{webidl:r}=t(4222);const{DOMException:s}=t(7326);const{URLSerializer:o}=t(4322);const{getGlobalOrigin:n}=t(5628);const{staticPropertyDescriptors:i,states:a,opcodes:c,emptyBuffer:g}=t(5913);const{kWebSocketURL:l,kReadyState:E,kController:u,kBinaryType:h,kResponse:Q,kSentClose:C,kByteParser:B}=t(2933);const{isEstablished:d,isClosing:I,isValidSubprotocol:p,failWebsocketConnection:m,fireEvent:y}=t(3574);const{establishWebSocketConnection:b}=t(8550);const{WebsocketFrameSend:R}=t(1237);const{ByteParser:k}=t(3171);const{kEnumerableProperty:D,isBlobLike:S}=t(3440);const{getGlobalDispatcher:F}=t(2581);const{types:T}=t(9023);let v=false;class WebSocket extends EventTarget{#l={open:null,error:null,close:null,message:null};#E=0;#u="";#h="";constructor(e,A=[]){super();r.argumentLengthCheck(arguments,1,{header:"WebSocket constructor"});if(!v){v=true;process.emitWarning("WebSockets are experimental, expect them to change at any time.",{code:"UNDICI-WS"})}const t=r.converters["DOMString or sequence or WebSocketInit"](A);e=r.converters.USVString(e);A=t.protocols;const o=n();let i;try{i=new URL(e,o)}catch(e){throw new s(e,"SyntaxError")}if(i.protocol==="http:"){i.protocol="ws:"}else if(i.protocol==="https:"){i.protocol="wss:"}if(i.protocol!=="ws:"&&i.protocol!=="wss:"){throw new s(`Expected a ws: or wss: protocol, got ${i.protocol}`,"SyntaxError")}if(i.hash||i.href.endsWith("#")){throw new s("Got fragment","SyntaxError")}if(typeof A==="string"){A=[A]}if(A.length!==new Set(A.map((e=>e.toLowerCase()))).size){throw new s("Invalid Sec-WebSocket-Protocol value","SyntaxError")}if(A.length>0&&!A.every((e=>p(e)))){throw new s("Invalid Sec-WebSocket-Protocol value","SyntaxError")}this[l]=new URL(i.href);this[u]=b(i,A,this,(e=>this.#Q(e)),t);this[E]=WebSocket.CONNECTING;this[h]="blob"}close(e=undefined,A=undefined){r.brandCheck(this,WebSocket);if(e!==undefined){e=r.converters["unsigned short"](e,{clamp:true})}if(A!==undefined){A=r.converters.USVString(A)}if(e!==undefined){if(e!==1e3&&(e<3e3||e>4999)){throw new s("invalid code","InvalidAccessError")}}let t=0;if(A!==undefined){t=Buffer.byteLength(A);if(t>123){throw new s(`Reason must be less than 123 bytes; received ${t}`,"SyntaxError")}}if(this[E]===WebSocket.CLOSING||this[E]===WebSocket.CLOSED){}else if(!d(this)){m(this,"Connection was closed before it was established.");this[E]=WebSocket.CLOSING}else if(!I(this)){const r=new R;if(e!==undefined&&A===undefined){r.frameData=Buffer.allocUnsafe(2);r.frameData.writeUInt16BE(e,0)}else if(e!==undefined&&A!==undefined){r.frameData=Buffer.allocUnsafe(2+t);r.frameData.writeUInt16BE(e,0);r.frameData.write(A,2,"utf-8")}else{r.frameData=g}const s=this[Q].socket;s.write(r.createFrame(c.CLOSE),(e=>{if(!e){this[C]=true}}));this[E]=a.CLOSING}else{this[E]=WebSocket.CLOSING}}send(e){r.brandCheck(this,WebSocket);r.argumentLengthCheck(arguments,1,{header:"WebSocket.send"});e=r.converters.WebSocketSendData(e);if(this[E]===WebSocket.CONNECTING){throw new s("Sent before connected.","InvalidStateError")}if(!d(this)||I(this)){return}const A=this[Q].socket;if(typeof e==="string"){const t=Buffer.from(e);const r=new R(t);const s=r.createFrame(c.TEXT);this.#E+=t.byteLength;A.write(s,(()=>{this.#E-=t.byteLength}))}else if(T.isArrayBuffer(e)){const t=Buffer.from(e);const r=new R(t);const s=r.createFrame(c.BINARY);this.#E+=t.byteLength;A.write(s,(()=>{this.#E-=t.byteLength}))}else if(ArrayBuffer.isView(e)){const t=Buffer.from(e,e.byteOffset,e.byteLength);const r=new R(t);const s=r.createFrame(c.BINARY);this.#E+=t.byteLength;A.write(s,(()=>{this.#E-=t.byteLength}))}else if(S(e)){const t=new R;e.arrayBuffer().then((e=>{const r=Buffer.from(e);t.frameData=r;const s=t.createFrame(c.BINARY);this.#E+=r.byteLength;A.write(s,(()=>{this.#E-=r.byteLength}))}))}}get readyState(){r.brandCheck(this,WebSocket);return this[E]}get bufferedAmount(){r.brandCheck(this,WebSocket);return this.#E}get url(){r.brandCheck(this,WebSocket);return o(this[l])}get extensions(){r.brandCheck(this,WebSocket);return this.#h}get protocol(){r.brandCheck(this,WebSocket);return this.#u}get onopen(){r.brandCheck(this,WebSocket);return this.#l.open}set onopen(e){r.brandCheck(this,WebSocket);if(this.#l.open){this.removeEventListener("open",this.#l.open)}if(typeof e==="function"){this.#l.open=e;this.addEventListener("open",e)}else{this.#l.open=null}}get onerror(){r.brandCheck(this,WebSocket);return this.#l.error}set onerror(e){r.brandCheck(this,WebSocket);if(this.#l.error){this.removeEventListener("error",this.#l.error)}if(typeof e==="function"){this.#l.error=e;this.addEventListener("error",e)}else{this.#l.error=null}}get onclose(){r.brandCheck(this,WebSocket);return this.#l.close}set onclose(e){r.brandCheck(this,WebSocket);if(this.#l.close){this.removeEventListener("close",this.#l.close)}if(typeof e==="function"){this.#l.close=e;this.addEventListener("close",e)}else{this.#l.close=null}}get onmessage(){r.brandCheck(this,WebSocket);return this.#l.message}set onmessage(e){r.brandCheck(this,WebSocket);if(this.#l.message){this.removeEventListener("message",this.#l.message)}if(typeof e==="function"){this.#l.message=e;this.addEventListener("message",e)}else{this.#l.message=null}}get binaryType(){r.brandCheck(this,WebSocket);return this[h]}set binaryType(e){r.brandCheck(this,WebSocket);if(e!=="blob"&&e!=="arraybuffer"){this[h]="blob"}else{this[h]=e}}#Q(e){this[Q]=e;const A=new k(this);A.on("drain",(function onParserDrain(){this.ws[Q].socket.resume()}));e.socket.ws=this;this[B]=A;this[E]=a.OPEN;const t=e.headersList.get("sec-websocket-extensions");if(t!==null){this.#h=t}const r=e.headersList.get("sec-websocket-protocol");if(r!==null){this.#u=r}y("open",this)}}WebSocket.CONNECTING=WebSocket.prototype.CONNECTING=a.CONNECTING;WebSocket.OPEN=WebSocket.prototype.OPEN=a.OPEN;WebSocket.CLOSING=WebSocket.prototype.CLOSING=a.CLOSING;WebSocket.CLOSED=WebSocket.prototype.CLOSED=a.CLOSED;Object.defineProperties(WebSocket.prototype,{CONNECTING:i,OPEN:i,CLOSING:i,CLOSED:i,url:D,readyState:D,bufferedAmount:D,onopen:D,onerror:D,onclose:D,close:D,onmessage:D,binaryType:D,send:D,extensions:D,protocol:D,[Symbol.toStringTag]:{value:"WebSocket",writable:false,enumerable:false,configurable:true}});Object.defineProperties(WebSocket,{CONNECTING:i,OPEN:i,CLOSING:i,CLOSED:i});r.converters["sequence "]=r.sequenceConverter(r.converters.DOMString);r.converters["DOMString or sequence "]=function(e){if(r.util.Type(e)==="Object"&&Symbol.iterator in e){return r.converters["sequence "](e)}return r.converters.DOMString(e)};r.converters.WebSocketInit=r.dictionaryConverter([{key:"protocols",converter:r.converters["DOMString or sequence "],get defaultValue(){return[]}},{key:"dispatcher",converter:e=>e,get defaultValue(){return F()}},{key:"headers",converter:r.nullableConverter(r.converters.HeadersInit)}]);r.converters["DOMString or sequence or WebSocketInit"]=function(e){if(r.util.Type(e)==="Object"&&!(Symbol.iterator in e)){return r.converters.WebSocketInit(e)}return{protocols:r.converters["DOMString or sequence "](e)}};r.converters.WebSocketSendData=function(e){if(r.util.Type(e)==="Object"){if(S(e)){return r.converters.Blob(e,{strict:false})}if(ArrayBuffer.isView(e)||T.isAnyArrayBuffer(e)){return r.converters.BufferSource(e)}}return r.converters.USVString(e)};e.exports={WebSocket:WebSocket}},3843:(e,A)=>{"use strict";Object.defineProperty(A,"__esModule",{value:true});function getUserAgent(){if(typeof navigator==="object"&&"userAgent"in navigator){return navigator.userAgent}if(typeof process==="object"&&process.version!==undefined){return`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`}return" "}A.getUserAgent=getUserAgent},8264:e=>{e.exports=wrappy;function wrappy(e,A){if(e&&A)return wrappy(e)(A);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach((function(A){wrapper[A]=e[A]}));return wrapper;function wrapper(){var A=new Array(arguments.length);for(var t=0;t {"use strict";e.exports=require("assert")},290:e=>{"use strict";e.exports=require("async_hooks")},181:e=>{"use strict";e.exports=require("buffer")},5317:e=>{"use strict";e.exports=require("child_process")},4236:e=>{"use strict";e.exports=require("console")},6982:e=>{"use strict";e.exports=require("crypto")},1637:e=>{"use strict";e.exports=require("diagnostics_channel")},4434:e=>{"use strict";e.exports=require("events")},9896:e=>{"use strict";e.exports=require("fs")},8611:e=>{"use strict";e.exports=require("http")},5675:e=>{"use strict";e.exports=require("http2")},5692:e=>{"use strict";e.exports=require("https")},9278:e=>{"use strict";e.exports=require("net")},7598:e=>{"use strict";e.exports=require("node:crypto")},8474:e=>{"use strict";e.exports=require("node:events")},7075:e=>{"use strict";e.exports=require("node:stream")},7975:e=>{"use strict";e.exports=require("node:util")},857:e=>{"use strict";e.exports=require("os")},6928:e=>{"use strict";e.exports=require("path")},2987:e=>{"use strict";e.exports=require("perf_hooks")},3480:e=>{"use strict";e.exports=require("querystring")},2203:e=>{"use strict";e.exports=require("stream")},3774:e=>{"use strict";e.exports=require("stream/web")},3193:e=>{"use strict";e.exports=require("string_decoder")},3557:e=>{"use strict";e.exports=require("timers")},4756:e=>{"use strict";e.exports=require("tls")},7016:e=>{"use strict";e.exports=require("url")},9023:e=>{"use strict";e.exports=require("util")},8253:e=>{"use strict";e.exports=require("util/types")},8167:e=>{"use strict";e.exports=require("worker_threads")},3106:e=>{"use strict";e.exports=require("zlib")},7182:(e,A,t)=>{"use strict";const r=t(7075).Writable;const s=t(7975).inherits;const o=t(4136);const n=t(612);const i=t(2271);const a=45;const c=Buffer.from("-");const g=Buffer.from("\r\n");const EMPTY_FN=function(){};function Dicer(e){if(!(this instanceof Dicer)){return new Dicer(e)}r.call(this,e);if(!e||!e.headerFirst&&typeof e.boundary!=="string"){throw new TypeError("Boundary required")}if(typeof e.boundary==="string"){this.setBoundary(e.boundary)}else{this._bparser=undefined}this._headerFirst=e.headerFirst;this._dashes=0;this._parts=0;this._finished=false;this._realFinish=false;this._isPreamble=true;this._justMatched=false;this._firstWrite=true;this._inHeader=true;this._part=undefined;this._cb=undefined;this._ignoreData=false;this._partOpts={highWaterMark:e.partHwm};this._pause=false;const A=this;this._hparser=new i(e);this._hparser.on("header",(function(e){A._inHeader=false;A._part.emit("header",e)}))}s(Dicer,r);Dicer.prototype.emit=function(e){if(e==="finish"&&!this._realFinish){if(!this._finished){const e=this;process.nextTick((function(){e.emit("error",new Error("Unexpected end of multipart data"));if(e._part&&!e._ignoreData){const A=e._isPreamble?"Preamble":"Part";e._part.emit("error",new Error(A+" terminated early due to unexpected end of multipart data"));e._part.push(null);process.nextTick((function(){e._realFinish=true;e.emit("finish");e._realFinish=false}));return}e._realFinish=true;e.emit("finish");e._realFinish=false}))}}else{r.prototype.emit.apply(this,arguments)}};Dicer.prototype._write=function(e,A,t){if(!this._hparser&&!this._bparser){return t()}if(this._headerFirst&&this._isPreamble){if(!this._part){this._part=new n(this._partOpts);if(this.listenerCount("preamble")!==0){this.emit("preamble",this._part)}else{this._ignore()}}const A=this._hparser.push(e);if(!this._inHeader&&A!==undefined&&A {"use strict";const r=t(8474).EventEmitter;const s=t(7975).inherits;const o=t(2393);const n=t(4136);const i=Buffer.from("\r\n\r\n");const a=/\r\n/g;const c=/^([^:]+):[ \t]?([\x00-\xFF]+)?$/;function HeaderParser(e){r.call(this);e=e||{};const A=this;this.nread=0;this.maxed=false;this.npairs=0;this.maxHeaderPairs=o(e,"maxHeaderPairs",2e3);this.maxHeaderSize=o(e,"maxHeaderSize",80*1024);this.buffer="";this.header={};this.finished=false;this.ss=new n(i);this.ss.on("info",(function(e,t,r,s){if(t&&!A.maxed){if(A.nread+s-r>=A.maxHeaderSize){s=A.maxHeaderSize-A.nread+r;A.nread=A.maxHeaderSize;A.maxed=true}else{A.nread+=s-r}A.buffer+=t.toString("binary",r,s)}if(e){A._finish()}}))}s(HeaderParser,r);HeaderParser.prototype.push=function(e){const A=this.ss.push(e);if(this.finished){return A}};HeaderParser.prototype.reset=function(){this.finished=false;this.buffer="";this.header={};this.ss.reset()};HeaderParser.prototype._finish=function(){if(this.buffer){this._parseHeader()}this.ss.matches=this.ss.maxMatches;const e=this.header;this.header={};this.buffer="";this.finished=true;this.nread=this.npairs=0;this.maxed=false;this.emit("header",e)};HeaderParser.prototype._parseHeader=function(){if(this.npairs===this.maxHeaderPairs){return}const e=this.buffer.split(a);const A=e.length;let t,r;for(var s=0;s{"use strict";const r=t(7975).inherits;const s=t(7075).Readable;function PartStream(e){s.call(this,e)}r(PartStream,s);PartStream.prototype._read=function(e){};e.exports=PartStream},4136:(e,A,t)=>{"use strict";const r=t(8474).EventEmitter;const s=t(7975).inherits;function SBMH(e){if(typeof e==="string"){e=Buffer.from(e)}if(!Buffer.isBuffer(e)){throw new TypeError("The needle has to be a String or a Buffer.")}const A=e.length;if(A===0){throw new Error("The needle cannot be an empty String/Buffer.")}if(A>256){throw new Error("The needle cannot have a length bigger than 256.")}this.maxMatches=Infinity;this.matches=0;this._occ=new Array(256).fill(A);this._lookbehind_size=0;this._needle=e;this._bufpos=0;this._lookbehind=Buffer.alloc(A);for(var t=0;t =0){this.emit("info",false,this._lookbehind,0,this._lookbehind_size);this._lookbehind_size=0}else{const t=this._lookbehind_size+o;if(t>0){this.emit("info",false,this._lookbehind,0,t)}this._lookbehind.copy(this._lookbehind,0,t,this._lookbehind_size-t);this._lookbehind_size-=t;e.copy(this._lookbehind,this._lookbehind_size);this._lookbehind_size+=A;this._bufpos=A;return A}}o+=(o>=0)*this._bufpos;if(e.indexOf(t,o)!==-1){o=e.indexOf(t,o);++this.matches;if(o>0){this.emit("info",true,e,this._bufpos,o)}else{this.emit("info",true)}return this._bufpos=o+r}else{o=A-r}while(o0){this.emit("info",false,e,this._bufpos,o{"use strict";const r=t(7075).Writable;const{inherits:s}=t(7975);const o=t(7182);const n=t(1192);const i=t(855);const a=t(8929);function Busboy(e){if(!(this instanceof Busboy)){return new Busboy(e)}if(typeof e!=="object"){throw new TypeError("Busboy expected an options-Object.")}if(typeof e.headers!=="object"){throw new TypeError("Busboy expected an options-Object with headers-attribute.")}if(typeof e.headers["content-type"]!=="string"){throw new TypeError("Missing Content-Type-header.")}const{headers:A,...t}=e;this.opts={autoDestroy:false,...t};r.call(this,this.opts);this._done=false;this._parser=this.getParserByHeaders(A);this._finished=false}s(Busboy,r);Busboy.prototype.emit=function(e){if(e==="finish"){if(!this._done){this._parser?.end();return}else if(this._finished){return}this._finished=true}r.prototype.emit.apply(this,arguments)};Busboy.prototype.getParserByHeaders=function(e){const A=a(e["content-type"]);const t={defCharset:this.opts.defCharset,fileHwm:this.opts.fileHwm,headers:e,highWaterMark:this.opts.highWaterMark,isPartAFile:this.opts.isPartAFile,limits:this.opts.limits,parsedConType:A,preservePath:this.opts.preservePath};if(n.detect.test(A[0])){return new n(this,t)}if(i.detect.test(A[0])){return new i(this,t)}throw new Error("Unsupported Content-Type.")};Busboy.prototype._write=function(e,A,t){this._parser.write(e,t)};e.exports=Busboy;e.exports["default"]=Busboy;e.exports.Busboy=Busboy;e.exports.Dicer=o},1192:(e,A,t)=>{"use strict";const{Readable:r}=t(7075);const{inherits:s}=t(7975);const o=t(7182);const n=t(8929);const i=t(2747);const a=t(692);const c=t(2393);const g=/^boundary$/i;const l=/^form-data$/i;const E=/^charset$/i;const u=/^filename$/i;const h=/^name$/i;Multipart.detect=/^multipart\/form-data/i;function Multipart(e,A){let t;let r;const s=this;let Q;const C=A.limits;const B=A.isPartAFile||((e,A,t)=>A==="application/octet-stream"||t!==undefined);const d=A.parsedConType||[];const I=A.defCharset||"utf8";const p=A.preservePath;const m={highWaterMark:A.fileHwm};for(t=0,r=d.length;t D){s.parser.removeListener("part",onPart);s.parser.on("part",skipPart);e.hitPartsLimit=true;e.emit("partsLimit");return skipPart(A)}if(L){const e=L;e.emit("end");e.removeAllListeners("end")}A.on("header",(function(o){let c;let g;let Q;let C;let d;let D;let S=0;if(o["content-type"]){Q=n(o["content-type"][0]);if(Q[0]){c=Q[0].toLowerCase();for(t=0,r=Q.length;t b){const r=b-S+e.length;if(r>0){t.push(e.slice(0,r))}t.truncated=true;t.bytesRead=b;A.removeAllListeners("data");t.emit("limit");return}else if(!t.push(e)){s._pause=true}t.bytesRead=S};G=function(){U=undefined;t.push(null)}}else{if(v===k){if(!e.hitFieldsLimit){e.hitFieldsLimit=true;e.emit("fieldsLimit")}return skipPart(A)}++v;++N;let t="";let r=false;L=A;F=function(e){if((S+=e.length)>y){const s=y-(S-e.length);t+=e.toString("binary",0,s);r=true;A.removeAllListeners("data")}else{t+=e.toString("binary")}};G=function(){L=undefined;if(t.length){t=i(t,"binary",C)}e.emit("field",g,t,false,r,d,c);--N;checkFinished()}}A._readableState.sync=false;A.on("data",F);A.on("end",G)})).on("error",(function(e){if(U){U.emit("error",e)}}))})).on("error",(function(A){e.emit("error",A)})).on("finish",(function(){G=true;checkFinished()}))}Multipart.prototype.write=function(e,A){const t=this.parser.write(e);if(t&&!this._pause){A()}else{this._needDrain=!t;this._cb=A}};Multipart.prototype.end=function(){const e=this;if(e.parser.writable){e.parser.end()}else if(!e._boy._done){process.nextTick((function(){e._boy._done=true;e._boy.emit("finish")}))}};function skipPart(e){e.resume()}function FileStream(e){r.call(this,e);this.bytesRead=0;this.truncated=false}s(FileStream,r);FileStream.prototype._read=function(e){};e.exports=Multipart},855:(e,A,t)=>{"use strict";const r=t(1496);const s=t(2747);const o=t(2393);const n=/^charset$/i;UrlEncoded.detect=/^application\/x-www-form-urlencoded/i;function UrlEncoded(e,A){const t=A.limits;const s=A.parsedConType;this.boy=e;this.fieldSizeLimit=o(t,"fieldSize",1*1024*1024);this.fieldNameSizeLimit=o(t,"fieldNameSize",100);this.fieldsLimit=o(t,"fields",Infinity);let i;for(var a=0,c=s.length;a n){this._key+=this.decoder.write(e.toString("binary",n,t))}this._state="val";this._hitLimit=false;this._checkingBytes=true;this._val="";this._bytesVal=0;this._valTrunc=false;this.decoder.reset();n=t+1}else if(r!==undefined){++this._fields;let t;const o=this._keyTrunc;if(r>n){t=this._key+=this.decoder.write(e.toString("binary",n,r))}else{t=this._key}this._hitLimit=false;this._checkingBytes=true;this._key="";this._bytesKey=0;this._keyTrunc=false;this.decoder.reset();if(t.length){this.boy.emit("field",s(t,"binary",this.charset),"",o,false)}n=r+1;if(this._fields===this.fieldsLimit){return A()}}else if(this._hitLimit){if(o>n){this._key+=this.decoder.write(e.toString("binary",n,o))}n=o;if((this._bytesKey=this._key.length)===this.fieldNameSizeLimit){this._checkingBytes=false;this._keyTrunc=true}}else{if(nn){this._val+=this.decoder.write(e.toString("binary",n,r))}this.boy.emit("field",s(this._key,"binary",this.charset),s(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc);this._state="key";this._hitLimit=false;this._checkingBytes=true;this._key="";this._bytesKey=0;this._keyTrunc=false;this.decoder.reset();n=r+1;if(this._fields===this.fieldsLimit){return A()}}else if(this._hitLimit){if(o>n){this._val+=this.decoder.write(e.toString("binary",n,o))}n=o;if(this._val===""&&this.fieldSizeLimit===0||(this._bytesVal=this._val.length)===this.fieldSizeLimit){this._checkingBytes=false;this._valTrunc=true}}else{if(n0){this.boy.emit("field",s(this._key,"binary",this.charset),"",this._keyTrunc,false)}else if(this._state==="val"){this.boy.emit("field",s(this._key,"binary",this.charset),s(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc)}this.boy._done=true;this.boy.emit("finish")};e.exports=UrlEncoded},1496:e=>{"use strict";const A=/\+/g;const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function Decoder(){this.buffer=undefined}Decoder.prototype.write=function(e){e=e.replace(A," ");let r="";let s=0;let o=0;const n=e.length;for(;s o){r+=e.substring(o,s);o=s}this.buffer="";++o}}if(o {"use strict";e.exports=function basename(e){if(typeof e!=="string"){return""}for(var A=e.length-1;A>=0;--A){switch(e.charCodeAt(A)){case 47:case 92:e=e.slice(A+1);return e===".."||e==="."?"":e}}return e===".."||e==="."?"":e}},2747:function(e){"use strict";const A=new TextDecoder("utf-8");const t=new Map([["utf-8",A],["utf8",A]]);function getDecoder(e){let A;while(true){switch(e){case"utf-8":case"utf8":return r.utf8;case"latin1":case"ascii":case"us-ascii":case"iso-8859-1":case"iso8859-1":case"iso88591":case"iso_8859-1":case"windows-1252":case"iso_8859-1:1987":case"cp1252":case"x-cp1252":return r.latin1;case"utf16le":case"utf-16le":case"ucs2":case"ucs-2":return r.utf16le;case"base64":return r.base64;default:if(A===undefined){A=true;e=e.toLowerCase();continue}return r.other.bind(e)}}}const r={utf8:(e,A)=>{if(e.length===0){return""}if(typeof e==="string"){e=Buffer.from(e,A)}return e.utf8Slice(0,e.length)},latin1:(e,A)=>{if(e.length===0){return""}if(typeof e==="string"){return e}return e.latin1Slice(0,e.length)},utf16le:(e,A)=>{if(e.length===0){return""}if(typeof e==="string"){e=Buffer.from(e,A)}return e.ucs2Slice(0,e.length)},base64:(e,A)=>{if(e.length===0){return""}if(typeof e==="string"){e=Buffer.from(e,A)}return e.base64Slice(0,e.length)},other:(e,A)=>{if(e.length===0){return""}if(typeof e==="string"){e=Buffer.from(e,A)}if(t.has(this.toString())){try{return t.get(this).decode(e)}catch{}}return typeof e==="string"?e:e.toString()}};function decodeText(e,A,t){if(e){return getDecoder(t)(e,A)}return e}e.exports=decodeText},2393:e=>{"use strict";e.exports=function getLimit(e,A,t){if(!e||e[A]===undefined||e[A]===null){return t}if(typeof e[A]!=="number"||isNaN(e[A])){throw new TypeError("Limit "+A+" is not a valid number")}return e[A]}},8929:(e,A,t)=>{"use strict";const r=t(2747);const s=/%[a-fA-F0-9][a-fA-F0-9]/g;const o={"%00":"\0","%01":"","%02":"","%03":"","%04":"","%05":"","%06":"","%07":"","%08":"\b","%09":"\t","%0a":"\n","%0A":"\n","%0b":"\v","%0B":"\v","%0c":"\f","%0C":"\f","%0d":"\r","%0D":"\r","%0e":"","%0E":"","%0f":"","%0F":"","%10":"","%11":"","%12":"","%13":"","%14":"","%15":"","%16":"","%17":"","%18":"","%19":"","%1a":"","%1A":"","%1b":"","%1B":"","%1c":"","%1C":"","%1d":"","%1D":"","%1e":"","%1E":"","%1f":"","%1F":"","%20":" ","%21":"!","%22":'"',"%23":"#","%24":"$","%25":"%","%26":"&","%27":"'","%28":"(","%29":")","%2a":"*","%2A":"*","%2b":"+","%2B":"+","%2c":",","%2C":",","%2d":"-","%2D":"-","%2e":".","%2E":".","%2f":"/","%2F":"/","%30":"0","%31":"1","%32":"2","%33":"3","%34":"4","%35":"5","%36":"6","%37":"7","%38":"8","%39":"9","%3a":":","%3A":":","%3b":";","%3B":";","%3c":"<","%3C":"<","%3d":"=","%3D":"=","%3e":">","%3E":">","%3f":"?","%3F":"?","%40":"@","%41":"A","%42":"B","%43":"C","%44":"D","%45":"E","%46":"F","%47":"G","%48":"H","%49":"I","%4a":"J","%4A":"J","%4b":"K","%4B":"K","%4c":"L","%4C":"L","%4d":"M","%4D":"M","%4e":"N","%4E":"N","%4f":"O","%4F":"O","%50":"P","%51":"Q","%52":"R","%53":"S","%54":"T","%55":"U","%56":"V","%57":"W","%58":"X","%59":"Y","%5a":"Z","%5A":"Z","%5b":"[","%5B":"[","%5c":"\\","%5C":"\\","%5d":"]","%5D":"]","%5e":"^","%5E":"^","%5f":"_","%5F":"_","%60":"`","%61":"a","%62":"b","%63":"c","%64":"d","%65":"e","%66":"f","%67":"g","%68":"h","%69":"i","%6a":"j","%6A":"j","%6b":"k","%6B":"k","%6c":"l","%6C":"l","%6d":"m","%6D":"m","%6e":"n","%6E":"n","%6f":"o","%6F":"o","%70":"p","%71":"q","%72":"r","%73":"s","%74":"t","%75":"u","%76":"v","%77":"w","%78":"x","%79":"y","%7a":"z","%7A":"z","%7b":"{","%7B":"{","%7c":"|","%7C":"|","%7d":"}","%7D":"}","%7e":"~","%7E":"~","%7f":"","%7F":"","%80":"","%81":"","%82":"","%83":"","%84":"","%85":" ","%86":"","%87":"","%88":"","%89":"","%8a":"","%8A":"","%8b":"","%8B":"","%8c":"","%8C":"","%8d":"","%8D":"","%8e":"","%8E":"","%8f":"","%8F":"","%90":"","%91":"","%92":"","%93":"","%94":"","%95":"","%96":"","%97":"","%98":"","%99":"","%9a":"","%9A":"","%9b":"","%9B":"","%9c":"","%9C":"","%9d":"","%9D":"","%9e":"","%9E":"","%9f":"","%9F":"","%a0":" ","%A0":" ","%a1":"¡","%A1":"¡","%a2":"¢","%A2":"¢","%a3":"£","%A3":"£","%a4":"¤","%A4":"¤","%a5":"¥","%A5":"¥","%a6":"¦","%A6":"¦","%a7":"§","%A7":"§","%a8":"¨","%A8":"¨","%a9":"©","%A9":"©","%aa":"ª","%Aa":"ª","%aA":"ª","%AA":"ª","%ab":"«","%Ab":"«","%aB":"«","%AB":"«","%ac":"¬","%Ac":"¬","%aC":"¬","%AC":"¬","%ad":"","%Ad":"","%aD":"","%AD":"","%ae":"®","%Ae":"®","%aE":"®","%AE":"®","%af":"¯","%Af":"¯","%aF":"¯","%AF":"¯","%b0":"°","%B0":"°","%b1":"±","%B1":"±","%b2":"²","%B2":"²","%b3":"³","%B3":"³","%b4":"´","%B4":"´","%b5":"µ","%B5":"µ","%b6":"¶","%B6":"¶","%b7":"·","%B7":"·","%b8":"¸","%B8":"¸","%b9":"¹","%B9":"¹","%ba":"º","%Ba":"º","%bA":"º","%BA":"º","%bb":"»","%Bb":"»","%bB":"»","%BB":"»","%bc":"¼","%Bc":"¼","%bC":"¼","%BC":"¼","%bd":"½","%Bd":"½","%bD":"½","%BD":"½","%be":"¾","%Be":"¾","%bE":"¾","%BE":"¾","%bf":"¿","%Bf":"¿","%bF":"¿","%BF":"¿","%c0":"À","%C0":"À","%c1":"Á","%C1":"Á","%c2":"Â","%C2":"Â","%c3":"Ã","%C3":"Ã","%c4":"Ä","%C4":"Ä","%c5":"Å","%C5":"Å","%c6":"Æ","%C6":"Æ","%c7":"Ç","%C7":"Ç","%c8":"È","%C8":"È","%c9":"É","%C9":"É","%ca":"Ê","%Ca":"Ê","%cA":"Ê","%CA":"Ê","%cb":"Ë","%Cb":"Ë","%cB":"Ë","%CB":"Ë","%cc":"Ì","%Cc":"Ì","%cC":"Ì","%CC":"Ì","%cd":"Í","%Cd":"Í","%cD":"Í","%CD":"Í","%ce":"Î","%Ce":"Î","%cE":"Î","%CE":"Î","%cf":"Ï","%Cf":"Ï","%cF":"Ï","%CF":"Ï","%d0":"Ð","%D0":"Ð","%d1":"Ñ","%D1":"Ñ","%d2":"Ò","%D2":"Ò","%d3":"Ó","%D3":"Ó","%d4":"Ô","%D4":"Ô","%d5":"Õ","%D5":"Õ","%d6":"Ö","%D6":"Ö","%d7":"×","%D7":"×","%d8":"Ø","%D8":"Ø","%d9":"Ù","%D9":"Ù","%da":"Ú","%Da":"Ú","%dA":"Ú","%DA":"Ú","%db":"Û","%Db":"Û","%dB":"Û","%DB":"Û","%dc":"Ü","%Dc":"Ü","%dC":"Ü","%DC":"Ü","%dd":"Ý","%Dd":"Ý","%dD":"Ý","%DD":"Ý","%de":"Þ","%De":"Þ","%dE":"Þ","%DE":"Þ","%df":"ß","%Df":"ß","%dF":"ß","%DF":"ß","%e0":"à","%E0":"à","%e1":"á","%E1":"á","%e2":"â","%E2":"â","%e3":"ã","%E3":"ã","%e4":"ä","%E4":"ä","%e5":"å","%E5":"å","%e6":"æ","%E6":"æ","%e7":"ç","%E7":"ç","%e8":"è","%E8":"è","%e9":"é","%E9":"é","%ea":"ê","%Ea":"ê","%eA":"ê","%EA":"ê","%eb":"ë","%Eb":"ë","%eB":"ë","%EB":"ë","%ec":"ì","%Ec":"ì","%eC":"ì","%EC":"ì","%ed":"í","%Ed":"í","%eD":"í","%ED":"í","%ee":"î","%Ee":"î","%eE":"î","%EE":"î","%ef":"ï","%Ef":"ï","%eF":"ï","%EF":"ï","%f0":"ð","%F0":"ð","%f1":"ñ","%F1":"ñ","%f2":"ò","%F2":"ò","%f3":"ó","%F3":"ó","%f4":"ô","%F4":"ô","%f5":"õ","%F5":"õ","%f6":"ö","%F6":"ö","%f7":"÷","%F7":"÷","%f8":"ø","%F8":"ø","%f9":"ù","%F9":"ù","%fa":"ú","%Fa":"ú","%fA":"ú","%FA":"ú","%fb":"û","%Fb":"û","%fB":"û","%FB":"û","%fc":"ü","%Fc":"ü","%fC":"ü","%FC":"ü","%fd":"ý","%Fd":"ý","%fD":"ý","%FD":"ý","%fe":"þ","%Fe":"þ","%fE":"þ","%FE":"þ","%ff":"ÿ","%Ff":"ÿ","%fF":"ÿ","%FF":"ÿ"};function encodedReplacer(e){return o[e]}const n=0;const i=1;const a=2;const c=3;function parseParams(e){const A=[];let t=n;let o="";let g=false;let l=false;let E=0;let u="";const h=e.length;for(var Q=0;Q {"use strict";var r;var s=";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";try{r=t(8167).Worker}catch(e){}var o={};o["default"]=r?function(e,A,t,o,n){var i=false;var a=new r(e+s,{eval:true}).on("error",(function(e){return n(e,null)})).on("message",(function(e){return n(null,e)})).on("exit",(function(e){if(e&&!i)n(new Error("exited with code "+e),null)}));a.postMessage(t,o);a.terminate=function(){i=true;return r.prototype.terminate.call(a)};return a}:function(e,A,t,r,s){setImmediate((function(){return s(new Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var NOP=function(){};return{terminate:NOP,postMessage:NOP}};var n=Uint8Array,i=Uint16Array,a=Int32Array;var c=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]);var g=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]);var l=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);var freb=function(e,A){var t=new i(31);for(var r=0;r<31;++r){t[r]=A+=1< >1|(I&21845)<<1;p=(p&52428)>>2|(p&13107)<<2;p=(p&61680)>>4|(p&3855)<<4;d[I]=((p&65280)>>8|(p&255)<<8)>>1}var hMap=function(e,A,t){var r=e.length;var s=0;var o=new i(A);for(;s >c]=g}}}}else{a=new i(r);for(s=0;s >15-e[s]}}}return a};var m=new n(288);for(var I=0;I<144;++I)m[I]=8;for(var I=144;I<256;++I)m[I]=9;for(var I=256;I<280;++I)m[I]=7;for(var I=280;I<288;++I)m[I]=8;var y=new n(32);for(var I=0;I<32;++I)y[I]=5;var b=hMap(m,9,0),R=hMap(m,9,1);var k=hMap(y,5,0),D=hMap(y,5,1);var max=function(e){var A=e[0];for(var t=1;t A)A=e[t]}return A};var bits=function(e,A,t){var r=A/8|0;return(e[r]|e[r+1]<<8)>>(A&7)&t};var bits16=function(e,A){var t=A/8|0;return(e[t]|e[t+1]<<8|e[t+2]<<16)>>(A&7)};var shft=function(e){return(e+7)/8|0};var slc=function(e,A,t){if(A==null||A<0)A=0;if(t==null||t>e.length)t=e.length;return new n(e.subarray(A,t))};A.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var S=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"];var err=function(e,A,t){var r=new Error(A||S[e]);r.code=e;if(Error.captureStackTrace)Error.captureStackTrace(r,err);if(!t)throw r;return r};var inflt=function(e,A,t,r){var s=e.length,o=r?r.length:0;if(!s||A.f&&!A.l)return t||new n(0);var i=!t;var a=i||A.i!=2;var E=A.i;if(i)t=new n(s*3);var cbuf=function(e){var A=t.length;if(e>A){var r=new n(Math.max(A*2,e));r.set(t);t=r}};var h=A.f||0,Q=A.p||0,B=A.b||0,d=A.l,I=A.d,p=A.m,m=A.n;var y=s*8;do{if(!d){h=bits(e,Q,1);var b=bits(e,Q+1,3);Q+=3;if(!b){var k=shft(Q)+4,S=e[k-4]|e[k-3]<<8,F=k+S;if(F>s){if(E)err(0);break}if(a)cbuf(B+S);t.set(e.subarray(k,F),B);A.b=B+=S,A.p=Q=F*8,A.f=h;continue}else if(b==1)d=R,I=D,p=9,m=5;else if(b==2){var T=bits(e,Q,31)+257,v=bits(e,Q+10,15)+4;var N=T+bits(e,Q+5,31)+1;Q+=14;var U=new n(N);var L=new n(19);for(var G=0;G >4;if(k<16){U[G++]=k}else{var P=0,Y=0;if(k==16)Y=3+bits(e,Q,3),Q+=2,P=U[G-1];else if(k==17)Y=3+bits(e,Q,7),Q+=3;else if(k==18)Y=11+bits(e,Q,127),Q+=7;while(Y--)U[G++]=P}}var J=U.subarray(0,T),V=U.subarray(T);p=max(J);m=max(V);d=hMap(J,p,1);I=hMap(V,m,1)}else err(1);if(Q>y){if(E)err(0);break}}if(a)cbuf(B+131072);var x=(1< >4;Q+=P&15;if(Q>y){if(E)err(0);break}if(!P)err(2);if(j<256)t[B++]=j;else if(j==256){W=Q,d=null;break}else{var z=j-254;if(j>264){var G=j-257,Z=c[G];z=bits(e,Q,(1<
>4;if(!X)err(3);Q+=X&15;var V=C[K];if(K>3){var Z=g[K];V+=bits16(e,Q)&(1< y){if(E)err(0);break}if(a)cbuf(B+131072);var $=B+z;if(B >8};var wbits16=function(e,A,t){t<<=A&7;var r=A/8|0;e[r]|=t;e[r+1]|=t>>8;e[r+2]|=t>>16};var hTree=function(e,A){var t=[];for(var r=0;r h)h=o[r].s}var Q=new i(h+1);var C=ln(t[E-1],Q,0);if(C>A){var r=0,B=0;var d=C-A,I=1< A){B+=I-(1< >=d;while(B>0){var m=o[r].s;if(Q[m]=0&&B;--r){var y=o[r].s;if(Q[y]==A){--Q[y];++B}}C=A}return{t:new n(Q),l:C}};var ln=function(e,A,t){return e.s==-1?Math.max(ln(e.l,A,t+1),ln(e.r,A,t+1)):A[e.s]=t};var lc=function(e){var A=e.length;while(A&&!e[--A]);var t=new i(++A);var r=0,s=e[0],o=1;var w=function(e){t[r++]=e};for(var n=1;n<=A;++n){if(e[n]==s&&n!=A)++o;else{if(!s&&o>2){for(;o>138;o-=138)w(32754);if(o>2){w(o>10?o-11<<5|28690:o-3<<5|12305);o=0}}else if(o>3){w(s),--o;for(;o>6;o-=6)w(8304);if(o>2)w(o-3<<5|8208),o=0}while(o--)w(s);o=1;s=e[n]}}return{c:t.subarray(0,r),n:A}};var clen=function(e,A){var t=0;for(var r=0;r >8;e[s+2]=e[s]^255;e[s+3]=e[s+1]^255;for(var o=0;o 4&&!G[l[_-1]];--_);var O=u+5<<3;var H=clen(s,m)+clen(o,y)+n;var P=clen(s,C)+clen(o,I)+n+14+3*_+clen(N,G)+2*N[16]+3*N[17]+7*N[18];if(E>=0&&O<=H&&O<=P)return wfblk(A,h,e.subarray(E,E+u));var Y,J,V,x;wbits(A,h,1+(P 15)wbits(A,h,z[U]>>5&127),h+=z[U]>>12}}}else{Y=b,J=m,V=k,x=y}for(var U=0;U255){var Z=X>>18&31;wbits16(A,h,Y[Z+257]),h+=J[Z+257];if(Z>7)wbits(A,h,X>>23&31),h+=c[Z];var K=X&31;wbits16(A,h,V[K]),h+=x[K];if(K>3)wbits16(A,h,X>>5&8191),h+=g[K]}else{wbits16(A,h,Y[X]),h+=J[X]}}wbits16(A,h,Y[256]);return h+J[256]};var F=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]);var T=new n(0);var dflt=function(e,A,t,r,s,o){var l=o.z||e.length;var E=new n(r+l+5*(1+Math.ceil(l/7e3))+s);var u=E.subarray(r,E.length-s);var Q=o.l;var C=(o.r||0)&7;if(A){if(C)u[0]=o.r>>3;var d=F[A-1];var I=d>>13,p=d&8191;var m=(1< 7e3||L>24576)&&(P>423||!Q)){C=wblk(e,u,0,D,S,T,N,L,M,U-M,C);L=v=N=0,M=U;for(var Y=0;Y<286;++Y)S[Y]=0;for(var Y=0;Y<30;++Y)T[Y]=0}var J=2,V=0,x=p,q=O-H&32767;if(P>2&&_==hsh(U-q)){var W=Math.min(I,P)-1;var j=Math.min(32767,U);var z=Math.min(258,P);while(q<=j&&--x&&O!=H){if(e[U+J]==e[U+J-q]){var Z=0;for(;Z J){J=Z,V=q;if(Z>W)break;var X=Math.min(q,Z-2);var K=0;for(var Y=0;Y K)K=Ae,H=$}}}O=H,H=y[O];q+=O-H&32767}}if(V){D[L++]=268435456|h[J]<<18|B[V];var te=h[J]&31,re=B[V]&31;N+=c[te]+g[re];++S[257+te];++T[re];G=U+J;++v}else{D[L++]=e[U];++S[e[U]]}}}for(U=Math.max(U,G);U =l){u[C/8|0]=Q;se=l}C=wfblk(u,C+1,e.subarray(U,se))}o.i=l}return slc(E,0,r+shft(C)+s)};var v=function(){var e=new Int32Array(256);for(var A=0;A<256;++A){var t=A,r=9;while(--r)t=(t&1&&-306674912)^t>>>1;e[A]=t}return e}();var crc=function(){var e=-1;return{p:function(A){var t=e;for(var r=0;r >>8;e=t},d:function(){return~e}}};var adler=function(){var e=1,A=0;return{p:function(t){var r=e,s=A;var o=t.length|0;for(var n=0;n!=o;){var i=Math.min(n+2655,o);for(;n>16),s=(s&65535)+15*(s>>16)}e=r,A=s},d:function(){e%=65521,A%=65521;return(e&255)<<24|(e&65280)<<8|(A&255)<<8|A>>8}}};var dopt=function(e,A,t,r,s){if(!s){s={l:1};if(A.dictionary){var o=A.dictionary.subarray(-32768);var i=new n(o.length+e.length);i.set(o);i.set(e,o.length);e=i;s.w=o.length}}return dflt(e,A.level==null?6:A.level,A.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+A.mem,t,r,s)};var mrg=function(e,A){var t={};for(var r in e)t[r]=e[r];for(var r in A)t[r]=A[r];return t};var wcln=function(e,A,t){var r=e();var s=e.toString();var o=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(",");for(var n=0;n >>0};var b8=function(e,A){return b4(e,A)+b4(e,A+4)*4294967296};var wbytes=function(e,A,t){for(;t;++A)e[A]=t,t>>>=8};var gzh=function(e,A){var t=A.filename;e[0]=31,e[1]=139,e[2]=8,e[8]=A.level<2?4:A.level==9?2:0,e[9]=3;if(A.mtime!=0)wbytes(e,4,Math.floor(new Date(A.mtime||Date.now())/1e3));if(t){e[3]=8;for(var r=0;r<=t.length;++r)e[r+10]=t.charCodeAt(r)}};var gzs=function(e){if(e[0]!=31||e[1]!=139||e[2]!=8)err(6,"invalid gzip data");var A=e[3];var t=10;if(A&4)t+=(e[10]|e[11]<<8)+2;for(var r=(A>>3&1)+(A>>4&1);r>0;r-=!e[t++]);return t+(A&2)};var gzl=function(e){var A=e.length;return(e[A-4]|e[A-3]<<8|e[A-2]<<16|e[A-1]<<24)>>>0};var gzhl=function(e){return 10+(e.filename?e.filename.length+1:0)};var zlh=function(e,A){var t=A.level,r=t==0?0:t<6?1:t==9?3:2;e[0]=120,e[1]=r<<6|(A.dictionary&&32);e[1]|=31-(e[0]<<8|e[1])%31;if(A.dictionary){var s=adler();s.p(A.dictionary);wbytes(e,2,s.d())}};var zls=function(e,A){if((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)err(6,"invalid zlib data");if((e[1]>>5&1)==+!A)err(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary");return(e[1]>>3&4)+2};function StrmOpt(e,A){if(typeof e=="function")A=e,e={};this.ondata=A;return e}var U=function(){function Deflate(e,A){if(typeof e=="function")A=e,e={};this.ondata=A;this.o=e||{};this.s={l:0,i:32768,w:32768,z:32768};this.b=new n(98304);if(this.o.dictionary){var t=this.o.dictionary.subarray(-32768);this.b.set(t,32768-t.length);this.s.i=32768-t.length}}Deflate.prototype.p=function(e,A){this.ondata(dopt(e,this.o,0,0,this.s),A)};Deflate.prototype.push=function(e,A){if(!this.ondata)err(5);if(this.s.l)err(4);var t=e.length+this.s.z;if(t>this.b.length){if(t>2*this.b.length-32768){var r=new n(t&-32768);r.set(this.b.subarray(0,this.s.z));this.b=r}var s=this.b.length-this.s.z;this.b.set(e.subarray(0,s),this.s.z);this.s.z=this.b.length;this.p(this.b,false);this.b.set(this.b.subarray(-32768));this.b.set(e.subarray(s),32768);this.s.z=e.length-s+32768;this.s.i=32766,this.s.w=32768}else{this.b.set(e,this.s.z);this.s.z+=e.length}this.s.l=A&1;if(this.s.z>this.s.w+8191||A){this.p(this.b,A||false);this.s.w=this.s.i,this.s.i-=2}};Deflate.prototype.flush=function(){if(!this.ondata)err(5);if(this.s.l)err(4);this.p(this.b,false);this.s.w=this.s.i,this.s.i-=2};return Deflate}();A.Deflate=U;var L=function(){function AsyncDeflate(e,A){astrmify([bDflt,function(){return[astrm,U]}],this,StrmOpt.call(this,e,A),(function(e){var A=new U(e.data);onmessage=astrm(A)}),6,1)}return AsyncDeflate}();A.AsyncDeflate=L;function deflate(e,A,t){if(!t)t=A,A={};if(typeof t!="function")err(7);return cbify(e,A,[bDflt],(function(e){return pbf(deflateSync(e.data[0],e.data[1]))}),0,t)}A.deflate=deflate;function deflateSync(e,A){return dopt(e,A||{},0,0)}A.deflateSync=deflateSync;var G=function(){function Inflate(e,A){if(typeof e=="function")A=e,e={};this.ondata=A;var t=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:t?t.length:0};this.o=new n(32768);this.p=new n(0);if(t)this.o.set(t)}Inflate.prototype.e=function(e){if(!this.ondata)err(5);if(this.d)err(4);if(!this.p.length)this.p=e;else if(e.length){var A=new n(this.p.length+e.length);A.set(this.p),A.set(e,this.p.length),this.p=A}};Inflate.prototype.c=function(e){this.s.i=+(this.d=e||false);var A=this.s.b;var t=inflt(this.p,this.s,this.o);this.ondata(slc(t,A,this.s.b),this.d);this.o=slc(t,this.s.b-32768),this.s.b=this.o.length;this.p=slc(this.p,this.s.p/8|0),this.s.p&=7};Inflate.prototype.push=function(e,A){this.e(e),this.c(A)};return Inflate}();A.Inflate=G;var M=function(){function AsyncInflate(e,A){astrmify([bInflt,function(){return[astrm,G]}],this,StrmOpt.call(this,e,A),(function(e){var A=new G(e.data);onmessage=astrm(A)}),7,0)}return AsyncInflate}();A.AsyncInflate=M;function inflate(e,A,t){if(!t)t=A,A={};if(typeof t!="function")err(7);return cbify(e,A,[bInflt],(function(e){return pbf(inflateSync(e.data[0],gopt(e.data[1])))}),1,t)}A.inflate=inflate;function inflateSync(e,A){return inflt(e,{i:2},A&&A.out,A&&A.dictionary)}A.inflateSync=inflateSync;var _=function(){function Gzip(e,A){this.c=crc();this.l=0;this.v=1;U.call(this,e,A)}Gzip.prototype.push=function(e,A){this.c.p(e);this.l+=e.length;U.prototype.push.call(this,e,A)};Gzip.prototype.p=function(e,A){var t=dopt(e,this.o,this.v&&gzhl(this.o),A&&8,this.s);if(this.v)gzh(t,this.o),this.v=0;if(A)wbytes(t,t.length-8,this.c.d()),wbytes(t,t.length-4,this.l);this.ondata(t,A)};Gzip.prototype.flush=function(){U.prototype.flush.call(this)};return Gzip}();A.Gzip=_;A.Compress=_;var O=function(){function AsyncGzip(e,A){astrmify([bDflt,gze,function(){return[astrm,U,_]}],this,StrmOpt.call(this,e,A),(function(e){var A=new _(e.data);onmessage=astrm(A)}),8,1)}return AsyncGzip}();A.AsyncGzip=O;A.AsyncCompress=O;function gzip(e,A,t){if(!t)t=A,A={};if(typeof t!="function")err(7);return cbify(e,A,[bDflt,gze,function(){return[gzipSync]}],(function(e){return pbf(gzipSync(e.data[0],e.data[1]))}),2,t)}A.gzip=gzip;A.compress=gzip;function gzipSync(e,A){if(!A)A={};var t=crc(),r=e.length;t.p(e);var s=dopt(e,A,gzhl(A),8),o=s.length;return gzh(s,A),wbytes(s,o-8,t.d()),wbytes(s,o-4,r),s}A.gzipSync=gzipSync;A.compressSync=gzipSync;var H=function(){function Gunzip(e,A){this.v=1;this.r=0;G.call(this,e,A)}Gunzip.prototype.push=function(e,A){G.prototype.e.call(this,e);this.r+=e.length;if(this.v){var t=this.p.subarray(this.v-1);var r=t.length>3?gzs(t):4;if(r>t.length){if(!A)return}else if(this.v>1&&this.onmember){this.onmember(this.r-t.length)}this.p=t.subarray(r),this.v=0}G.prototype.c.call(this,A);if(this.s.f&&!this.s.l&&!A){this.v=shft(this.s.p)+9;this.s={i:0};this.o=new n(0);this.push(new n(0),A)}};return Gunzip}();A.Gunzip=H;var P=function(){function AsyncGunzip(e,A){var t=this;astrmify([bInflt,guze,function(){return[astrm,G,H]}],this,StrmOpt.call(this,e,A),(function(e){var A=new H(e.data);A.onmember=function(e){return postMessage(e)};onmessage=astrm(A)}),9,0,(function(e){return t.onmember&&t.onmember(e)}))}return AsyncGunzip}();A.AsyncGunzip=P;function gunzip(e,A,t){if(!t)t=A,A={};if(typeof t!="function")err(7);return cbify(e,A,[bInflt,guze,function(){return[gunzipSync]}],(function(e){return pbf(gunzipSync(e.data[0],e.data[1]))}),3,t)}A.gunzip=gunzip;function gunzipSync(e,A){var t=gzs(e);if(t+8>e.length)err(6,"invalid gzip data");return inflt(e.subarray(t,-8),{i:2},A&&A.out||new n(gzl(e)),A&&A.dictionary)}A.gunzipSync=gunzipSync;var Y=function(){function Zlib(e,A){this.c=adler();this.v=1;U.call(this,e,A)}Zlib.prototype.push=function(e,A){this.c.p(e);U.prototype.push.call(this,e,A)};Zlib.prototype.p=function(e,A){var t=dopt(e,this.o,this.v&&(this.o.dictionary?6:2),A&&4,this.s);if(this.v)zlh(t,this.o),this.v=0;if(A)wbytes(t,t.length-4,this.c.d());this.ondata(t,A)};Zlib.prototype.flush=function(){U.prototype.flush.call(this)};return Zlib}();A.Zlib=Y;var J=function(){function AsyncZlib(e,A){astrmify([bDflt,zle,function(){return[astrm,U,Y]}],this,StrmOpt.call(this,e,A),(function(e){var A=new Y(e.data);onmessage=astrm(A)}),10,1)}return AsyncZlib}();A.AsyncZlib=J;function zlib(e,A,t){if(!t)t=A,A={};if(typeof t!="function")err(7);return cbify(e,A,[bDflt,zle,function(){return[zlibSync]}],(function(e){return pbf(zlibSync(e.data[0],e.data[1]))}),4,t)}A.zlib=zlib;function zlibSync(e,A){if(!A)A={};var t=adler();t.p(e);var r=dopt(e,A,A.dictionary?6:2,4);return zlh(r,A),wbytes(r,r.length-4,t.d()),r}A.zlibSync=zlibSync;var V=function(){function Unzlib(e,A){G.call(this,e,A);this.v=e&&e.dictionary?2:1}Unzlib.prototype.push=function(e,A){G.prototype.e.call(this,e);if(this.v){if(this.p.length<6&&!A)return;this.p=this.p.subarray(zls(this.p,this.v-1)),this.v=0}if(A){if(this.p.length<4)err(6,"invalid zlib data");this.p=this.p.subarray(0,-4)}G.prototype.c.call(this,A)};return Unzlib}();A.Unzlib=V;var x=function(){function AsyncUnzlib(e,A){astrmify([bInflt,zule,function(){return[astrm,G,V]}],this,StrmOpt.call(this,e,A),(function(e){var A=new V(e.data);onmessage=astrm(A)}),11,0)}return AsyncUnzlib}();A.AsyncUnzlib=x;function unzlib(e,A,t){if(!t)t=A,A={};if(typeof t!="function")err(7);return cbify(e,A,[bInflt,zule,function(){return[unzlibSync]}],(function(e){return pbf(unzlibSync(e.data[0],gopt(e.data[1])))}),5,t)}A.unzlib=unzlib;function unzlibSync(e,A){return inflt(e.subarray(zls(e,A&&A.dictionary),-4),{i:2},A&&A.out,A&&A.dictionary)}A.unzlibSync=unzlibSync;var q=function(){function Decompress(e,A){this.o=StrmOpt.call(this,e,A)||{};this.G=H;this.I=G;this.Z=V}Decompress.prototype.i=function(){var e=this;this.s.ondata=function(A,t){e.ondata(A,t)}};Decompress.prototype.push=function(e,A){if(!this.ondata)err(5);if(!this.s){if(this.p&&this.p.length){var t=new n(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length)}else this.p=e;if(this.p.length>2){this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o);this.i();this.s.push(this.p,A);this.p=null}}else this.s.push(e,A)};return Decompress}();A.Decompress=q;var W=function(){function AsyncDecompress(e,A){q.call(this,e,A);this.queuedSize=0;this.G=P;this.I=M;this.Z=x}AsyncDecompress.prototype.i=function(){var e=this;this.s.ondata=function(A,t,r){e.ondata(A,t,r)};this.s.ondrain=function(A){e.queuedSize-=A;if(e.ondrain)e.ondrain(A)}};AsyncDecompress.prototype.push=function(e,A){this.queuedSize+=e.length;q.prototype.push.call(this,e,A)};return AsyncDecompress}();A.AsyncDecompress=W;function decompress(e,A,t){if(!t)t=A,A={};if(typeof t!="function")err(7);return e[0]==31&&e[1]==139&&e[2]==8?gunzip(e,A,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?inflate(e,A,t):unzlib(e,A,t)}A.decompress=decompress;function decompressSync(e,A){return e[0]==31&&e[1]==139&&e[2]==8?gunzipSync(e,A):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?inflateSync(e,A):unzlibSync(e,A)}A.decompressSync=decompressSync;var fltn=function(e,A,t,r){for(var s in e){var o=e[s],i=A+s,a=r;if(Array.isArray(o))a=mrg(r,o[1]),o=o[0];if(o instanceof n)t[i]=[o,a];else{t[i+="/"]=[new n(0),a];fltn(o,i,t,r)}}};var j=typeof TextEncoder!="undefined"&&new TextEncoder;var z=typeof TextDecoder!="undefined"&&new TextDecoder;var Z=0;try{z.decode(T,{stream:true});Z=1}catch(e){}var dutf8=function(e){for(var A="",t=0;;){var r=e[t++];var s=(r>127)+(r>223)+(r>239);if(t+s>e.length)return{s:A,r:slc(e,t-1)};if(!s)A+=String.fromCharCode(r);else if(s==3){r=((r&15)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,A+=String.fromCharCode(55296|r>>10,56320|r&1023)}else if(s&1)A+=String.fromCharCode((r&31)<<6|e[t++]&63);else A+=String.fromCharCode((r&15)<<12|(e[t++]&63)<<6|e[t++]&63)}};var X=function(){function DecodeUTF8(e){this.ondata=e;if(Z)this.t=new TextDecoder;else this.p=T}DecodeUTF8.prototype.push=function(e,A){if(!this.ondata)err(5);A=!!A;if(this.t){this.ondata(this.t.decode(e,{stream:true}),A);if(A){if(this.t.decode().length)err(8);this.t=null}return}if(!this.p)err(4);var t=new n(this.p.length+e.length);t.set(this.p);t.set(e,this.p.length);var r=dutf8(t),s=r.s,o=r.r;if(A){if(o.length)err(8);this.p=null}else this.p=o;this.ondata(s,A)};return DecodeUTF8}();A.DecodeUTF8=X;var K=function(){function EncodeUTF8(e){this.ondata=e}EncodeUTF8.prototype.push=function(e,A){if(!this.ondata)err(5);if(this.d)err(4);this.ondata(strToU8(e),this.d=A||false)};return EncodeUTF8}();A.EncodeUTF8=K;function strToU8(e,A){if(A){var t=new n(e.length);for(var r=0;r >1));var i=0;var w=function(e){o[i++]=e};for(var r=0;r o.length){var a=new n(i+8+(s-r<<1));a.set(o);o=a}var c=e.charCodeAt(r);if(c<128||A)w(c);else if(c<2048)w(192|c>>6),w(128|c&63);else if(c>55295&&c<57344)c=65536+(c&1023<<10)|e.charCodeAt(++r)&1023,w(240|c>>18),w(128|c>>12&63),w(128|c>>6&63),w(128|c&63);else w(224|c>>12),w(128|c>>6&63),w(128|c&63)}return slc(o,0,i)}A.strToU8=strToU8;function strFromU8(e,A){if(A){var t="";for(var r=0;r65535)err(9);A+=r+4}}return A};var wzh=function(e,A,t,r,s,o,n,i){var a=r.length,c=t.extra,g=i&&i.length;var l=exfl(c);wbytes(e,A,n!=null?33639248:67324752),A+=4;if(n!=null)e[A++]=20,e[A++]=t.os;e[A]=20,A+=2;e[A++]=t.flag<<1|(o<0&&8),e[A++]=s&&8;e[A++]=t.compression&255,e[A++]=t.compression>>8;var E=new Date(t.mtime==null?Date.now():t.mtime),u=E.getFullYear()-1980;if(u<0||u>119)err(10);wbytes(e,A,u<<25|E.getMonth()+1<<21|E.getDate()<<16|E.getHours()<<11|E.getMinutes()<<5|E.getSeconds()>>1),A+=4;if(o!=-1){wbytes(e,A,t.crc);wbytes(e,A+4,o<0?-o-2:o);wbytes(e,A+8,t.size)}wbytes(e,A+12,a);wbytes(e,A+14,l),A+=16;if(n!=null){wbytes(e,A,g);wbytes(e,A+6,t.attrs);wbytes(e,A+10,n),A+=14}e.set(r,A);A+=a;if(l){for(var h in c){var Q=c[h],C=Q.length;wbytes(e,A,+h);wbytes(e,A+2,C);e.set(Q,A+4),A+=4+C}}if(g)e.set(i,A),A+=g;return A};var wzf=function(e,A,t,r,s){wbytes(e,A,101010256);wbytes(e,A+8,t);wbytes(e,A+10,t);wbytes(e,A+12,r);wbytes(e,A+16,s)};var $=function(){function ZipPassThrough(e){this.filename=e;this.c=crc();this.size=0;this.compression=0}ZipPassThrough.prototype.process=function(e,A){this.ondata(null,e,A)};ZipPassThrough.prototype.push=function(e,A){if(!this.ondata)err(5);this.c.p(e);this.size+=e.length;if(A)this.crc=this.c.d();this.process(e,A||false)};return ZipPassThrough}();A.ZipPassThrough=$;var ee=function(){function ZipDeflate(e,A){var t=this;if(!A)A={};$.call(this,e);this.d=new U(A,(function(e,A){t.ondata(null,e,A)}));this.compression=8;this.flag=dbf(A.level)}ZipDeflate.prototype.process=function(e,A){try{this.d.push(e,A)}catch(e){this.ondata(e,null,A)}};ZipDeflate.prototype.push=function(e,A){$.prototype.push.call(this,e,A)};return ZipDeflate}();A.ZipDeflate=ee;var Ae=function(){function AsyncZipDeflate(e,A){var t=this;if(!A)A={};$.call(this,e);this.d=new L(A,(function(e,A,r){t.ondata(e,A,r)}));this.compression=8;this.flag=dbf(A.level);this.terminate=this.d.terminate}AsyncZipDeflate.prototype.process=function(e,A){this.d.push(e,A)};AsyncZipDeflate.prototype.push=function(e,A){$.prototype.push.call(this,e,A)};return AsyncZipDeflate}();A.AsyncZipDeflate=Ae;var te=function(){function Zip(e){this.ondata=e;this.u=[];this.d=1}Zip.prototype.add=function(e){var A=this;if(!this.ondata)err(5);if(this.d&2)this.ondata(err(4+(this.d&1)*8,0,1),null,false);else{var t=strToU8(e.filename),r=t.length;var s=e.comment,o=s&&strToU8(s);var i=r!=e.filename.length||o&&s.length!=o.length;var a=r+exfl(e.extra)+30;if(r>65535)this.ondata(err(11,0,1),null,false);var c=new n(a);wzh(c,0,e,t,i,-1);var g=[c];var pAll_1=function(){for(var e=0,t=g;e 65535)cbl(err(11,0,1),null);if(!p)cbl(null,n);else if(u<16e4){try{cbl(null,deflateSync(n,c))}catch(e){cbl(e,null)}}else l.push(deflate(n,c,cbl))};for(var E=0;E 65535)err(11);var d=l?deflateSync(c,g):c,I=d.length;var p=crc();p.p(c);r.push(mrg(g,{size:c.length,crc:p.d(),c:d,f:E,m:Q,u:u!=i.length||Q&&h.length!=C,o:s,compression:l}));s+=30+u+B+I;o+=76+2*(u+B)+(C||0)+I}var m=new n(o+22),y=s,b=o-s;for(var R=0;R 0){var r=Math.min(this.c,e.length);var s=e.subarray(0,r);this.c-=r;if(this.d)this.d.push(s,!this.c);else this.k[0].push(s);e=e.subarray(r);if(e.length)return this.push(e,A)}else{var o=0,i=0,a=void 0,c=void 0;if(!this.p.length)c=e;else if(!e.length)c=this.p;else{c=new n(this.p.length+e.length);c.set(this.p),c.set(e,this.p.length)}var g=c.length,l=this.c,E=l&&this.d;var _loop_2=function(){var e;var A=b4(c,i);if(A==67324752){o=1,a=i;u.d=null;u.c=0;var r=b2(c,i+6),s=b2(c,i+8),n=r&2048,E=r&8,h=b2(c,i+26),Q=b2(c,i+28);if(g>i+30+h+Q){var C=[];u.k.unshift(C);o=2;var B=b4(c,i+18),d=b4(c,i+22);var I=strFromU8(c.subarray(i+30,i+=30+h),!n);if(B==4294967295){e=E?[-2]:z64e(c,i),B=e[0],d=e[1]}else if(E)B=-1;i+=Q;u.c=B;var p;var m={name:I,compression:s,start:function(){if(!m.ondata)err(5);if(!B)m.ondata(null,T,true);else{var e=t.o[s];if(!e)m.ondata(err(14,"unknown compression type "+s,1),null,false);p=B<0?new e(I):new e(I,B,d);p.ondata=function(e,A,t){m.ondata(e,A,t)};for(var A=0,r=C;A =0)m.size=B,m.originalSize=d;u.onfile(m)}return"break"}else if(l){if(A==134695760){a=i+=12+(l==-2&&8),o=3,u.c=0;return"break"}else if(A==33639248){a=i-=4,o=3,u.c=0;return"break"}}};var u=this;for(;i 65558){cbd(err(13,0,1),null);return tAll}}var i=b2(e,o+8);if(i){var a=i;var c=b4(e,o+16);var g=c==4294967295||a==65535;if(g){var l=b4(e,o-12);g=b4(e,l)==101075792;if(g){a=i=b4(e,l+32);c=b4(e,l+48)}}var E=A&&A.filter;var _loop_3=function(A){var t=zh(e,c,g),o=t[0],a=t[1],l=t[2],u=t[3],h=t[4],Q=t[5],C=slzh(e,Q);c=h;var cbl=function(e,A){if(e){tAll();cbd(e,null)}else{if(A)s[u]=A;if(! --i)cbd(null,s)}};if(!E||E({name:u,size:a,originalSize:l,compression:o})){if(!o)cbl(null,slc(e,C,C+a));else if(o==8){var B=e.subarray(C,C+a);if(l<524288||a>.8*l){try{cbl(null,inflateSync(B,{out:new n(l)}))}catch(e){cbl(e,null)}}else r.push(inflate(B,{size:l},cbl))}else cbl(err(14,"unknown compression type "+o,1),null)}else cbl(null,null)};for(var u=0;u65558)err(13)}var s=b2(e,r+8);if(!s)return{};var o=b4(e,r+16);var i=o==4294967295||s==65535;if(i){var a=b4(e,r-12);i=b4(e,a)==101075792;if(i){s=b4(e,a+32);o=b4(e,a+48)}}var c=A&&A.filter;for(var g=0;g 0 - ? Math.round((tokens.cacheReadTokens / (tokens.cacheReadTokens + tokens.inputTokens)) * 100) - : 0; + totalPromptTokens > 0 ? Math.round((tokens.cacheReadTokens / totalPromptTokens) * 100) : 0; const pricing = getPricing({ apiPricing, model }); const perM = (count: number, pricePerM: number | null | undefined): string => {