@legit-sdk/assistant-ui 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +120 -2
- package/dist/server.js +2 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,123 @@
|
|
|
1
1
|
// @legit-sdk/assistant-ui bundle (ESM)
|
|
2
2
|
// Generated by esbuild
|
|
3
3
|
|
|
4
|
-
var ve=Object.defineProperty;var Ee=r=>{throw TypeError(r)};var lt=(r,e,t)=>e in r?ve(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e)=>ve(r,"name",{value:e,configurable:!0});var u=(r,e,t)=>lt(r,typeof e!="symbol"?e+"":e,t),Me=(r,e,t)=>e.has(r)||Ee("Cannot "+t);var G=(r,e,t)=>(Me(r,e,"read from private field"),t?t.call(r):e.get(r)),K=(r,e,t)=>e.has(r)?Ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),V=(r,e,t,o)=>(Me(r,e,"write to private field"),o?o.call(r,t):e.set(r,t),t);var Oe=a(r=>{try{let t=r.split(".")[1];if(!t)throw new Error("Invalid JWT format");let o=t.replace(/-/g,"+").replace(/_/g,"/");for(;o.length%4!==0;)o+="=";let s=atob(o),i=JSON.parse(s).exp;if(!i||typeof i!="number")throw new Error('JWT does not contain a valid "exp" field');return i*1e3}catch(e){throw new Error("Unable to determine the token expiry: "+e)}},"getJwtExpiry"),Q,C,ge=(C=class{constructor(e){u(this,"strategy","jwt");u(this,"cachedToken",null);u(this,"tokenExpiry",null);K(this,Q);V(this,Q,e)}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>30*1e3)return{Authorization:`Bearer ${this.cachedToken}`};let t=await G(this,Q).call(this);return t?(this.cachedToken=t,this.tokenExpiry=Oe(t),{Authorization:`Bearer ${t}`}):!1}readAuthHeaders(e){let t=e.get("Authorization");if(!t)return;let[o,s]=t.split(" ");if(o!=="Bearer"||!s)throw new Error("Invalid auth header received");this.cachedToken=s,this.tokenExpiry=Oe(s)}},Q=new WeakMap,a(C,"AssistantCloudJWTAuthStrategy"),C),X,Y,Z,A,Fe=(A=class{constructor(e,t,o){u(this,"strategy","api-key");K(this,X);K(this,Y);K(this,Z);V(this,X,e),V(this,Y,t),V(this,Z,o)}async getAuthHeaders(){return{Authorization:`Bearer ${G(this,X)}`,"Aui-User-Id":G(this,Y),"Aui-Workspace-Id":G(this,Z)}}readAuthHeaders(){}},X=new WeakMap,Y=new WeakMap,Z=new WeakMap,a(A,"AssistantCloudAPIKeyAuthStrategy"),A),oe="aui:refresh_token",S,De=(S=class{constructor(e){u(this,"strategy","anon");u(this,"baseUrl");u(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new ge(async()=>{let t=Date.now(),o=localStorage.getItem(oe),s=o?JSON.parse(o):void 0;if(s)if(new Date(s.expires_at).getTime()-t>30*1e3){let T=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:s.token})});if(T.ok){let z=await T.json(),{access_token:m,refresh_token:h}=z;return h&&localStorage.setItem(oe,JSON.stringify(h)),m}}else localStorage.removeItem(oe);let l=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!l.ok)return null;let i=await l.json(),{access_token:n,refresh_token:c}=i;return!n||!c?null:(localStorage.setItem(oe,JSON.stringify(c)),n)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},a(S,"AssistantCloudAnonymousAuthStrategy"),S);var _,ct=(_=class extends Error{constructor(e){super(e),this.name="APIError"}},a(_,"CloudAPIError"),_),b,qe=(b=class{constructor(e){u(this,"_auth");u(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new ge(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new Fe(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new De(e.baseUrl);else throw new Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,t={}){let o=await this._auth.getAuthHeaders();if(!o)throw new Error("Authorization failed");let s={...o,...t.headers,"Content-Type":"application/json"},l=new URLSearchParams;if(t.query)for(let[c,d]of Object.entries(t.query))d!==!1&&(d===!0?l.set(c,"true"):l.set(c,d.toString()));let i=new URL(`${this._baseUrl}/v1${e}`);i.search=l.toString();let n=await fetch(i,{method:t.method??"GET",headers:s,body:t.body?JSON.stringify(t.body):null});if(this._auth.readAuthHeaders(n.headers),!n.ok){let c=await n.text();try{let d=JSON.parse(c);throw new ct(d.message)}catch{throw new Error(`Request failed with status ${n.status}, ${c}`)}}return n}async makeRequest(e,t={}){return(await this.makeRawRequest(e,t)).json()}},a(b,"AssistantCloudAPI"),b);var R,Le=(R=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},a(R,"AssistantCloudAuthTokens"),R);var g={toResponse(r,e){return new Response(g.toByteStream(r,e),{headers:e.headers??{}})},fromResponse(r,e){return g.fromByteStream(r.body,e)},toByteStream(r,e){return r.pipeThrough(e)},fromByteStream(r,e){return r.pipeThrough(e)}};var ne=a(function(){let r,e,t=new Promise((o,s)=>{r=o,e=s});if(!r||!e)throw new Error("Failed to create promise");return{promise:t,resolve:r,reject:e}},"promiseWithResolvers");var Ne=a(()=>{let r=[],e=!1,t,o,s=a(i=>{i.promise||(i.promise=i.reader.read().then(({done:n,value:c})=>{i.promise=void 0,n?(r.splice(r.indexOf(i),1),e&&r.length===0&&t.close()):t.enqueue(c),o?.resolve(),o=void 0}).catch(n=>{console.error(n),r.forEach(c=>{c.reader.cancel()}),r.length=0,t.error(n),o?.reject(n),o=void 0}))},"handlePull");return{readable:new ReadableStream({start(i){t=i},pull(){return o=ne(),r.forEach(i=>{s(i)}),o.promise},cancel(){r.forEach(i=>{i.reader.cancel()}),r.length=0}}),isSealed(){return e},seal(){e=!0,r.length===0&&t.close()},addStream(i){if(e)throw new Error("Cannot add streams after the run callback has settled.");let n={reader:i.getReader()};r.push(n),s(n)},enqueue(i){this.addStream(new ReadableStream({start(n){n.enqueue(i),n.close()}}))}}},"createMergeStream");var k,Ue=(k=class{constructor(e){u(this,"_controller");u(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},a(k,"TextStreamControllerImpl"),k),ye=a(r=>new ReadableStream({start(e){return r.start?.(new Ue(e))},pull(e){return r.pull?.(new Ue(e))},cancel(e){return r.cancel?.(e)}}),"createTextStream"),we=a(()=>{let r;return[ye({start(t){r=t}}),r]},"createTextStreamController");var P,$e=(P=class{constructor(e){u(this,"_isClosed",!1);u(this,"_mergeTask");u(this,"_argsTextController");this._controller=e;let t=ye({start:a(s=>{this._argsTextController=s},"start")}),o=!1;this._mergeTask=t.pipeTo(new WritableStream({write:a(s=>{switch(s.type){case"text-delta":o=!0,this._controller.enqueue(s);break;case"part-finish":o||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${s.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},a(P,"ToolCallStreamControllerImpl"),P),ut=a(r=>new ReadableStream({start(e){return r.start?.(new $e(e))},pull(e){return r.pull?.(new $e(e))},cancel(e){return r.cancel?.(e)}}),"createToolCallStream"),He=a(()=>{let r;return[ut({start(t){r=t}}),r]},"createToolCallStreamController");var I,ie=(I=class{constructor(){u(this,"value",-1)}up(){return++this.value}},a(I,"Counter"),I);var v,Je=(v=class extends TransformStream{constructor(e){super({transform(t,o){o.enqueue({...t,path:[e,...t.path]})}})}},a(v,"PathAppendEncoder"),v),E,er=(E=class extends TransformStream{constructor(e){super({transform(t,o){let{path:[s,...l]}=t;if(e!==s)throw new Error(`Path mismatch: expected ${e}, got ${s}`);o.enqueue({...t,path:l})}})}},a(E,"PathAppendDecoder"),E),M,je=(M=class extends TransformStream{constructor(e){let t=new ie,o=new Map;super({transform(s,l){s.type==="part-start"&&s.path.length===0&&o.set(t.up(),e.up());let[i,...n]=s.path;if(i===void 0){l.enqueue(s);return}let c=o.get(i);if(c===void 0)throw new Error("Path not found");l.enqueue({...s,path:[c,...n]})}})}},a(M,"PathMergeEncoder"),M);var O,Be=(O=class extends TransformStream{constructor(e,t,o){let[s,l]=ee(),i;super({start(n){return i=s.pipeTo(new WritableStream({write(c){n.enqueue(c)},abort(c){n.error(c)},close(){n.terminate()}})).catch(c=>{n.error(c)}),e.start?.(l)},transform(n){return e.transform?.(n,l)},async flush(){await e.flush?.(l),l.close(),await i}},t,o)}},a(O,"AssistantTransformStream"),O);var F,le=(F=class extends TransformStream{constructor(e){super();let t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},a(F,"PipeableTransformStream"),F);var p=(r=>(r.TextDelta="0",r.Data="2",r.Error="3",r.Annotation="8",r.ToolCall="9",r.ToolCallResult="a",r.StartToolCall="b",r.ToolCallArgsTextDelta="c",r.FinishMessage="d",r.FinishStep="e",r.StartStep="f",r.ReasoningDelta="g",r.Source="h",r.RedactedReasoning="i",r.ReasoningSignature="j",r.File="k",r.AuiUpdateStateOperations="aui-state",r.AuiTextDelta="aui-text-delta",r.AuiReasoningDelta="aui-reasoning-delta",r))(p||{});var D,We=(D=class extends TransformStream{constructor(){super({transform:a((e,t)=>{t.enqueue(`${e.type}:${JSON.stringify(e.value)}
|
|
5
|
-
`)},"transform")})}},a(D,"DataStreamChunkEncoder"),D),q,pt=(q=class extends TransformStream{constructor(){super({transform:a((e,t)=>{let o=e.indexOf(":");if(o===-1)throw new Error("Invalid stream part");t.enqueue({type:e.slice(0,o),value:JSON.parse(e.slice(o+1))})},"transform")})}},a(q,"DataStreamChunkDecoder"),q);var L,ze=(L=class extends TransformStream{constructor(){let e=[];super({transform(t,o){if(t.type==="part-start"){if(t.path.length!==0){o.error(new Error("Nested parts are not supported"));return}e.push(t.part),o.enqueue(t);return}if(t.type==="text-delta"||t.type==="result"||t.type==="part-finish"||t.type==="tool-call-args-text-finish"){if(t.path.length!==1){o.error(new Error(`${t.type} chunks must have a path of length 1`));return}let s=t.path[0];if(s<0||s>=e.length){o.error(new Error(`Invalid path index: ${s}`));return}let l=e[s];o.enqueue({...t,meta:l});return}o.enqueue(t)}})}},a(L,"AssistantMetaTransformStream"),L);var N,Te=(N=class extends le{constructor(){super(t=>{let o=new TransformStream({transform(s,l){let i=s.type;switch(i){case"part-start":{let n=s.part;if(n.type==="tool-call"){let{type:c,...d}=n;l.enqueue({type:p.StartToolCall,value:d})}if(n.type==="source"){let{type:c,...d}=n;l.enqueue({type:p.Source,value:d})}break}case"text-delta":{let n=s.meta;switch(n.type){case"text":{n.parentId?l.enqueue({type:p.AuiTextDelta,value:{textDelta:s.textDelta,parentId:n.parentId}}):l.enqueue({type:p.TextDelta,value:s.textDelta});break}case"reasoning":{n.parentId?l.enqueue({type:p.AuiReasoningDelta,value:{reasoningDelta:s.textDelta,parentId:n.parentId}}):l.enqueue({type:p.ReasoningDelta,value:s.textDelta});break}case"tool-call":{l.enqueue({type:p.ToolCallArgsTextDelta,value:{toolCallId:n.toolCallId,argsTextDelta:s.textDelta}});break}default:throw new Error(`Unsupported part type for text-delta: ${n.type}`)}break}case"result":{let n=s.meta;if(n.type!=="tool-call")throw new Error(`Result chunk on non-tool-call part not supported: ${n.type}`);l.enqueue({type:p.ToolCallResult,value:{toolCallId:n.toolCallId,result:s.result,artifact:s.artifact,...s.isError?{isError:s.isError}:{}}});break}case"step-start":{let{type:n,...c}=s;l.enqueue({type:p.StartStep,value:c});break}case"step-finish":{let{type:n,...c}=s;l.enqueue({type:p.FinishStep,value:c});break}case"message-finish":{let{type:n,...c}=s;l.enqueue({type:p.FinishMessage,value:c});break}case"error":{l.enqueue({type:p.Error,value:s.error});break}case"annotations":{l.enqueue({type:p.Annotation,value:s.annotations});break}case"data":{l.enqueue({type:p.Data,value:s.data});break}case"update-state":{l.enqueue({type:p.AuiUpdateStateOperations,value:s.operations});break}case"tool-call-args-text-finish":case"part-finish":break;default:{let n=i;throw new Error(`Unsupported chunk type: ${n}`)}}}});return t.pipeThrough(new ze).pipeThrough(o).pipeThrough(new We).pipeThrough(new TextEncoderStream)});u(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},a(N,"DataStreamEncoder"),N),yr=[p.StartToolCall,p.ToolCall,p.TextDelta,p.ReasoningDelta,p.Source,p.Error,p.FinishStep,p.FinishMessage,p.AuiTextDelta,p.AuiReasoningDelta];var Ge=a((r,e=21)=>(t=e)=>{let o="",s=t|0;for(;s--;)o+=r[Math.random()*r.length|0];return o},"customAlphabet");var Ke=Ge("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var x,dt=(x=class{constructor(e){u(this,"_state");u(this,"_parentId");this._state=e||{merger:Ne(),contentCounter:new ie}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(t.pipeThrough(new Je(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new je(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,t]=we();return this._addPart({type:"text"},e),t}addReasoningPart(){let[e,t]=we();return this._addPart({type:"reasoning"},e),t}addToolCallPart(e){let t=typeof e=="string"?{toolName:e}:e,o=t.toolName,s=t.toolCallId??Ke(),[l,i]=He();return this._addPart({type:"tool-call",toolName:o,toolCallId:s,...this._parentId&&{parentId:this._parentId}},l),t.argsText!==void 0&&(i.argsText.append(t.argsText),i.argsText.close()),t.args!==void 0&&(i.argsText.append(JSON.stringify(t.args)),i.argsText.close()),t.response!==void 0&&i.setResponse(t.response),i}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let t=new x(this._state);return t._parentId=e,t}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},a(x,"_AssistantStreamControllerImpl"),x);function Ve(r){let e=new dt;return a(async()=>{try{await r(e)}catch(o){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(o)}),o}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}a(Ve,"createAssistantStream");function ee(){let{resolve:r,promise:e}=ne(),t;return[Ve(s=>(t=s,t.__internal_subscribeToClose(r),e)),t]}a(ee,"createAssistantStreamController");var U,te=(U=class extends le{constructor(){super(e=>{let t=new Be({transform(o,s){s.appendText(o)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}},a(U,"PlainTextDecoder"),U);var $,Qe=($=class{constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:this.cloud._baseUrl+"/v1/runs/stream",headers:a(async()=>{let t=await this.cloud._auth.getAuthHeaders();if(!t)throw new Error("Authorization failed");return{...t,Accept:"text/plain"}},"headers"),body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let t=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return g.fromResponse(t,new te)}},a($,"AssistantCloudRuns"),$);var H,Xe=(H=class{constructor(e){this.cloud=e}async list(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:t})}async create(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:t})}},a(H,"AssistantCloudThreadMessages"),H);var J,Ye=(J=class{constructor(e){u(this,"messages");this.cloud=e,this.messages=new Xe(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:t})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}},a(J,"AssistantCloudThreads"),J);var j,Ze=(j=class{constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}},a(j,"AssistantCloudFiles"),j);var B,xe=(B=class{constructor(e){u(this,"threads");u(this,"auth");u(this,"runs");u(this,"files");let t=new qe(e);this.threads=new Ye(t),this.auth={tokens:new Le(t)},this.runs=new Qe(t),this.files=new Ze(t)}},a(B,"AssistantCloud"),B);import{openLegitFs as xt}from"@legit-sdk/core";import Ct from"memfs";import{createContext as mt,useContext as ht,useEffect as ft,useMemo as gt,useState as Ce,useCallback as ce}from"react";import{jsx as Tt}from"react/jsx-runtime";var re="main",y="/.legit/branches",tt="/.legit/commits",et=a(r=>(r.startsWith("/")&&(r=r.slice(1)),`${y}/${re}/${r}`),"resolveThreadPath"),yt=a(r=>r instanceof Error?r:new Error(String(r??"Unknown error")),"normalizeError"),rt=mt(void 0);function wt({children:r}){let[e,t]=Ce(null),[o,s]=Ce(!0),[l,i]=Ce(null);ft(()=>{let m=!1,h=a(async()=>{try{let f=await w();m||(t(f),i(null),s(!1))}catch(f){if(!m){let ae=yt(f);t(null),i(ae),s(!1)}}},"load");return s(!0),i(null),h(),()=>{m=!0}},[]);let n=ce(async(m,h)=>{if(e){let f=et(m);await e.promises.writeFile(f,h)}},[e]),c=ce(async m=>{if(e){let h=await W(re);if(!h)return;let f=h.find(fe=>fe.oid===m),ae=h.find(fe=>fe.oid===f?.parentOids[0]);if(!f||!ae)return;let Pe=f?.parentOids[1],Ie=ae?.originBranchOid;return!Pe||!Ie?void 0:{newOid:Pe,oldOid:Ie}}},[e]),d=ce(async(m,h)=>{if(e)return await at(m,h)},[e]),T=ce(async m=>(e&&(console.log("rollback",m),await st(re,m)),await ue(re)),[e]),z=gt(()=>({legitFs:e,loading:o,error:l,saveData:n,getMessageDiff:c,getPastState:d,rollback:T,threadId:re,resolvePath:et}),[e,o,l,n]);return Tt(rt.Provider,{value:z,children:r})}a(wt,"LegitFsProvider");function Ae(){let r=ht(rt);if(r===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return r}a(Ae,"useLegitFs");var pe=null;async function w(){return pe||(pe=xt({storageFs:Ct,gitRoot:"/"}),window&&(window.legitFs=await pe)),pe}a(w,"getLegitFs");async function ot(){let r=await w();try{return(await r.promises.readdir(y)).filter(t=>!t.startsWith("."))}catch(e){if(e.code==="ENOENT")return await r.promises.mkdir(y,{recursive:!0}),[];throw e}}a(ot,"listBranches");async function ue(r){try{return await(await w()).promises.readFile(`${y}/${r}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",r,e),e}}a(ue,"readHead");async function st(r,e){try{await(await w()).promises.writeFile(`${y}/${r}/.legit/operationHead`,e,"utf8")}catch(t){throw console.error("Error writing head to path:",r,t),t}}a(st,"writeOperationHead");async function nt(r,e){try{await(await w()).promises.writeFile(`${y}/${r}/.legit/operation`,e,"utf8")}catch(t){throw console.error("Error writing operation to path:",r,t),t}}a(nt,"writeOperation");async function W(r){try{let t=await(await w()).promises.readFile(`${y}/${r}/.legit/operationHistory`,"utf8");return t.length>0?JSON.parse(t):JSON.parse("[]")}catch(e){throw console.error("Error reading operation history from path:",r,e),e}}a(W,"readOperationHistory");async function at(r,e){try{e.startsWith("/")&&(e=e.slice(1));let t=await w(),o=`${tt}/${r.slice(0,2)}/${r.slice(2)}/${e}`;return await t.promises.readFile(o,"utf8")}catch(t){throw console.error("Error reading past state from path:",r,t),t}}a(at,"readPastState");var de=a(async r=>{let e=[];for(let t of r){let o,s;try{o=JSON.parse(t.message),s={id:t.oid,height:e.length,parent_id:t.parentOids[0]===t.parentOids[1]?null:t.parentOids[0],metadata:{custom:{depending_branch_commit_id:t.originBranchOid??null}},...o},e.unshift(s)}catch{console.log("Skipping operation with invalid JSON message:",t);continue}}return e},"createUIMessages");var Se=class Se{async list(e,t){let o=await W(e);return{messages:(await de(o)).map((i,n)=>({...i,height:n,created_at:new Date(i.created_at),updated_at:new Date(i.updated_at)}))}}async create(e,t){let o=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`,s={created_at:new Date,updated_at:new Date,format:t.format,content:t.content};return await nt(e,JSON.stringify(s)),{message_id:o}}};a(Se,"LegitThreadMessages");var me=Se;var _e=class _e{constructor(){u(this,"messages",new me)}async list(e){return{threads:(await ot()).map(o=>({id:o,title:o,last_message_at:new Date,metadata:{},external_id:null,project_id:"",created_at:new Date,updated_at:new Date,workspace_id:"local-workspace",is_archived:!1}))}}async create(e){return{thread_id:"main"}}async update(e,t){}async delete(e){}};a(_e,"LegitThreads");var he=_e;var Re=class Re extends xe{constructor(t){super(t);u(this,"runtime");u(this,"legitFs",null);this.legitFs=t.legitFs,this.threads=new he;let o=this.runs.stream;this.runs.stream=async s=>{if(!this.runtime)throw new Error("LegitLocal runtime not set");let n=this.runtime.thread.__internal_threadBinding?.getState?.()?.adapters?.chatModel?.options??{},c=new Headers;c.set("Content-Type","application/json");try{let d=await fetch(n.api??"/api/chat",{method:"POST",headers:c,credentials:n.credentials??"same-origin",body:JSON.stringify({messages:s.messages,system:s.system,tools:s.tools,runConfig:n.runConfig??{}})});if(!d.ok)throw new Error(`Request failed with status ${d.status}`);return g.fromResponse(d,new te)}catch(d){return console.error("LegitLocal stream failed, falling back to default handler.",d),o.call(this.runs,s)}}}};a(Re,"LegitLocal");var be=Re;import{ExportedMessageRepository as At}from"@assistant-ui/react";var St=a(r=>{if(r&&typeof r=="object"){let e=r,t=e.custom&&typeof e.custom=="object"?e.custom:{};return{...e,custom:t}}return{custom:{}}},"normalizeMetadata"),_t="aui/v0";function bt(r){if(r.format!==_t)return null;let e=r.content;if(!e||typeof e!="object")return null;let t=e.role;if(t!=="assistant"&&t!=="user"&&t!=="system")return null;let o=e.content??[],s=typeof o=="string"||Array.isArray(o)?o:[],l=e.createdAt instanceof Date?e.createdAt:e.createdAt?new Date(e.createdAt):new Date(r.created_at),i=St(r.metadata);return{...e,role:t,content:s,id:e.id??r.id,createdAt:l,metadata:i}}a(bt,"toThreadMessageLike");async function ke({threadId:r,threadApi:e}){console.log("sync initiated");let t=await W(r),s=(await de(t)).map(bt).filter(l=>l!==null);e?.reset?.(s),e.import(At.fromArray(s))}a(ke,"syncThreadFromLegitFs");var it=a(r=>{if(typeof r=="string")return r;if(r===void 0)return"";try{return JSON.stringify(r)}catch{return""}},"serializeStructuredData");var se=a(r=>r==null?null:typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:Array.isArray(r)?r.map(e=>se(e)):typeof r=="object"?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,se(t)])):JSON.stringify(r),"toJsonValue"),Rt=a((r,e)=>e?typeof r=="string"?{type:"error-text",value:r}:{type:"error-json",value:se(r)}:typeof r=="string"?{type:"text",value:r}:{type:"json",value:se(r)},"buildToolResultOutput"),kt=a(r=>{switch(r.type){case"text":return{type:"text",text:typeof r.text=="string"?r.text:""};case"tool-call":return{type:"tool-call",toolCallId:typeof r.toolCallId=="string"?r.toolCallId:`unknown-${Date.now()}`,toolName:typeof r.toolName=="string"?r.toolName:"unknown",input:se(r.args??r.input??{})};default:return null}},"mapAssistantContentPart"),Pt=a(r=>r.type!=="tool-result"?null:{type:"tool-result",toolCallId:typeof r.toolCallId=="string"?r.toolCallId:`unknown-${Date.now()}`,toolName:typeof r.toolName=="string"?r.toolName:"unknown",output:Rt(r.result??r.output,!!r.isError)},"mapToolContentPart"),js=a(r=>r.map(e=>{let t=Array.isArray(e.content)?e.content:[];switch(e.role){case"system":return{role:"system",content:t.map(s=>s.type==="text"&&typeof s.text=="string"?s.text:"").join("")};case"user":return{role:"user",content:t.map(s=>{switch(s.type){case"text":return{type:"text",text:typeof s.text=="string"?s.text:""};default:return null}}).filter(Boolean)};case"assistant":return{role:"assistant",content:t.map(s=>kt(s)).filter(Boolean)};case"tool":{let o=t.map(s=>Pt(s)).filter(Boolean);return o.length>0?{role:"tool",content:o}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function Bs(r){let[e,t]=ee();(async()=>{try{let s=null,l=new Map;for await(let i of r.fullStream)switch(i.type){case"text-start":s=t.addTextPart();break;case"text-delta":s||(s=t.addTextPart()),s.append(i.text);break;case"text-end":s?.close(),s=null;break;case"tool-input-start":{let n=i.id;if(!l.has(n)){let c=t.addToolCallPart({toolCallId:n,toolName:i.toolName});l.set(n,c)}break}case"tool-input-delta":{let n=i.id,c=l.get(n);c&&c.argsText.append(i.delta);break}case"tool-input-end":{let n=i.id,c=l.get(n);c&&c.argsText.close();break}case"tool-call":{let n=i.toolCallId;if(!l.get(n)){let d=t.addToolCallPart({toolCallId:n,toolName:i.toolName,args:i.input});l.set(n,d)}break}case"tool-result":{let n=i.toolCallId,c=l.get(n);c&&c.setResponse({result:it(i.output),isError:!1});break}case"tool-error":{let n=i.toolCallId,c=l.get(n);c&&c.setResponse({result:it(i.error),isError:!0});break}case"start-step":{let n=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;t.enqueue({type:"step-start",path:[],messageId:n});break}case"finish-step":{let n=i.usage;t.enqueue({type:"step-finish",path:[],finishReason:i.finishReason,usage:{promptTokens:n.promptTokens??n.prompt?.tokens??0,completionTokens:n.completionTokens??n.completion?.tokens??0},isContinued:!1});break}case"finish":{let n=i.totalUsage;t.enqueue({type:"message-finish",path:[],finishReason:i.finishReason,usage:{promptTokens:n.promptTokens??n.prompt?.tokens??0,completionTokens:n.completionTokens??n.completion?.tokens??0}});break}case"error":{t.enqueue({type:"error",path:[],error:i.error instanceof Error?i.error.message:typeof i.error=="string"?i.error:"Unknown error"});break}case"start":case"abort":case"raw":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"source":case"file":break}s?.close(),l.forEach(i=>i.close()),t.close()}catch(s){t.enqueue({type:"error",path:[],error:s instanceof Error?s.message:typeof s=="string"?s:"Unknown error"}),t.close()}})();let o=new Te;return g.toResponse(e,o)}a(Bs,"streamTextToDataStreamResponse");import{useEffect as It}from"react";import{useAssistantApi as vt}from"@assistant-ui/react";var Et=100;function Ys(){let{legitFs:r,threadId:e}=Ae(),o=vt().thread();return It(()=>{if(!r||!e)return;let s=!1,l,i=null,n=a(()=>{s||(l=setTimeout(c,Et))},"scheduleNext"),c=a(async()=>{try{let d=await ue(e);if(s||d===i)return;let{isRunning:T,isLoading:z}=o.getState();if(T||z)return;setTimeout(async()=>{await ke({threadId:e,threadApi:o}),i=d},100)}catch(d){d.code!=="ENOENT"&&console.error("Failed to poll Legit head",d)}finally{n()}},"tick");return n(),()=>{s=!0,l!==void 0&&clearTimeout(l)}},[r,o,e]),null}a(Ys,"LegitFsHeadPoller");export{Ys as LegitFsHeadPoller,wt as LegitFsProvider,be as LegitLocal,js as convertMessagesToModelMessages,Bs as streamTextToDataStreamResponse,ke as syncThreadFromLegitFs,Ae as useLegitFs};
|
|
4
|
+
var SO=Object.create;var Ji=Object.defineProperty;var FO=Object.getOwnPropertyDescriptor;var TO=Object.getOwnPropertyNames;var RO=Object.getPrototypeOf,OO=Object.prototype.hasOwnProperty;var fy=t=>{throw TypeError(t)};var kO=(t,e,r)=>e in t?Ji(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var l=(t,e)=>Ji(t,"name",{value:e,configurable:!0}),se=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var xO=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),AO=(t,e)=>{for(var r in e)Ji(t,r,{get:e[r],enumerable:!0})},uy=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of TO(e))!OO.call(t,n)&&n!==r&&Ji(t,n,{get:()=>e[n],enumerable:!(i=FO(e,n))||i.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?SO(RO(t)):{},uy(e||!t||!t.__esModule?Ji(r,"default",{value:t,enumerable:!0}):r,t)),th=t=>uy(Ji({},"__esModule",{value:!0}),t);var G=(t,e,r)=>kO(t,typeof e!="symbol"?e+"":e,r),hy=(t,e,r)=>e.has(t)||fy("Cannot "+r);var ea=(t,e,r)=>(hy(t,e,"read from private field"),r?r.call(t):e.get(t)),ta=(t,e,r)=>e.has(t)?fy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ra=(t,e,r,i)=>(hy(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r);var Ct=T(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.constants=vn.SEP=void 0;vn.SEP="/";vn.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var oh=T(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.Stats=void 0;var IO=Ct(),{S_IFMT:$O,S_IFDIR:BO,S_IFREG:MO,S_IFBLK:jO,S_IFCHR:LO,S_IFLNK:qO,S_IFIFO:UO,S_IFSOCK:WO}=IO.constants,Lo=class Lo{static build(e,r=!1){let i=new Lo,{uid:n,gid:s,atime:a,mtime:f,ctime:o}=e,c=r?h=>BigInt(h):h=>h;i.uid=c(n),i.gid=c(s),i.rdev=c(e.rdev),i.blksize=c(4096),i.ino=c(e.ino),i.size=c(e.getSize()),i.blocks=c(1),i.atime=a,i.mtime=f,i.ctime=o,i.birthtime=o,i.atimeMs=c(a.getTime()),i.mtimeMs=c(f.getTime());let u=c(o.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(a.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(o.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=c(0),i.mode=c(e.mode),i.nlink=c(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&$O)===e}isDirectory(){return this._checkModeProperty(BO)}isFile(){return this._checkModeProperty(MO)}isBlockDevice(){return this._checkModeProperty(jO)}isCharacterDevice(){return this._checkModeProperty(LO)}isSymbolicLink(){return this._checkModeProperty(qO)}isFIFO(){return this._checkModeProperty(UO)}isSocket(){return this._checkModeProperty(WO)}};l(Lo,"Stats");var jo=Lo;la.Stats=jo;la.default=jo});var Cy=T(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.Buffer=void 0;var zO=se("node:buffer");Object.defineProperty(qo,"Buffer",{enumerable:!0,get:l(function(){return zO.Buffer},"get")})});var Pr=T(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.bufferFrom=Ar.bufferAllocUnsafe=Ar.Buffer=void 0;var Uo=Cy();Object.defineProperty(Ar,"Buffer",{enumerable:!0,get:l(function(){return Uo.Buffer},"get")});function Iy(t,...e){return new Uo.Buffer(t,...e)}l(Iy,"bufferV0P12Ponyfill");var HO=Uo.Buffer.allocUnsafe||Iy;Ar.bufferAllocUnsafe=HO;var VO=Uo.Buffer.from||Iy;Ar.bufferFrom=VO});var lh=T(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.inherits=GO;En.promisify=KO;En.inspect=ch;En.format=JO;function GO(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}l(GO,"inherits");function KO(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}l(KO,"promisify");function ch(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>ch(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${ch(i)}`).join(", ")} }`:String(t)}l(ch,"inspect");function JO(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}l(JO,"format")});var fa=T(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.AssertionError=qe.RangeError=qe.TypeError=qe.Error=void 0;qe.message=My;qe.E=Nr;var fh=lh(),$y=typeof Symbol>"u"?"_kCode":Symbol("code"),By={};function hh(t){var e;return e=class extends t{constructor(i,...n){super(My(i,n)),this.code=i,this[$y]=i,this.name=`${super.name} [${this[$y]}]`}},l(e,"NodeError"),e}l(hh,"makeNodeError");var Wo=globalThis,dh=class dh extends Wo.Error{constructor(e){if(typeof e!="object"||e===null)throw new qe.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,fh.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,fh.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,qe.Error.captureStackTrace(this,e.stackStartFunction)}};l(dh,"AssertionError");var uh=dh;qe.AssertionError=uh;function My(t,e){if(typeof t!="string")throw new qe.Error("Error message key must be a string");let r=By[t];if(!r)throw new qe.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=fh.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(My,"message");function Nr(t,e){By[t]=typeof e=="function"?e:String(e)}l(Nr,"E");qe.Error=hh(Wo.Error);qe.TypeError=hh(Wo.TypeError);qe.RangeError=hh(Wo.RangeError);Nr("ERR_DIR_CLOSED","Directory handle was closed");Nr("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");Nr("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');Nr("ERR_INVALID_FILE_URL_PATH","File URL path %s");Nr("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);Nr("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);Nr("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var ua=T(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.ENCODING_UTF8=void 0;di.assertEncoding=YO;di.strToEncoding=ZO;var ph=Pr(),XO=fa();di.ENCODING_UTF8="utf8";function YO(t){if(t&&!ph.Buffer.isEncoding(t))throw new XO.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(YO,"assertEncoding");function ZO(t,e){return!e||e===di.ENCODING_UTF8?t:e==="buffer"?new ph.Buffer(t):new ph.Buffer(t).toString(e)}l(ZO,"strToEncoding")});var Vo=T(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.Dirent=void 0;var QO=Ct(),ek=ua(),{S_IFMT:tk,S_IFDIR:rk,S_IFREG:ik,S_IFBLK:nk,S_IFCHR:sk,S_IFLNK:ak,S_IFIFO:ok,S_IFSOCK:ck}=QO.constants,Ho=class Ho{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new Ho,{mode:n}=e.getNode();return i.name=(0,ek.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&tk)===e}isDirectory(){return this._checkModeProperty(rk)}isFile(){return this._checkModeProperty(ik)}isBlockDevice(){return this._checkModeProperty(nk)}isCharacterDevice(){return this._checkModeProperty(sk)}isSymbolicLink(){return this._checkModeProperty(ak)}isFIFO(){return this._checkModeProperty(ok)}isSocket(){return this._checkModeProperty(ck)}};l(Ho,"Dirent");var zo=Ho;ha.Dirent=zo;ha.default=zo});var Sn=T(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.basename=_e.isAbsolute=_e.normalize=_e.dirname=_e.relative=_e.join=_e.posix=_e.sep=_e.resolve=void 0;var ur=se("node:path");Object.defineProperty(_e,"resolve",{enumerable:!0,get:l(function(){return ur.resolve},"get")});Object.defineProperty(_e,"sep",{enumerable:!0,get:l(function(){return ur.sep},"get")});Object.defineProperty(_e,"posix",{enumerable:!0,get:l(function(){return ur.posix},"get")});Object.defineProperty(_e,"join",{enumerable:!0,get:l(function(){return ur.join},"get")});Object.defineProperty(_e,"relative",{enumerable:!0,get:l(function(){return ur.relative},"get")});Object.defineProperty(_e,"dirname",{enumerable:!0,get:l(function(){return ur.dirname},"get")});Object.defineProperty(_e,"normalize",{enumerable:!0,get:l(function(){return ur.normalize},"get")});Object.defineProperty(_e,"isAbsolute",{enumerable:!0,get:l(function(){return ur.isAbsolute},"get")});Object.defineProperty(_e,"basename",{enumerable:!0,get:l(function(){return ur.basename},"get")})});var Xo={};AO(Xo,{__addDisposableResource:()=>lg,__assign:()=>Go,__asyncDelegator:()=>tg,__asyncGenerator:()=>eg,__asyncValues:()=>rg,__await:()=>Fn,__awaiter:()=>Ky,__classPrivateFieldGet:()=>ag,__classPrivateFieldIn:()=>cg,__classPrivateFieldSet:()=>og,__createBinding:()=>Jo,__decorate:()=>qy,__disposeResources:()=>fg,__esDecorate:()=>Wy,__exportStar:()=>Xy,__extends:()=>jy,__generator:()=>Jy,__importDefault:()=>sg,__importStar:()=>ng,__makeTemplateObject:()=>ig,__metadata:()=>Gy,__param:()=>Uy,__propKey:()=>Hy,__read:()=>yh,__rest:()=>Ly,__rewriteRelativeImportExtension:()=>ug,__runInitializers:()=>zy,__setFunctionName:()=>Vy,__spread:()=>Yy,__spreadArray:()=>Qy,__spreadArrays:()=>Zy,__values:()=>Ko,default:()=>uk});function jy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");mh(t,e);function r(){this.constructor=t}l(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ly(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function qy(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var f=t.length-1;f>=0;f--)(a=t[f])&&(s=(n<3?a(s):n>3?a(e,r,s):a(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function Uy(t,e){return function(r,i){e(r,i,t)}}function Wy(t,e,r,i,n,s){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}l(a,"accept");for(var f=i.kind,o=f==="getter"?"get":f==="setter"?"set":"value",c=!e&&t?i.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h,d=!1,p=r.length-1;p>=0;p--){var m={};for(var w in i)m[w]=w==="access"?{}:i[w];for(var w in i.access)m.access[w]=i.access[w];m.addInitializer=function(g){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(g||null))};var y=(0,r[p])(f==="accessor"?{get:u.get,set:u.set}:u[o],m);if(f==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(h=a(y.get))&&(u.get=h),(h=a(y.set))&&(u.set=h),(h=a(y.init))&&n.unshift(h)}else(h=a(y))&&(f==="field"?n.unshift(h):u[o]=h)}c&&Object.defineProperty(c,i.name,u),d=!0}function zy(t,e,r){for(var i=arguments.length>2,n=0;n<e.length;n++)r=i?e[n].call(t,r):e[n].call(t);return i?r:void 0}function Hy(t){return typeof t=="symbol"?t:"".concat(t)}function Vy(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Gy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Ky(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return l(n,"adopt"),new(r||(r=Promise))(function(s,a){function f(u){try{c(i.next(u))}catch(h){a(h)}}l(f,"fulfilled");function o(u){try{c(i.throw(u))}catch(h){a(h)}}l(o,"rejected");function c(u){u.done?s(u.value):n(u.value).then(f,o)}l(c,"step"),c((i=i.apply(t,e||[])).next())})}function Jy(t,e){var r={label:0,sent:l(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},i,n,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=f(0),a.throw=f(1),a.return=f(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(c){return function(u){return o([c,u])}}function o(c){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(i=1,n&&(s=c[0]&2?n.return:c[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,c[1])).done)return s;switch(n=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){r.label=c[1];break}if(c[0]===6&&r.label<s[1]){r.label=s[1],s=c;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(c);break}s[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],n=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Xy(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jo(e,t,r)}function Ko(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:l(function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yh(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],a;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}function Yy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(yh(arguments[e]));return t}function Zy(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],a=0,f=s.length;a<f;a++,n++)i[n]=s[a];return i}function Qy(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function Fn(t){return this instanceof Fn?(this.v=t,this):new Fn(t)}function eg(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),f("next"),f("throw"),f("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(p){return function(m){return Promise.resolve(m).then(p,h)}}function f(p,m){i[p]&&(n[p]=function(w){return new Promise(function(y,g){s.push([p,w,y,g])>1||o(p,w)})},m&&(n[p]=m(n[p])))}function o(p,m){try{c(i[p](m))}catch(w){d(s[0][3],w)}}function c(p){p.value instanceof Fn?Promise.resolve(p.value.v).then(u,h):d(s[0][2],p)}function u(p){o("next",p)}function h(p){o("throw",p)}function d(p,m){p(m),s.shift(),s.length&&o(s[0][0],s[0][1])}}function tg(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(a){return(r=!r)?{value:Fn(t[n](a)),done:!1}:s?s(a):a}:s}}function rg(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Ko=="function"?Ko(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(a){return new Promise(function(f,o){a=t[s](a),n(f,o,a.done,a.value)})}}function n(s,a,f,o){Promise.resolve(o).then(function(c){s({value:c,done:f})},a)}}function ig(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ng(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=wh(t),i=0;i<r.length;i++)r[i]!=="default"&&Jo(e,t,r[i]);return lk(e,t),e}function sg(t){return t&&t.__esModule?t:{default:t}}function ag(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)}function og(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function cg(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function lg(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(i===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose],r&&(n=i)}if(typeof i!="function")throw new TypeError("Object not disposable.");n&&(i=l(function(){try{n.call(this)}catch(s){return Promise.reject(s)}},"dispose")),t.stack.push({value:e,dispose:i,async:r})}else r&&t.stack.push({async:!0});return e}function fg(t){function e(s){t.error=t.hasError?new fk(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}l(e,"fail");var r,i=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(s).then(n,function(a){return e(a),n()})}else i|=1}catch(a){e(a)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return l(n,"next"),n()}function ug(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,i,n,s,a){return i?e?".jsx":".js":n&&(!s||!a)?r:n+s+"."+a.toLowerCase()+"js"}):t}var mh,Go,Jo,lk,wh,fk,uk,Yo=xO(()=>{mh=l(function(t,e){return mh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},mh(t,e)},"extendStatics");l(jy,"__extends");Go=l(function(){return Go=Object.assign||l(function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},"__assign"),Go.apply(this,arguments)},"__assign");l(Ly,"__rest");l(qy,"__decorate");l(Uy,"__param");l(Wy,"__esDecorate");l(zy,"__runInitializers");l(Hy,"__propKey");l(Vy,"__setFunctionName");l(Gy,"__metadata");l(Ky,"__awaiter");l(Jy,"__generator");Jo=Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:l(function(){return e[r]},"get")}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]};l(Xy,"__exportStar");l(Ko,"__values");l(yh,"__read");l(Yy,"__spread");l(Zy,"__spreadArrays");l(Qy,"__spreadArray");l(Fn,"__await");l(eg,"__asyncGenerator");l(tg,"__asyncDelegator");l(rg,"__asyncValues");l(ig,"__makeTemplateObject");lk=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},wh=l(function(t){return wh=Object.getOwnPropertyNames||function(e){var r=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[r.length]=i);return r},wh(t)},"ownKeys");l(ng,"__importStar");l(sg,"__importDefault");l(ag,"__classPrivateFieldGet");l(og,"__classPrivateFieldSet");l(cg,"__classPrivateFieldIn");l(lg,"__addDisposableResource");fk=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var i=new Error(r);return i.name="SuppressedError",i.error=t,i.suppressed=e,i};l(fg,"__disposeResources");l(ug,"__rewriteRelativeImportExtension");uk={__extends:jy,__assign:Go,__rest:Ly,__decorate:qy,__param:Uy,__esDecorate:Wy,__runInitializers:zy,__propKey:Hy,__setFunctionName:Vy,__metadata:Gy,__awaiter:Ky,__generator:Jy,__createBinding:Jo,__exportStar:Xy,__values:Ko,__read:yh,__spread:Yy,__spreadArrays:Zy,__spreadArray:Qy,__await:Fn,__asyncGenerator:eg,__asyncDelegator:tg,__asyncValues:rg,__makeTemplateObject:ig,__importStar:ng,__importDefault:sg,__classPrivateFieldGet:ag,__classPrivateFieldSet:og,__classPrivateFieldIn:cg,__addDisposableResource:lg,__disposeResources:fg,__rewriteRelativeImportExtension:ug}});var dg=T(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0})});var bh=T(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.flattenJSON=void 0;var pg=Pr(),gh=Sn(),hk=gh.posix?gh.posix.join:gh.join,dk=l(t=>{let e={};function r(i,n){for(let s in n){let a=n[s],f=hk(i,s);typeof a=="string"||a instanceof pg.Buffer?e[f]=a:typeof a=="object"&&a!==null&&!(a instanceof pg.Buffer)&&Object.keys(a).length>0?r(f,a):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");Zo.flattenJSON=dk});var da=T(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.FanOut=void 0;var vh=class vh{constructor(){this.listeners=new Set}emit(e){this.listeners.forEach(r=>r(e))}listen(e){let r=this.listeners;return r.add(e),()=>r.delete(e)}};l(vh,"FanOut");var _h=vh;Qo.FanOut=_h});var tc=T(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.createProcess=mg;var pk=l(()=>{if(typeof process<"u")return process;try{return se("process")}catch{return}},"maybeReturnProcess");function mg(){let t=pk()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(mg,"createProcess");ec.default=mg()});var Fh=T(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.Node=void 0;var mk=da(),yg=tc(),bt=Pr(),wk=Ct(),{S_IFMT:hr,S_IFDIR:yk,S_IFREG:gk,S_IFLNK:wg,S_IFCHR:bk}=wk.constants,rc=l(()=>yg.default.getuid?.()??0,"getuid"),ic=l(()=>yg.default.getgid?.()??0,"getgid"),Sh=class Sh{constructor(e,r=438){this.changes=new mk.FanOut,this._uid=rc(),this._gid=ic(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~hr}set perm(e){this.mode=this.mode&hr|e&~hr,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this.buf=(0,bt.bufferFrom)(e,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,bt.bufferAllocUnsafe)(0)),(0,bt.bufferFrom)(this.buf)}setBuffer(e){this.buf=(0,bt.bufferFrom)(e),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(e){this.mode=e}isFile(){return(this.mode&hr)===gk}isDirectory(){return(this.mode&hr)===yk}isSymlink(){return(this.mode&hr)===wg}isCharacterDevice(){return(this.mode&hr)===bk}makeSymlink(e){this.mode=wg|438,this.symlink=e}write(e,r=0,i=e.length,n=0){if(this.buf||(this.buf=(0,bt.bufferAllocUnsafe)(0)),n+i>this.buf.length){let s=(0,bt.bufferAllocUnsafe)(n+i);this.buf.copy(s,0,0,this.buf.length),this.buf=s}return e.copy(this.buf,n,r,r+i),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,this.buf||(this.buf=(0,bt.bufferAllocUnsafe)(0)),n>=this.buf.length)return 0;let s=i;s>e.byteLength&&(s=e.byteLength),s+n>this.buf.length&&(s=this.buf.length-n);let a=e instanceof bt.Buffer?e:bt.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(a,r,n,n+s),s}truncate(e=0){if(!e)this.buf=(0,bt.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,bt.bufferAllocUnsafe)(0)),e<=this.buf.length)this.buf=this.buf.slice(0,e);else{let r=(0,bt.bufferAllocUnsafe)(e);this.buf.copy(r),r.fill(0,this.buf.length),this.buf=r}this.touch()}chmod(e){this.mode=this.mode&hr|e&~hr,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=rc(),r=ic()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=rc(),r=ic()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=rc(),r=ic()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};l(Sh,"Node");var Eh=Sh;nc.Node=Eh});var Rh=T(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.Link=void 0;var _k=Ct(),vk=da(),{S_IFREG:Ek}=_k.constants,pa=class pa{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new vk.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(Ek|438)){let i=new pa(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new pa(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};l(pa,"Link");var Th=pa;sc.Link=Th});var xh=T(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.File=void 0;var Sk=Ct(),{O_APPEND:Fk}=Sk.constants,kh=class kh{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&Fk&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};l(kh,"File");var Oh=kh;ac.File=Oh});var On=T(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.FLAGS=Rn.ERRSTR=void 0;var Tk=Ct();Rn.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:gg,O_WRONLY:oc,O_RDWR:Tn,O_CREAT:Dr,O_EXCL:cc,O_TRUNC:lc,O_APPEND:fc,O_SYNC:bg}=Tk.constants,_g;(function(t){t[t.r=gg]="r",t[t["r+"]=Tn]="r+",t[t.rs=gg|bg]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=Tn|bg]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=oc|Dr|lc]="w",t[t.wx=oc|Dr|lc|cc]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=Tn|Dr|lc]="w+",t[t["wx+"]=Tn|Dr|lc|cc]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=oc|fc|Dr]="a",t[t.ax=oc|fc|Dr|cc]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=Tn|fc|Dr]="a+",t[t["ax+"]=Tn|fc|Dr|cc]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(_g||(Rn.FLAGS=_g={}))});var Ph=T(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var pc=T(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.filenameToSteps=Ae.resolve=Ae.unixify=Ae.isWin=void 0;Ae.isFd=Eg;Ae.validateFd=Ik;Ae.dataToBuffer=$k;var hc=Sn(),uc=Pr(),vg=tc(),Rk=ua(),Ok=On();Ae.isWin=vg.default.platform==="win32";var kk=hc.resolve,xk=hc.posix?hc.posix.sep:hc.sep,Ak=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||Ae.isWin&&r==="\\")},"isSeparator"),Pk=l(t=>{let e=t.length-1;if(e<2)return t;for(;Ak(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),Nk=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=Pk(t)),t},"normalizePath"),Dk=l((t,e=!0)=>Ae.isWin?(t=Nk(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");Ae.unixify=Dk;var dc=l((t,e=vg.default.cwd())=>kk(e,t),"resolve");Ae.resolve=dc;if(Ae.isWin){let t=dc;Ae.resolve=dc=l((e,r)=>(0,Ae.unixify)(t(e,r)),"resolve")}var Ck=l((t,e)=>{let i=dc(t,e).substring(1);return i?i.split(xk):[]},"filenameToSteps");Ae.filenameToSteps=Ck;function Eg(t){return t>>>0===t}l(Eg,"isFd");function Ik(t){if(!Eg(t))throw TypeError(Ok.ERRSTR.FD)}l(Ik,"validateFd");function $k(t,e=Rk.ENCODING_UTF8){return uc.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,uc.bufferFrom)(t):e==="buffer"?(0,uc.bufferFrom)(String(t),"utf8"):(0,uc.bufferFrom)(String(t),e)}l($k,"dataToBuffer")});var Cr=T(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.getWriteSyncArgs=Re.getWriteArgs=Re.bufToUint8=void 0;Re.promisify=Mk;Re.validateCallback=Sg;Re.modeToNumber=Fg;Re.nullCheck=Tg;Re.pathToFilename=qk;Re.createError=ix;Re.genRndStr6=nx;Re.flagsToNumber=sx;Re.streamToBuffer=ax;Re.bufferToEncoding=fx;Re.isReadableStream=ux;var ma=On(),Nh=fa(),Dh=Pr(),Bk=Ph(),mc=pc();function Mk(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(a,f)=>a?s(a):n(r(f)))})}l(Mk,"promisify");function Sg(t){if(typeof t!="function")throw TypeError(ma.ERRSTR.CB);return t}l(Sg,"validateCallback");function jk(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return Fg(e)}l(jk,"_modeToNumber");function Fg(t,e){let r=jk(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(ma.ERRSTR.MODE_INT);return r}l(Fg,"modeToNumber");function Tg(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,Bk.default)(()=>{e(r)}),!1}return!0}l(Tg,"nullCheck");function Lk(t){if(t.hostname!=="")throw new Nh.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new Nh.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(Lk,"getPathFromURLPosix");function qk(t){if(t instanceof Uint8Array&&(t=(0,Dh.bufferFrom)(t)),typeof t!="string"&&!Dh.Buffer.isBuffer(t)){try{if(!(t instanceof se("url").URL))throw new TypeError(ma.ERRSTR.PATH_STR)}catch{throw new TypeError(ma.ERRSTR.PATH_STR)}t=Lk(t)}let e=String(t);return Tg(e),e}l(qk,"pathToFilename");var Uk="ENOENT",Wk="EBADF",zk="EINVAL",Hk="EPERM",Vk="EPROTO",Gk="EEXIST",Kk="ENOTDIR",Jk="EMFILE",Xk="EACCES",Yk="EISDIR",Zk="ENOTEMPTY",Qk="ENOSYS",ex="ERR_FS_EISDIR",tx="ERR_OUT_OF_RANGE";function rx(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case Uk:return`ENOENT: no such file or directory, ${e}${n}`;case Wk:return`EBADF: bad file descriptor, ${e}${n}`;case zk:return`EINVAL: invalid argument, ${e}${n}`;case Hk:return`EPERM: operation not permitted, ${e}${n}`;case Vk:return`EPROTO: protocol error, ${e}${n}`;case Gk:return`EEXIST: file already exists, ${e}${n}`;case Kk:return`ENOTDIR: not a directory, ${e}${n}`;case Yk:return`EISDIR: illegal operation on a directory, ${e}${n}`;case Xk:return`EACCES: permission denied, ${e}${n}`;case Zk:return`ENOTEMPTY: directory not empty, ${e}${n}`;case Jk:return`EMFILE: too many open files, ${e}${n}`;case Qk:return`ENOSYS: function not implemented, ${e}${n}`;case ex:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case tx:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(rx,"formatError");function ix(t,e="",r="",i="",n=Error){let s=new n(rx(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(ix,"createError");function nx(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(nx,"genRndStr6");function sx(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=ma.FLAGS[t];if(typeof e<"u")return e}throw new Nh.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(sx,"flagsToNumber");function ax(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(Dh.Buffer.concat(e))),t.on("error",i)})}l(ax,"streamToBuffer");var ox=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");Re.bufToUint8=ox;var cx=l((t,e,r,i,n,s)=>{(0,mc.validateFd)(t);let a=0,f,o=null,c,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(a=r|0,u=i):m==="function"?(a=r|0,f=i,u=n):(a=r|0,f=i,o=n,u=s):d==="function"?u=r:p==="function"?(o=r,u=i):m==="function"&&(o=r,c=i,u=n);let w=(0,mc.dataToBuffer)(e,c);h!=="string"?typeof f>"u"&&(f=w.length):(a=0,f=w.length);let y=Sg(u);return[t,h==="string",w,a,f,o,y]},"getWriteArgs");Re.getWriteArgs=cx;var lx=l((t,e,r,i,n)=>{(0,mc.validateFd)(t);let s,a,f,o,c=typeof e!="string";c?(a=(r||0)|0,f=i,o=n):(o=r,s=i);let u=(0,mc.dataToBuffer)(e,s);return c?typeof f>"u"&&(f=u.length):(a=0,f=u.length),[t,u,a||0,f,o]},"getWriteSyncArgs");Re.getWriteSyncArgs=lx;function fx(t,e){return!e||e==="buffer"?t:t.toString(e)}l(fx,"bufferToEncoding");function ux(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(ux,"isReadableStream")});var Pg=T(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.Superblock=void 0;var Pe=Sn(),hx=Fh(),Rg=Rh(),dx=xh(),px=Pr(),Og=tc(),Jt=Ct(),kg=On(),H=Cr(),It=pc(),mx=bh(),kn=Pe.posix?Pe.posix.sep:Pe.sep,xg=Pe.posix?Pe.posix.relative:Pe.relative,wx=Pe.posix?Pe.posix.join:Pe.join,{O_RDONLY:Ch,O_WRONLY:wc,O_RDWR:Ih,O_CREAT:Ag,O_EXCL:yx,O_TRUNC:gx,O_APPEND:bx,O_DIRECTORY:_x}=Jt.constants,xn=class xn{static fromJSON(e,r){let i=new xn;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new xn;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,a=!0)=>{let f=this.openFile(i,n,s,a);if(!f)throw(0,H.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,a)=>{let f=typeof i=="number",o;f?o=i:o=this.open((0,H.pathToFilename)(i),s,a);let c=0,u=n.length,h=s&bx?void 0:0;try{for(;u>0;){let d=this.write(o,n,c,u,h);c+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(o)}},this.read=(i,n,s,a,f)=>{if(n.byteLength<a)throw(0,H.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let o=this.getFileByFdOrThrow(i);if(o.node.isSymlink())throw(0,H.createError)("EPERM","read",o.link.getPath());return o.read(n,Number(s),Number(a),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let a=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let o=0;for(let c of n){let u=a.read(c,0,c.byteLength,f);if(f=void 0,o+=u,u<c.byteLength)break}return o},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,H.createError)(u.code,"link",i,n)),u}let a=(0,Pe.dirname)(n),f;try{f=this.getLinkOrThrow(a,"link")}catch(u){throw u.code&&(u=(0,H.createError)(u.code,"link",i,n)),u}let o=(0,Pe.basename)(n);if(f.getChild(o))throw(0,H.createError)("EEXIST","link",i,n);let c=s.getNode();c.nlink++,f.createChild(o,c)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,It.filenameToSteps)(n),a;try{a=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,H.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(a.getChild(f))throw(0,H.createError)("EEXIST","symlink",i,n);let o=a.getNode();if(!o.canExecute()||!o.canWrite())throw(0,H.createError)("EACCES","symlink",i,n);let c=a.createChild(f);return c.getNode().makeSymlink(i),c},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,H.createError)(h.code,"rename",i,n)),h}let a;try{a=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,H.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,H.createError)("EINVAL","rename",i,n);let o=f.getNode(),c=a.getNode();if(!o.canExecute()||!o.canWrite()||!c.canExecute()||!c.canWrite())throw(0,H.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,Pe.basename)(n);s.name=u,s.steps=[...a.steps,u],a.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,It.filenameToSteps)(i);if(!s.length)throw(0,H.createError)("EEXIST","mkdir",i);let a=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(a.getChild(f))throw(0,H.createError)("EEXIST","mkdir",i);let o=a.getNode();if(!o.canWrite()||!o.canExecute())throw(0,H.createError)("EACCES","mkdir",i);a.createChild(f,this.createNode(Jt.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,a=(0,It.filenameToSteps)(i),f=null,o=a.length;for(o=a.length;o>=0&&(f=this.getResolvedLink(a.slice(0,o)),!f);o--);for(f||(f=this.root,o=0),f=this.getResolvedLinkOrThrow(Pe.sep+a.slice(0,o).join(Pe.sep),"mkdir"),o;o<a.length;o++){let c=f.getNode();if(c.isDirectory()){if(!c.canExecute()||!c.canWrite())throw(0,H.createError)("EACCES","mkdir",i)}else throw(0,H.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(a[o],this.createNode(Jt.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,H.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let a;try{a=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(a.getNode().isDirectory()&&!s)throw(0,H.createError)("ERR_FS_EISDIR","rm",i);if(!a.parent?.getNode().canWrite())throw(0,H.createError)("EACCES","rm",i);this.deleteLink(a)},this.close=i=>{(0,It.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(Jt.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new Rg.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&Jt.constants.S_IFMT?n&Jt.constants.S_IFMT:i?Jt.constants.S_IFDIR:Jt.constants.S_IFREG,o=s&~Jt.constants.S_IFMT|f;return e.createChild(r,this.createNode(o))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:xn.fd--}createNode(e){let r=new hx.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let a,f;e instanceof Rg.Link?(a=e.steps,f=kn+a.join(kn)):typeof e=="string"?(a=(0,It.filenameToSteps)(e),f=e):(a=e,f=kn+a.join(kn));let o=this.root,c=0;for(;c<a.length;){let u=o.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,H.createError)("EACCES",s,f)}else if(c<a.length-1)throw(0,H.createError)("ENOTDIR",s,f);if(o=o.getChild(a[c])??null,!o){if(i)throw(0,H.createError)("ENOENT",s,f);return null}if(u=o?.getNode(),u.isSymlink()&&(r||c<a.length-1)){let h=(0,Pe.isAbsolute)(u.symlink)?u.symlink:wx((0,Pe.dirname)(o.getPath()),u.symlink);a=(0,It.filenameToSteps)(h).concat(a.slice(c+1)),o=this.root,c=0;continue}if(i&&!u.isDirectory()&&c<a.length-1){let h=Og.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,H.createError)(h,s,f)}c++}return o}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,H.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,It.filenameToSteps)(e)).slice(0,-1),n=kn+i.join(kn),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,H.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,It.isFd)(e))throw TypeError(kg.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,H.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,a=e.children;e.getNode().isFile()&&(a=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let o of a.keys()){if(o==="."||o==="..")continue;s=!1;let c=e.getChild(o);if(!c)throw new Error("_toJSON: unexpected undefined");let u=c.getNode();if(u.isFile()){let h=c.getPath();i&&(h=xg(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(c,r,i,n)}let f=e.getPath();return i&&(f=xg(i,f)),f&&s&&(r[f]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let a of e){let f=(0,H.pathToFilename)(a),o=this.getResolvedLink(f);o&&s.push(o)}}else s.push(this.root);if(!s.length)return r;for(let a of s)this._toJSON(a,r,i?a.getPath():"",n);return r}fromJSON(e,r=Og.default.cwd()){for(let i in e){let n=e[i];if(i=(0,It.resolve)(i,r),typeof n=="string"||n instanceof px.Buffer){let s=(0,Pe.dirname)(i);this.mkdirp(s,511);let a=(0,It.dataToBuffer)(n);this.writeFile(i,a,kg.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,mx.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(Jt.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,H.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(Ch|Ih|wc))!==Ch)throw(0,H.createError)("EISDIR","open",e.getPath())}else if(r&_x)throw(0,H.createError)("ENOTDIR","open",e.getPath());if((r&(Ch|Ih|wc))!==wc&&!s.canRead()||r&(wc|Ih)&&!s.canWrite())throw(0,H.createError)("EACCES","open",e.getPath());let a=new dx.File(e,s,r,this.newFdNumber());return this.fds[a.fd]=a,this.openFiles++,r&gx&&a.truncate(),a}openFile(e,r,i,n=!0){let s=(0,It.filenameToSteps)(e),a;try{if(a=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),a&&r&Ag&&r&yx)throw(0,H.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&Ag){let o=(0,Pe.dirname)(e),c=this.getResolvedLinkOrThrow(o),u=c.getNode();if(!u.isDirectory())throw(0,H.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,H.createError)("EACCES","open",e);i??(i=438),a=this.createLink(c,s[s.length-1],!1,i)}else throw f}if(a)return this.openLink(a,r,n);throw(0,H.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let a=this.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,H.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(xn,"Superblock");var yc=xn;gc.Superblock=yc;yc.fd=2147483647});var Dg=T(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.Superblock=_t.File=_t.Link=_t.Node=void 0;var Ng=(Yo(),th(Xo));Ng.__exportStar(dg(),_t);Ng.__exportStar(bh(),_t);var vx=Fh();Object.defineProperty(_t,"Node",{enumerable:!0,get:l(function(){return vx.Node},"get")});var Ex=Rh();Object.defineProperty(_t,"Link",{enumerable:!0,get:l(function(){return Ex.Link},"get")});var Sx=xh();Object.defineProperty(_t,"File",{enumerable:!0,get:l(function(){return Sx.File},"get")});var Fx=Pg();Object.defineProperty(_t,"Superblock",{enumerable:!0,get:l(function(){return Fx.Superblock},"get")})});var Cg=T(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.StatFs=void 0;var _c=class _c{static build(e,r=!1){let i=new _c,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,a=1e6,f=Math.min(s*2,a),o=a-f;i.blocks=n(a),i.bfree=n(o),i.bavail=n(o);let c=1e6;return i.files=n(c),i.ffree=n(c-s),i}};l(_c,"StatFs");var bc=_c;wa.StatFs=bc;wa.default=bc});var Ig=T($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});function Tx(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(Tx,"setTimeoutUnref");$h.default=Tx});var Bg=T(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.Writable=An.Readable=void 0;var $g=se("node:stream");Object.defineProperty(An,"Readable",{enumerable:!0,get:l(function(){return $g.Readable},"get")});Object.defineProperty(An,"Writable",{enumerable:!0,get:l(function(){return $g.Writable},"get")})});var Bh=T(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.EventEmitter=void 0;var Rx=se("node:events");Object.defineProperty(vc,"EventEmitter",{enumerable:!0,get:l(function(){return Rx.EventEmitter},"get")})});var Mg=T(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.FileHandle=void 0;var Ue=Cr(),Ox=Bh(),jh=class jh extends Ox.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,Ue.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,Ue.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,Ue.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,Ue.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,Ue.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=l(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:l(async a=>{try{let f=a.byobRequest?.view;if(!f){let c=new Uint8Array(16384),u=await this.read(c,0,c.length,n);if(u.bytesRead===0){a.close(),s();return}n+=u.bytesRead,a.enqueue(c.slice(0,u.bytesRead));return}let o=await this.read(f,f.byteOffset,f.byteLength,n);if(o.bytesRead===0){a.close(),s();return}n+=o.bytesRead,a.byobRequest.respond(o.bytesRead)}catch(f){a.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,a=await(0,Ue.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=a.bytesRead),a}readv(e,r){return(0,Ue.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,Ue.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,Ue.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,Ue.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,Ue.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,Ue.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",a=s?this.position:n,f=await(0,Ue.promisify)(this.fs,"write",o=>({bytesWritten:o,buffer:e}))(this.fd,e,r,i,a);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,Ue.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,Ue.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,Ue.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(jh,"FileHandle");var Mh=jh;Ec.FileHandle=Mh});var jg=T(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.FsPromises=void 0;var te=Cr(),kx=Ct(),Uh=class Uh{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};l(Uh,"FSWatchAsyncIterator");var Lh=Uh,Wh=class Wh{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=kx.constants,this.cp=(0,te.promisify)(this.fs,"cp"),this.opendir=(0,te.promisify)(this.fs,"opendir"),this.statfs=(0,te.promisify)(this.fs,"statfs"),this.lutimes=(0,te.promisify)(this.fs,"lutimes"),this.glob=(0,te.promisify)(this.fs,"glob"),this.access=(0,te.promisify)(this.fs,"access"),this.chmod=(0,te.promisify)(this.fs,"chmod"),this.chown=(0,te.promisify)(this.fs,"chown"),this.copyFile=(0,te.promisify)(this.fs,"copyFile"),this.lchmod=(0,te.promisify)(this.fs,"lchmod"),this.lchown=(0,te.promisify)(this.fs,"lchown"),this.link=(0,te.promisify)(this.fs,"link"),this.lstat=(0,te.promisify)(this.fs,"lstat"),this.mkdir=(0,te.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,te.promisify)(this.fs,"mkdtemp"),this.readdir=(0,te.promisify)(this.fs,"readdir"),this.readlink=(0,te.promisify)(this.fs,"readlink"),this.realpath=(0,te.promisify)(this.fs,"realpath"),this.rename=(0,te.promisify)(this.fs,"rename"),this.rmdir=(0,te.promisify)(this.fs,"rmdir"),this.rm=(0,te.promisify)(this.fs,"rm"),this.stat=(0,te.promisify)(this.fs,"stat"),this.symlink=(0,te.promisify)(this.fs,"symlink"),this.truncate=(0,te.promisify)(this.fs,"truncate"),this.unlink=(0,te.promisify)(this.fs,"unlink"),this.utimes=(0,te.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,te.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,te.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,te.promisify)(this.fs,"open",a=>new this.FileHandle(this.fs,a))(i,n,s),this.writeFile=(i,n,s)=>((0,te.isReadableStream)(n)?(0,te.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,te.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,f,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new Lh(this.fs,i,s)}}};l(Wh,"FsPromises");var qh=Wh;Sc.FsPromises=qh});var Lg=T(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.printTree=void 0;var xx=l((t="",e)=>{let r="",i=e.length-1;for(;i>=0&&!e[i];i--);for(let n=0;n<=i;n++){let s=e[n];if(!s)continue;let a=n===i,f=s(t+(a?" ":"\u2502")+" "),o=f?a?"\u2514\u2500":"\u251C\u2500":"\u2502";r+=`
|
|
5
|
+
`+t+o+(f?" "+f:"")}return r},"printTree");Fc.printTree=xx});var qg=T(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.printBinary=void 0;var Ax=l((t="",e)=>{let r=e[0],i=e[1],n="";return r&&(n+=`
|
|
6
|
+
`+t+"\u2190 "+r(t+" ")),i&&(n+=`
|
|
7
|
+
`+t+"\u2192 "+i(t+" ")),n},"printBinary");Tc.printBinary=Ax});var Ug=T(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.printJson=void 0;var Px=l((t="",e,r=2)=>(JSON.stringify(e,null,r)||"nil").split(`
|
|
8
|
+
`).join(`
|
|
9
|
+
`+t),"printJson");Rc.printJson=Px});var Hh=T(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var zh=(Yo(),th(Xo));zh.__exportStar(Lg(),ya);zh.__exportStar(qg(),ya);zh.__exportStar(Ug(),ya)});var Wg=T(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.newNotAllowedError=We.newTypeMismatchError=We.newNotFoundError=We.assertCanWrite=We.assertName=We.basename=We.ctx=void 0;var Nx=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");We.ctx=Nx;var Dx=l((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");We.basename=Dx;var Cx=/^(\.{1,2})$|^(.*([\/\\]).*)$/,Ix=l((t,e,r)=>{if(!t||Cx.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");We.assertName=Ix;var $x=l(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");We.assertCanWrite=$x;var Bx=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");We.newNotFoundError=Bx;var Mx=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");We.newTypeMismatchError=Mx;var jx=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");We.newNotAllowedError=jx});var zg=T(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.toTreeSync=void 0;var Lx=Hh(),qx=Wg(),Ux=l((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,a=" (...)";if(s>0){let o=t.readdirSync(i,{withFileTypes:!0});a=(0,Lx.printTree)(n,o.map(c=>u=>c.isDirectory()?(0,ga.toTreeSync)(t,{dir:i+c.name,depth:s-1,tab:u}):c.isSymbolicLink()?""+c.name+" \u2192 "+t.readlinkSync(i+c.name):""+c.name))}return(0,qx.basename)(i,r)+r+a},"toTreeSync");ga.toTreeSync=Ux});var Gg=T(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.getWriteFileOptions=j.writeFileDefaults=j.getRealpathOptsAndCb=j.getRealpathOptions=j.getStatfsOptsAndCb=j.getStatfsOptions=j.getStatOptsAndCb=j.getStatOptions=j.getAppendFileOptsAndCb=j.getAppendFileOpts=j.getOpendirOptsAndCb=j.getOpendirOptions=j.getReaddirOptsAndCb=j.getReaddirOptions=j.getReadFileOptions=j.getRmOptsAndCb=j.getRmdirOptions=j.getDefaultOptsAndCb=j.getDefaultOpts=j.optsDefaults=j.getMkdirOptions=void 0;j.getOptions=Vg;j.optsGenerator=dr;j.optsAndCbGenerator=pi;var Oc=On(),Wx=ua(),Vh=Cr(),Hg={mode:511,recursive:!1},zx=l(t=>typeof t=="number"?Object.assign({},Hg,{mode:t}):Object.assign({},Hg,t),"getMkdirOptions");j.getMkdirOptions=zx;var Hx=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function Vg(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(Hx(i))}}else return t;return r.encoding!=="buffer"&&(0,Wx.assertEncoding)(r.encoding),r}l(Vg,"getOptions");function dr(t){return e=>Vg(t,e)}l(dr,"optsGenerator");function pi(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,Vh.validateCallback)(r)]}l(pi,"optsAndCbGenerator");j.optsDefaults={encoding:"utf8"};j.getDefaultOpts=dr(j.optsDefaults);j.getDefaultOptsAndCb=pi(j.getDefaultOpts);var Vx={recursive:!1},Gx=l(t=>Object.assign({},Vx,t),"getRmdirOptions");j.getRmdirOptions=Gx;var Kx=dr(j.optsDefaults);j.getRmOptsAndCb=pi(Kx);var Jx={flag:"r"};j.getReadFileOptions=dr(Jx);var Xx={encoding:"utf8",recursive:!1,withFileTypes:!1};j.getReaddirOptions=dr(Xx);j.getReaddirOptsAndCb=pi(j.getReaddirOptions);var Yx={encoding:"utf8",bufferSize:32,recursive:!1};j.getOpendirOptions=dr(Yx);j.getOpendirOptsAndCb=pi(j.getOpendirOptions);var Zx={encoding:"utf8",mode:438,flag:Oc.FLAGS[Oc.FLAGS.a]};j.getAppendFileOpts=dr(Zx);j.getAppendFileOptsAndCb=pi(j.getAppendFileOpts);var Qx={bigint:!1},eA=l((t={})=>Object.assign({},Qx,t),"getStatOptions");j.getStatOptions=eA;var tA=l((t,e)=>typeof t=="function"?[(0,j.getStatOptions)(),t]:[(0,j.getStatOptions)(t),(0,Vh.validateCallback)(e)],"getStatOptsAndCb");j.getStatOptsAndCb=tA;var rA={bigint:!1},iA=l((t={})=>Object.assign({},rA,t),"getStatfsOptions");j.getStatfsOptions=iA;var nA=l((t,e)=>typeof t=="function"?[(0,j.getStatfsOptions)(),t]:[(0,j.getStatfsOptions)(t),(0,Vh.validateCallback)(e)],"getStatfsOptsAndCb");j.getStatfsOptsAndCb=nA;var sA=j.optsDefaults;j.getRealpathOptions=dr(sA);j.getRealpathOptsAndCb=pi(j.getRealpathOptions);j.writeFileDefaults={encoding:"utf8",mode:438,flag:Oc.FLAGS[Oc.FLAGS.w]};j.getWriteFileOptions=dr(j.writeFileDefaults)});var Jg=T(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.Dir=void 0;var Kg=Cr(),aA=Vo(),mi=fa(),Kh=class Kh{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),aA.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new mi.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,Kg.validateCallback)(e),this.closed){process.nextTick(e,new mi.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new mi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new mi.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,Kg.validateCallback)(e),this.closed){process.nextTick(e,new mi.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new mi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new mi.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:l(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};l(Kh,"Dir");var Gh=Kh;kc.Dir=Gh});var Jh=T(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.toMatcher=pr.toRegex=void 0;var oA=l(t=>/[.^$+{}()|\\]/.test(t)?`\\${t}`:t,"escapeRe"),cA=l((t,e,r,i)=>{let n=e,s=[],a="",f=1;for(;n<t.length&&f>0;){let u=t[n];if(u==="(")f++,a+=u,n++;else if(u===")")if(f--,f===0){s.push(a),n++;break}else a+=u,n++;else u==="|"&&f===1?(s.push(a),a="",n++):(a+=u,n++)}if(f!==0)return;let o="",c=s.length;for(let u=0;u<c;u++)o+=(o?"|":"")+(0,pr.toRegex)(s[u],i).source.replace(/^\^/,"").replace(/\$$/,"");switch(r){case"?":return[`(?:${o})?`,n];case"*":return[`(?:${o})*`,n];case"+":return[`(?:${o})+`,n];case"@":return[`(?:${o})`,n];case"!":return[`(?!${o})[^/]*`,n]}},"parseExtGlob"),lA=l((t,e)=>{let r="",i=0,n=l(()=>{i++;let f=[],o="",c=!1;for(;i<t.length;){let h=t[i];if(h==="}"){f.push(o),i++,c=!0;break}if(h===","){f.push(o),o="",i++;continue}o+=h,i++}return c?`(?:${f.map(h=>(0,pr.toRegex)(h,e).source.replace(/^\^/,"").replace(/\$$/,"")).join("|")})`:"\\{"+oA(o)},"parseBraceGroup"),s=!!e?.extglob;for(;i<t.length;){let f=t[i];if(s&&t[i+1]==="("&&(f==="?"||f==="*"||f==="+"||f==="@"||f==="!")){let o=cA(t,i+2,f,e);if(o){r+=o[0],i=o[1];continue}}switch(f){case"*":{if(t[i+1]==="*"){let o=i+2;for(;t[o]==="*";)o++;t[o]==="/"?(r+="(?:.*/)?",i=o+1):(r+=".*",i=o)}else r+="[^/]*",i++;break}case"?":r+="[^/]",i++;break;case"[":{let o="[";for(i++,i<t.length&&t[i]==="!"&&(o+="^",i++),i<t.length&&t[i]==="]"&&(o+="]",i++);i<t.length&&t[i]!=="]";){let c=t[i];o+=c==="\\"?"\\\\":c,i++}if(i<t.length&&t[i]==="]")o+="]",i++;else{r+="\\[";continue}r+=o;break}case"{":{r+=n();break}case"/":r+="/",i++;break;case".":case"^":case"$":case"+":case"(":case")":case"|":case"\\":r+=`\\${f}`,i++;break;default:r+=f,i++;break}}let a=e?.nocase?"i":"";return new RegExp("^"+r+"$",a)},"toRegex");pr.toRegex=lA;var fA=/^\/(.{1,4096})\/([gimsuy]{0,6})$/,uA=l((t,e)=>{let r=[],i=Array.isArray(t)?t:[t];for(let n of i)if(typeof n=="string"){let s=fA.exec(n);if(s){let[,a,f]=s;r.push(new RegExp(a,f))}else r.push((0,pr.toRegex)(n,e))}else r.push(n);return r.length?new Function("p","return "+r.map(n=>n+".test(p)").join("||")):()=>!1},"toMatcher");pr.toMatcher=uA});var Zg=T(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.globSync=yA;var wi=Sn(),hA=Jh(),Xg=Cr(),dA=wi.posix.join,pA=wi.posix.relative,mA=wi.posix.resolve;function Yg(t,e){return(0,hA.toRegex)(e).test(t)}l(Yg,"matchesPattern");function wA(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>Yg(t,i)):!1}l(wA,"isExcluded");function Xh(t,e,r,i,n=0){let s=[],a=i.maxdepth??1/0,f=i.cwd?(0,Xg.pathToFilename)(i.cwd):process.cwd();if(n>a)return s;try{let o=t.readdirSync(e,{withFileTypes:!0});for(let c of o){let u=dA(e,c.name.toString()),h=pA(f,u);if(wA(h,i.exclude))continue;if(r.some(p=>Yg(h,p))&&s.push(h),c.isDirectory()&&n<a){let p=Xh(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(Xh,"walkDirectory");function yA(t,e,r={}){let i=r.cwd?(0,Xg.pathToFilename)(r.cwd):process.cwd(),n=mA(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},a=[];if(wi.posix.isAbsolute(e)){let f=wi.posix.dirname(e),o=wi.posix.basename(e),c=Xh(t,f,[o],{...s,cwd:f});a.push(...c.map(u=>wi.posix.resolve(f,u)))}else{let f=Xh(t,n,[e],s);a.push(...f)}return a=[...new Set(a)].sort(),a}l(yA,"globSync")});var s0=T(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.FSWatcher=ct.StatWatcher=ct.Volume=void 0;ct.pathToSteps=CA;ct.dataToStr=IA;ct.toUnixTimestamp=ot;var ve=Sn(),td=Dg(),Zh=oh(),gA=Vo(),bA=Cg(),Dn=Pr(),Dc=Ph(),_A=Ig(),Cc=Bg(),vA=Ct(),r0=Bh(),yi=ua(),EA=Mg(),i0=lh(),SA=jg(),FA=zg(),Ac=On(),TA=fa(),Y=Gg(),A=Cr(),RA=Jg(),$e=pc(),OA=ve.resolve,{O_SYMLINK:Qg,F_OK:Qh,R_OK:kA,W_OK:xA,X_OK:AA,COPYFILE_EXCL:PA,COPYFILE_FICLONE_FORCE:NA}=vA.constants,S6=ve.posix?ve.posix.sep:ve.sep,xc=ve.posix?ve.posix.relative:ve.relative,ed=ve.posix?ve.posix.join:ve.join,e0=ve.posix?ve.posix.dirname:ve.dirname,t0=ve.posix?ve.posix.normalize:ve.normalize,DA=128;function CA(t){return(0,$e.filenameToSteps)((0,A.pathToFilename)(t))}l(CA,"pathToSteps");function IA(t,e=yi.ENCODING_UTF8){return Dn.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Dn.bufferFrom)(t).toString(e):String(t)}l(IA,"dataToStr");function ot(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}l(ot,"toUnixTimestamp");function Pn(t){if(typeof t!="number")throw TypeError(Ac.ERRSTR.UID)}l(Pn,"validateUid");function Nn(t){if(typeof t!="number")throw TypeError(Ac.ERRSTR.GID)}l(Nn,"validateGid");var rd=class rd{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new td.Superblock){this._core=e,this.promisesApi=new SA.FsPromises(this,EA.FileHandle),this.openSync=(o,c,u=438)=>{let h=(0,A.modeToNumber)(u),d=(0,A.pathToFilename)(o),p=(0,A.flagsToNumber)(c);return this._core.open(d,p,h,!(p&Qg))},this.open=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,A.modeToNumber)(d),w=(0,A.pathToFilename)(o),y=(0,A.flagsToNumber)(c);this.wrapAsync(this._core.open,[w,y,m,!(y&Qg)],p)},this.closeSync=o=>{this._core.close(o)},this.close=(o,c)=>{(0,$e.validateFd)(o);let u=this._core.getFileByFdOrThrow(o,"close");this.wrapAsync(this._core.close,[u.fd],c)},this.readSync=(o,c,u,h,d)=>((0,$e.validateFd)(o),this._core.read(o,c,u,h,d)),this.read=(o,c,u,h,d,p)=>{if((0,A.validateCallback)(p),h===0)return(0,Dc.default)(()=>{p&&p(null,0,c)});Promise.resolve().then(()=>{try{let m=this._core.read(o,c,u,h,d);p(null,m,c)}catch(m){p(m)}})},this.readv=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,A.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.readvSync=(o,c,u)=>((0,$e.validateFd)(o),this._core.readv(o,c,u??null)),this._readfile=(o,c,u)=>{let h,p=typeof o=="number"&&(0,$e.isFd)(o),m;if(p)m=o;else{let w=(0,A.pathToFilename)(o),y=String(o),g=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,A.createError)("EISDIR","open",_.getPath());if(g&&F.isFile())throw(0,A.createError)("ENOTDIR","open",y);m=this.openSync(o,c)}try{h=(0,A.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(o,c)=>{let u=(0,Y.getReadFileOptions)(c),h=(0,A.flagsToNumber)(u.flag);return this._readfile(o,h,u.encoding)},this.readFile=(o,c,u)=>{let[h,d]=(0,Y.optsAndCbGenerator)(Y.getReadFileOptions)(c,u),p=(0,A.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[o,p,h.encoding],d)},this.writeSync=(o,c,u,h,d)=>{let[,p,m,w,y]=(0,A.getWriteSyncArgs)(o,c,u,h,d);return this._write(o,p,m,w,y)},this.write=(o,c,u,h,d,p)=>{let[,m,w,y,g,_,F]=(0,A.getWriteArgs)(o,c,u,h,d,p);Promise.resolve().then(()=>{try{let R=this._write(o,w,y,g,_);m?F(null,R,c):F(null,R,w)}catch(R){F(R)}})},this.writev=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,A.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.writevSync=(o,c,u)=>((0,$e.validateFd)(o),this.writevBase(o,c,u??null)),this.writeFileSync=(o,c,u)=>{let h=(0,Y.getWriteFileOptions)(u),d=(0,A.flagsToNumber)(h.flag),p=(0,A.modeToNumber)(h.mode),m=(0,$e.dataToBuffer)(c,h.encoding);this._core.writeFile(o,m,d,p)},this.writeFile=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[Y.writeFileDefaults,u]);let m=(0,A.validateCallback)(p),w=(0,Y.getWriteFileOptions)(d),y=(0,A.flagsToNumber)(w.flag),g=(0,A.modeToNumber)(w.mode),_=(0,$e.dataToBuffer)(c,w.encoding);this.wrapAsync(this._core.writeFile,[o,_,y,g],m)},this.copyFileSync=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(o,c,u,h)=>{let d=(0,A.pathToFilename)(o),p=(0,A.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,A.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(o,c,u)=>{if(u.filter&&!u.filter(o,c))return;let h=u.dereference?this.statSync(o):this.lstatSync(o),d=null;try{d=this.lstatSync(c)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,A.createError)("EINVAL","cp",o,c);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,A.createError)("EISDIR","cp",o,c);if(!h.isDirectory()&&d.isDirectory())throw(0,A.createError)("ENOTDIR","cp",o,c)}if(h.isDirectory()&&this.isSrcSubdir(o,c))throw(0,A.createError)("EINVAL","cp",o,c);{let p=e0(c);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,A.createError)("EISDIR","cp",o);this.cpDirSync(h,d,o,c,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,o,c,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,o,c,u);else throw(0,A.createError)("EINVAL","cp",o)},this.linkSync=(o,c)=>{let u=(0,A.pathToFilename)(o),h=(0,A.pathToFilename)(c);this._core.link(u,h)},this.link=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=o=>{let c=(0,A.pathToFilename)(o);this._core.unlink(c)},this.unlink=(o,c)=>{let u=(0,A.pathToFilename)(o);this.wrapAsync(this._core.unlink,[u],c)},this.symlinkSync=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);this._core.symlink(h,d)},this.symlink=(o,c,u,h)=>{let d=(0,A.validateCallback)(typeof u=="function"?u:h),p=(0,A.pathToFilename)(o),m=(0,A.pathToFilename)(c);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(o,c=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(o,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return Zh.default.build(h.getNode(),c)},this.lstatSync=(o,c)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,Y.getStatOptions)(c);return this._lstat((0,A.pathToFilename)(o),h,u)},this.renameSync=(o,c)=>{let u=(0,A.pathToFilename)(o),h=(0,A.pathToFilename)(c);this._core.rename(u,h)},this.rename=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=o=>{try{return this._exists((0,A.pathToFilename)(o))}catch{return!1}},this.exists=(o,c)=>{let u=(0,A.pathToFilename)(o);if(typeof c!="function")throw Error(Ac.ERRSTR.CB);Promise.resolve().then(()=>{try{c(this._exists(u))}catch{c(!1)}})},this.accessSync=(o,c=Qh)=>{let u=(0,A.pathToFilename)(o);c=c|0,this._access(u,c)},this.access=(o,c,u)=>{let h=Qh,d;typeof c!="function"?[h,d]=[c|0,(0,A.validateCallback)(u)]:d=c;let p=(0,A.pathToFilename)(o);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(o,c,u)=>{let h=(0,Y.getAppendFileOpts)(u);(!h.flag||(0,$e.isFd)(o))&&(h.flag="a"),this.writeFileSync(o,c,h)},this.appendFile=(o,c,u,h)=>{let[d,p]=(0,Y.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,$e.isFd)(o))&&(d.flag="a"),this.writeFile(o,c,d,p)},this._readdir=(o,c)=>{let u=(0,$e.filenameToSteps)(o),h=this._core.getResolvedLinkOrThrow(o,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,A.createError)("ENOTDIR","scandir",o);if(!d.canRead())throw(0,A.createError)("EACCES","scandir",o);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(gA.default.build(y,c.encoding)),c.recursive&&y.children.size)){let g={...c,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),g);p.push(..._)}}if(!$e.isWin&&c.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),c.withFileTypes)return p;let m=o;return $e.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(c.recursive){let y=ed(w.parentPath,w.name.toString());return $e.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+ve.posix.sep,"")}return w.name})},this.readdirSync=(o,c)=>{let u=(0,Y.getReaddirOptions)(c),h=(0,A.pathToFilename)(o);return this._readdir(h,u)},this.readdir=(o,c,u)=>{let[h,d]=(0,Y.getReaddirOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(o,c)=>{let h=this._core.getLinkOrThrow(o,"readlink").getNode();if(!h.isSymlink())throw(0,A.createError)("EINVAL","readlink",o);return(0,yi.strToEncoding)(h.symlink,c)},this.readlinkSync=(o,c)=>{let u=(0,Y.getDefaultOpts)(c),h=(0,A.pathToFilename)(o);return this._readlink(h,u.encoding)},this.readlink=(o,c,u)=>{let[h,d]=(0,Y.getDefaultOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=o=>{this._core.getFileByFdOrThrow(o,"fsync")},this.fsyncSync=o=>{this._fsync(o)},this.fsync=(o,c)=>{this.wrapAsync(this._fsync,[o],c)},this._fdatasync=o=>{this._core.getFileByFdOrThrow(o,"fdatasync")},this.fdatasyncSync=o=>{this._fdatasync(o)},this.fdatasync=(o,c)=>{this.wrapAsync(this._fdatasync,[o],c)},this._ftruncate=(o,c)=>{this._core.getFileByFdOrThrow(o,"ftruncate").truncate(c)},this.ftruncateSync=(o,c)=>{this._ftruncate(o,c)},this.ftruncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,A.validateCallback)(typeof c=="number"?u:c);this.wrapAsync(this._ftruncate,[o,h],d)},this._truncate=(o,c)=>{let u=this.openSync(o,"r+");try{this.ftruncateSync(u,c)}finally{this.closeSync(u)}},this.truncateSync=(o,c)=>{if((0,$e.isFd)(o))return this.ftruncateSync(o,c);this._truncate(o,c)},this.truncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,A.validateCallback)(typeof c=="number"?u:c);if((0,$e.isFd)(o))return this.ftruncate(o,h,d);this.wrapAsync(this._truncate,[o,h],d)},this._futimes=(o,c,u)=>{let d=this._core.getFileByFdOrThrow(o,"futimes").node;d.atime=new Date(c*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(o,c,u)=>{this._futimes(o,ot(c),ot(u))},this.futimes=(o,c,u,h)=>{this.wrapAsync(this._futimes,[o,ot(c),ot(u)],h)},this._utimes=(o,c,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(o,"utimes"):d.getLinkOrThrow(o,"lutimes")).getNode();m.atime=new Date(c*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(o,c,u)=>{this._utimes((0,A.pathToFilename)(o),ot(c),ot(u),!0)},this.utimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,A.pathToFilename)(o),ot(c),ot(u),!0],h)},this.lutimesSync=(o,c,u)=>{this._utimes((0,A.pathToFilename)(o),ot(c),ot(u),!1)},this.lutimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,A.pathToFilename)(o),ot(c),ot(u),!1],h)},this.mkdirSync=(o,c)=>{let u=(0,Y.getMkdirOptions)(c),h=(0,A.modeToNumber)(u.mode,511),d=(0,A.pathToFilename)(o);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(o,c,u)=>{let h=(0,Y.getMkdirOptions)(c),d=(0,A.validateCallback)(typeof c=="function"?c:u),p=(0,A.modeToNumber)(h.mode,511),m=(0,A.pathToFilename)(o);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(o,c,u=5)=>{let h=o+(0,A.genRndStr6)();try{return this._core.mkdir(h,511),(0,yi.strToEncoding)(h,c)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(o,c,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(o,c)=>{let{encoding:u}=(0,Y.getDefaultOpts)(c);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");return(0,A.nullCheck)(o),this._mkdtemp(o,u)},this.mkdtemp=(o,c,u)=>{let[{encoding:h},d]=(0,Y.getDefaultOptsAndCb)(c,u);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");(0,A.nullCheck)(o)&&this.wrapAsync(this._mkdtemp,[o,h],d)},this.rmdirSync=(o,c)=>{let u=(0,Y.getRmdirOptions)(c);this._core.rmdir((0,A.pathToFilename)(o),u.recursive)},this.rmdir=(o,c,u)=>{let h=(0,Y.getRmdirOptions)(c),d=(0,A.validateCallback)(typeof c=="function"?c:u);this.wrapAsync(this._core.rmdir,[(0,A.pathToFilename)(o),h.recursive],d)},this.rmSync=(o,c)=>{this._core.rm((0,A.pathToFilename)(o),c?.force,c?.recursive)},this.rm=(o,c,u)=>{let[h,d]=(0,Y.getRmOptsAndCb)(c,u);this.wrapAsync(this._core.rm,[(0,A.pathToFilename)(o),h?.force,h?.recursive],d)},this._fchmod=(o,c)=>{this._core.getFileByFdOrThrow(o,"fchmod").chmod(c)},this.fchmodSync=(o,c)=>{this._fchmod(o,(0,A.modeToNumber)(c))},this.fchmod=(o,c,u)=>{this.wrapAsync(this._fchmod,[o,(0,A.modeToNumber)(c)],u)},this._chmod=(o,c,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(o,"chmod"):this._core.getLinkOrThrow(o,"chmod")).getNode().chmod(c)},this.chmodSync=(o,c)=>{let u=(0,A.modeToNumber)(c),h=(0,A.pathToFilename)(o);this._chmod(h,u,!0)},this.chmod=(o,c,u)=>{let h=(0,A.modeToNumber)(c),d=(0,A.pathToFilename)(o);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(o,c)=>{this._chmod(o,c,!1)},this.lchmodSync=(o,c)=>{let u=(0,A.modeToNumber)(c),h=(0,A.pathToFilename)(o);this._lchmod(h,u)},this.lchmod=(o,c,u)=>{let h=(0,A.modeToNumber)(c),d=(0,A.pathToFilename)(o);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(o,c,u)=>{this._core.getFileByFdOrThrow(o,"fchown").chown(c,u)},this.fchownSync=(o,c,u)=>{Pn(c),Nn(u),this._fchown(o,c,u)},this.fchown=(o,c,u,h)=>{Pn(c),Nn(u),this.wrapAsync(this._fchown,[o,c,u],h)},this._chown=(o,c,u)=>{this._core.getResolvedLinkOrThrow(o,"chown").getNode().chown(c,u)},this.chownSync=(o,c,u)=>{Pn(c),Nn(u),this._chown((0,A.pathToFilename)(o),c,u)},this.chown=(o,c,u,h)=>{Pn(c),Nn(u),this.wrapAsync(this._chown,[(0,A.pathToFilename)(o),c,u],h)},this._lchown=(o,c,u)=>{this._core.getLinkOrThrow(o,"lchown").getNode().chown(c,u)},this.lchownSync=(o,c,u)=>{Pn(c),Nn(u),this._lchown((0,A.pathToFilename)(o),c,u)},this.lchown=(o,c,u,h)=>{Pn(c),Nn(u),this.wrapAsync(this._lchown,[(0,A.pathToFilename)(o),c,u],h)},this.statWatchers={},this.cpSync=(o,c,u)=>{let h=(0,A.pathToFilename)(o),d=(0,A.pathToFilename)(c),p={dereference:u?.dereference??!1,errorOnExist:u?.errorOnExist??!1,filter:u?.filter,force:u?.force??!0,mode:u?.mode??0,preserveTimestamps:u?.preserveTimestamps??!1,recursive:u?.recursive??!1,verbatimSymlinks:u?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(o,c,u,h)=>{let d=(0,A.pathToFilename)(o),p=(0,A.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,A.validateCallback)(w);let y={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,y],w)},this.openAsBlob=async(o,c)=>{let u=(0,A.pathToFilename)(o),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new TA.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=c?.type||"";return new Blob([p],{type:m})},this.glob=(o,...c)=>{let[u,h]=c.length===1?[{},c[0]]:[c[0],c[1]];this.wrapAsync(this._globSync,[o,u||{}],h)},this.globSync=(o,c={})=>this._globSync(o,c),this._globSync=(o,c={})=>{let{globSync:u}=Zg();return u(this,o,c)},this._opendir=(o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"scandir");if(!u.getNode().isDirectory())throw(0,A.createError)("ENOTDIR","scandir",o);return new RA.Dir(u,c)},this.opendirSync=(o,c)=>{let u=(0,Y.getOpendirOptions)(c),h=(0,A.pathToFilename)(o);return this._opendir(h,u)},this.opendir=(o,c,u)=>{let[h,d]=(0,Y.getOpendirOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Pc{constructor(){super(r)}};let i=Xt;this.ReadStream=class extends i{constructor(...o){super(r,...o)}};let n=Et;this.WriteStream=class extends n{constructor(...o){super(r,...o)}},this.FSWatcher=class extends Nc{constructor(){super(r)}};let s=l((o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"realpath");return(0,yi.strToEncoding)(u.getPath()||"/",c)},"_realpath"),a=l((o,c,u)=>{let[h,d]=(0,Y.getRealpathOptsAndCb)(c,u),p=(0,A.pathToFilename)(o);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((o,c)=>s((0,A.pathToFilename)(o),(0,Y.getRealpathOptions)(c).encoding),"realpathSyncImpl");this.realpath=a,this.realpath.native=a,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,A.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:ve.sep}){return(0,FA.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let a=this._core.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,A.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let a=0;for(let f of r){let o=Dn.Buffer.from(f.buffer,f.byteOffset,f.byteLength),c=n.write(o,0,o.byteLength,s);if(s=void 0,a+=c,c<o.byteLength)break}return a}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&PA&&this.existsSync(r))throw(0,A.createError)("EEXIST","copyFile",e,r);if(i&NA)throw(0,A.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,Ac.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=t0(e.startsWith("/")?e:"/"+e),n=t0(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=xc(i,n);return s===""||!s.startsWith("..")&&!(0,ve.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,A.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let a=this.readdirSync(i);for(let f of a){let o=ed(i,String(f)),c=ed(n,String(f));s.filter&&!s.filter(o,c)||this._cp(o,c,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,ve.isAbsolute)(s)&&(s=OA(e0(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},a]=(0,Y.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,A.pathToFilename)(e),s,n],a)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return Zh.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,Y.getStatOptions)(r);return this._stat((0,A.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},a]=(0,Y.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,A.pathToFilename)(e),n,s],a)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,A.createError)("EBADF","fstat");return Zh.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,Y.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,Y.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==Qh&&(r&kA&&!n.canRead()||r&xA&&!n.canWrite()||r&AA&&!n.canExecute()))throw(0,A.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,A.pathToFilename)(e),s=r,a=i;if(typeof s=="function"&&(a=r,s=null),typeof a!="function")throw Error('"watchFile()" requires a listener function');let f=5007,o=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(o=s.persistent));let c=this.statWatchers[n];return c||(c=new this.StatWatcher,c.start(n,o,f),this.statWatchers[n]=c),c.addListener("change",a),c}unwatchFile(e,r){let i=(0,A.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,A.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:a,recursive:f,encoding:o}=(0,Y.getDefaultOpts)(s);a===void 0&&(a=!0),f===void 0&&(f=!1);let c=new this.FSWatcher;return c.start(n,a,f,o),i&&c.addListener("change",i),c}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),bA.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,Y.getStatfsOptions)(r);return this._statfs((0,A.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,Y.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,A.pathToFilename)(e),n],s)}};l(rd,"Volume");var gi=rd;ct.Volume=gi;gi.fromJSON=(t,e)=>new gi(td.Superblock.fromJSON(t,e));gi.fromNestedJSON=(t,e)=>new gi(td.Superblock.fromNestedJSON(t,e));function $A(t){t.emit("stop")}l($A,"emitStop");var id=class id extends r0.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,A.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):_A.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,Dc.default)(()=>{$A.call(this,this)})}};l(id,"StatWatcher");var Pc=id;ct.StatWatcher=Pc;var vt;function BA(t){vt=(0,Dn.bufferAllocUnsafe)(t),vt.used=0}l(BA,"allocNewPool");(0,i0.inherits)(Xt,Cc.Readable);ct.ReadStream=Xt;function Xt(t,e,r){if(!(this instanceof Xt))return new Xt(t,e,r);if(this._vol=t,r=Object.assign({},(0,Y.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),Cc.Readable.call(this,r),this.path=(0,A.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}l(Xt,"FsReadStream");Xt.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};Xt.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!vt||vt.length-vt.used<DA)&&BA(this._readableState.highWaterMark);var e=vt,r=Math.min(vt.length-vt.used,t),i=vt.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,vt,vt.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),vt.used+=r;function s(a,f){if(a)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",a);else{var o=null;f>0&&(n.bytesRead+=f,o=e.slice(i,i+f)),n.push(o)}}l(s,"onread")};Xt.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};Xt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",n0);return}return(0,Dc.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function n0(t){this.close()}l(n0,"closeOnOpen");(0,i0.inherits)(Et,Cc.Writable);ct.WriteStream=Et;function Et(t,e,r){if(!(this instanceof Et))return new Et(t,e,r);if(this._vol=t,r=Object.assign({},(0,Y.getOptions)(r,{})),Cc.Writable.call(this,r),this.path=(0,A.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}l(Et,"FsWriteStream");Et.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Et.prototype._write=function(t,e,r){if(!(t instanceof Dn.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};Et.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,a=0;a<i;a++){var f=t[a].chunk;n[a]=f,s+=f.length}let o=Dn.Buffer.concat(n);this._vol.write(this.fd,o,0,o.length,this.pos,(c,u)=>{if(c)return r.destroy&&r.destroy(),e(c);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Et.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",n0);return}return(0,Dc.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Et.prototype._destroy=Xt.prototype._destroy;Et.prototype.destroySoon=Et.prototype.end;var nd=class nd extends r0.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=yi.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=yi.ENCODING_UTF8){this._filename=(0,A.pathToFilename)(e),this._steps=(0,$e.filenameToSteps)(this._filename),this._filenameEncoded=(0,yi.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(o){let c=new Error(`watch ${this._filename} ${o.code}`);throw c.code=o.code,c.errno=o.code,c}let s=l(o=>{let c=o.getPath(),u=o.getNode(),h=l(()=>{let m=xc(this._filename,c);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=u.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(u.ino)??[];p.push(()=>d()),this._listenerRemovers.set(u.ino,p)},"watchLinkNodeChanged"),a=l(o=>{let c=o.getNode(),u=l(m=>{this.emit("change","rename",xc(this._filename,m.getPath())),s(m),a(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let g=y.getNode().ino,_=this._listenerRemovers.get(g);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(g));for(let[F,R]of y.children.entries())R&&F!=="."&&F!==".."&&w(R)},"removeLinkNodeListeners");w(m),this.emit("change","rename",xc(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=o.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(c.ino)??[]).push(()=>{d()}),i)for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&a(w)},"watchLinkChildrenChanged");s(this._link),a(this._link);let f=this._link.parent;f&&f.changes.listen(([o,c])=>{o==="child:del"&&this._onParentChild(c)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(nd,"FSWatcher");var Nc=nd;ct.FSWatcher=Nc});var a0=T(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.fsSynchronousApiList=void 0;Ic.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var o0=T($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.fsCallbackApiList=void 0;$c.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var Cn=T((lt,Bc)=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.memfs=lt.fs=lt.vol=lt.Volume=void 0;lt.createFsFromVolume=sd;var MA=oh(),jA=Vo(),Mc=s0();Object.defineProperty(lt,"Volume",{enumerable:!0,get:l(function(){return Mc.Volume},"get")});var c0=Ct(),LA=a0(),qA=o0(),{F_OK:UA,R_OK:WA,W_OK:zA,X_OK:HA}=c0.constants;lt.vol=new Mc.Volume;function sd(t){let e={F_OK:UA,R_OK:WA,W_OK:zA,X_OK:HA,constants:c0.constants,Stats:MA.default,Dirent:jA.default};for(let r of LA.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of qA.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=Mc.toUnixTimestamp,e.__vol=t,e}l(sd,"createFsFromVolume");lt.fs=sd(lt.vol);var VA=l((t={},e="/")=>{let r=Mc.Volume.fromNestedJSON(t,e);return{fs:sd(r),vol:r}},"memfs");lt.memfs=VA;Bc.exports={...Bc.exports,...lt.fs};Bc.exports.semantic=!0});var md=T((D6,qc)=>{function u0(t){return Array.isArray(t)?t:[t]}l(u0,"makeArray");var GA=void 0,od="",l0=" ",ad="\\",KA=/^\s+$/,JA=/(?:[^\\]|^)\\$/,XA=/^\\!/,YA=/^\\#/,ZA=/\r?\n/g,QA=/^\.{0,2}\/|^\.{1,2}$/,eP=/\/$/,In="/",h0="node-ignore";typeof Symbol<"u"&&(h0=Symbol.for("node-ignore"));var d0=h0,$n=l((t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),"define"),tP=/([0-z])-([0-z])/g,p0=l(()=>!1,"RETURN_FALSE"),rP=l(t=>t.replace(tP,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:od),"sanitizeRange"),iP=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),nP=[[/^\uFEFF/,()=>od],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?l0:od)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+l0}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,l(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>ad],[/\\\\/g,()=>ad],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===ad?`\\[${r}${iP(i)}${n}`:n==="]"&&i.length%2===0?`[${rP(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],sP=/(^|\\\/)?\\\*$/,ba="regex",jc="checkRegex",f0="_",aP={[ba](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[jc](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},oP=l(t=>nP.reduce((e,[r,i])=>e.replace(r,i.bind(t)),t),"makeRegexPrefix"),Lc=l(t=>typeof t=="string","isString"),cP=l(t=>t&&Lc(t)&&!KA.test(t)&&!JA.test(t)&&t.indexOf("#")!==0,"checkPattern"),lP=l(t=>t.split(ZA).filter(Boolean),"splitPattern"),hd=class hd{constructor(e,r,i,n,s,a){this.pattern=e,this.mark=r,this.negative=s,$n(this,"body",i),$n(this,"ignoreCase",n),$n(this,"regexPrefix",a)}get regex(){let e=f0+ba;return this[e]?this[e]:this._make(ba,e)}get checkRegex(){let e=f0+jc;return this[e]?this[e]:this._make(jc,e)}_make(e,r){let i=this.regexPrefix.replace(sP,aP[e]),n=this.ignoreCase?new RegExp(i,"i"):new RegExp(i);return $n(this,r,n)}};l(hd,"IgnoreRule");var cd=hd,fP=l(({pattern:t,mark:e},r)=>{let i=!1,n=t;n.indexOf("!")===0&&(i=!0,n=n.substr(1)),n=n.replace(XA,"!").replace(YA,"#");let s=oP(n);return new cd(t,e,n,r,i,s)},"createRule"),dd=class dd{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d0]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(Lc(e)&&(e={pattern:e}),cP(e.pattern)){let r=fP(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,u0(Lc(e)?lP(e):e).forEach(this._add,this),this._added}test(e,r,i){let n=!1,s=!1,a;this._rules.forEach(o=>{let{negative:c}=o;s===c&&n!==s||c&&!n&&!s&&!r||!o[i].test(e)||(n=!c,s=c,a=c?GA:o)});let f={ignored:n,unignored:s};return a&&(f.rule=a),f}};l(dd,"RuleManager");var ld=dd,uP=l((t,e)=>{throw new e(t)},"throwError"),mr=l((t,e,r)=>Lc(t)?t?mr.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),m0=l(t=>QA.test(t),"isNotRelative");mr.isNotRelative=m0;mr.convert=t=>t;var pd=class pd{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){$n(this,d0,!0),this._rules=new ld(r),this._strictPathCheck=!i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,i,n){let s=e&&mr.convert(e);return mr(s,e,this._strictPathCheck?uP:p0),this._t(s,r,i,n)}checkIgnore(e){if(!eP.test(e))return this.test(e);let r=e.split(In).filter(Boolean);if(r.pop(),r.length){let i=this._t(r.join(In)+In,this._testCache,!0,r);if(i.ignored)return i}return this._rules.test(e,!1,jc)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(In).filter(Boolean)),n.pop(),!n.length)return r[e]=this._rules.test(e,i,ba);let s=this._t(n.join(In)+In,r,i,n);return r[e]=s.ignored?s:this._rules.test(e,i,ba)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return u0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(pd,"Ignore");var fd=pd,ud=l(t=>new fd(t),"factory"),hP=l(t=>mr(t&&mr.convert(t),t,p0),"isPathValid"),w0=l(()=>{let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");mr.convert=t;let e=/^[a-z]:\//i;mr.isNotRelative=r=>e.test(r)||m0(r)},"setupWindows");typeof process<"u"&&process.platform==="win32"&&w0();qc.exports=ud;ud.default=ud;qc.exports.isPathValid=hP;$n(qc.exports,Symbol.for("setupWindows"),w0)});var g0=T((I6,y0)=>{"use strict";var ft=l(function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||ft.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||ft.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||ft.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=ft.DEFAULT_MAX_PENDING},"AsyncLock");ft.DEFAULT_TIMEOUT=0;ft.DEFAULT_MAX_OCCUPATION_TIME=0;ft.DEFAULT_MAX_EXECUTION_TIME=0;ft.DEFAULT_MAX_PENDING=1e3;ft.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,a=null;typeof r!="function"&&(i=r,r=null,a=new this.Promise(function(_,F){n=_,s=F})),i=i||{};var f=!1,o=null,c=null,u=null,h=this,d=l(function(_,F,R){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),_&&(h.queues[t]&&h.queues[t].length===0&&delete h.queues[t],h.domainReentrant&&delete h.domains[t]),f||(a?F?s(F):n(R):typeof r=="function"&&r(F,R),f=!0),_&&h.queues[t]&&h.queues[t].length>0&&h.queues[t].shift()()},"done"),p=l(function(_){if(f)return d(_);o&&(clearTimeout(o),o=null),h.domainReentrant&&_&&(h.domains[t]=process.domain);var F=i.maxExecutionTime||h.maxExecutionTime;if(F&&(u=setTimeout(function(){h.queues[t]&&d(_,new Error("Maximum execution time is exceeded "+t))},F)),e.length===1){var R=!1;try{e(function(k,D){R||(R=!0,d(_,k,D))})}catch(k){R||(R=!0,d(_,k))}}else h._promiseTry(function(){return e()}).then(function(k){d(_,void 0,k)},function(k){d(_,k)})},"exec");h.domainReentrant&&process.domain&&(p=process.domain.bind(p));var m=i.maxPending||h.maxPending;if(!h.queues[t])h.queues[t]=[],p(!0);else if(h.domainReentrant&&process.domain&&process.domain===h.domains[t])p(!1);else if(h.queues[t].length>=m)d(!1,new Error("Too many pending tasks in queue "+t));else{var w=l(function(){p(!0)},"taskFn");i.skipQueue?h.queues[t].unshift(w):h.queues[t].push(w);var y=i.timeout||h.timeout;y&&(o=setTimeout(function(){o=null,d(!1,new Error("async-lock timed out in queue "+t))},y))}var g=i.maxOccupationTime||h.maxOccupationTime;if(g&&(c=setTimeout(function(){h.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},g)),a)return a};ft.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=l(function(f,o){return function(c){n.acquire(f,o,c,i)}},"getFn"),a=t.reduceRight(function(f,o){return s(o,f)},e);if(typeof r=="function")a(r);else return new this.Promise(function(f,o){a.length===1?a(function(c,u){c?o(c):f(u)}):f(a())})};ft.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};ft.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};y0.exports=ft});var _0=T((B6,b0)=>{"use strict";b0.exports=g0()});var v0=T((M6,wd)=>{typeof Object.create=="function"?wd.exports=l(function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):wd.exports=l(function(e,r){if(r){e.super_=r;var i=l(function(){},"TempCtor");i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}},"inherits")});var bi=T((L6,gd)=>{try{if(yd=se("util"),typeof yd.inherits!="function")throw"";gd.exports=yd.inherits}catch{gd.exports=v0()}var yd});var _a=T((bd,S0)=>{var Uc=se("buffer"),Yt=Uc.Buffer;function E0(t,e){for(var r in t)e[r]=t[r]}l(E0,"copyProps");Yt.from&&Yt.alloc&&Yt.allocUnsafe&&Yt.allocUnsafeSlow?S0.exports=Uc:(E0(Uc,bd),bd.Buffer=_i);function _i(t,e,r){return Yt(t,e,r)}l(_i,"SafeBuffer");_i.prototype=Object.create(Yt.prototype);E0(Yt,_i);_i.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Yt(t,e,r)};_i.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=Yt(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};_i.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Yt(t)};_i.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Uc.SlowBuffer(t)}});var T0=T((U6,F0)=>{var dP={}.toString;F0.exports=Array.isArray||function(t){return dP.call(t)=="[object Array]"}});var Bn=T((W6,R0)=>{"use strict";R0.exports=TypeError});var _d=T((z6,O0)=>{"use strict";O0.exports=Object});var x0=T((H6,k0)=>{"use strict";k0.exports=Error});var P0=T((V6,A0)=>{"use strict";A0.exports=EvalError});var D0=T((G6,N0)=>{"use strict";N0.exports=RangeError});var I0=T((K6,C0)=>{"use strict";C0.exports=ReferenceError});var vd=T((J6,$0)=>{"use strict";$0.exports=SyntaxError});var M0=T((X6,B0)=>{"use strict";B0.exports=URIError});var L0=T((Y6,j0)=>{"use strict";j0.exports=Math.abs});var U0=T((Z6,q0)=>{"use strict";q0.exports=Math.floor});var z0=T((Q6,W0)=>{"use strict";W0.exports=Math.max});var V0=T((e3,H0)=>{"use strict";H0.exports=Math.min});var K0=T((t3,G0)=>{"use strict";G0.exports=Math.pow});var X0=T((r3,J0)=>{"use strict";J0.exports=Math.round});var Z0=T((i3,Y0)=>{"use strict";Y0.exports=Number.isNaN||l(function(e){return e!==e},"isNaN")});var eb=T((s3,Q0)=>{"use strict";var pP=Z0();Q0.exports=l(function(e){return pP(e)||e===0?e:e<0?-1:1},"sign")});var rb=T((o3,tb)=>{"use strict";tb.exports=Object.getOwnPropertyDescriptor});var Mn=T((c3,ib)=>{"use strict";var Wc=rb();if(Wc)try{Wc([],"length")}catch{Wc=null}ib.exports=Wc});var va=T((l3,nb)=>{"use strict";var zc=Object.defineProperty||!1;if(zc)try{zc({},"a",{value:1})}catch{zc=!1}nb.exports=zc});var Ed=T((f3,sb)=>{"use strict";sb.exports=l(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==n||f.enumerable!==!0)return!1}return!0},"hasSymbols")});var cb=T((h3,ob)=>{"use strict";var ab=typeof Symbol<"u"&&Symbol,mP=Ed();ob.exports=l(function(){return typeof ab!="function"||typeof Symbol!="function"||typeof ab("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:mP()},"hasNativeSymbols")});var Sd=T((p3,lb)=>{"use strict";lb.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Fd=T((m3,fb)=>{"use strict";var wP=_d();fb.exports=wP.getPrototypeOf||null});var db=T((w3,hb)=>{"use strict";var yP="Function.prototype.bind called on incompatible ",gP=Object.prototype.toString,bP=Math.max,_P="[object Function]",ub=l(function(e,r){for(var i=[],n=0;n<e.length;n+=1)i[n]=e[n];for(var s=0;s<r.length;s+=1)i[s+e.length]=r[s];return i},"concatty"),vP=l(function(e,r){for(var i=[],n=r||0,s=0;n<e.length;n+=1,s+=1)i[s]=e[n];return i},"slicy"),EP=l(function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r},"joiny");hb.exports=l(function(e){var r=this;if(typeof r!="function"||gP.apply(r)!==_P)throw new TypeError(yP+r);for(var i=vP(arguments,1),n,s=l(function(){if(this instanceof n){var u=r.apply(this,ub(i,arguments));return Object(u)===u?u:this}return r.apply(e,ub(i,arguments))},"binder"),a=bP(0,r.length-i.length),f=[],o=0;o<a;o++)f[o]="$"+o;if(n=Function("binder","return function ("+EP(f,",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var c=l(function(){},"Empty");c.prototype=r.prototype,n.prototype=new c,c.prototype=null}return n},"bind")});var jn=T((g3,pb)=>{"use strict";var SP=db();pb.exports=Function.prototype.bind||SP});var Hc=T((b3,mb)=>{"use strict";mb.exports=Function.prototype.call});var Vc=T((_3,wb)=>{"use strict";wb.exports=Function.prototype.apply});var gb=T((v3,yb)=>{"use strict";yb.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Td=T((E3,bb)=>{"use strict";var FP=jn(),TP=Vc(),RP=Hc(),OP=gb();bb.exports=OP||FP.call(RP,TP)});var Gc=T((S3,_b)=>{"use strict";var kP=jn(),xP=Bn(),AP=Hc(),PP=Td();_b.exports=l(function(e){if(e.length<1||typeof e[0]!="function")throw new xP("a function is required");return PP(kP,AP,e)},"callBindBasic")});var Rb=T((T3,Tb)=>{"use strict";var NP=Gc(),vb=Mn(),Sb;try{Sb=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var Rd=!!Sb&&vb&&vb(Object.prototype,"__proto__"),Fb=Object,Eb=Fb.getPrototypeOf;Tb.exports=Rd&&typeof Rd.get=="function"?NP([Rd.get]):typeof Eb=="function"?l(function(e){return Eb(e==null?e:Fb(e))},"getDunder"):!1});var Od=T((O3,Ab)=>{"use strict";var Ob=Sd(),kb=Fd(),xb=Rb();Ab.exports=Ob?l(function(e){return Ob(e)},"getProto"):kb?l(function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return kb(e)},"getProto"):xb?l(function(e){return xb(e)},"getProto"):null});var Nb=T((x3,Pb)=>{"use strict";var DP=Function.prototype.call,CP=Object.prototype.hasOwnProperty,IP=jn();Pb.exports=IP.call(DP,CP)});var Ad=T((A3,Mb)=>{"use strict";var J,$P=_d(),BP=x0(),MP=P0(),jP=D0(),LP=I0(),Wn=vd(),Un=Bn(),qP=M0(),UP=L0(),WP=U0(),zP=z0(),HP=V0(),VP=K0(),GP=X0(),KP=eb(),$b=Function,kd=l(function(t){try{return $b('"use strict"; return ('+t+").constructor;")()}catch{}},"getEvalledConstructor"),Ea=Mn(),JP=va(),xd=l(function(){throw new Un},"throwTypeError"),XP=Ea?function(){try{return arguments.callee,xd}catch{try{return Ea(arguments,"callee").get}catch{return xd}}}():xd,Ln=cb()(),Ne=Od(),YP=Fd(),ZP=Sd(),Bb=Vc(),Sa=Hc(),qn={},QP=typeof Uint8Array>"u"||!Ne?J:Ne(Uint8Array),vi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?J:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?J:ArrayBuffer,"%ArrayIteratorPrototype%":Ln&&Ne?Ne([][Symbol.iterator]()):J,"%AsyncFromSyncIteratorPrototype%":J,"%AsyncFunction%":qn,"%AsyncGenerator%":qn,"%AsyncGeneratorFunction%":qn,"%AsyncIteratorPrototype%":qn,"%Atomics%":typeof Atomics>"u"?J:Atomics,"%BigInt%":typeof BigInt>"u"?J:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?J:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?J:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?J:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":BP,"%eval%":eval,"%EvalError%":MP,"%Float16Array%":typeof Float16Array>"u"?J:Float16Array,"%Float32Array%":typeof Float32Array>"u"?J:Float32Array,"%Float64Array%":typeof Float64Array>"u"?J:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?J:FinalizationRegistry,"%Function%":$b,"%GeneratorFunction%":qn,"%Int8Array%":typeof Int8Array>"u"?J:Int8Array,"%Int16Array%":typeof Int16Array>"u"?J:Int16Array,"%Int32Array%":typeof Int32Array>"u"?J:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ln&&Ne?Ne(Ne([][Symbol.iterator]())):J,"%JSON%":typeof JSON=="object"?JSON:J,"%Map%":typeof Map>"u"?J:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ln||!Ne?J:Ne(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":$P,"%Object.getOwnPropertyDescriptor%":Ea,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?J:Promise,"%Proxy%":typeof Proxy>"u"?J:Proxy,"%RangeError%":jP,"%ReferenceError%":LP,"%Reflect%":typeof Reflect>"u"?J:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?J:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ln||!Ne?J:Ne(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?J:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ln&&Ne?Ne(""[Symbol.iterator]()):J,"%Symbol%":Ln?Symbol:J,"%SyntaxError%":Wn,"%ThrowTypeError%":XP,"%TypedArray%":QP,"%TypeError%":Un,"%Uint8Array%":typeof Uint8Array>"u"?J:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?J:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?J:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?J:Uint32Array,"%URIError%":qP,"%WeakMap%":typeof WeakMap>"u"?J:WeakMap,"%WeakRef%":typeof WeakRef>"u"?J:WeakRef,"%WeakSet%":typeof WeakSet>"u"?J:WeakSet,"%Function.prototype.call%":Sa,"%Function.prototype.apply%":Bb,"%Object.defineProperty%":JP,"%Object.getPrototypeOf%":YP,"%Math.abs%":UP,"%Math.floor%":WP,"%Math.max%":zP,"%Math.min%":HP,"%Math.pow%":VP,"%Math.round%":GP,"%Math.sign%":KP,"%Reflect.getPrototypeOf%":ZP};if(Ne)try{null.error}catch(t){Db=Ne(Ne(t)),vi["%Error.prototype%"]=Db}var Db,eN=l(function t(e){var r;if(e==="%AsyncFunction%")r=kd("async function () {}");else if(e==="%GeneratorFunction%")r=kd("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=kd("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Ne&&(r=Ne(n.prototype))}return vi[e]=r,r},"doEval"),Cb={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Fa=jn(),Kc=Nb(),tN=Fa.call(Sa,Array.prototype.concat),rN=Fa.call(Bb,Array.prototype.splice),Ib=Fa.call(Sa,String.prototype.replace),Jc=Fa.call(Sa,String.prototype.slice),iN=Fa.call(Sa,RegExp.prototype.exec),nN=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,sN=/\\(\\)?/g,aN=l(function(e){var r=Jc(e,0,1),i=Jc(e,-1);if(r==="%"&&i!=="%")throw new Wn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Wn("invalid intrinsic syntax, expected opening `%`");var n=[];return Ib(e,nN,function(s,a,f,o){n[n.length]=f?Ib(o,sN,"$1"):a||s}),n},"stringToPath"),oN=l(function(e,r){var i=e,n;if(Kc(Cb,i)&&(n=Cb[i],i="%"+n[0]+"%"),Kc(vi,i)){var s=vi[i];if(s===qn&&(s=eN(i)),typeof s>"u"&&!r)throw new Un("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Wn("intrinsic "+e+" does not exist!")},"getBaseIntrinsic");Mb.exports=l(function(e,r){if(typeof e!="string"||e.length===0)throw new Un("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Un('"allowMissing" argument must be a boolean');if(iN(/^%?[^%]*%?$/,e)===null)throw new Wn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=aN(e),n=i.length>0?i[0]:"",s=oN("%"+n+"%",r),a=s.name,f=s.value,o=!1,c=s.alias;c&&(n=c[0],rN(i,tN([0,1],c)));for(var u=1,h=!0;u<i.length;u+=1){var d=i[u],p=Jc(d,0,1),m=Jc(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Wn("property names with quotes must have matching quotes");if((d==="constructor"||!h)&&(o=!0),n+="."+d,a="%"+n+"%",Kc(vi,a))f=vi[a];else if(f!=null){if(!(d in f)){if(!r)throw new Un("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ea&&u+1>=i.length){var w=Ea(f,d);h=!!w,h&&"get"in w&&!("originalValue"in w.get)?f=w.get:f=f[d]}else h=Kc(f,d),f=f[d];h&&!o&&(vi[a]=f)}}return f},"GetIntrinsic")});var Pd=T((N3,qb)=>{"use strict";var jb=Ad(),Lb=Gc(),cN=Lb([jb("%String.prototype.indexOf%")]);qb.exports=l(function(e,r){var i=jb(e,!!r);return typeof i=="function"&&cN(e,".prototype.")>-1?Lb([i]):i},"callBoundIntrinsic")});var Hb=T((C3,zb)=>{"use strict";var Wb=Function.prototype.toString,zn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Dd,Xc;if(typeof zn=="function"&&typeof Object.defineProperty=="function")try{Dd=Object.defineProperty({},"length",{get:l(function(){throw Xc},"get")}),Xc={},zn(function(){throw 42},null,Dd)}catch(t){t!==Xc&&(zn=null)}else zn=null;var lN=/^\s*class\b/,Cd=l(function(e){try{var r=Wb.call(e);return lN.test(r)}catch{return!1}},"isES6ClassFunction"),Nd=l(function(e){try{return Cd(e)?!1:(Wb.call(e),!0)}catch{return!1}},"tryFunctionToStr"),Yc=Object.prototype.toString,fN="[object Object]",uN="[object Function]",hN="[object GeneratorFunction]",dN="[object HTMLAllCollection]",pN="[object HTML document.all class]",mN="[object HTMLCollection]",wN=typeof Symbol=="function"&&!!Symbol.toStringTag,yN=!(0 in[,]),Id=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(Ub=document.all,Yc.call(Ub)===Yc.call(document.all)&&(Id=l(function(e){if((yN||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=Yc.call(e);return(r===dN||r===pN||r===mN||r===fN)&&e("")==null}catch{}return!1},"isDocumentDotAll")));var Ub;zb.exports=l(zn?function(e){if(Id(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{zn(e,null,Dd)}catch(r){if(r!==Xc)return!1}return!Cd(e)&&Nd(e)}:function(e){if(Id(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(wN)return Nd(e);if(Cd(e))return!1;var r=Yc.call(e);return r!==uN&&r!==hN&&!/^\[object HTML/.test(r)?!1:Nd(e)},"isCallable")});var Kb=T(($3,Gb)=>{"use strict";var gN=Hb(),bN=Object.prototype.toString,Vb=Object.prototype.hasOwnProperty,_N=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)Vb.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachArray"),vN=l(function(e,r,i){for(var n=0,s=e.length;n<s;n++)i==null?r(e.charAt(n),n,e):r.call(i,e.charAt(n),n,e)},"forEachString"),EN=l(function(e,r,i){for(var n in e)Vb.call(e,n)&&(i==null?r(e[n],n,e):r.call(i,e[n],n,e))},"forEachObject");function SN(t){return bN.call(t)==="[object Array]"}l(SN,"isArray");Gb.exports=l(function(e,r,i){if(!gN(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),SN(e)?_N(e,r,n):typeof e=="string"?vN(e,r,n):EN(e,r,n)},"forEach")});var Xb=T((M3,Jb)=>{"use strict";Jb.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Zb=T((j3,Yb)=>{"use strict";var $d=Xb(),FN=globalThis;Yb.exports=l(function(){for(var e=[],r=0;r<$d.length;r++)typeof FN[$d[r]]=="function"&&(e[e.length]=$d[r]);return e},"availableTypedArrays")});var r_=T((q3,t_)=>{"use strict";var Qb=va(),TN=vd(),Hn=Bn(),e_=Mn();t_.exports=l(function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Hn("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Hn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Hn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Hn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Hn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Hn("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,o=!!e_&&e_(e,r);if(Qb)Qb(e,r,{configurable:a===null&&o?o.configurable:!a,enumerable:n===null&&o?o.enumerable:!n,value:i,writable:s===null&&o?o.writable:!s});else if(f||!n&&!s&&!a)e[r]=i;else throw new TN("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var s_=T((W3,n_)=>{"use strict";var Bd=va(),i_=l(function(){return!!Bd},"hasPropertyDescriptors");i_.hasArrayLengthDefineBug=l(function(){if(!Bd)return null;try{return Bd([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");n_.exports=i_});var f_=T((H3,l_)=>{"use strict";var RN=Ad(),a_=r_(),ON=s_()(),o_=Mn(),c_=Bn(),kN=RN("%Math.floor%");l_.exports=l(function(e,r){if(typeof e!="function")throw new c_("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||kN(r)!==r)throw new c_("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&o_){var a=o_(e,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(s=!1)}return(n||s||!i)&&(ON?a_(e,"length",r,!0,!0):a_(e,"length",r)),e},"setFunctionLength")});var h_=T((G3,u_)=>{"use strict";var xN=jn(),AN=Vc(),PN=Td();u_.exports=l(function(){return PN(xN,AN,arguments)},"applyBind")});var m_=T((J3,Zc)=>{"use strict";var NN=f_(),d_=va(),DN=Gc(),p_=h_();Zc.exports=l(function(e){var r=DN(arguments),i=e.length-(arguments.length-1);return NN(r,1+(i>0?i:0),!0)},"callBind");d_?d_(Zc.exports,"apply",{value:p_}):Zc.exports.apply=p_});var y_=T((Y3,w_)=>{"use strict";var CN=Ed();w_.exports=l(function(){return CN()&&!!Symbol.toStringTag},"hasToStringTagShams")});var E_=T((Q3,v_)=>{"use strict";var tl=Kb(),IN=Zb(),g_=m_(),jd=Pd(),el=Mn(),Qc=Od(),$N=jd("Object.prototype.toString"),__=y_()(),b_=globalThis,Md=IN(),Ld=jd("String.prototype.slice"),BN=jd("Array.prototype.indexOf",!0)||l(function(e,r){for(var i=0;i<e.length;i+=1)if(e[i]===r)return i;return-1},"indexOf"),rl={__proto__:null};__&&el&&Qc?tl(Md,function(t){var e=new b_[t];if(Symbol.toStringTag in e&&Qc){var r=Qc(e),i=el(r,Symbol.toStringTag);if(!i&&r){var n=Qc(r);i=el(n,Symbol.toStringTag)}rl["$"+t]=g_(i.get)}}):tl(Md,function(t){var e=new b_[t],r=e.slice||e.set;r&&(rl["$"+t]=g_(r))});var MN=l(function(e){var r=!1;return tl(rl,function(i,n){if(!r)try{"$"+i(e)===n&&(r=Ld(n,1))}catch{}}),r},"tryAllTypedArrays"),jN=l(function(e){var r=!1;return tl(rl,function(i,n){if(!r)try{i(e),r=Ld(n,1)}catch{}}),r},"tryAllSlices");v_.exports=l(function(e){if(!e||typeof e!="object")return!1;if(!__){var r=Ld($N(e),8,-1);return BN(Md,r)>-1?r:r!=="Object"?!1:jN(e)}return el?MN(e):null},"whichTypedArray")});var F_=T((tW,S_)=>{"use strict";var LN=E_();S_.exports=l(function(e){return!!LN(e)},"isTypedArray")});var R_=T((iW,T_)=>{"use strict";var qN=Bn(),UN=Pd(),WN=UN("TypedArray.prototype.buffer",!0),zN=F_();T_.exports=WN||l(function(e){if(!zN(e))throw new qN("Not a Typed Array");return e.buffer},"typedArrayBuffer")});var x_=T((sW,k_)=>{"use strict";var $t=_a().Buffer,HN=T0(),VN=R_(),GN=ArrayBuffer.isView||l(function(e){try{return VN(e),!0}catch{return!1}},"isView"),KN=typeof Uint8Array<"u",O_=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",JN=O_&&($t.prototype instanceof Uint8Array||$t.TYPED_ARRAY_SUPPORT);k_.exports=l(function(e,r){if($t.isBuffer(e))return e.constructor&&!("isBuffer"in e)?$t.from(e):e;if(typeof e=="string")return $t.from(e,r);if(O_&&GN(e)){if(e.byteLength===0)return $t.alloc(0);if(JN){var i=$t.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=$t.from(n);if(s.length===e.byteLength)return s}if(KN&&e instanceof Uint8Array)return $t.from(e);var a=HN(e);if(a)for(var f=0;f<e.length;f+=1){var o=e[f];if(typeof o!="number"||o<0||o>255||~~o!==o)throw new RangeError("Array items must be numbers in the range 0-255.")}if(a||$t.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return $t.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},"toBuffer")});var P_=T((oW,A_)=>{"use strict";var XN=_a().Buffer,YN=x_();function il(t,e){this._block=XN.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}l(il,"Hash");il.prototype.update=function(t,e){t=YN(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,a=0;a<n;){for(var f=s%i,o=Math.min(n-a,i-f),c=0;c<o;c++)r[f+c]=t[a+c];s+=o,a+=o,s%i===0&&this._update(r)}return this._len+=n,this};il.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};il.prototype._update=function(){throw new Error("_update must be implemented by subclass")};A_.exports=il});var C_=T((lW,D_)=>{"use strict";var ZN=bi(),N_=P_(),QN=_a().Buffer,eD=[1518500249,1859775393,-1894007588,-899497514],tD=new Array(80);function Ta(){this.init(),this._w=tD,N_.call(this,64,56)}l(Ta,"Sha1");ZN(Ta,N_);Ta.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rD(t){return t<<1|t>>>31}l(rD,"rotl1");function iD(t){return t<<5|t>>>27}l(iD,"rotl5");function nD(t){return t<<30|t>>>2}l(nD,"rotl30");function sD(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}l(sD,"ft");Ta.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,a=this._e|0,f=0;f<16;++f)e[f]=t.readInt32BE(f*4);for(;f<80;++f)e[f]=rD(e[f-3]^e[f-8]^e[f-14]^e[f-16]);for(var o=0;o<80;++o){var c=~~(o/20),u=iD(r)+sD(c,i,n,s)+a+e[o]+eD[c]|0;a=s,s=n,n=nD(i),i=r,r=u}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};Ta.prototype._hash=function(){var t=QN.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};D_.exports=Ta});var B_=T((uW,$_)=>{"use strict";function Zt(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}l(Zt,"assertPath");function I_(t,e){for(var r="",i=0,n=-1,s=0,a,f=0;f<=t.length;++f){if(f<t.length)a=t.charCodeAt(f);else{if(a===47)break;a=47}if(a===47){if(!(n===f-1||s===1))if(n!==f-1&&s===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var o=r.lastIndexOf("/");if(o!==r.length-1){o===-1?(r="",i=0):(r=r.slice(0,o),i=r.length-1-r.lastIndexOf("/")),n=f,s=0;continue}}else if(r.length===2||r.length===1){r="",i=0,n=f,s=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+t.slice(n+1,f):r=t.slice(n+1,f),i=f-n-1;n=f,s=0}else a===46&&s!==-1?++s:s=-1}return r}l(I_,"normalizeStringPosix");function aD(t,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+t+i:i}l(aD,"_format");var Vn={resolve:l(function(){for(var e="",r=!1,i,n=arguments.length-1;n>=-1&&!r;n--){var s;n>=0?s=arguments[n]:(i===void 0&&(i=process.cwd()),s=i),Zt(s),s.length!==0&&(e=s+"/"+e,r=s.charCodeAt(0)===47)}return e=I_(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},"resolve"),normalize:l(function(e){if(Zt(e),e.length===0)return".";var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=I_(e,!r),e.length===0&&!r&&(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},"normalize"),isAbsolute:l(function(e){return Zt(e),e.length>0&&e.charCodeAt(0)===47},"isAbsolute"),join:l(function(){if(arguments.length===0)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];Zt(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":Vn.normalize(e)},"join"),relative:l(function(e,r){if(Zt(e),Zt(r),e===r||(e=Vn.resolve(e),r=Vn.resolve(r),e===r))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var n=e.length,s=n-i,a=1;a<r.length&&r.charCodeAt(a)===47;++a);for(var f=r.length,o=f-a,c=s<o?s:o,u=-1,h=0;h<=c;++h){if(h===c){if(o>c){if(r.charCodeAt(a+h)===47)return r.slice(a+h+1);if(h===0)return r.slice(a+h)}else s>c&&(e.charCodeAt(i+h)===47?u=h:h===0&&(u=0));break}var d=e.charCodeAt(i+h),p=r.charCodeAt(a+h);if(d!==p)break;d===47&&(u=h)}var m="";for(h=i+u+1;h<=n;++h)(h===n||e.charCodeAt(h)===47)&&(m.length===0?m+="..":m+="/..");return m.length>0?m+r.slice(a+u):(a+=u,r.charCodeAt(a)===47&&++a,r.slice(a))},"relative"),_makeLong:l(function(e){return e},"_makeLong"),dirname:l(function(e){if(Zt(e),e.length===0)return".";for(var r=e.charCodeAt(0),i=r===47,n=-1,s=!0,a=e.length-1;a>=1;--a)if(r=e.charCodeAt(a),r===47){if(!s){n=a;break}}else s=!1;return n===-1?i?"/":".":i&&n===1?"//":e.slice(0,n)},"dirname"),basename:l(function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Zt(e);var i=0,n=-1,s=!0,a;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var f=r.length-1,o=-1;for(a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(c===47){if(!s){i=a+1;break}}else o===-1&&(s=!1,o=a+1),f>=0&&(c===r.charCodeAt(f)?--f===-1&&(n=a):(f=-1,n=o))}return i===n?n=o:n===-1&&(n=e.length),e.slice(i,n)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!s){i=a+1;break}}else n===-1&&(s=!1,n=a+1);return n===-1?"":e.slice(i,n)}},"basename"),extname:l(function(e){Zt(e);for(var r=-1,i=0,n=-1,s=!0,a=0,f=e.length-1;f>=0;--f){var o=e.charCodeAt(f);if(o===47){if(!s){i=f+1;break}continue}n===-1&&(s=!1,n=f+1),o===46?r===-1?r=f:a!==1&&(a=1):r!==-1&&(a=-1)}return r===-1||n===-1||a===0||a===1&&r===n-1&&r===i+1?"":e.slice(r,n)},"extname"),format:l(function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return aD("/",e)},"format"),parse:l(function(e){Zt(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var i=e.charCodeAt(0),n=i===47,s;n?(r.root="/",s=1):s=0;for(var a=-1,f=0,o=-1,c=!0,u=e.length-1,h=0;u>=s;--u){if(i=e.charCodeAt(u),i===47){if(!c){f=u+1;break}continue}o===-1&&(c=!1,o=u+1),i===46?a===-1?a=u:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||o===-1||h===0||h===1&&a===o-1&&a===f+1?o!==-1&&(f===0&&n?r.base=r.name=e.slice(1,o):r.base=r.name=e.slice(f,o)):(f===0&&n?(r.name=e.slice(1,a),r.base=e.slice(1,o)):(r.name=e.slice(f,a),r.base=e.slice(f,o)),r.ext=e.slice(a,o)),f>0?r.dir=e.slice(0,f-1):n&&(r.dir="/"),r},"parse"),sep:"/",delimiter:":",win32:null,posix:null};Vn.posix=Vn;$_.exports=Vn});var j_=T(qd=>{var M_;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof qd=="object"?t(qd):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(M_={}):t(M_={})})(function(t){t.version="1.2.2";function e(){for(var v=0,O=new Array(256),E=0;E!=256;++E)v=E,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,O[E]=v;return typeof Int32Array<"u"?new Int32Array(O):O}l(e,"signed_crc_table");var r=e();function i(v){var O=0,E=0,N=0,x=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(N=0;N!=256;++N)x[N]=v[N];for(N=0;N!=256;++N)for(E=v[N],O=256+N;O<4096;O+=256)E=x[O]=E>>>8^v[E&255];var I=[];for(N=1;N!=16;++N)I[N-1]=typeof Int32Array<"u"?x.subarray(N*256,N*256+256):x.slice(N*256,N*256+256);return I}l(i,"slice_by_16_tables");var n=i(r),s=n[0],a=n[1],f=n[2],o=n[3],c=n[4],u=n[5],h=n[6],d=n[7],p=n[8],m=n[9],w=n[10],y=n[11],g=n[12],_=n[13],F=n[14];function R(v,O){for(var E=O^-1,N=0,x=v.length;N<x;)E=E>>>8^r[(E^v.charCodeAt(N++))&255];return~E}l(R,"crc32_bstr");function k(v,O){for(var E=O^-1,N=v.length-15,x=0;x<N;)E=F[v[x++]^E&255]^_[v[x++]^E>>8&255]^g[v[x++]^E>>16&255]^y[v[x++]^E>>>24]^w[v[x++]]^m[v[x++]]^p[v[x++]]^d[v[x++]]^h[v[x++]]^u[v[x++]]^c[v[x++]]^o[v[x++]]^f[v[x++]]^a[v[x++]]^s[v[x++]]^r[v[x++]];for(N+=15;x<N;)E=E>>>8^r[(E^v[x++])&255];return~E}l(k,"crc32_buf");function D(v,O){for(var E=O^-1,N=0,x=v.length,I=0,q=0;N<x;)I=v.charCodeAt(N++),I<128?E=E>>>8^r[(E^I)&255]:I<2048?(E=E>>>8^r[(E^(192|I>>6&31))&255],E=E>>>8^r[(E^(128|I&63))&255]):I>=55296&&I<57344?(I=(I&1023)+64,q=v.charCodeAt(N++)&1023,E=E>>>8^r[(E^(240|I>>8&7))&255],E=E>>>8^r[(E^(128|I>>2&63))&255],E=E>>>8^r[(E^(128|q>>6&15|(I&3)<<4))&255],E=E>>>8^r[(E^(128|q&63))&255]):(E=E>>>8^r[(E^(224|I>>12&15))&255],E=E>>>8^r[(E^(128|I>>6&63))&255],E=E>>>8^r[(E^(128|I&63))&255]);return~E}l(D,"crc32_str"),t.table=r,t.bstr=R,t.buf=k,t.str=D})});var wr=T(Je=>{"use strict";var oD=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function cD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}l(cD,"_has");Je.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)cD(r,i)&&(t[i]=r[i])}}return t};Je.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var lD={arraySet:l(function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:l(function(t){var e,r,i,n,s,a;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(a=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)s=t[e],a.set(s,n),n+=s.length;return a},"flattenChunks")},fD={arraySet:l(function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},"arraySet"),flattenChunks:l(function(t){return[].concat.apply([],t)},"flattenChunks")};Je.setTyped=function(t){t?(Je.Buf8=Uint8Array,Je.Buf16=Uint16Array,Je.Buf32=Int32Array,Je.assign(Je,lD)):(Je.Buf8=Array,Je.Buf16=Array,Je.Buf32=Array,Je.assign(Je,fD))};Je.setTyped(oD)});var cv=T(Jn=>{"use strict";var uD=wr(),hD=4,L_=0,q_=1,dD=2;function Kn(t){for(var e=t.length;--e>=0;)t[e]=0}l(Kn,"zero");var pD=0,G_=1,mD=2,wD=3,yD=258,Kd=29,Pa=256,Oa=Pa+1+Kd,Gn=30,Jd=19,K_=2*Oa+1,Ei=15,Ud=16,gD=7,Xd=256,J_=16,X_=17,Y_=18,Vd=[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],nl=[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],bD=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Z_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_D=512,yr=new Array((Oa+2)*2);Kn(yr);var Ra=new Array(Gn*2);Kn(Ra);var ka=new Array(_D);Kn(ka);var xa=new Array(yD-wD+1);Kn(xa);var Yd=new Array(Kd);Kn(Yd);var sl=new Array(Gn);Kn(sl);function Wd(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}l(Wd,"StaticTreeDesc");var Q_,ev,tv;function zd(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}l(zd,"TreeDesc");function rv(t){return t<256?ka[t]:ka[256+(t>>>7)]}l(rv,"d_code");function Aa(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}l(Aa,"put_short");function Qe(t,e,r){t.bi_valid>Ud-r?(t.bi_buf|=e<<t.bi_valid&65535,Aa(t,t.bi_buf),t.bi_buf=e>>Ud-t.bi_valid,t.bi_valid+=r-Ud):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}l(Qe,"send_bits");function Qt(t,e,r){Qe(t,r[e*2],r[e*2+1])}l(Qt,"send_code");function iv(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}l(iv,"bi_reverse");function vD(t){t.bi_valid===16?(Aa(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}l(vD,"bi_flush");function ED(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,o=e.stat_desc.max_length,c,u,h,d,p,m,w=0;for(d=0;d<=Ei;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<K_;c++)u=t.heap[c],d=r[r[u*2+1]*2+1]+1,d>o&&(d=o,w++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,p=0,u>=f&&(p=a[u-f]),m=r[u*2],t.opt_len+=m*(d+p),s&&(t.static_len+=m*(n[u*2+1]+p)));if(w!==0){do{for(d=o-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[o]--,w-=2}while(w>0);for(d=o;d!==0;d--)for(u=t.bl_count[d];u!==0;)h=t.heap[--c],!(h>i)&&(r[h*2+1]!==d&&(t.opt_len+=(d-r[h*2+1])*r[h*2],r[h*2+1]=d),u--)}}l(ED,"gen_bitlen");function nv(t,e,r){var i=new Array(Ei+1),n=0,s,a;for(s=1;s<=Ei;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=e;a++){var f=t[a*2+1];f!==0&&(t[a*2]=iv(i[f]++,f))}}l(nv,"gen_codes");function SD(){var t,e,r,i,n,s=new Array(Ei+1);for(r=0,i=0;i<Kd-1;i++)for(Yd[i]=r,t=0;t<1<<Vd[i];t++)xa[r++]=i;for(xa[r-1]=i,n=0,i=0;i<16;i++)for(sl[i]=n,t=0;t<1<<nl[i];t++)ka[n++]=i;for(n>>=7;i<Gn;i++)for(sl[i]=n<<7,t=0;t<1<<nl[i]-7;t++)ka[256+n++]=i;for(e=0;e<=Ei;e++)s[e]=0;for(t=0;t<=143;)yr[t*2+1]=8,t++,s[8]++;for(;t<=255;)yr[t*2+1]=9,t++,s[9]++;for(;t<=279;)yr[t*2+1]=7,t++,s[7]++;for(;t<=287;)yr[t*2+1]=8,t++,s[8]++;for(nv(yr,Oa+1,s),t=0;t<Gn;t++)Ra[t*2+1]=5,Ra[t*2]=iv(t,5);Q_=new Wd(yr,Vd,Pa+1,Oa,Ei),ev=new Wd(Ra,nl,0,Gn,Ei),tv=new Wd(new Array(0),bD,0,Jd,gD)}l(SD,"tr_static_init");function sv(t){var e;for(e=0;e<Oa;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Gn;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Jd;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Xd*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}l(sv,"init_block");function av(t){t.bi_valid>8?Aa(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}l(av,"bi_windup");function FD(t,e,r,i){av(t),i&&(Aa(t,r),Aa(t,~r)),uD.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}l(FD,"copy_block");function U_(t,e,r,i){var n=e*2,s=r*2;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}l(U_,"smaller");function Hd(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&U_(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U_(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}l(Hd,"pqdownheap");function W_(t,e,r){var i,n,s=0,a,f;if(t.last_lit!==0)do i=t.pending_buf[t.d_buf+s*2]<<8|t.pending_buf[t.d_buf+s*2+1],n=t.pending_buf[t.l_buf+s],s++,i===0?Qt(t,n,e):(a=xa[n],Qt(t,a+Pa+1,e),f=Vd[a],f!==0&&(n-=Yd[a],Qe(t,n,f)),i--,a=rv(i),Qt(t,a,r),f=nl[a],f!==0&&(i-=sl[a],Qe(t,i,f)));while(s<t.last_lit);Qt(t,Xd,e)}l(W_,"compress_block");function Gd(t,e){var r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,s=e.stat_desc.elems,a,f,o=-1,c;for(t.heap_len=0,t.heap_max=K_,a=0;a<s;a++)r[a*2]!==0?(t.heap[++t.heap_len]=o=a,t.depth[a]=0):r[a*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=o<2?++o:0,r[c*2]=1,t.depth[c]=0,t.opt_len--,n&&(t.static_len-=i[c*2+1]);for(e.max_code=o,a=t.heap_len>>1;a>=1;a--)Hd(t,r,a);c=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Hd(t,r,1),f=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=f,r[c*2]=r[a*2]+r[f*2],t.depth[c]=(t.depth[a]>=t.depth[f]?t.depth[a]:t.depth[f])+1,r[a*2+1]=r[f*2+1]=c,t.heap[1]=c++,Hd(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],ED(t,e),nv(r,o,t.bl_count)}l(Gd,"build_tree");function z_(t,e,r){var i,n=-1,s,a=e[0*2+1],f=0,o=7,c=4;for(a===0&&(o=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++f<o&&s===a)&&(f<c?t.bl_tree[s*2]+=f:s!==0?(s!==n&&t.bl_tree[s*2]++,t.bl_tree[J_*2]++):f<=10?t.bl_tree[X_*2]++:t.bl_tree[Y_*2]++,f=0,n=s,a===0?(o=138,c=3):s===a?(o=6,c=3):(o=7,c=4))}l(z_,"scan_tree");function H_(t,e,r){var i,n=-1,s,a=e[0*2+1],f=0,o=7,c=4;for(a===0&&(o=138,c=3),i=0;i<=r;i++)if(s=a,a=e[(i+1)*2+1],!(++f<o&&s===a)){if(f<c)do Qt(t,s,t.bl_tree);while(--f!==0);else s!==0?(s!==n&&(Qt(t,s,t.bl_tree),f--),Qt(t,J_,t.bl_tree),Qe(t,f-3,2)):f<=10?(Qt(t,X_,t.bl_tree),Qe(t,f-3,3)):(Qt(t,Y_,t.bl_tree),Qe(t,f-11,7));f=0,n=s,a===0?(o=138,c=3):s===a?(o=6,c=3):(o=7,c=4)}}l(H_,"send_tree");function TD(t){var e;for(z_(t,t.dyn_ltree,t.l_desc.max_code),z_(t,t.dyn_dtree,t.d_desc.max_code),Gd(t,t.bl_desc),e=Jd-1;e>=3&&t.bl_tree[Z_[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}l(TD,"build_bl_tree");function RD(t,e,r,i){var n;for(Qe(t,e-257,5),Qe(t,r-1,5),Qe(t,i-4,4),n=0;n<i;n++)Qe(t,t.bl_tree[Z_[n]*2+1],3);H_(t,t.dyn_ltree,e-1),H_(t,t.dyn_dtree,r-1)}l(RD,"send_all_trees");function OD(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return L_;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return q_;for(r=32;r<Pa;r++)if(t.dyn_ltree[r*2]!==0)return q_;return L_}l(OD,"detect_data_type");var V_=!1;function kD(t){V_||(SD(),V_=!0),t.l_desc=new zd(t.dyn_ltree,Q_),t.d_desc=new zd(t.dyn_dtree,ev),t.bl_desc=new zd(t.bl_tree,tv),t.bi_buf=0,t.bi_valid=0,sv(t)}l(kD,"_tr_init");function ov(t,e,r,i){Qe(t,(pD<<1)+(i?1:0),3),FD(t,e,r,!0)}l(ov,"_tr_stored_block");function xD(t){Qe(t,G_<<1,3),Qt(t,Xd,yr),vD(t)}l(xD,"_tr_align");function AD(t,e,r,i){var n,s,a=0;t.level>0?(t.strm.data_type===dD&&(t.strm.data_type=OD(t)),Gd(t,t.l_desc),Gd(t,t.d_desc),a=TD(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?ov(t,e,r,i):t.strategy===hD||s===n?(Qe(t,(G_<<1)+(i?1:0),3),W_(t,yr,Ra)):(Qe(t,(mD<<1)+(i?1:0),3),RD(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),W_(t,t.dyn_ltree,t.dyn_dtree)),sv(t),i&&av(t)}l(AD,"_tr_flush_block");function PD(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(xa[r]+Pa+1)*2]++,t.dyn_dtree[rv(e)*2]++),t.last_lit===t.lit_bufsize-1}l(PD,"_tr_tally");Jn._tr_init=kD;Jn._tr_stored_block=ov;Jn._tr_flush_block=AD;Jn._tr_tally=PD;Jn._tr_align=xD});var Zd=T((bW,lv)=>{"use strict";function ND(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+e[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}l(ND,"adler32");lv.exports=ND});var Qd=T((vW,fv)=>{"use strict";function DD(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}l(DD,"makeTable");var CD=DD();function ID(t,e,r,i){var n=CD,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[(t^e[a])&255];return t^-1}l(ID,"crc32");fv.exports=ID});var al=T((SW,uv)=>{"use strict";uv.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var _v=T(rr=>{"use strict";var Xe=wr(),St=cv(),mv=Zd(),Ir=Qd(),$D=al(),Ri=0,BD=1,MD=3,Lr=4,hv=5,tr=0,dv=1,Ft=-2,jD=-3,ep=-5,LD=-1,qD=1,ol=2,UD=3,WD=4,zD=0,HD=2,ul=8,VD=9,GD=15,KD=8,JD=29,XD=256,rp=XD+1+JD,YD=30,ZD=19,QD=2*rp+1,eC=15,X=3,Mr=258,Bt=Mr+X+1,tC=32,hl=42,ip=69,cl=73,ll=91,fl=103,Si=113,Da=666,Oe=1,Ca=2,Fi=3,Zn=4,rC=3;function jr(t,e){return t.msg=$D[e],e}l(jr,"err");function pv(t){return(t<<1)-(t>4?9:0)}l(pv,"rank");function Br(t){for(var e=t.length;--e>=0;)t[e]=0}l(Br,"zero");function $r(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(Xe.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}l($r,"flush_pending");function Be(t,e){St._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,$r(t.strm)}l(Be,"flush_block_only");function re(t,e){t.pending_buf[t.pending++]=e}l(re,"put_byte");function Na(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}l(Na,"putShortMSB");function iC(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,Xe.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=mv(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Ir(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}l(iC,"read_buf");function wv(t,e){var r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,f=t.nice_match,o=t.strstart>t.w_size-Bt?t.strstart-(t.w_size-Bt):0,c=t.window,u=t.w_mask,h=t.prev,d=t.strstart+Mr,p=c[i+a-1],m=c[i+a];t.prev_length>=t.good_match&&(r>>=2),f>t.lookahead&&(f=t.lookahead);do if(n=e,!(c[n+a]!==m||c[n+a-1]!==p||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&i<d);if(s=Mr-(d-i),i=d-Mr,s>a){if(t.match_start=e,a=s,s>=f)break;p=c[i+a-1],m=c[i+a]}}while((e=h[e&u])>o&&--r!==0);return a<=t.lookahead?a:t.lookahead}l(wv,"longest_match");function Ti(t){var e=t.w_size,r,i,n,s,a;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Bt)){Xe.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=iC(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=X)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+X-1])&t.hash_mask,t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<X)););}while(t.lookahead<Bt&&t.strm.avail_in!==0)}l(Ti,"fill_window");function nC(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Ti(t),t.lookahead===0&&e===Ri)return Oe;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,Be(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Bt&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=0,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):(t.strstart>t.block_start&&(Be(t,!1),t.strm.avail_out===0),Oe)}l(nC,"deflate_stored");function tp(t,e){for(var r,i;;){if(t.lookahead<Bt){if(Ti(t),t.lookahead<Bt&&e===Ri)return Oe;if(t.lookahead===0)break}if(r=0,t.lookahead>=X&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+X-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-Bt&&(t.match_length=wv(t,r)),t.match_length>=X)if(i=St._tr_tally(t,t.strstart-t.match_start,t.match_length-X),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=X){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+X-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=St._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=t.strstart<X-1?t.strstart:X-1,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(tp,"deflate_fast");function Xn(t,e){for(var r,i,n;;){if(t.lookahead<Bt){if(Ti(t),t.lookahead<Bt&&e===Ri)return Oe;if(t.lookahead===0)break}if(r=0,t.lookahead>=X&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+X-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=X-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Bt&&(t.match_length=wv(t,r),t.match_length<=5&&(t.strategy===qD||t.match_length===X&&t.strstart-t.match_start>4096)&&(t.match_length=X-1)),t.prev_length>=X&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-X,i=St._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-X),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+X-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=X-1,t.strstart++,i&&(Be(t,!1),t.strm.avail_out===0))return Oe}else if(t.match_available){if(i=St._tr_tally(t,0,t.window[t.strstart-1]),i&&Be(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Oe}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=St._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<X-1?t.strstart:X-1,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(Xn,"deflate_slow");function sC(t,e){for(var r,i,n,s,a=t.window;;){if(t.lookahead<=Mr){if(Ti(t),t.lookahead<=Mr&&e===Ri)return Oe;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=X&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+Mr;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<s);t.match_length=Mr-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=X?(r=St._tr_tally(t,1,t.match_length-X),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=St._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=0,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(sC,"deflate_rle");function aC(t,e){for(var r;;){if(t.lookahead===0&&(Ti(t),t.lookahead===0)){if(e===Ri)return Oe;break}if(t.match_length=0,r=St._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Be(t,!1),t.strm.avail_out===0))return Oe}return t.insert=0,e===Lr?(Be(t,!0),t.strm.avail_out===0?Fi:Zn):t.last_lit&&(Be(t,!1),t.strm.avail_out===0)?Oe:Ca}l(aC,"deflate_huff");function er(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}l(er,"Config");var Yn;Yn=[new er(0,0,0,0,nC),new er(4,4,8,4,tp),new er(4,5,16,8,tp),new er(4,6,32,32,tp),new er(4,4,16,16,Xn),new er(8,16,32,32,Xn),new er(8,16,128,128,Xn),new er(8,32,128,256,Xn),new er(32,128,258,1024,Xn),new er(32,258,258,4096,Xn)];function oC(t){t.window_size=2*t.w_size,Br(t.head),t.max_lazy_match=Yn[t.level].max_lazy,t.good_match=Yn[t.level].good_length,t.nice_match=Yn[t.level].nice_length,t.max_chain_length=Yn[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=X-1,t.match_available=0,t.ins_h=0}l(oC,"lm_init");function cC(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ul,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Xe.Buf16(QD*2),this.dyn_dtree=new Xe.Buf16((2*YD+1)*2),this.bl_tree=new Xe.Buf16((2*ZD+1)*2),Br(this.dyn_ltree),Br(this.dyn_dtree),Br(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Xe.Buf16(eC+1),this.heap=new Xe.Buf16(2*rp+1),Br(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xe.Buf16(2*rp+1),Br(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}l(cC,"DeflateState");function yv(t){var e;return!t||!t.state?jr(t,Ft):(t.total_in=t.total_out=0,t.data_type=HD,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?hl:Si,t.adler=e.wrap===2?0:1,e.last_flush=Ri,St._tr_init(e),tr)}l(yv,"deflateResetKeep");function gv(t){var e=yv(t);return e===tr&&oC(t.state),e}l(gv,"deflateReset");function lC(t,e){return!t||!t.state||t.state.wrap!==2?Ft:(t.state.gzhead=e,tr)}l(lC,"deflateSetHeader");function bv(t,e,r,i,n,s){if(!t)return Ft;var a=1;if(e===LD&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>VD||r!==ul||i<8||i>15||e<0||e>9||s<0||s>WD)return jr(t,Ft);i===8&&(i=9);var f=new cC;return t.state=f,f.strm=t,f.wrap=a,f.gzhead=null,f.w_bits=i,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=n+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+X-1)/X),f.window=new Xe.Buf8(f.w_size*2),f.head=new Xe.Buf16(f.hash_size),f.prev=new Xe.Buf16(f.w_size),f.lit_bufsize=1<<n+6,f.pending_buf_size=f.lit_bufsize*4,f.pending_buf=new Xe.Buf8(f.pending_buf_size),f.d_buf=1*f.lit_bufsize,f.l_buf=3*f.lit_bufsize,f.level=e,f.strategy=s,f.method=r,gv(t)}l(bv,"deflateInit2");function fC(t,e){return bv(t,e,ul,GD,KD,zD)}l(fC,"deflateInit");function uC(t,e){var r,i,n,s;if(!t||!t.state||e>hv||e<0)return t?jr(t,Ft):Ft;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Da&&e!==Lr)return jr(t,t.avail_out===0?ep:Ft);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===hl)if(i.wrap===2)t.adler=0,re(i,31),re(i,139),re(i,8),i.gzhead?(re(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),re(i,i.gzhead.time&255),re(i,i.gzhead.time>>8&255),re(i,i.gzhead.time>>16&255),re(i,i.gzhead.time>>24&255),re(i,i.level===9?2:i.strategy>=ol||i.level<2?4:0),re(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(re(i,i.gzhead.extra.length&255),re(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=Ir(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=ip):(re(i,0),re(i,0),re(i,0),re(i,0),re(i,0),re(i,i.level===9?2:i.strategy>=ol||i.level<2?4:0),re(i,rC),i.status=Si);else{var a=ul+(i.w_bits-8<<4)<<8,f=-1;i.strategy>=ol||i.level<2?f=0:i.level<6?f=1:i.level===6?f=2:f=3,a|=f<<6,i.strstart!==0&&(a|=tC),a+=31-a%31,i.status=Si,Na(i,a),i.strstart!==0&&(Na(i,t.adler>>>16),Na(i,t.adler&65535)),t.adler=1}if(i.status===ip)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),$r(t),n=i.pending,i.pending===i.pending_buf_size));)re(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=cl)}else i.status=cl;if(i.status===cl)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),$r(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.name.length?s=i.gzhead.name.charCodeAt(i.gzindex++)&255:s=0,re(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=ll)}else i.status=ll;if(i.status===ll)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),$r(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.comment.length?s=i.gzhead.comment.charCodeAt(i.gzindex++)&255:s=0,re(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Ir(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=fl)}else i.status=fl;if(i.status===fl&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&$r(t),i.pending+2<=i.pending_buf_size&&(re(i,t.adler&255),re(i,t.adler>>8&255),t.adler=0,i.status=Si)):i.status=Si),i.pending!==0){if($r(t),t.avail_out===0)return i.last_flush=-1,tr}else if(t.avail_in===0&&pv(e)<=pv(r)&&e!==Lr)return jr(t,ep);if(i.status===Da&&t.avail_in!==0)return jr(t,ep);if(t.avail_in!==0||i.lookahead!==0||e!==Ri&&i.status!==Da){var o=i.strategy===ol?aC(i,e):i.strategy===UD?sC(i,e):Yn[i.level].func(i,e);if((o===Fi||o===Zn)&&(i.status=Da),o===Oe||o===Fi)return t.avail_out===0&&(i.last_flush=-1),tr;if(o===Ca&&(e===BD?St._tr_align(i):e!==hv&&(St._tr_stored_block(i,0,0,!1),e===MD&&(Br(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),$r(t),t.avail_out===0))return i.last_flush=-1,tr}return e!==Lr?tr:i.wrap<=0?dv:(i.wrap===2?(re(i,t.adler&255),re(i,t.adler>>8&255),re(i,t.adler>>16&255),re(i,t.adler>>24&255),re(i,t.total_in&255),re(i,t.total_in>>8&255),re(i,t.total_in>>16&255),re(i,t.total_in>>24&255)):(Na(i,t.adler>>>16),Na(i,t.adler&65535)),$r(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?tr:dv)}l(uC,"deflate");function hC(t){var e;return!t||!t.state?Ft:(e=t.state.status,e!==hl&&e!==ip&&e!==cl&&e!==ll&&e!==fl&&e!==Si&&e!==Da?jr(t,Ft):(t.state=null,e===Si?jr(t,jD):tr))}l(hC,"deflateEnd");function dC(t,e){var r=e.length,i,n,s,a,f,o,c,u;if(!t||!t.state||(i=t.state,a=i.wrap,a===2||a===1&&i.status!==hl||i.lookahead))return Ft;for(a===1&&(t.adler=mv(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(a===0&&(Br(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new Xe.Buf8(i.w_size),Xe.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),f=t.avail_in,o=t.next_in,c=t.input,t.avail_in=r,t.next_in=0,t.input=e,Ti(i);i.lookahead>=X;){n=i.strstart,s=i.lookahead-(X-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+X-1])&i.hash_mask,i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++;while(--s);i.strstart=n,i.lookahead=X-1,Ti(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=X-1,i.match_available=0,t.next_in=o,t.input=c,t.avail_in=f,i.wrap=a,tr}l(dC,"deflateSetDictionary");rr.deflateInit=fC;rr.deflateInit2=bv;rr.deflateReset=gv;rr.deflateResetKeep=yv;rr.deflateSetHeader=lC;rr.deflate=uC;rr.deflateEnd=hC;rr.deflateSetDictionary=dC;rr.deflateInfo="pako deflate (from Nodeca project)"});var np=T(Qn=>{"use strict";var dl=wr(),vv=!0,Ev=!0;try{String.fromCharCode.apply(null,[0])}catch{vv=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ev=!1}var Ia=new dl.Buf8(256);for(gr=0;gr<256;gr++)Ia[gr]=gr>=252?6:gr>=248?5:gr>=240?4:gr>=224?3:gr>=192?2:1;var gr;Ia[254]=Ia[254]=1;Qn.string2buf=function(t){var e,r,i,n,s,a=t.length,f=0;for(n=0;n<a;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<a&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),f+=r<128?1:r<2048?2:r<65536?3:4;for(e=new dl.Buf8(f),s=0,n=0;s<f;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<a&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function Sv(t,e){if(e<65534&&(t.subarray&&Ev||!t.subarray&&vv))return String.fromCharCode.apply(null,dl.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}l(Sv,"buf2binstring");Qn.buf2binstring=function(t){return Sv(t,t.length)};Qn.binstring2buf=function(t){for(var e=new dl.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e};Qn.buf2string=function(t,e){var r,i,n,s,a=e||t.length,f=new Array(a*2);for(i=0,r=0;r<a;){if(n=t[r++],n<128){f[i++]=n;continue}if(s=Ia[n],s>4){f[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r<a;)n=n<<6|t[r++]&63,s--;if(s>1){f[i++]=65533;continue}n<65536?f[i++]=n:(n-=65536,f[i++]=55296|n>>10&1023,f[i++]=56320|n&1023)}return Sv(f,i)};Qn.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Ia[t[r]]>e?r:e}});var sp=T((kW,Fv)=>{"use strict";function pC(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}l(pC,"ZStream");Fv.exports=pC});var kv=T(Ma=>{"use strict";var $a=_v(),Ba=wr(),op=np(),cp=al(),mC=sp(),Ov=Object.prototype.toString,wC=0,ap=4,es=0,Tv=1,Rv=2,yC=-1,gC=0,bC=8;function Oi(t){if(!(this instanceof Oi))return new Oi(t);this.options=Ba.assign({level:yC,method:bC,chunkSize:16384,windowBits:15,memLevel:8,strategy:gC,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mC,this.strm.avail_out=0;var r=$a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==es)throw new Error(cp[r]);if(e.header&&$a.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=op.string2buf(e.dictionary):Ov.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=$a.deflateSetDictionary(this.strm,i),r!==es)throw new Error(cp[r]);this._dict_set=!0}}l(Oi,"Deflate");Oi.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?ap:wC,typeof t=="string"?r.input=op.string2buf(t):Ov.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Ba.Buf8(i),r.next_out=0,r.avail_out=i),n=$a.deflate(r,s),n!==Tv&&n!==es)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===ap||s===Rv))&&(this.options.to==="string"?this.onData(op.buf2binstring(Ba.shrinkBuf(r.output,r.next_out))):this.onData(Ba.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==Tv);return s===ap?(n=$a.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===es):(s===Rv&&(this.onEnd(es),r.avail_out=0),!0)};Oi.prototype.onData=function(t){this.chunks.push(t)};Oi.prototype.onEnd=function(t){t===es&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ba.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function lp(t,e){var r=new Oi(e);if(r.push(t,!0),r.err)throw r.msg||cp[r.err];return r.result}l(lp,"deflate");function _C(t,e){return e=e||{},e.raw=!0,lp(t,e)}l(_C,"deflateRaw");function vC(t,e){return e=e||{},e.gzip=!0,lp(t,e)}l(vC,"gzip");Ma.Deflate=Oi;Ma.deflate=lp;Ma.deflateRaw=_C;Ma.gzip=vC});var Av=T((NW,xv)=>{"use strict";var pl=30,EC=12;xv.exports=l(function(e,r){var i,n,s,a,f,o,c,u,h,d,p,m,w,y,g,_,F,R,k,D,v,O,E,N,x;i=e.state,n=e.next_in,N=e.input,s=n+(e.avail_in-5),a=e.next_out,x=e.output,f=a-(r-e.avail_out),o=a+(e.avail_out-257),c=i.dmax,u=i.wsize,h=i.whave,d=i.wnext,p=i.window,m=i.hold,w=i.bits,y=i.lencode,g=i.distcode,_=(1<<i.lenbits)-1,F=(1<<i.distbits)-1;e:do{w<15&&(m+=N[n++]<<w,w+=8,m+=N[n++]<<w,w+=8),R=y[m&_];t:for(;;){if(k=R>>>24,m>>>=k,w-=k,k=R>>>16&255,k===0)x[a++]=R&65535;else if(k&16){D=R&65535,k&=15,k&&(w<k&&(m+=N[n++]<<w,w+=8),D+=m&(1<<k)-1,m>>>=k,w-=k),w<15&&(m+=N[n++]<<w,w+=8,m+=N[n++]<<w,w+=8),R=g[m&F];r:for(;;){if(k=R>>>24,m>>>=k,w-=k,k=R>>>16&255,k&16){if(v=R&65535,k&=15,w<k&&(m+=N[n++]<<w,w+=8,w<k&&(m+=N[n++]<<w,w+=8)),v+=m&(1<<k)-1,v>c){e.msg="invalid distance too far back",i.mode=pl;break e}if(m>>>=k,w-=k,k=a-f,v>k){if(k=v-k,k>h&&i.sane){e.msg="invalid distance too far back",i.mode=pl;break e}if(O=0,E=p,d===0){if(O+=u-k,k<D){D-=k;do x[a++]=p[O++];while(--k);O=a-v,E=x}}else if(d<k){if(O+=u+d-k,k-=d,k<D){D-=k;do x[a++]=p[O++];while(--k);if(O=0,d<D){k=d,D-=k;do x[a++]=p[O++];while(--k);O=a-v,E=x}}}else if(O+=d-k,k<D){D-=k;do x[a++]=p[O++];while(--k);O=a-v,E=x}for(;D>2;)x[a++]=E[O++],x[a++]=E[O++],x[a++]=E[O++],D-=3;D&&(x[a++]=E[O++],D>1&&(x[a++]=E[O++]))}else{O=a-v;do x[a++]=x[O++],x[a++]=x[O++],x[a++]=x[O++],D-=3;while(D>2);D&&(x[a++]=x[O++],D>1&&(x[a++]=x[O++]))}}else if(k&64){e.msg="invalid distance code",i.mode=pl;break e}else{R=g[(R&65535)+(m&(1<<k)-1)];continue r}break}}else if(k&64)if(k&32){i.mode=EC;break e}else{e.msg="invalid literal/length code",i.mode=pl;break e}else{R=y[(R&65535)+(m&(1<<k)-1)];continue t}break}}while(n<s&&a<o);D=w>>3,n-=D,w-=D<<3,m&=(1<<w)-1,e.next_in=n,e.next_out=a,e.avail_in=n<s?5+(s-n):5-(n-s),e.avail_out=a<o?257+(o-a):257-(a-o),i.hold=m,i.bits=w},"inflate_fast")});var Bv=T((CW,$v)=>{"use strict";var Pv=wr(),ts=15,Nv=852,Dv=592,Cv=0,fp=1,Iv=2,SC=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],FC=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],TC=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],RC=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];$v.exports=l(function(e,r,i,n,s,a,f,o){var c=o.bits,u=0,h=0,d=0,p=0,m=0,w=0,y=0,g=0,_=0,F=0,R,k,D,v,O,E=null,N=0,x,I=new Pv.Buf16(ts+1),q=new Pv.Buf16(ts+1),z=null,be=0,Vt,yt,Dt;for(u=0;u<=ts;u++)I[u]=0;for(h=0;h<n;h++)I[r[i+h]]++;for(m=c,p=ts;p>=1&&I[p]===0;p--);if(m>p&&(m=p),p===0)return s[a++]=1<<24|64<<16|0,s[a++]=1<<24|64<<16|0,o.bits=1,0;for(d=1;d<p&&I[d]===0;d++);for(m<d&&(m=d),g=1,u=1;u<=ts;u++)if(g<<=1,g-=I[u],g<0)return-1;if(g>0&&(e===Cv||p!==1))return-1;for(q[1]=0,u=1;u<ts;u++)q[u+1]=q[u]+I[u];for(h=0;h<n;h++)r[i+h]!==0&&(f[q[r[i+h]]++]=h);if(e===Cv?(E=z=f,x=19):e===fp?(E=SC,N-=257,z=FC,be-=257,x=256):(E=TC,z=RC,x=-1),F=0,h=0,u=d,O=a,w=m,y=0,D=-1,_=1<<m,v=_-1,e===fp&&_>Nv||e===Iv&&_>Dv)return 1;for(;;){Vt=u-y,f[h]<x?(yt=0,Dt=f[h]):f[h]>x?(yt=z[be+f[h]],Dt=E[N+f[h]]):(yt=96,Dt=0),R=1<<u-y,k=1<<w,d=k;do k-=R,s[O+(F>>y)+k]=Vt<<24|yt<<16|Dt|0;while(k!==0);for(R=1<<u-1;F&R;)R>>=1;if(R!==0?(F&=R-1,F+=R):F=0,h++,--I[u]===0){if(u===p)break;u=r[i+f[h]]}if(u>m&&(F&v)!==D){for(y===0&&(y=m),O+=d,w=u-y,g=1<<w;w+y<p&&(g-=I[w+y],!(g<=0));)w++,g<<=1;if(_+=1<<w,e===fp&&_>Nv||e===Iv&&_>Dv)return 1;D=F&v,s[D]=m<<24|w<<16|O-a|0}}return F!==0&&(s[O+F]=u-y<<24|64<<16|0),o.bits=m,0},"inflate_table")});var gE=T(Mt=>{"use strict";var ut=wr(),wp=Zd(),ir=Qd(),OC=Av(),ja=Bv(),kC=0,lE=1,fE=2,Mv=4,xC=5,ml=6,ki=0,AC=1,PC=2,Tt=-2,uE=-3,yp=-4,NC=-5,jv=8,hE=1,Lv=2,qv=3,Uv=4,Wv=5,zv=6,Hv=7,Vv=8,Gv=9,Kv=10,gl=11,br=12,up=13,Jv=14,hp=15,Xv=16,Yv=17,Zv=18,Qv=19,wl=20,yl=21,eE=22,tE=23,rE=24,iE=25,nE=26,dp=27,sE=28,aE=29,ue=30,gp=31,DC=32,CC=852,IC=592,$C=15,BC=$C;function oE(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}l(oE,"zswap32");function MC(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new ut.Buf16(320),this.work=new ut.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}l(MC,"InflateState");function dE(t){var e;return!t||!t.state?Tt:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=hE,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new ut.Buf32(CC),e.distcode=e.distdyn=new ut.Buf32(IC),e.sane=1,e.back=-1,ki)}l(dE,"inflateResetKeep");function pE(t){var e;return!t||!t.state?Tt:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,dE(t))}l(pE,"inflateReset");function mE(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Tt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,pE(t))}l(mE,"inflateReset2");function wE(t,e){var r,i;return t?(i=new MC,t.state=i,i.window=null,r=mE(t,e),r!==ki&&(t.state=null),r):Tt}l(wE,"inflateInit2");function jC(t){return wE(t,BC)}l(jC,"inflateInit");var cE=!0,pp,mp;function LC(t){if(cE){var e;for(pp=new ut.Buf32(512),mp=new ut.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ja(lE,t.lens,0,288,pp,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ja(fE,t.lens,0,32,mp,0,t.work,{bits:5}),cE=!1}t.lencode=pp,t.lenbits=9,t.distcode=mp,t.distbits=5}l(LC,"fixedtables");function yE(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new ut.Buf8(s.wsize)),i>=s.wsize?(ut.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),ut.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(ut.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}l(yE,"updatewindow");function qC(t,e){var r,i,n,s,a,f,o,c,u,h,d,p,m,w,y=0,g,_,F,R,k,D,v,O,E=new ut.Buf8(4),N,x,I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&t.avail_in!==0)return Tt;r=t.state,r.mode===br&&(r.mode=up),a=t.next_out,n=t.output,o=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,c=r.hold,u=r.bits,h=f,d=o,O=ki;e:for(;;)switch(r.mode){case hE:if(r.wrap===0){r.mode=up;break}for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(r.wrap&2&&c===35615){r.check=0,E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0),c=0,u=0,r.mode=Lv;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=ue;break}if((c&15)!==jv){t.msg="unknown compression method",r.mode=ue;break}if(c>>>=4,u-=4,v=(c&15)+8,r.wbits===0)r.wbits=v;else if(v>r.wbits){t.msg="invalid window size",r.mode=ue;break}r.dmax=1<<v,t.adler=r.check=1,r.mode=c&512?Kv:br,c=0,u=0;break;case Lv:for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(r.flags=c,(r.flags&255)!==jv){t.msg="unknown compression method",r.mode=ue;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=ue;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0)),c=0,u=0,r.mode=qv;case qv:for(;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.head&&(r.head.time=c),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,E[2]=c>>>16&255,E[3]=c>>>24&255,r.check=ir(r.check,E,4,0)),c=0,u=0,r.mode=Uv;case Uv:for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0)),c=0,u=0,r.mode=Wv;case Wv:if(r.flags&1024){for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,r.check=ir(r.check,E,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=zv;case zv:if(r.flags&1024&&(p=r.length,p>f&&(p=f),p&&(r.head&&(v=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),ut.arraySet(r.head.extra,i,s,p,v)),r.flags&512&&(r.check=ir(r.check,i,p,s)),f-=p,s+=p,r.length-=p),r.length))break e;r.length=0,r.mode=Hv;case Hv:if(r.flags&2048){if(f===0)break e;p=0;do v=i[s+p++],r.head&&v&&r.length<65536&&(r.head.name+=String.fromCharCode(v));while(v&&p<f);if(r.flags&512&&(r.check=ir(r.check,i,p,s)),f-=p,s+=p,v)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Vv;case Vv:if(r.flags&4096){if(f===0)break e;p=0;do v=i[s+p++],r.head&&v&&r.length<65536&&(r.head.comment+=String.fromCharCode(v));while(v&&p<f);if(r.flags&512&&(r.check=ir(r.check,i,p,s)),f-=p,s+=p,v)break e}else r.head&&(r.head.comment=null);r.mode=Gv;case Gv:if(r.flags&512){for(;u<16;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(c!==(r.check&65535)){t.msg="header crc mismatch",r.mode=ue;break}c=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=br;break;case Kv:for(;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}t.adler=r.check=oE(c),c=0,u=0,r.mode=gl;case gl:if(r.havedict===0)return t.next_out=a,t.avail_out=o,t.next_in=s,t.avail_in=f,r.hold=c,r.bits=u,PC;t.adler=r.check=1,r.mode=br;case br:if(e===xC||e===ml)break e;case up:if(r.last){c>>>=u&7,u-=u&7,r.mode=dp;break}for(;u<3;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}switch(r.last=c&1,c>>>=1,u-=1,c&3){case 0:r.mode=Jv;break;case 1:if(LC(r),r.mode=wl,e===ml){c>>>=2,u-=2;break e}break;case 2:r.mode=Yv;break;case 3:t.msg="invalid block type",r.mode=ue}c>>>=2,u-=2;break;case Jv:for(c>>>=u&7,u-=u&7;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=ue;break}if(r.length=c&65535,c=0,u=0,r.mode=hp,e===ml)break e;case hp:r.mode=Xv;case Xv:if(p=r.length,p){if(p>f&&(p=f),p>o&&(p=o),p===0)break e;ut.arraySet(n,i,s,p,a),f-=p,s+=p,o-=p,a+=p,r.length-=p;break}r.mode=br;break;case Yv:for(;u<14;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(r.nlen=(c&31)+257,c>>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=ue;break}r.have=0,r.mode=Zv;case Zv:for(;r.have<r.ncode;){for(;u<3;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.lens[I[r.have++]]=c&7,c>>>=3,u-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,N={bits:r.lenbits},O=ja(kC,r.lens,0,19,r.lencode,0,r.work,N),r.lenbits=N.bits,O){t.msg="invalid code lengths set",r.mode=ue;break}r.have=0,r.mode=Qv;case Qv:for(;r.have<r.nlen+r.ndist;){for(;y=r.lencode[c&(1<<r.lenbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(F<16)c>>>=g,u-=g,r.lens[r.have++]=F;else{if(F===16){for(x=g+2;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(c>>>=g,u-=g,r.have===0){t.msg="invalid bit length repeat",r.mode=ue;break}v=r.lens[r.have-1],p=3+(c&3),c>>>=2,u-=2}else if(F===17){for(x=g+3;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=g,u-=g,v=0,p=3+(c&7),c>>>=3,u-=3}else{for(x=g+7;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=g,u-=g,v=0,p=11+(c&127),c>>>=7,u-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=ue;break}for(;p--;)r.lens[r.have++]=v}}if(r.mode===ue)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=ue;break}if(r.lenbits=9,N={bits:r.lenbits},O=ja(lE,r.lens,0,r.nlen,r.lencode,0,r.work,N),r.lenbits=N.bits,O){t.msg="invalid literal/lengths set",r.mode=ue;break}if(r.distbits=6,r.distcode=r.distdyn,N={bits:r.distbits},O=ja(fE,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,N),r.distbits=N.bits,O){t.msg="invalid distances set",r.mode=ue;break}if(r.mode=wl,e===ml)break e;case wl:r.mode=yl;case yl:if(f>=6&&o>=258){t.next_out=a,t.avail_out=o,t.next_in=s,t.avail_in=f,r.hold=c,r.bits=u,OC(t,d),a=t.next_out,n=t.output,o=t.avail_out,s=t.next_in,i=t.input,f=t.avail_in,c=r.hold,u=r.bits,r.mode===br&&(r.back=-1);break}for(r.back=0;y=r.lencode[c&(1<<r.lenbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(_&&!(_&240)){for(R=g,k=_,D=F;y=r.lencode[D+((c&(1<<R+k)-1)>>R)],g=y>>>24,_=y>>>16&255,F=y&65535,!(R+g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=g,u-=g,r.back+=g,r.length=F,_===0){r.mode=nE;break}if(_&32){r.back=-1,r.mode=br;break}if(_&64){t.msg="invalid literal/length code",r.mode=ue;break}r.extra=_&15,r.mode=eE;case eE:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=tE;case tE:for(;y=r.distcode[c&(1<<r.distbits)-1],g=y>>>24,_=y>>>16&255,F=y&65535,!(g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(!(_&240)){for(R=g,k=_,D=F;y=r.distcode[D+((c&(1<<R+k)-1)>>R)],g=y>>>24,_=y>>>16&255,F=y&65535,!(R+g<=u);){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=g,u-=g,r.back+=g,_&64){t.msg="invalid distance code",r.mode=ue;break}r.offset=F,r.extra=_&15,r.mode=rE;case rE:if(r.extra){for(x=r.extra;u<x;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=ue;break}r.mode=iE;case iE:if(o===0)break e;if(p=d-o,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=ue;break}p>r.wnext?(p-=r.wnext,m=r.wsize-p):m=r.wnext-p,p>r.length&&(p=r.length),w=r.window}else w=n,m=a-r.offset,p=r.length;p>o&&(p=o),o-=p,r.length-=p;do n[a++]=w[m++];while(--p);r.length===0&&(r.mode=yl);break;case nE:if(o===0)break e;n[a++]=r.length,o--,r.mode=yl;break;case dp:if(r.wrap){for(;u<32;){if(f===0)break e;f--,c|=i[s++]<<u,u+=8}if(d-=o,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?ir(r.check,n,d,a-d):wp(r.check,n,d,a-d)),d=o,(r.flags?c:oE(c))!==r.check){t.msg="incorrect data check",r.mode=ue;break}c=0,u=0}r.mode=sE;case sE:if(r.wrap&&r.flags){for(;u<32;){if(f===0)break e;f--,c+=i[s++]<<u,u+=8}if(c!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=ue;break}c=0,u=0}r.mode=aE;case aE:O=AC;break e;case ue:O=uE;break e;case gp:return yp;case DC:default:return Tt}return t.next_out=a,t.avail_out=o,t.next_in=s,t.avail_in=f,r.hold=c,r.bits=u,(r.wsize||d!==t.avail_out&&r.mode<ue&&(r.mode<dp||e!==Mv))&&yE(t,t.output,t.next_out,d-t.avail_out)?(r.mode=gp,yp):(h-=t.avail_in,d-=t.avail_out,t.total_in+=h,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?ir(r.check,n,d,t.next_out-d):wp(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===br?128:0)+(r.mode===wl||r.mode===hp?256:0),(h===0&&d===0||e===Mv)&&O===ki&&(O=NC),O)}l(qC,"inflate");function UC(t){if(!t||!t.state)return Tt;var e=t.state;return e.window&&(e.window=null),t.state=null,ki}l(UC,"inflateEnd");function WC(t,e){var r;return!t||!t.state||(r=t.state,!(r.wrap&2))?Tt:(r.head=e,e.done=!1,ki)}l(WC,"inflateGetHeader");function zC(t,e){var r=e.length,i,n,s;return!t||!t.state||(i=t.state,i.wrap!==0&&i.mode!==gl)?Tt:i.mode===gl&&(n=1,n=wp(n,e,r,0),n!==i.check)?uE:(s=yE(t,e,r,r),s?(i.mode=gp,yp):(i.havedict=1,ki))}l(zC,"inflateSetDictionary");Mt.inflateReset=pE;Mt.inflateReset2=mE;Mt.inflateResetKeep=dE;Mt.inflateInit=jC;Mt.inflateInit2=wE;Mt.inflate=qC;Mt.inflateEnd=UC;Mt.inflateGetHeader=WC;Mt.inflateSetDictionary=zC;Mt.inflateInfo="pako inflate (from Nodeca project)"});var bp=T((MW,bE)=>{"use strict";bE.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var vE=T((jW,_E)=>{"use strict";function HC(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}l(HC,"GZheader");_E.exports=HC});var SE=T(qa=>{"use strict";var rs=gE(),La=wr(),bl=np(),ye=bp(),_p=al(),VC=sp(),GC=vE(),EE=Object.prototype.toString;function xi(t){if(!(this instanceof xi))return new xi(t);this.options=La.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new VC,this.strm.avail_out=0;var r=rs.inflateInit2(this.strm,e.windowBits);if(r!==ye.Z_OK)throw new Error(_p[r]);if(this.header=new GC,rs.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=bl.string2buf(e.dictionary):EE.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=rs.inflateSetDictionary(this.strm,e.dictionary),r!==ye.Z_OK)))throw new Error(_p[r])}l(xi,"Inflate");xi.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,f,o,c,u=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?ye.Z_FINISH:ye.Z_NO_FLUSH,typeof t=="string"?r.input=bl.binstring2buf(t):EE.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new La.Buf8(i),r.next_out=0,r.avail_out=i),s=rs.inflate(r,ye.Z_NO_FLUSH),s===ye.Z_NEED_DICT&&n&&(s=rs.inflateSetDictionary(this.strm,n)),s===ye.Z_BUF_ERROR&&u===!0&&(s=ye.Z_OK,u=!1),s!==ye.Z_STREAM_END&&s!==ye.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===ye.Z_STREAM_END||r.avail_in===0&&(a===ye.Z_FINISH||a===ye.Z_SYNC_FLUSH))&&(this.options.to==="string"?(f=bl.utf8border(r.output,r.next_out),o=r.next_out-f,c=bl.buf2string(r.output,f),r.next_out=o,r.avail_out=i-o,o&&La.arraySet(r.output,r.output,f,o,0),this.onData(c)):this.onData(La.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==ye.Z_STREAM_END);return s===ye.Z_STREAM_END&&(a=ye.Z_FINISH),a===ye.Z_FINISH?(s=rs.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===ye.Z_OK):(a===ye.Z_SYNC_FLUSH&&(this.onEnd(ye.Z_OK),r.avail_out=0),!0)};xi.prototype.onData=function(t){this.chunks.push(t)};xi.prototype.onEnd=function(t){t===ye.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=La.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function vp(t,e){var r=new xi(e);if(r.push(t,!0),r.err)throw r.msg||_p[r.err];return r.result}l(vp,"inflate");function KC(t,e){return e=e||{},e.raw=!0,vp(t,e)}l(KC,"inflateRaw");qa.Inflate=xi;qa.inflate=vp;qa.inflateRaw=KC;qa.ungzip=vp});var RE=T((WW,TE)=>{"use strict";var JC=wr().assign,XC=kv(),YC=SE(),ZC=bp(),FE={};JC(FE,XC,YC,ZC);TE.exports=FE});var xE=T((zW,kE)=>{"use strict";var OE=l((t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...a)=>{e.errorFirst?a[0]?s(a):(a.shift(),n(a)):n(a)}):e.errorFirst?r.push((a,f)=>{a?s(a):n(f)}):r.push(n),t.apply(this,r)})},"processFn");kE.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=l(s=>{let a=l(f=>typeof f=="string"?s===f:f.test(s),"match");return e.include?e.include.some(a):!e.exclude.some(a)},"filter"),n;r==="function"?n=l(function(...s){return e.excludeMain?t(...s):OE(t,e).apply(this,s)},"ret"):n=Object.create(Object.getPrototypeOf(t));for(let s in t){let a=t[s];n[s]=typeof a=="function"&&i(s)?OE(a,e):a}return n}});var ME=T((VW,BE)=>{function AE(t){return Array.isArray(t)?t:[t]}l(AE,"makeArray");var Fp="",PE=" ",Ep="\\",QC=/^\s+$/,eI=/(?:[^\\]|^)\\$/,tI=/^\\!/,rI=/^\\#/,iI=/\r?\n/g,nI=/^\.*\/|^\.+$/,Sp="/",CE="node-ignore";typeof Symbol<"u"&&(CE=Symbol.for("node-ignore"));var NE=CE,sI=l((t,e,r)=>Object.defineProperty(t,e,{value:r}),"define"),aI=/([0-z])-([0-z])/g,IE=l(()=>!1,"RETURN_FALSE"),oI=l(t=>t.replace(aI,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:Fp),"sanitizeRange"),cI=l(t=>{let{length:e}=t;return t.slice(0,e-e%2)},"cleanRangeBackSlash"),lI=[[/^\uFEFF/,()=>Fp],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?PE:Fp)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+PE}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,l(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Ep],[/\\\\/g,()=>Ep],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Ep?`\\[${r}${cI(i)}${n}`:n==="]"&&i.length%2===0?`[${oI(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],DE=Object.create(null),fI=l((t,e)=>{let r=DE[t];return r||(r=lI.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),DE[t]=r),e?new RegExp(r,"i"):new RegExp(r)},"makeRegex"),Op=l(t=>typeof t=="string","isString"),uI=l(t=>t&&Op(t)&&!QC.test(t)&&!eI.test(t)&&t.indexOf("#")!==0,"checkPattern"),hI=l(t=>t.split(iI),"splitPattern"),kp=class kp{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}};l(kp,"IgnoreRule");var Tp=kp,dI=l((t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(tI,"!").replace(rI,"#");let n=fI(t,e);return new Tp(r,t,i,n)},"createRule"),pI=l((t,e)=>{throw new e(t)},"throwError"),_r=l((t,e,r)=>Op(t)?t?_r.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),"checkPath"),$E=l(t=>nI.test(t),"isNotRelative");_r.isNotRelative=$E;_r.convert=t=>t;var xp=class xp{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){sI(this,NE,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[NE]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(uI(e)){let r=dI(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,AE(Op(e)?hI(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:a}=s;if(n===a&&i!==n||a&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!a,n=a)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&_r.convert(e);return _r(s,e,this._allowRelativePaths?IE:pI),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(Sp)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(Sp)+Sp,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return AE(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};l(xp,"Ignore");var Rp=xp,_l=l(t=>new Rp(t),"factory"),mI=l(t=>_r(t&&_r.convert(t),t,IE),"isPathValid");_l.isPathValid=mI;_l.default=_l;BE.exports=_l;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=l(r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/"),"makePosix");_r.convert=t;let e=/^[a-z]:\//i;_r.isNotRelative=r=>e.test(r)||$E(r)}});var LE=T((KW,jE)=>{"use strict";function wI(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(wI,"escapeRegExp");function nr(t,e,r){return e=e instanceof RegExp?e:new RegExp(wI(e),"g"),t.replace(e,r)}l(nr,"replaceAll");var yI={clean:l(function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=nr(e,"./","/"),e=nr(e,"..","."),e=nr(e," ","-"),e=nr(e,/^[~^:?*\\\-]/g,""),e=nr(e,/[~^:?*\\]/g,"-"),e=nr(e,/[~^:?*\\\-]$/g,""),e=nr(e,"@{","-"),e=nr(e,/\.$/g,""),e=nr(e,/\/$/g,""),e=nr(e,/\.lock$/g,""),e},"clean")};jE.exports=yI});var UE=T((XW,qE)=>{"use strict";var gI=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;qE.exports=l(function(e,r){if(typeof e!="string")throw new TypeError("Reference name must be a string");return!gI.test(e)&&(!!r||e.includes("/"))},"validRef")});var zE=T((ZW,WE)=>{WE.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,f=null,o=n+1,c=[],u=[],h=[],d="",p=-1,m=0,w=1,y,g,_=l(function(){n>=s&&(y=r,g=n,r=i,i=y,n=s,s=g,a=!0,o=n+1)},"init"),F=l(function(v,O,E){return{x:v,y:O,k:E}},"P"),R=l(function(v,O){return{elem:v,t:O}},"seselem"),k=l(function(v,O,E){var N,x,I;for(O>E?N=c[v-1+o]:N=c[v+1+o],I=Math.max(O,E),x=I-v;x<n&&I<s&&r[x]===i[I];)++x,++I;return c[v+o]=u.length,u[u.length]=new F(x,I,N),I},"snake"),D=l(function(v){var O,E,N,x,I;for(O=E=1,N=x=0,I=v.length-1;I>=0;--I)for(;N<v[I].x||x<v[I].y;)v[I].y-v[I].x>x-N?(a?h[h.length]=new R(i[x],p):h[h.length]=new R(i[x],w),++E,++x):v[I].y-v[I].x<x-N?(a?h[h.length]=new R(r[N],w):h[h.length]=new R(r[N],p),++O,++N):(h[h.length]=new R(r[N],m),d+=r[N],++O,++E,++N,++x)},"recordseq");return _(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:l(function(){return f},"editdistance"),getlcs:l(function(){return d},"getlcs"),getses:l(function(){return h},"getses"),compose:l(function(){var v,O,E,N,x,I,q,z;for(v=s-n,O=n+s+3,E={},q=0;q<O;++q)E[q]=-1,c[q]=-1;N=-1;do{for(++N,z=-N;z<=v-1;++z)E[z+o]=k(z,E[z-1+o]+1,E[z+1+o]);for(z=v+N;z>=v+1;--z)E[z+o]=k(z,E[z-1+o]+1,E[z+1+o]);E[v+o]=k(v,E[v-1+o]+1,E[v+1+o])}while(E[v+o]!==s);for(f=v+2*N,x=c[v+o],I=[];x!==-1;)I[I.length]=new F(u[x].x,u[x].y,null),x=u[x].k;D(I)},"compose")}}});var GE=T((ez,VE)=>{var bI=zE();function _I(t,e){var r=new bI(t,e);r.compose();for(var i=r.getses(),n,s,a=t.length-1,f=e.length-1,o=i.length-1;o>=0;--o)i[o].t===r.SES_COMMON?(s?(s.chain={file1index:a,file2index:f,chain:null},s=s.chain):(n={file1index:a,file2index:f,chain:null},s=n),a--,f--):i[o].t===r.SES_DELETE?a--:i[o].t===r.SES_ADD&&f--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,n):c}l(_I,"longestCommonSubsequence");function HE(t,e){for(var r=[],i=t.length,n=e.length,s=_I(t,e);s!==null;s=s.chain){var a=i-s.file1index-1,f=n-s.file2index-1;i=s.file1index,n=s.file2index,(a||f)&&r.push({file1:[i+1,a],file2:[n+1,f]})}return r.reverse(),r}l(HE,"diffIndices");function vI(t,e,r){var i,n=HE(e,t),s=HE(e,r),a=[];function f(q,z){a.push([q.file1[0],z,q.file1[1],q.file2[0],q.file2[1]])}for(l(f,"addHunk"),i=0;i<n.length;i++)f(n[i],0);for(i=0;i<s.length;i++)f(s[i],2);a.sort(function(q,z){return q[0]-z[0]});var o=[],c=0;function u(q){q>c&&(o.push([1,c,q-c]),c=q)}l(u,"copyCommon");for(var h=0;h<a.length;h++){for(var d=h,p=a[h],m=p[0],w=m+p[2];h<a.length-1;){var y=a[h+1],g=y[0];if(g>w)break;w=Math.max(w,g+y[2]),h++}if(u(m),d==h)p[4]>0&&o.push([p[1],p[3],p[4]]);else{var _={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=h;i++){p=a[i];var F=p[1],R=_[F],k=p[0],D=k+p[2],v=p[3],O=v+p[4];R[0]=Math.min(v,R[0]),R[1]=Math.max(O,R[1]),R[2]=Math.min(k,R[2]),R[3]=Math.max(D,R[3])}var E=_[0][0]+(m-_[0][2]),N=_[0][1]+(w-_[0][3]),x=_[2][0]+(m-_[2][2]),I=_[2][1]+(w-_[2][3]);o.push([-1,E,N-E,m,w-m,x,I-x])}c=w}return u(e.length),o}l(vI,"diff3MergeIndices");function EI(t,e,r){var i=[],n=[t,e,r],s=vI(t,e,r),a=[];function f(){a.length&&i.push({ok:a}),a=[]}l(f,"flushOk");function o(p){for(var m=0;m<p.length;m++)a.push(p[m])}l(o,"pushOk");function c(p){if(p[2]!=p[6])return!0;for(var m=p[1],w=p[5],y=0;y<p[2];y++)if(t[y+m]!=r[y+w])return!0;return!1}l(c,"isTrueConflict");for(var u=0;u<s.length;u++){var h=s[u],d=h[0];d==-1?c(h)?(f(),i.push({conflict:{a:t.slice(h[1],h[1]+h[2]),aIndex:h[1],o:e.slice(h[3],h[3]+h[4]),oIndex:h[3],b:r.slice(h[5],h[5]+h[6]),bIndex:h[5]}})):o(n[0].slice(h[1],h[1]+h[2])):o(n[d].slice(h[1],h[1]+h[2]))}return f(),i}l(EI,"diff3Merge");VE.exports=EI});var ke=T(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});function Sr(t){return t&&typeof t=="object"&&"default"in t?t.default:t}l(Sr,"_interopDefault");var za=Sr(_0()),wS=Sr(C_()),C=B_(),SI=Sr(j_()),tm=Sr(RE()),Ap=Sr(xE()),FI=Sr(ME()),Ha=Sr(LE()),Va=Sr(UE()),TI=Sr(GE()),Dl=class Dl extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new Dl(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}};l(Dl,"BaseError");var Z=Dl,Cl=class Cl extends Z{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=Cl.code,this.data={filepaths:e}}};l(Cl,"UnmergedPathsError");var Ga=Cl;Ga.code="UnmergedPathsError";var Il=class Il extends Z{constructor(e){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=Il.code,this.data={message:e}}};l(Il,"InternalError");var W=Il;W.code="InternalError";var $l=class $l extends Z{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=$l.code,this.data={filepath:e}}};l($l,"UnsafeFilepathError");var as=$l;as.code="UnsafeFilepathError";var cm=class cm{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};l(cm,"BufferCursor");var Rt=cm;function bf(t,e){return-(t<e)||+(t>e)}l(bf,"compareStrings");function yS(t,e){return bf(t.path,e.path)}l(yS,"comparePath");function gS(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}l(gS,"normalizeMode");var sr=2**32;function KE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}l(KE,"SecondsNanoseconds");function os(t){let[e,r]=KE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=KE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%sr,ctimeNanoseconds:r%sr,mtimeSeconds:i%sr,mtimeNanoseconds:n%sr,dev:t.dev%sr,ino:t.ino%sr,mode:gS(t.mode%sr),uid:t.uid%sr,gid:t.gid%sr,size:t.size>-1?t.size%sr:0}}l(os,"normalizeStats");function RI(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}l(RI,"toHex");var Pp=null;async function Er(t){return Pp===null&&(Pp=await kI()),Pp?bS(t):OI(t)}l(Er,"shasum");function OI(t){return new wS().update(t).digest("hex")}l(OI,"shasumSync");async function bS(t){let e=await crypto.subtle.digest("SHA-1",t);return RI(e)}l(bS,"subtleSHA1");async function kI(){try{return await bS(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}l(kI,"testSubtleSHA1");function xI(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}l(xI,"parseCacheEntryFlags");function AI(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}l(AI,"renderCacheEntryFlags");var Ur=class Ur{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return Ur.fromBuffer(e);if(e===null)return new Ur(null);throw new W("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new W("Index file is empty (.git/index)");let r=new Ur,i=new Rt(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new W(`Invalid dircache magic file number: ${n}`);let s=await Er(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new W(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let f=i.readUInt32BE();if(f!==2)throw new W(`Unsupported dircache version: ${f}`);let o=i.readUInt32BE(),c=0;for(;!i.eof()&&c<o;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let h=i.readUInt16BE();u.flags=xI(h);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new W(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new as(u.path);let p=8-(i.tell()-12)%8;for(p===0&&(p=8);p--;){let m=i.readUInt8();if(m!==0)throw new W(`Expected 1-8 null characters but got '${m}' after ${u.path}`);if(i.eof())throw new W("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(yS)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=os(r);let s=Buffer.from(e),a={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:n,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
|
|
10
|
+
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new Rt(n),a=os(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(AI(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new Rt(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let f of this.entries)if(i.push(Ur._entryToBuffer(f)),f.stages.length>1)for(let o of f.stages)o&&o!==f&&i.push(Ur._entryToBuffer(o));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),a=await Er(s);return Buffer.concat([s,Buffer.from(a,"hex")])}};l(Ur,"GitIndex");var Wp=Ur;function Sl(t,e,r=!0,i=!0){let n=os(t),s=os(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}l(Sl,"compareStats");var Np=null,Dp=Symbol("IndexCache");function PI(){return{map:new Map,stats:new Map}}l(PI,"createCache");async function NI(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await Wp.from(n);r.map.set(e,s),r.stats.set(e,i)}l(NI,"updateCachedIndexFile");async function DI(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:Sl(i,n)}l(DI,"isIndexStale");var lm=class lm{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Dp]||(i[Dp]=PI());let a=`${r}/index`;Np===null&&(Np=new za({maxPending:1/0}));let f,o=[];return await Np.acquire(a,async()=>{let c=i[Dp];await DI(e,a,c)&&await NI(e,a,c);let u=c.map.get(a);if(o=u.unmergedPaths,o.length&&!n)throw new Ga(o);if(f=await s(u),u._dirty){let h=await u.toObject();await e.write(a,h),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),f}};l(lm,"GitIndexManager");var ge=lm;function Fl(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}l(Fl,"basename");function cs(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}l(cs,"dirname");function _S(t){let e=new Map,r=l(function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Fl(n),metadata:{},children:[]};e.set(n,s),s.parent=r(cs(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},"mkdir"),i=l(function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:Fl(n),metadata:s,parent:r(cs(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)},"mkfile");r(".");for(let n of t)i(n.path,n);return e}l(_S,"flatFileListToDirectoryStructure");function CI(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new W(`Unexpected GitTree entry mode: ${t.toString(8)}`)}l(CI,"mode2type");var fm=class fm{constructor({fs:e,gitdir:r,cache:i}){var s;this.treePromise=ge.acquire({fs:e,gitdir:r,cache:i},async function(a){return _S(a.entries)});let n=this;this.ConstructEntry=(s=class{constructor(f){this._fullpath=f,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}},l(s,"StageEntry"),s)}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(bf),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:os(i.metadata);e._type=i.type==="tree"?"tree":CI(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}};l(fm,"GitWalkerIndex");var zp=fm,_f=Symbol("GitWalkSymbol");function Ii(){let t=Object.create(null);return Object.defineProperty(t,_f,{value:l(function({fs:e,gitdir:r,cache:i}){return new zp({fs:e,gitdir:r,cache:i})},"value")}),Object.freeze(t),t}l(Ii,"STAGE");var Bl=class Bl extends Z{constructor(e){super(`Could not find ${e}.`),this.code=this.name=Bl.code,this.data={what:e}}};l(Bl,"NotFoundError");var oe=Bl;oe.code="NotFoundError";var Ml=class Ml extends Z{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=Ml.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};l(Ml,"ObjectTypeError");var Ye=Ml;Ye.code="ObjectTypeError";var jl=class jl extends Z{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=jl.code,this.data={value:e}}};l(jl,"InvalidOidError");var zr=jl;zr.code="InvalidOidError";var Ll=class Ll extends Z{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
|
11
|
+
[remote "${e}"]
|
|
12
|
+
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
13
|
+
`),this.code=this.name=Ll.code,this.data={remote:e}}};l(Ll,"NoRefspecError");var Ka=Ll;Ka.code="NoRefspecError";var ql=class ql{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
|
|
14
|
+
`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new ql(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
|
15
|
+
`)+`
|
|
16
|
+
`}};l(ql,"GitPackedRefs");var Tl=ql,Ul=class Ul{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),f=r==="+",o=n==="*";if(o!==(a==="*"))throw new W("Invalid refspec");return new Ul({remotePath:i,localPath:s,force:f,matchPrefix:o})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}};l(Ul,"GitRefSpec");var Rl=Ul,Wl=class Wl{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Rl.from(i));return new Wl(r)}add(e){let r=Rl.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};l(Wl,"GitRefSpecSet");var Hp=Wl;function II(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}l(II,"compareRefNames");var $I=l(t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},"num"),Ua=l(t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},"bool"),JE={core:{filemode:Ua,bare:Ua,logallrefupdates:Ua,symlinks:Ua,ignorecase:Ua,bigFileThreshold:$I}},BI=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,MI=/^[A-Za-z0-9-.]+$/,jI=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,LI=/^[A-Za-z][A-Za-z-]*$/,qI=/^(.*?)( *[#;].*)$/,UI=l(t=>{let e=BI.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},"extractSectionLine"),WI=l(t=>{let e=jI.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=zI(i),s=HI(n);return[r,s]}return null},"extractVariableLine"),zI=l(t=>{let e=qI.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return XE(r)&&XE(i)?`${r}${i}`:r},"removeComments"),XE=l(t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,"hasOddNumberOfQuotes"),HI=l(t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),"removeQuotes"),YE=l(t=>t!=null?t.toLowerCase():null,"lower"),Vp=l((t,e,r)=>[YE(t),e,YE(r)].filter(i=>i!=null).join("."),"getPath"),ZE=l(t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Vp(r,n,i),sectionPath:Vp(r,n,null),isSection:!!r}},"normalizePath"),VI=l((t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),"findLastIndex"),zl=class zl{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
|
|
17
|
+
`).map(n=>{let s=null,a=null,f=n.trim(),o=UI(f),c=o!=null;if(c)[r,i]=o;else{let h=WI(f);h!=null&&([s,a]=h)}let u=Vp(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new zl(e)}async get(e,r=!1){let i=ZE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:f})=>{let o=JE[s]&&JE[s][a];return o?o(f):f});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:f,sectionPath:o,isSection:c}=ZE(e),u=VI(this.parsedConfig,h=>h.path===f);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let h=this.parsedConfig[u],d=Object.assign({},h,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let h=this.parsedConfig.findIndex(p=>p.path===o),d={section:n,subsection:s,name:a,value:r,modified:!0,path:f};if(MI.test(n)&&LI.test(a))if(h>=0)this.parsedConfig.splice(h+1,0,d);else{let p={isSection:c,section:n,subsection:s,modified:!0,path:o};this.parsedConfig.push(p,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
|
|
18
|
+
`)}};l(zl,"GitConfig");var Gp=zl,um=class um{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Gp.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}};l(um,"GitConfigManager");var me=um,vl=l(t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],"refpaths"),GI=["config","description","index","shallow","commondir"],Cp;async function qr(t,e){return Cp===void 0&&(Cp=new za),Cp.acquire(t,e)}l(qr,"acquireLock");var Ee=class Ee{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:f=void 0,prune:o=!1,pruneTags:c=!1}){for(let y of n.values())if(!y.match(/[0-9a-f]{40}/))throw new zr(y);let u=await me.get({fs:e,gitdir:r});if(!f){if(f=await u.getall(`remote.${i}.fetch`),f.length===0)throw new Ka(i);f.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let h=Hp.from(f),d=new Map;if(c){let y=await Ee.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await Ee.deleteRefs({fs:e,gitdir:r,refs:y.map(g=>`refs/tags/${g}`)})}if(a){for(let y of n.keys())if(y.startsWith("refs/tags")&&!y.endsWith("^{}")&&!await Ee.exists({fs:e,gitdir:r,ref:y})){let g=n.get(y);d.set(y,g)}}let p=h.translate([...n.keys()]);for(let[y,g]of p){let _=n.get(y);d.set(g,_)}let m=h.translate([...s.keys()]);for(let[y,g]of m){let _=s.get(y),F=h.translateOne(_);F&&d.set(g,`ref: ${F}`)}let w=[];if(o){for(let y of h.localNamespaces()){let g=(await Ee.listRefs({fs:e,gitdir:r,filepath:y})).map(_=>`${y}/${_}`);for(let _ of g)d.has(_)||w.push(_)}w.length>0&&await Ee.deleteRefs({fs:e,gitdir:r,refs:w})}for(let[y,g]of d)await qr(y,async()=>e.write(C.join(r,y),`${g.trim()}
|
|
19
|
+
`,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new zr(n);await qr(i,async()=>e.write(C.join(r,i),`${n.trim()}
|
|
20
|
+
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await qr(i,async()=>e.write(C.join(r,i),`ref: ${n.trim()}
|
|
21
|
+
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return Ee.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(f=>e.rm(C.join(r,f))));let n=await qr("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=Tl.from(n),a=s.refs.size;for(let f of i)s.refs.has(f)&&s.delete(f);s.refs.size<a&&(n=s.toString(),await qr("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),Ee.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await Ee.packedRefs({fs:e,gitdir:r}),a=vl(i).filter(f=>!GI.includes(f));for(let f of a){let o=await qr(f,async()=>await e.read(`${r}/${f}`,{encoding:"utf8"})||s.get(f));if(o)return Ee.resolve({fs:e,gitdir:r,ref:o.trim(),depth:n})}throw new oe(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await Ee.expand({fs:e,gitdir:r,ref:i}),!0}catch{return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await Ee.packedRefs({fs:e,gitdir:r}),s=vl(i);for(let a of s)if(await qr(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new oe(i)}static async expandAgainstMap({ref:e,map:r}){let i=vl(e);for(let n of i)if(await r.has(n))return n;throw new oe(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),Ee.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=vl(e);for(let a of s){let f=n.get(a);if(f)return Ee.resolveAgainstMap({ref:f.trim(),fullref:a,depth:i,map:n})}throw new oe(e)}static async packedRefs({fs:e,gitdir:r}){let i=await qr("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Tl.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=Ee.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch{s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(II),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?Ee.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):Ee.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await Ee.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};l(Ee,"GitRefManager");var $=Ee;function KI(t,e){return bf(QE(t),QE(e))}l(KI,"compareTreeEntryPath");function QE(t){return t.mode==="040000"?t.path+"/":t.path}l(QE,"appendSlashIfDir");function vS(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new W(`Unexpected GitTree entry mode: ${t}`)}l(vS,"mode2type$1");function JI(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new W(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new W(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=vS(s),f=t.slice(i+1,n).toString("utf8");if(f.includes("\\")||f.includes("/"))throw new as(f);let o=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:f,oid:o,type:a})}return e}l(JI,"parseBuffer");function XI(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new W(`Could not understand file mode: ${t}`)}l(XI,"limitModeToAllowed");function YI(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=XI(t.mode),t.type||(t.type=vS(t.mode)),t}l(YI,"nudgeIntoShape");var Hl=class Hl{constructor(e){if(Buffer.isBuffer(e))this._entries=JI(e);else if(Array.isArray(e))this._entries=e.map(YI);else throw new W("invalid type passed to GitTree constructor");this._entries.sort(yS)}static from(e){return new Hl(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
|
22
|
+
`)}toObject(){let e=[...this._entries];return e.sort(KI),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),a=Buffer.from([0]),f=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,a,f])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}};l(Hl,"GitTree");var rt=Hl,hm=class hm{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let f=0;f<n;f++)a[f]=i.charCodeAt(f);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new W(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};l(hm,"GitObject");var Hr=hm;async function ES({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}l(ES,"readObjectLoose");function ZI(t,e){let r=new Rt(t),i=eS(r);if(i!==e.byteLength)throw new W(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=eS(r),s,a=rS(r,e);if(a.byteLength===n)s=a;else{s=Buffer.alloc(n);let f=new Rt(s);for(f.copy(a);!r.eof();)f.copy(rS(r,e));let o=f.tell();if(n!==o)throw new W(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${o} bytes`)}return s}l(ZI,"applyDelta");function eS(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}l(eS,"readVarIntLE");function tS(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}l(tS,"readCompactLE");function rS(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=tS(t,r&n,4),f=tS(t,(r&s)>>4,3);return f===0&&(f=65536),e.slice(a,a+f)}else return t.slice(r)}l(rS,"readOp");function QI(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(QI,"fromValue");function SS(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:QI(t)}l(SS,"getIterator");var dm=class dm{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=SS(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>e2(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};l(dm,"StreamReader");var Ol=dm;function e2(t){return t.reduce((e,r)=>e+r.length,0)}l(e2,"lengthBuffers");async function t2(t,e){let r=new Ol(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new W(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new W(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:f,length:o,ofs:c,reference:u}=await r2(r),h=new tm.Inflate;for(;!h.result;){let d=await r.chunk();if(!d)break;if(h.push(d,!1),h.err)throw new W(`Pako error: ${h.msg}`);if(h.result){if(h.result.length!==o)throw new W("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-h.strm.avail_in);let p=r.tell();await e({data:h.result,type:f,num:s,offset:a,end:p,reference:u,ofs:c})}}}}l(t2,"listpack");async function r2(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let f=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,f.push(e);while(e&128);s=Buffer.from(f)}return r===7&&(s=await t.read(20)),{type:r,length:i,ofs:n,reference:s}}l(r2,"parseHeader");var Ip=!1;async function FS(t){return Ip===null&&(Ip=n2()),Ip?i2(t):tm.inflate(t)}l(FS,"inflate");async function i2(t){let e=new DecompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(i2,"browserInflate");function n2(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}l(n2,"testDecompressionStream");function s2(t){let e=[],r=0,i=0;do{r=t.readUInt8();let n=r&127;e.push(n),i=r&128}while(i);return e.reduce((n,s)=>n+1<<7|s,-1)}l(s2,"decodeVarInt");function a2(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<<i,i+=7;while(n&128);return r}l(a2,"otherVarIntDecode");var Wa=class Wa{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:r}){let i=new Rt(e);if(i.slice(4).toString("hex")!=="ff744f63")return;let s=i.readUInt32BE();if(s!==2)throw new W(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new W("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+4*255);let a=i.readUInt32BE(),f=[];for(let u=0;u<a;u++){let h=i.slice(20).toString("hex");f[u]=h}i.seek(i.tell()+4*a);let o=new Map;for(let u=0;u<a;u++)o.set(f[u],i.readUInt32BE());let c=i.slice(20).toString("hex");return new Wa({hashes:f,crcs:{},offsets:o,packfileSha:c,getExternalRefDelta:r})}static async fromPack({pack:e,getExternalRefDelta:r,onProgress:i}){let n={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},s={},a=e.slice(-20).toString("hex"),f=[],o={},c=new Map,u=null,h=null;await t2([e],async({data:y,type:g,reference:_,offset:F,num:R})=>{u===null&&(u=R);let k=Math.floor((u-R)*100/u);k!==h&&i&&await i({phase:"Receiving objects",loaded:u-R,total:u}),h=k,g=n[g],["commit","tree","blob","tag"].includes(g)?s[F]={type:g,offset:F}:g==="ofs-delta"?s[F]={type:g,offset:F}:g==="ref-delta"&&(s[F]={type:g,offset:F})});let d=Object.keys(s).map(Number);for(let[y,g]of d.entries()){let _=y+1===d.length?e.byteLength-20:d[y+1],F=s[g],R=SI.buf(e.slice(g,_))>>>0;F.end=_,F.crc=R}let p=new Wa({pack:Promise.resolve(e),packfileSha:a,crcs:o,hashes:f,offsets:c,getExternalRefDelta:r});h=null;let m=0,w=[0,0,0,0,0,0,0,0,0,0,0,0];for(let y in s){y=Number(y);let g=Math.floor(m*100/u);g!==h&&i&&await i({phase:"Resolving deltas",loaded:m,total:u}),m++,h=g;let _=s[y];if(!_.oid)try{p.readDepth=0,p.externalReadDepth=0;let{type:F,object:R}=await p.readSlice({start:y});w[p.readDepth]+=1;let k=await Er(Hr.wrap({type:F,object:R}));_.oid=k,f.push(k),c.set(k,y),o[k]=_.crc}catch{continue}}return f.sort(),p}async toBuffer(){let e=[],r=l((c,u)=>{e.push(Buffer.from(c,u))},"write");r("ff744f63","hex"),r("00000002","hex");let i=new Rt(Buffer.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let h of this.hashes)parseInt(h.slice(0,2),16)<=c&&u++;i.writeUInt32BE(u)}e.push(i.buffer);for(let c of this.hashes)r(c,"hex");let n=new Rt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)n.writeUInt32BE(this.crcs[c]);e.push(n.buffer);let s=new Rt(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),r(this.packfileSha,"hex");let a=Buffer.concat(e),f=await Er(a),o=Buffer.alloc(20);return o.write(f,"hex"),Buffer.concat([a,o])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new W(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new W("Tried to read from a GitPackIndex with no packfile loaded into memory");let i=(await this.pack).slice(e),n=new Rt(i),s=n.readUInt8(),a=s&112,f=r[a];if(f===void 0)throw new W("Unrecognized type: 0b"+a.toString(2));let o=s&15,c=o;s&128&&(c=a2(n,o));let h=null,d=null;if(f==="ofs_delta"){let m=s2(n),w=e-m;({object:h,type:f}=await this.readSlice({start:w}))}if(f==="ref_delta"){let m=n.slice(20).toString("hex");({object:h,type:f}=await this.read({oid:m}))}let p=i.slice(n.tell());if(d=Buffer.from(await FS(p)),d.byteLength!==c)throw new W(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return h&&(d=Buffer.from(ZI(d,h))),this.readDepth>3&&(this.offsetCache[e]={type:f,object:d}),{type:f,format:"content",object:d}}};l(Wa,"GitPackIndex");var Ja=Wa,El=Symbol("PackfileCache");async function o2({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return Ja.fromIdx({idx:s,getExternalRefDelta:r})}l(o2,"loadPackIndex");function rm({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[El]||(e[El]=new Map);let a=e[El].get(r);return a||(a=o2({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[El].set(r,a)),a}l(rm,"readPackIndex");async function c2({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let a=await t.readdir(C.join(r,"objects/pack"));a=a.filter(f=>f.endsWith(".idx"));for(let f of a){let o=`${r}/objects/pack/${f}`,c=await rm({fs:t,cache:e,filename:o,getExternalRefDelta:s});if(c.error)throw new W(c.error);if(c.offsets.has(i)){if(!c.pack){let h=o.replace(/idx$/,"pack");c.pack=t.read(h)}let u=await c.read({oid:i,getExternalRefDelta:s});return u.format="content",u.source=`objects/pack/${f.replace(/idx$/,"pack")}`,u}}return null}l(c2,"readObjectPacked");async function fe({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(u=>fe({fs:t,cache:e,gitdir:r,oid:u}),"getExternalRefDelta"),a;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(a={format:"wrapped",object:Buffer.from("tree 0\0")}),a||(a=await ES({fs:t,gitdir:r,oid:i})),!a){if(a=await c2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!a)throw new oe(i);return a}if(n==="deflated"||(a.format==="deflated"&&(a.object=Buffer.from(await FS(a.object)),a.format="wrapped"),n==="wrapped"))return a;let f=await Er(a.object);if(f!==i)throw new W(`SHA check failed! Expected ${i}, computed ${f}`);let{object:o,type:c}=Hr.unwrap(a.object);if(a.type=c,a.object=o,a.format="content",n==="content")return a;throw new W(`invalid requested format "${n}"`)}l(fe,"_readObject");var Vl=class Vl extends Z{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=Vl.code,this.data={noun:e,where:r,canForce:i}}};l(Vl,"AlreadyExistsError");var jt=Vl;jt.code="AlreadyExistsError";var Gl=class Gl extends Z{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=Gl.code,this.data={nouns:e,short:r,matches:i}}};l(Gl,"AmbiguousError");var Xa=Gl;Xa.code="AmbiguousError";var Kl=class Kl extends Z{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=Kl.code,this.data={filepaths:e}}};l(Kl,"CheckoutConflictError");var Ya=Kl;Ya.code="CheckoutConflictError";var Jl=class Jl extends Z{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=Jl.code,this.data={ref:e,oid:r}}};l(Jl,"CommitNotFetchedError");var Za=Jl;Za.code="CommitNotFetchedError";var Xl=class Xl extends Z{constructor(){super("Empty response from git server."),this.code=this.name=Xl.code,this.data={}}};l(Xl,"EmptyServerResponseError");var Qa=Xl;Qa.code="EmptyServerResponseError";var Yl=class Yl extends Z{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=Yl.code,this.data={}}};l(Yl,"FastForwardError");var eo=Yl;eo.code="FastForwardError";var Zl=class Zl extends Z{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=Zl.code,this.data={prettyDetails:e,result:r}}};l(Zl,"GitPushError");var to=Zl;to.code="GitPushError";var Ql=class Ql extends Z{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=Ql.code,this.data={statusCode:e,statusMessage:r,response:i}}};l(Ql,"HttpError");var ls=Ql;ls.code="HttpError";var ef=class ef extends Z{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=ef.code,this.data={reason:e}}};l(ef,"InvalidFilepathError");var Vr=ef;Vr.code="InvalidFilepathError";var tf=class tf extends Z{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=tf.code,this.data={ref:e,suggestion:r}}};l(tf,"InvalidRefNameError");var Lt=tf;Lt.code="InvalidRefNameError";var rf=class rf extends Z{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=rf.code,this.data={depth:e}}};l(rf,"MaxDepthError");var ro=rf;ro.code="MaxDepthError";var nf=class nf extends Z{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=nf.code,this.data={}}};l(nf,"MergeNotSupportedError");var fs=nf;fs.code="MergeNotSupportedError";var sf=class sf extends Z{constructor(e,r,i,n){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=sf.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};l(sf,"MergeConflictError");var us=sf;us.code="MergeConflictError";var af=class af extends Z{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=af.code,this.data={role:e}}};l(af,"MissingNameError");var ze=af;ze.code="MissingNameError";var of=class of extends Z{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=of.code,this.data={parameter:e}}};l(of,"MissingParameterError");var tt=of;tt.code="MissingParameterError";var cf=class cf extends Z{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=cf.code,this.data={errors:e},this.errors=e}};l(cf,"MultipleGitError");var io=cf;io.code="MultipleGitError";var lf=class lf extends Z{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=lf.code,this.data={expected:e,actual:r}}};l(lf,"ParseError");var Ni=lf;Ni.code="ParseError";var ff=class ff extends Z{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=ff.code,this.data={reason:e}}};l(ff,"PushRejectedError");var hs=ff;hs.code="PushRejectedError";var uf=class uf extends Z{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=uf.code,this.data={capability:e,parameter:r}}};l(uf,"RemoteCapabilityError");var Wr=uf;Wr.code="RemoteCapabilityError";var hf=class hf extends Z{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=hf.code,this.data={preview:e,response:r}}};l(hf,"SmartHttpError");var no=hf;no.code="SmartHttpError";var df=class df extends Z{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=df.code,this.data={url:e,transport:r,suggestion:i}}};l(df,"UnknownTransportError");var so=df;so.code="UnknownTransportError";var pf=class pf extends Z{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=pf.code,this.data={url:e}}};l(pf,"UrlParseError");var ao=pf;ao.code="UrlParseError";var mf=class mf extends Z{constructor(){super("The operation was canceled."),this.code=this.name=mf.code,this.data={}}};l(mf,"UserCanceledError");var ds=mf;ds.code="UserCanceledError";var wf=class wf extends Z{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=wf.code,this.data={filepath:e}}};l(wf,"IndexResetError");var oo=wf;oo.code="IndexResetError";var yf=class yf extends Z{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=yf.code,this.data={ref:e}}};l(yf,"NoCommitError");var co=yf;co.code="NoCommitError";var TS=Object.freeze({__proto__:null,AlreadyExistsError:jt,AmbiguousError:Xa,CheckoutConflictError:Ya,CommitNotFetchedError:Za,EmptyServerResponseError:Qa,FastForwardError:eo,GitPushError:to,HttpError:ls,InternalError:W,InvalidFilepathError:Vr,InvalidOidError:zr,InvalidRefNameError:Lt,MaxDepthError:ro,MergeNotSupportedError:fs,MergeConflictError:us,MissingNameError:ze,MissingParameterError:tt,MultipleGitError:io,NoRefspecError:Ka,NotFoundError:oe,ObjectTypeError:Ye,ParseError:Ni,PushRejectedError:hs,RemoteCapabilityError:Wr,SmartHttpError:no,UnknownTransportError:so,UnsafeFilepathError:as,UrlParseError:ao,UserCanceledError:ds,UnmergedPathsError:Ga,IndexResetError:oo,NoCommitError:co});function Kp({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=l2(i),`${t} <${e}> ${r} ${i}`}l(Kp,"formatAuthor");function l2(t){let e=f2(u2(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}l(l2,"formatTimezoneOffset");function f2(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}l(f2,"simpleSign");function u2(t){return t===0?t:-t}l(u2,"negateExceptForZero");function vr(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
|
|
23
|
+
`,t}l(vr,"normalizeNewlines");function kl(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:h2(n)}}l(kl,"parseAuthor");function h2(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),d2(i)}l(h2,"parseTimezoneOffset");function d2(t){return t===0?t:-t}l(d2,"negateExceptForZero$1");var is=class is{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=is.render(e);else throw new W("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new is(e)}static render(e){return`object ${e.object}
|
|
24
|
+
type ${e.type}
|
|
25
|
+
tag ${e.tag}
|
|
26
|
+
tagger ${Kp(e.tagger)}
|
|
27
|
+
|
|
28
|
+
${e.message}
|
|
29
|
+
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
|
30
|
+
|
|
31
|
+
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
|
|
32
|
+
|
|
33
|
+
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
|
34
|
+
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
|
35
|
+
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=kl(i.tagger)),i.committer&&(i.committer=kl(i.committer)),i}withoutSignature(){let e=vr(this._tag);return e.indexOf(`
|
|
36
|
+
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
|
37
|
+
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
|
38
|
+
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return vr(e)}payload(){return this.withoutSignature()+`
|
|
39
|
+
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=vr(s);let a=n+s;return is.from(a)}};l(is,"GitAnnotatedTag");var dt=is;function $p(t){return t.trim().split(`
|
|
40
|
+
`).map(e=>" "+e).join(`
|
|
41
|
+
`)+`
|
|
42
|
+
`}l($p,"indent");function p2(t){return t.split(`
|
|
43
|
+
`).map(e=>e.replace(/^ /,"")).join(`
|
|
44
|
+
`)}l(p2,"outdent");var et=class et{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=et.render(e);else throw new W("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=et.justHeaders(e),n=et.justMessage(e),s=vr(i+`
|
|
45
|
+
gpgsig`+$p(r)+`
|
|
46
|
+
`+n);return new et(s)}static from(e){return new et(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return et.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return vr(e.slice(e.indexOf(`
|
|
47
|
+
|
|
48
|
+
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
|
49
|
+
|
|
50
|
+
`))}parseHeaders(){let e=et.justHeaders(this._commit).split(`
|
|
51
|
+
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
|
52
|
+
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=kl(i.author)),i.committer&&(i.committer=kl(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
|
|
53
|
+
`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
54
|
+
`,e.parent){if(e.parent.length===void 0)throw new W("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
|
|
55
|
+
`}let i=e.author;r+=`author ${Kp(i)}
|
|
56
|
+
`;let n=e.committer||e.author;return r+=`committer ${Kp(n)}
|
|
57
|
+
`,e.gpgsig&&(r+="gpgsig"+$p(e.gpgsig)),r}static render(e){return et.renderHeaders(e)+`
|
|
58
|
+
`+vr(e.message)}render(){return this._commit}withoutSignature(){let e=vr(this._commit);if(e.indexOf(`
|
|
59
|
+
gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
|
|
60
|
+
gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
|
61
|
+
`)+28);return vr(r+`
|
|
62
|
+
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return p2(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=et.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=vr(a);let o=et.justHeaders(e._commit)+`
|
|
63
|
+
gpgsig`+$p(a)+`
|
|
64
|
+
`+s;return et.from(o)}};l(et,"GitCommit");var it=et;async function ps({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:rt.from([]),oid:i};let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=dt.from(s).parse().object,ps({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=it.from(s).parse().tree,ps({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new Ye(i,n,"tree");return{tree:rt.from(s),oid:i}}l(ps,"resolveTree");var pm=class pm{constructor({fs:e,gitdir:r,ref:i,cache:n}){var a;this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let f=new Map,o;try{o=await $.resolve({fs:e,gitdir:r,ref:i})}catch(u){u instanceof oe&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let c=await ps({fs:e,cache:this.cache,gitdir:r,oid:o});return c.type="tree",c.mode="40000",f.set(".",c),f})();let s=this;this.ConstructEntry=(a=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}},l(a,"TreeEntry"),a)}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,f=a.get(r);if(!f)throw new Error(`No obj for ${r}`);let o=f.oid;if(!o)throw new Error(`No oid for obj ${JSON.stringify(f)}`);if(f.type!=="tree")return null;let{type:c,object:u}=await fe({fs:i,cache:n,gitdir:s,oid:o});if(c!==f.type)throw new Ye(o,c,f.type);let h=rt.from(u);for(let d of h)a.set(C.join(r,d.path),d);return h.entries().map(d=>C.join(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=gS(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,f=r.get(e._fullpath).oid,{type:o,object:c}=await fe({fs:i,cache:n,gitdir:s,oid:f});o!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};l(pm,"GitWalkerRepo");var Jp=pm;function ht({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,_f,{value:l(function({fs:r,gitdir:i,cache:n}){return new Jp({fs:r,gitdir:i,ref:t,cache:n})},"value")}),Object.freeze(e),e}l(ht,"TREE");var mm=class mm{constructor({fs:e,dir:r,gitdir:i,cache:n}){var a;this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=(a=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}},l(a,"WorkdirEntry"),a)}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(C.join(n,r));return s===null?null:s.map(a=>C.join(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=os(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let a=await(await this._getGitConfig(r,n)).get("core.autocrlf"),f=await r.read(`${i}/${e._fullpath}`,{autocrlf:a});e._actualSize=f.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(f)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await ge.acquire({fs:i,gitdir:n,cache:s},async function(f){let o=f.entriesMap.get(e._fullpath),c=await e.stat(),h=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;if(!o||Sl(c,o,h,d)){let p=await e.content();p===void 0?a=void 0:(a=await Er(Hr.wrap({type:"blob",object:p})),o&&a===o.oid&&(!h||c.mode===o.mode)&&Sl(c,o,h,d)&&f.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=o.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await me.get({fs:e,gitdir:r}),this.config)}};l(mm,"GitWalkerFs");var Xp=mm;function _s(){let t=Object.create(null);return Object.defineProperty(t,_f,{value:l(function({fs:e,dir:r,gitdir:i,cache:n}){return new Xp({fs:e,dir:r,gitdir:i,cache:n})},"value")}),Object.freeze(t),t}l(_s,"WORKDIR");function m2(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}l(m2,"arrayRange");var RS=typeof Array.prototype.flat>"u"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),wm=class wm{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};l(wm,"RunningMinimum");var Yp=wm;function*w2(t){let e=new Yp,r,i=[],n=t.length;for(let s=0;s<n;s++)i[s]=t[s].next().value,i[s]!==void 0&&e.consider(i[s]);if(e.value!==null)for(;;){let s=[];r=e.value,e.reset();for(let a=0;a<n;a++)i[a]!==void 0&&i[a]===r?(s[a]=i[a],i[a]=t[a].next().value):s[a]=null,i[a]!==void 0&&e.consider(i[a]);if(yield s,e.value===null)return}}l(w2,"unionOfIterators");async function Gr({fs:t,cache:e,dir:r,gitdir:i,trees:n,map:s=l(async(o,c)=>c,"map"),reduce:a=l(async(o,c)=>{let u=RS(c);return o!==void 0&&u.unshift(o),u},"reduce"),iterate:f=l((o,c)=>Promise.all([...c].map(o)),"iterate")}){let o=n.map(p=>p[_f]({fs:t,dir:r,gitdir:i,cache:e})),c=new Array(o.length).fill("."),u=m2(0,o.length),h=l(async p=>{u.map(y=>{let g=p[y];p[y]=g&&new o[y].ConstructEntry(g)});let w=(await Promise.all(u.map(y=>{let g=p[y];return g?o[y].readdir(g):[]}))).map(y=>(y===null?[]:y)[Symbol.iterator]());return{entries:p,children:w2(w)}},"unionWalkerFromReaddir"),d=l(async p=>{let{entries:m,children:w}=await h(p),y=m.find(_=>_&&_._fullpath)._fullpath,g=await s(y,m);if(g!==null){let _=await f(d,w);return _=_.filter(F=>F!==void 0),a(g,_)}},"walk");return d(c)}l(Gr,"_walk");async function Zp(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(i=>{let n=C.join(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?Zp(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}l(Zp,"rmRecursive");function y2(t){return g2(t)&&iS(t.then)&&iS(t.catch)}l(y2,"isPromiseLike");function g2(t){return t&&typeof t=="object"}l(g2,"isObject");function iS(t){return typeof t=="function"}l(iS,"isFunction");function nS(t){return y2(l(r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}},"test")(t))}l(nS,"isPromiseFs");var sS=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function aS(t,e){if(nS(e))for(let r of sS)t[`_${r}`]=e[r].bind(e);else for(let r of sS)t[`_${r}`]=Ap(e[r].bind(e));nS(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Zp.bind(null,t):e.rm?t._rm=Ap(e.rm.bind(e)):e.rmdir.length>2?t._rm=Ap(e.rmdir.bind(e)):t._rm=Zp.bind(null,t)}l(aS,"bindFs");var ym=class ym{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?aS(this,e.promises):aS(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(i){if(i.code==="ENOENT"||i.code==="ENOTDIR"||(i.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',i),i}}async read(e,r={}){try{let i=await this._readFile(e,r);if(r.autocrlf==="true")try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,`
|
|
65
|
+
`),i=new TextEncoder().encode(i)}catch{}return typeof i!="string"&&(i=Buffer.from(i)),i}catch{return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i);return}catch{await this.mkdir(cs(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e);return}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=cs(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(bf),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};l(ym,"FileSystem");var M=ym;function S(t,e){if(e===void 0)throw new tt(t)}l(S,"assertParameter");async function xl(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}l(xl,"modified");async function OS({fs:t,dir:e,gitdir:r=C.join(e,".git"),commit:i="HEAD",cache:n={}}){try{S("fs",t),S("dir",e),S("gitdir",r);let s=new M(t),a=[ht({ref:i}),_s(),Ii()],f=[];await ge.acquire({fs:s,gitdir:r,cache:n},async function(c){f=c.unmergedPaths});let o=await Gr({fs:s,cache:n,dir:e,gitdir:r,trees:a,map:l(async function(c,[u,h,d]){let p=!await xl(h,d),m=f.includes(c),w=!await xl(d,u);if(p||m)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(w)return!1;throw new oo(c)},"map")});await ge.acquire({fs:s,gitdir:r,cache:n},async function(c){for(let u of o)if(u!==!1){if(!u){await s.rmdir(`${e}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let h=new TextDecoder().decode(u.content);await s.write(`${e}/${u.path}`,h,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}l(OS,"abortMerge");var gm=class gm{static async isIgnored({fs:e,dir:r,gitdir:i=C.join(r,".git"),filepath:n}){if(Fl(n)===".git")return!0;if(n===".")return!1;let s="",a=C.join(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let f=[{gitignore:C.join(r,".gitignore"),filepath:n}],o=n.split("/").filter(Boolean);for(let u=1;u<o.length;u++){let h=o.slice(0,u).join("/"),d=o.slice(u).join("/");f.push({gitignore:C.join(r,h,".gitignore"),filepath:d})}let c=!1;for(let u of f){let h;try{h=await e.read(u.gitignore,"utf8")}catch(m){if(m.code==="NOENT")continue}let d=FI().add(s);d.add(h);let p=cs(u.filepath);if(p!=="."&&d.ignores(p))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};l(gm,"GitIgnoreManager");var Kr=gm;async function b2({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new W("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}l(b2,"writeObjectLoose");var Bp=null;async function kS(t){return Bp===null&&(Bp=v2()),Bp?_2(t):tm.deflate(t)}l(kS,"deflate");async function _2(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}l(_2,"browserDeflate");function v2(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}l(v2,"testCompressionStream");async function nt({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=Hr.wrap({type:r,object:i})),s=await Er(i),i=Buffer.from(await kS(i))),a||await b2({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}l(nt,"_writeObject");function xS(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}l(xS,"posixifyPathBuffer");async function AS({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{S("fs",t),S("dir",e),S("gitdir",r),S("filepath",i);let f=new M(t);await ge.acquire({fs:f,gitdir:r,cache:n},async o=>{let u=await(await me.get({fs:f,gitdir:r})).get("core.autocrlf");return Qp({dir:e,gitdir:r,fs:f,filepath:i,index:o,force:s,parallel:a,autocrlf:u})})}catch(f){throw f.caller="git.add",f}}l(AS,"add");async function Qp({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:a,autocrlf:f}){i=Array.isArray(i)?i:[i];let o=i.map(async d=>{if(!s&&await Kr.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let p=await r.lstat(C.join(t,d));if(!p)throw new oe(d);if(p.isDirectory()){let m=await r.readdir(C.join(t,d));if(a){let w=m.map(y=>Qp({dir:t,gitdir:e,fs:r,filepath:[C.join(d,y)],index:n,force:s,parallel:a,autocrlf:f}));await Promise.all(w)}else for(let w of m)await Qp({dir:t,gitdir:e,fs:r,filepath:[C.join(d,w)],index:n,force:s,parallel:a,autocrlf:f})}else{let m=p.isSymbolicLink()?await r.readlink(C.join(t,d)).then(xS):await r.read(C.join(t,d),{autocrlf:f});if(m===null)throw new oe(d);let w=await nt({fs:r,gitdir:e,type:"blob",object:m});n.insert({filepath:d,stats:p,oid:w})}}),c=await Promise.allSettled(o),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new io(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}l(Qp,"addToIndex");async function lo({fs:t,gitdir:e,path:r}){return(await me.get({fs:t,gitdir:e})).get(r)}l(lo,"_getConfig");function PS(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}l(PS,"assignDefined");async function Jr({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await lo({fs:t,gitdir:e,path:"user.name"}),email:await lo({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},a=PS({},s,i?i.author:void 0,r);if(a.name!==void 0)return a}l(Jr,"normalizeAuthorObject");async function ms({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),a={name:await lo({fs:t,gitdir:e,path:"user.name"}),email:await lo({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},f=PS({},a,n?n.committer:void 0,r,i);if(f.name!==void 0)return f}l(ms,"normalizeCommitterObject");async function NS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=dt.from(s).parse().object,NS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new Ye(i,n,"commit");return{commit:it.from(s),oid:i}}l(NS,"resolveCommit");async function ws({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await NS({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}l(ws,"_readCommit");async function vf({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:a,signingKey:f,amend:o=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:h,parent:d,tree:p}){let m=!1;h||(h=await $.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let w,y;try{w=await $.resolve({fs:t,gitdir:i,ref:h}),y=await ws({fs:t,gitdir:i,oid:w,cache:{}})}catch{m=!0}if(o&&m)throw new co(h);let g=o?await Jr({fs:t,gitdir:i,author:s,commit:y.commit}):await Jr({fs:t,gitdir:i,author:s});if(!g)throw new ze("author");let _=o?await ms({fs:t,gitdir:i,author:g,committer:a,commit:y.commit}):await ms({fs:t,gitdir:i,author:g,committer:a});if(!_)throw new ze("committer");return ge.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(F){let k=_S(F.entries).get(".");if(p||(p=await DS({fs:t,gitdir:i,inode:k,dryRun:c})),d?d=await Promise.all(d.map(O=>$.resolve({fs:t,gitdir:i,ref:O}))):o?d=y.commit.parent:d=w?[w]:[],!n)if(o)n=y.commit.message;else throw new tt("message");let D=it.from({tree:p,parent:d,author:g,committer:_,message:n});f&&(D=await it.sign(D,r,f));let v=await nt({fs:t,gitdir:i,type:"commit",object:D.toObject(),dryRun:c});return!u&&!c&&await $.writeRef({fs:t,gitdir:i,ref:h,value:v}),v})}l(vf,"_commit");async function DS({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let o of n)o.type==="tree"&&(o.metadata.mode="040000",o.metadata.oid=await DS({fs:t,gitdir:e,inode:o,dryRun:i}));let s=n.map(o=>({mode:o.metadata.mode,path:o.basename,oid:o.metadata.oid,type:o.type})),a=rt.from(s);return await nt({fs:t,gitdir:e,type:"tree",object:a.toObject(),dryRun:i})}l(DS,"constructTree");async function fo({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new Vr("leading-slash");if(n.endsWith("/"))throw new Vr("trailing-slash");let s=i,a=await ps({fs:t,cache:e,gitdir:r,oid:i}),f=a.tree;if(n==="")i=a.oid;else{let o=n.split("/");i=await CS({fs:t,cache:e,gitdir:r,tree:f,pathArray:o,oid:s,filepath:n})}return i}l(fo,"resolveFilepath");async function CS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a}){let f=n.shift();for(let o of i)if(o.path===f){if(n.length===0)return o.oid;{let{type:c,object:u}=await fe({fs:t,cache:e,gitdir:r,oid:o.oid});if(c!=="tree")throw new Ye(s,c,"tree",a);return i=rt.from(u),CS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a})}}throw new oe(`file or directory found at "${s}:${a}"`)}l(CS,"_resolveFilepath");async function vs({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await fo({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:a}=await ps({fs:t,cache:e,gitdir:r,oid:i});return{oid:a,tree:s.entries()}}l(vs,"_readTree");async function uo({fs:t,gitdir:e,tree:r}){let i=rt.from(r).toObject();return await nt({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}l(uo,"_writeTree");async function E2({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:a,force:f,author:o,committer:c,signingKey:u}){let h;try{h=await $.resolve({gitdir:i,fs:t,ref:n})}catch(g){if(!(g instanceof oe))throw g}let p=(await vs({fs:t,cache:e,gitdir:i,oid:h||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(f)p=p.filter(g=>g.path!==s);else for(let g of p)if(g.path===s)throw new jt("note",s);typeof a=="string"&&(a=Buffer.from(a,"utf8"));let m=await nt({fs:t,gitdir:i,type:"blob",object:a,format:"content"});p.push({mode:"100644",path:s,oid:m,type:"blob"});let w=await uo({fs:t,gitdir:i,tree:p});return await vf({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:w,parent:h&&[h],message:`Note added by 'isomorphic-git addNote'
|
|
66
|
+
`,author:o,committer:c,signingKey:u})}l(E2,"_addNote");async function IS({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:f,author:o,committer:c,signingKey:u,cache:h={}}){try{S("fs",t),S("gitdir",i),S("oid",s),S("note",a),u&&S("onSign",e);let d=new M(t),p=await Jr({fs:d,gitdir:i,author:o});if(!p)throw new ze("author");let m=await ms({fs:d,gitdir:i,author:p,committer:c});if(!m)throw new ze("committer");return await E2({fs:new M(d),cache:h,onSign:e,gitdir:i,ref:n,oid:s,note:a,force:f,author:p,committer:m,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}l(IS,"addNote");async function $S({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!Va(r,!0))throw new Lt(r,Ha.clean(r));let s=await me.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new jt("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await me.save({fs:t,gitdir:e,config:s})}l($S,"_addRemote");async function BS({fs:t,dir:e,gitdir:r=C.join(e,".git"),remote:i,url:n,force:s=!1}){try{return S("fs",t),S("gitdir",r),S("remote",i),S("url",n),await $S({fs:new M(t),gitdir:r,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}l(BS,"addRemote");async function S2({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:f,object:o,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await $.exists({fs:t,gitdir:i,ref:n}))throw new jt("tag",n);let h=await $.resolve({fs:t,gitdir:i,ref:o||"HEAD"}),{type:d}=await fe({fs:t,cache:e,gitdir:i,oid:h}),p=dt.from({object:h,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:f});c&&(p=await dt.sign(p,r,c));let m=await nt({fs:t,gitdir:i,type:"tag",object:p.toObject()});await $.writeRef({fs:t,gitdir:i,ref:n,value:m})}l(S2,"_annotatedTag");async function MS({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:f,object:o,signingKey:c,force:u=!1,cache:h={}}){try{S("fs",t),S("gitdir",i),S("ref",n),c&&S("onSign",e);let d=new M(t),p=await Jr({fs:d,gitdir:i,author:s});if(!p)throw new ze("tagger");return await S2({fs:d,cache:h,onSign:e,gitdir:i,ref:n,tagger:p,message:a,gpgsig:f,object:o,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}l(MS,"annotatedTag");async function F2({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!Va(r,!0))throw new Lt(r,Ha.clean(r));let a=`refs/heads/${r}`;if(!s&&await $.exists({fs:t,gitdir:e,ref:a}))throw new jt("branch",r,!1);let f;try{f=await $.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch{}f&&await $.writeRef({fs:t,gitdir:e,ref:a,value:f}),n&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}l(F2,"_branch");async function jS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{return S("fs",t),S("gitdir",r),S("ref",i),await F2({fs:new M(t),gitdir:r,ref:i,object:n,checkout:s,force:a})}catch(f){throw f.caller="git.branch",f}}l(jS,"branch");var LS=l((t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e),"worthWalking");async function im({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:f,filepaths:o,noCheckout:c,noUpdateHead:u,dryRun:h,force:d,track:p=!0,nonBlocking:m=!1,batchSize:w=100}){let y;if(i)try{y=await $.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch{y="0000000000000000000000000000000000000000"}let g;try{g=await $.resolve({fs:t,gitdir:s,ref:f})}catch(_){if(f==="HEAD")throw _;let F=`${a}/${f}`;if(g=await $.resolve({fs:t,gitdir:s,ref:F}),p){let R=await me.get({fs:t,gitdir:s});await R.set(`branch.${f}.remote`,a),await R.set(`branch.${f}.merge`,`refs/heads/${f}`),await me.save({fs:t,gitdir:s,config:R})}await $.writeRef({fs:t,gitdir:s,ref:`refs/heads/${f}`,value:g})}if(!c){let _;try{_=await T2({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:f,force:d,filepaths:o})}catch(v){throw v instanceof oe&&v.data.what===g?new Za(f,g):v}let F=_.filter(([v])=>v==="conflict").map(([v,O])=>O);if(F.length>0)throw new Ya(F);let R=_.filter(([v])=>v==="error").map(([v,O])=>O);if(R.length>0)throw new W(R.join(", "));if(h){i&&await i({previousHead:y,newHead:g,type:o!=null&&o.length>0?"file":"branch"});return}let k=0,D=_.length;if(await ge.acquire({fs:t,gitdir:s,cache:e},async function(v){await Promise.all(_.filter(([O])=>O==="delete"||O==="delete-index").map(async function([O,E]){let N=`${n}/${E}`;O==="delete"&&await t.rm(N),v.delete({filepath:E}),r&&await r({phase:"Updating workdir",loaded:++k,total:D})}))}),await ge.acquire({fs:t,gitdir:s,cache:e},async function(v){for(let[O,E]of _)if(O==="rmdir"||O==="rmdir-index"){let N=`${n}/${E}`;try{O==="rmdir"&&await t.rmdir(N),v.delete({filepath:E}),r&&await r({phase:"Updating workdir",loaded:++k,total:D})}catch(x){if(x.code==="ENOTEMPTY")console.log(`Did not delete ${E} because directory is not empty`);else throw x}}}),await Promise.all(_.filter(([v])=>v==="mkdir"||v==="mkdir-index").map(async function([v,O]){let E=`${n}/${O}`;await t.mkdir(E),r&&await r({phase:"Updating workdir",loaded:++k,total:D})})),m){let v=_.filter(([E])=>E==="create"||E==="create-index"||E==="update"||E==="mkdir-index"),O=await oS("Update Working Dir",v.map(([E,N,x,I,q])=>()=>O2({fs:t,cache:e,gitdir:s,dir:n},[E,N,x,I,q])),r,w);await ge.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(E){await oS("Update Index",O.map(([N,x,I])=>()=>R2({index:E,fullpath:N,oid:x,stats:I})),r,w)})}else await ge.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await Promise.all(_.filter(([O])=>O==="create"||O==="create-index"||O==="update"||O==="mkdir-index").map(async function([O,E,N,x,I]){let q=`${n}/${E}`;try{if(O!=="create-index"&&O!=="mkdir-index"){let{object:be}=await fe({fs:t,cache:e,gitdir:s,oid:N});if(I&&await t.rm(q),x===33188)await t.write(q,be);else if(x===33261)await t.write(q,be,{mode:511});else if(x===40960)await t.writelink(q,be);else throw new W(`Invalid mode 0o${x.toString(8)} detected in blob ${N}`)}let z=await t.lstat(q);x===33261&&(z.mode=493),O==="mkdir-index"&&(z.mode=57344),v.insert({filepath:E,stats:z,oid:N}),r&&await r({phase:"Updating workdir",loaded:++k,total:D})}catch(z){console.log(z)}}))});i&&await i({previousHead:y,newHead:g,type:o!=null&&o.length>0?"file":"branch"})}if(!u){let _=await $.expand({fs:t,gitdir:s,ref:f});_.startsWith("refs/heads")?await $.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:_}):await $.writeRef({fs:t,gitdir:s,ref:"HEAD",value:g})}}l(im,"_checkout");async function T2({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:a,filepaths:f}){let o=0;return Gr({fs:t,cache:e,dir:i,gitdir:n,trees:[ht({ref:s}),_s(),Ii()],map:l(async function(c,[u,h,d]){if(c===".")return;if(f&&!f.some(m=>LS(c,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++o}),[!!d,!!u,!!h].map(Number).join("")){case"000":return;case"001":return a&&f&&f.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await h.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await h.oid()?a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",c]:await u.mode()!==await h.mode()?a?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir-index",c];case"blob":return await d.oid()!==await h.oid()?a?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!a)return;if(h){if(await h.oid()!==await d.oid()&&await h.oid()!==await u.oid())return a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()]:["conflict",c]}else if(a)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},"map"),reduce:l(async function(c,u){return u=RS(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u},"reduce")})}l(T2,"analyze");async function R2({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}l(R2,"updateIndex");async function O2({fs:t,cache:e,gitdir:r,dir:i},[n,s,a,f,o]){let c=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:h}=await fe({fs:t,cache:e,gitdir:r,oid:a});if(o&&await t.rm(c),f===33188)await t.write(c,h);else if(f===33261)await t.write(c,h,{mode:511});else if(f===40960)await t.writelink(c,h);else throw new W(`Invalid mode 0o${f.toString(8)} detected in blob ${a}`)}let u=await t.lstat(c);return f===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,a,u]}l(O2,"updateWorkingDir");async function oS(t,e,r,i){let n=[];try{for(let s=0;s<e.length;s+=i){let a=e.slice(s,s+i).map(o=>o());(await Promise.allSettled(a)).forEach(o=>{o.status==="fulfilled"&&n.push(o.value)}),r&&await r({phase:"Updating workdir",loaded:s+a.length,total:e.length})}return n}catch(s){console.error(`Error during ${t}: ${s}`)}return n}l(oS,"batchAllSettled");async function nm({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=C.join(i,".git"),remote:s="origin",ref:a,filepaths:f,noCheckout:o=!1,noUpdateHead:c=a===void 0,dryRun:u=!1,force:h=!1,track:d=!0,cache:p={},nonBlocking:m=!1,batchSize:w=100}){try{S("fs",t),S("dir",i),S("gitdir",n);let y=a||"HEAD";return await im({fs:new M(t),cache:p,onProgress:e,onPostCheckout:r,dir:i,gitdir:n,remote:s,ref:y,filepaths:f,noCheckout:o,noUpdateHead:c,dryRun:u,force:h,track:d,nonBlocking:m,batchSize:w})}catch(y){throw y.caller="git.checkout",y}}l(nm,"checkout");var k2=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Pi(t){let e=k2.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}l(Pi,"abbreviateRef");async function Xr({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await $.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await $.resolve({fs:t,gitdir:e,ref:n})}catch{return}if(n.startsWith("refs/"))return r?n:Pi(n)}l(Xr,"_currentBranch");function x2(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}l(x2,"translateSSHtoHTTP");function qS({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}l(qS,"calculateBasicAuthHeader");async function ho(t,e){let r=SS(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(ho,"forAwait");async function Al(t){let e=0,r=[];await ho(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}l(Al,"collect");function cS(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}l(cS,"extractAuthFromUrl");function em(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}l(em,"padHex");var bm=class bm{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let r=e.length+4,i=em(4,r);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){let r=new Ol(e);return l(async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s??!0}catch(n){return e.error=n,!0}},"read")}};l(bm,"GitPktLine");var pe=bm;async function lS(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}l(lS,"parseCapabilitiesV2");async function fS(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=pe.streamReader(t),a=await s();for(;a===null;)a=await s();if(a===!0)throw new Qa;if(a.includes("version 2"))return lS(s);if(a.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Ni(`# service=${e}\\n`,a.toString("utf8"));let f=await s();for(;f===null;)f=await s();if(f===!0)return{capabilities:r,refs:i,symrefs:n};if(f=f.toString("utf8"),f.includes("version 2"))return lS(s);let[o,c]=Mp(f,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),o!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,h]=Mp(o," "," ");for(i.set(h,u);;){let d=await s();if(d===!0)break;if(d!==null){let[p,m]=Mp(d.toString("utf8")," "," ");i.set(m,p)}}}for(let u of r)if(u.startsWith("symref=")){let h=u.match(/symref=([^:]+):(.*)/);h.length===3&&n.set(h[1],h[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}l(fS,"parseRefsAdResponse");function Mp(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new Ni(`Two strings separated by '${r}'`,t.toString("utf8"));return i}l(Mp,"splitAndAssert");var uS=l((t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,"corsProxify"),hS=l((t,e)=>{(e.username||e.password)&&(t.Authorization=qS(e)),e.headers&&Object.assign(t,e.headers)},"updateHeaders"),jp=l(async t=>{try{let e=Buffer.from(await Al(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch{return{}}},"stringifyBody"),_m=class _m{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:a,service:f,url:o,headers:c,protocolVersion:u}){let{url:h,auth:d}=cS(o),p=a?uS(a,h):h;(d.username||d.password)&&(c.Authorization=qS(d)),u===2&&(c["Git-Protocol"]="version=2");let m,w,y=!1;do if(m=await e.request({onProgress:r,method:"GET",url:`${p}/info/refs?service=${f}`,headers:c}),w=!1,m.statusCode===401||m.statusCode===203){let g=y?s:i;if(g){if(d=await g(h,{...d,headers:{...c}}),d&&d.cancel)throw new ds;d&&(hS(c,d),y=!0,w=!0)}}else m.statusCode===200&&y&&n&&await n(h,d);while(w);if(m.statusCode!==200){let{response:g}=await jp(m);throw new ls(m.statusCode,m.statusMessage,g)}if(m.headers["content-type"]===`application/x-${f}-advertisement`){let g=await fS(m.body,{service:f});return g.auth=d,g}else{let{preview:g,response:_,data:F}=await jp(m);try{let R=await fS([F],{service:f});return R.auth=d,R}catch{throw new no(g,_)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:a,body:f,headers:o}){let c=cS(s);c&&(s=c.url),i&&(s=uS(i,s)),o["content-type"]=`application/x-${n}-request`,o.accept=`application/x-${n}-result`,hS(o,a);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:f,headers:o});if(u.statusCode!==200){let{response:h}=jp(u);throw new ls(u.statusCode,u.statusMessage,h)}return u}};l(_m,"GitRemoteHTTP");var ys=_m,vm=class vm{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",ys),r.set("https",ys);let i=A2({url:e});if(!i)throw new ao(e);if(r.has(i.transport))return r.get(i.transport);throw new so(e,i.transport,i.transport==="ssh"?x2(e):void 0)}};l(vm,"GitRemoteManager");var gs=vm;function A2({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}l(A2,"parseRemoteUrl");var Ai=null,Em=class Em{static async read({fs:e,gitdir:r}){Ai===null&&(Ai=new za);let i=C.join(r,"shallow"),n=new Set;return await Ai.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(`
|
|
67
|
+
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){Ai===null&&(Ai=new za);let n=C.join(r,"shallow");if(i.size>0){let s=[...i].join(`
|
|
68
|
+
`)+`
|
|
69
|
+
`;await Ai.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await Ai.acquire(n,async function(){await e.rm(n)})}};l(Em,"GitShallowManager");var Di=Em;async function P2({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}l(P2,"hasObjectLoose");async function N2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(C.join(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let f=`${r}/objects/pack/${a}`,o=await rm({fs:t,cache:e,filename:f,getExternalRefDelta:n});if(o.error)throw new W(o.error);if(o.offsets.has(i))return!0}return!1}l(N2,"hasObjectPacked");async function dS({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=l(f=>fe({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),a=await P2({fs:t,gitdir:r,oid:i});return a||(a=await N2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}l(dS,"hasObject");function D2(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}l(D2,"emptyPackfile");function US(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}l(US,"filterCapabilities");var Ef={name:"isomorphic-git",version:"1.34.0",agent:"git/isomorphic-git@1.34.0"},Sm=class Sm{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};l(Sm,"FIFO");var ss=Sm;function C2(t){let e=t.indexOf("\r"),r=t.indexOf(`
|
|
70
|
+
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}l(C2,"findSplit");function WS(t){let e=new ss,r="";return(async()=>(await ho(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=C2(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}l(WS,"splitLines");var Fm=class Fm{static demux(e){let r=pe.streamReader(e),i=new ss,n=new ss,s=new ss,a=l(async function(){let f=await r();if(f===null)return a();if(f===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(f[0]){case 1:{n.write(f.slice(1));break}case 2:{s.write(f.slice(1));break}case 3:{let o=f.slice(1);s.write(o),i.end(),s.end(),n.destroy(new Error(o.toString("utf8")));return}default:i.write(f)}a()},"nextBit");return a(),{packetlines:i,packfile:n,progress:s}}};l(Fm,"GitSideBand");var Pl=Fm;async function I2(t){let{packetlines:e,packfile:r,progress:i}=Pl.demux(t),n=[],s=[],a=[],f=!1,o=!1;return new Promise((c,u)=>{ho(e,h=>{let d=h.toString("utf8").trim();if(d.startsWith("shallow")){let p=d.slice(-41).trim();p.length!==40&&u(new zr(p)),n.push(p)}else if(d.startsWith("unshallow")){let p=d.slice(-41).trim();p.length!==40&&u(new zr(p)),s.push(p)}else if(d.startsWith("ACK")){let[,p,m]=d.split(" ");a.push({oid:p,status:m}),m||(o=!0)}else d.startsWith("NAK")?(f=!0,o=!0):(o=!0,f=!0);o&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:f,packfile:r,progress:i}))}).finally(()=>{o||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:f,packfile:r,progress:i}))})})}l(I2,"parseUploadPackResponse");function $2({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let f=[];e=[...new Set(e)];let o=` ${t.join(" ")}`;for(let c of e)f.push(pe.encode(`want ${c}${o}
|
|
71
|
+
`)),o="";for(let c of i)f.push(pe.encode(`shallow ${c}
|
|
72
|
+
`));n!==null&&f.push(pe.encode(`deepen ${n}
|
|
73
|
+
`)),s!==null&&f.push(pe.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
|
|
74
|
+
`));for(let c of a)f.push(pe.encode(`deepen-not ${c}
|
|
75
|
+
`));f.push(pe.flush());for(let c of r)f.push(pe.encode(`have ${c}
|
|
76
|
+
`));return f.push(pe.encode(`done
|
|
77
|
+
`)),f}l($2,"writeUploadPackRequest");async function sm({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,gitdir:o,ref:c,remoteRef:u,remote:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:g=!1,tags:_=!1,singleBranch:F=!1,headers:R={},prune:k=!1,pruneTags:D=!1}){let v=c||await Xr({fs:t,gitdir:o,test:!0}),O=await me.get({fs:t,gitdir:o}),E=h||v&&await O.get(`branch.${v}.remote`)||"origin",N=d||await O.get(`remote.${E}.url`);if(typeof N>"u")throw new tt("remote OR url");let x=u||v&&await O.get(`branch.${v}.merge`)||c||"HEAD";p===void 0&&(p=await O.get("http.corsProxy"));let I=gs.getRemoteHelperFor({url:N}),q=await I.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:f,corsProxy:p,service:"git-upload-pack",url:N,headers:R,protocolVersion:1}),z=q.auth,be=q.refs;if(be.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!q.capabilities.has("shallow"))throw new Wr("shallow","depth");if(w!==null&&!q.capabilities.has("deepen-since"))throw new Wr("deepen-since","since");if(y.length>0&&!q.capabilities.has("deepen-not"))throw new Wr("deepen-not","exclude");if(g===!0&&!q.capabilities.has("deepen-relative"))throw new Wr("deepen-relative","relative");let{oid:Vt,fullref:yt}=$.resolveAgainstMap({ref:x,map:be});for(let ae of be.keys())ae===yt||ae==="HEAD"||ae.startsWith("refs/heads/")||_&&ae.startsWith("refs/tags/")||be.delete(ae);let Dt=US([...q.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ef.agent}`]);g&&Dt.push("deepen-relative");let Yu=F?[Vt]:be.values(),Zu=F?[v]:await $.listRefs({fs:t,gitdir:o,filepath:"refs"}),at=[];for(let ae of Zu)try{ae=await $.expand({fs:t,gitdir:o,ref:ae});let Ie=await $.resolve({fs:t,gitdir:o,ref:ae});await dS({fs:t,cache:e,gitdir:o,oid:Ie})&&at.push(Ie)}catch{}at=[...new Set(at)];let de=await Di.read({fs:t,gitdir:o}),Gt=q.capabilities.has("shallow")?[...de]:[],Le=$2({capabilities:Dt,wants:Yu,haves:at,shallows:Gt,depth:m,since:w,exclude:y}),Ys=Buffer.from(await Al(Le)),ui=await I.connect({http:r,onProgress:i,corsProxy:p,service:"git-upload-pack",url:N,auth:z,body:[Ys],headers:R}),Te=await I2(ui.body);ui.headers&&(Te.headers=ui.headers);for(let ae of Te.shallows)if(!de.has(ae))try{let{object:Ie}=await fe({fs:t,cache:e,gitdir:o,oid:ae}),gt=new it(Ie),Kt=await Promise.all(gt.headers().parent.map(Qs=>dS({fs:t,cache:e,gitdir:o,oid:Qs})));Kt.length===0||Kt.every(Qs=>Qs)||de.add(ae)}catch{de.add(ae)}for(let ae of Te.unshallows)de.delete(ae);if(await Di.write({fs:t,gitdir:o,oids:de}),F){let ae=new Map([[yt,Vt]]),Ie=new Map,gt=10,Kt=yt;for(;gt--;){let eh=q.symrefs.get(Kt);if(eh===void 0)break;Ie.set(Kt,eh),Kt=eh}let Qu=be.get(Kt);Qu&&ae.set(Kt,Qu);let{pruned:Qs}=await $.updateRemoteRefs({fs:t,gitdir:o,remote:E,refs:ae,symrefs:Ie,tags:_,prune:k});k&&(Te.pruned=Qs)}else{let{pruned:ae}=await $.updateRemoteRefs({fs:t,gitdir:o,remote:E,refs:be,symrefs:q.symrefs,tags:_,prune:k,pruneTags:D});k&&(Te.pruned=ae)}if(Te.HEAD=q.symrefs.get("HEAD"),Te.HEAD===void 0){let{oid:ae}=$.resolveAgainstMap({ref:"HEAD",map:be});for(let[Ie,gt]of be.entries())if(Ie!=="HEAD"&>===ae){Te.HEAD=Ie;break}}let EO=yt.startsWith("refs/tags")?"tag":"branch";if(Te.FETCH_HEAD={oid:Vt,description:`${EO} '${Pi(yt)}' of ${N}`},i||n){let ae=WS(Te.progress);ho(ae,async Ie=>{if(n&&await n(Ie),i){let gt=Ie.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);gt&&await i({phase:gt[1].trim(),loaded:parseInt(gt[2],10),total:parseInt(gt[3],10)})}})}let Co=Buffer.from(await Al(Te.packfile));if(ui.body.error)throw ui.body.error;let ly=Co.slice(-20).toString("hex"),Zs={defaultBranch:Te.HEAD,fetchHead:Te.FETCH_HEAD.oid,fetchHeadDescription:Te.FETCH_HEAD.description};if(Te.headers&&(Zs.headers=Te.headers),k&&(Zs.pruned=Te.pruned),ly!==""&&!D2(Co)){Zs.packfile=`objects/pack/pack-${ly}.pack`;let ae=C.join(o,Zs.packfile);await t.write(ae,Co);let Ie=l(Kt=>fe({fs:t,cache:e,gitdir:o,oid:Kt}),"getExternalRefDelta"),gt=await Ja.fromPack({pack:Co,getExternalRefDelta:Ie,onProgress:i});await t.write(ae.replace(/\.pack$/,".idx"),await gt.toBuffer())}return Zs}l(sm,"_fetch");async function zS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C.join(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
|
|
78
|
+
repositoryformatversion = 0
|
|
79
|
+
filemode = false
|
|
80
|
+
bare = ${e}
|
|
81
|
+
`+(e?"":` logallrefupdates = true
|
|
82
|
+
`)+` symlinks = false
|
|
83
|
+
ignorecase = true
|
|
84
|
+
`),await t.write(i+"/HEAD",`ref: refs/heads/${n}
|
|
85
|
+
`)}l(zS,"_init");async function B2({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,onPostCheckout:o,dir:c,gitdir:u,url:h,corsProxy:d,ref:p,remote:m,depth:w,since:y,exclude:g,relative:_,singleBranch:F,noCheckout:R,noTags:k,headers:D,nonBlocking:v,batchSize:O=100}){try{if(await zS({fs:t,gitdir:u}),await $S({fs:t,gitdir:u,remote:m,url:h,force:!1}),d){let x=await me.get({fs:t,gitdir:u});await x.set("http.corsProxy",d),await me.save({fs:t,gitdir:u,config:x})}let{defaultBranch:E,fetchHead:N}=await sm({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,gitdir:u,ref:p,remote:m,corsProxy:d,depth:w,since:y,exclude:g,relative:_,singleBranch:F,headers:D,tags:!k});if(N===null)return;p=p||E,p=p.replace("refs/heads/",""),await im({fs:t,cache:e,onProgress:i,onPostCheckout:o,dir:c,gitdir:u,ref:p,remote:m,noCheckout:R,nonBlocking:v,batchSize:O})}catch(E){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),E}}l(B2,"_clone");async function HS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:f,dir:o,gitdir:c=C.join(o,".git"),url:u,corsProxy:h=void 0,ref:d=void 0,remote:p="origin",depth:m=void 0,since:w=void 0,exclude:y=[],relative:g=!1,singleBranch:_=!1,noCheckout:F=!1,noTags:R=!1,headers:k={},cache:D={},nonBlocking:v=!1,batchSize:O=100}){try{return S("fs",t),S("http",e),S("gitdir",c),F||S("dir",o),S("url",u),await B2({fs:new M(t),cache:D,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:f,dir:o,gitdir:c,url:u,corsProxy:h,ref:d,remote:p,depth:m,since:w,exclude:y,relative:g,singleBranch:_,noCheckout:F,noTags:R,headers:k,nonBlocking:v,batchSize:O})}catch(E){throw E.caller="git.clone",E}}l(HS,"clone");async function VS({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),message:n,author:s,committer:a,signingKey:f,amend:o=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:h,parent:d,tree:p,cache:m={}}){try{S("fs",t),o||S("message",n),f&&S("onSign",e);let w=new M(t);return await vf({fs:w,cache:m,onSign:e,gitdir:i,message:n,author:s,committer:a,signingKey:f,amend:o,dryRun:c,noUpdateBranch:u,ref:h,parent:d,tree:p})}catch(w){throw w.caller="git.commit",w}}l(VS,"commit");async function GS({fs:t,dir:e,gitdir:r=C.join(e,".git"),fullname:i=!1,test:n=!1}){try{return S("fs",t),S("gitdir",r),await Xr({fs:new M(t),gitdir:r,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}l(GS,"currentBranch");async function M2({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await $.exists({fs:t,gitdir:e,ref:r}))throw new oe(r);let n=await $.expand({fs:t,gitdir:e,ref:r}),s=await Xr({fs:t,gitdir:e,fullname:!0});if(n===s){let o=await $.resolve({fs:t,gitdir:e,ref:n});await $.writeRef({fs:t,gitdir:e,ref:"HEAD",value:o})}await $.deleteRef({fs:t,gitdir:e,ref:n});let a=Pi(r),f=await me.get({fs:t,gitdir:e});await f.deleteSection("branch",a),await me.save({fs:t,gitdir:e,config:f})}l(M2,"_deleteBranch");async function KS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{return S("fs",t),S("ref",i),await M2({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}l(KS,"deleteBranch");async function JS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{S("fs",t),S("ref",i),await $.deleteRef({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}l(JS,"deleteRef");async function j2({fs:t,gitdir:e,remote:r}){let i=await me.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await me.save({fs:t,gitdir:e,config:i})}l(j2,"_deleteRemote");async function XS({fs:t,dir:e,gitdir:r=C.join(e,".git"),remote:i}){try{return S("fs",t),S("remote",i),await j2({fs:new M(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}l(XS,"deleteRemote");async function L2({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await $.deleteRef({fs:t,gitdir:e,ref:r})}l(L2,"_deleteTag");async function YS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{return S("fs",t),S("ref",i),await L2({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}l(YS,"deleteTag");async function q2({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}l(q2,"expandOidLoose");async function U2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(C.join(r,"objects/pack"));a=a.filter(f=>f.endsWith(".idx"));for(let f of a){let o=`${r}/objects/pack/${f}`,c=await rm({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(c.error)throw new W(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}l(U2,"expandOidPacked");async function W2({fs:t,cache:e,gitdir:r,oid:i}){let n=l(f=>fe({fs:t,cache:e,gitdir:r,oid:f}),"getExternalRefDelta"),s=await q2({fs:t,gitdir:r,oid:i}),a=await U2({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let f of a)s.indexOf(f)===-1&&s.push(f);if(s.length===1)return s[0];throw s.length>1?new Xa("oids",i,s):new oe(`an object matching "${i}"`)}l(W2,"_expandOid");async function ZS({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await W2({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.expandOid",s}}l(ZS,"expandOid");async function QS({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i}){try{return S("fs",t),S("gitdir",r),S("ref",i),await $.expand({fs:new M(t),gitdir:r,ref:i})}catch(n){throw n.caller="git.expandRef",n}}l(QS,"expandRef");async function am({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,a=i.map((f,o)=>({index:o,oid:f}));for(;a.length;){let f=new Set;for(let{oid:c,index:u}of a)n[c]||(n[c]=new Set),n[c].add(u),n[c].size===s&&f.add(c);if(f.size>0)return[...f];let o=new Map;for(let{oid:c,index:u}of a)try{let{object:h}=await fe({fs:t,cache:e,gitdir:r,oid:c}),d=it.from(h),{parent:p}=d.parseHeaders();for(let m of p)(!n[m]||!n[m].has(u))&&o.set(m+":"+u,{oid:m,index:u})}catch{}a=Array.from(o.values())}return[]}l(am,"_findMergeBase");var Lp=/^.*(\r?\n|$)/gm;function z2({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],a=e[2],f=s.match(Lp),o=n.match(Lp),c=a.match(Lp),u=TI(f,o,c),h=7,d="",p=!0;for(let m of u)m.ok&&(d+=m.ok.join("")),m.conflict&&(p=!1,d+=`${"<".repeat(h)} ${r}
|
|
86
|
+
`,d+=m.conflict.a.join(""),d+=`${"=".repeat(h)}
|
|
87
|
+
`,d+=m.conflict.b.join(""),d+=`${">".repeat(h)} ${i}
|
|
88
|
+
`);return{cleanMerge:p,mergedText:d}}l(z2,"mergeFile");async function H2({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:f,ourName:o="ours",baseName:c="base",theirName:u="theirs",dryRun:h=!1,abortOnConflict:d=!0,mergeDriver:p}){let m=ht({ref:s}),w=ht({ref:a}),y=ht({ref:f}),g=[],_=[],F=[],R=[],k=await Gr({fs:t,cache:e,dir:r,gitdir:i,trees:[m,w,y],map:l(async function(D,[v,O,E]){let N=Fl(D),x=await xl(v,O),I=await xl(E,O);switch(`${x}-${I}`){case"false-false":return{mode:await O.mode(),path:N,oid:await O.oid(),type:await O.type()};case"false-true":return!E&&await v.type()==="tree"?{mode:await v.mode(),path:N,oid:await v.oid(),type:await v.type()}:E?{mode:await E.mode(),path:N,oid:await E.oid(),type:await E.type()}:void 0;case"true-false":return!v&&await E.type()==="tree"?{mode:await E.mode(),path:N,oid:await E.oid(),type:await E.type()}:v?{mode:await v.mode(),path:N,oid:await v.oid(),type:await v.type()}:void 0;case"true-true":{if(v&&E&&await v.type()==="tree"&&await E.type()==="tree")return{mode:await v.mode(),path:N,oid:await v.oid(),type:"tree"};if(v&&E&&await v.type()==="blob"&&await E.type()==="blob")return V2({fs:t,gitdir:i,path:N,ours:v,base:O,theirs:E,ourName:o,baseName:c,theirName:u,mergeDriver:p}).then(async q=>{if(q.cleanMerge)d||n.insert({filepath:D,oid:q.mergeResult.oid,stage:0});else if(g.push(D),_.push(D),!d){let z="";O&&await O.type()==="blob"&&(z=await O.oid());let be=await v.oid(),Vt=await E.oid();n.delete({filepath:D}),z&&n.insert({filepath:D,oid:z,stage:1}),n.insert({filepath:D,oid:be,stage:2}),n.insert({filepath:D,oid:Vt,stage:3})}return q.mergeResult});if(O&&!v&&E&&await O.type()==="blob"&&await E.type()==="blob"){if(g.push(D),F.push(D),!d){let q=await O.oid(),z=await E.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:q,stage:1}),n.insert({filepath:D,oid:z,stage:3})}return{mode:await E.mode(),oid:await E.oid(),type:"blob",path:N}}if(O&&v&&!E&&await O.type()==="blob"&&await v.type()==="blob"){if(g.push(D),R.push(D),!d){let q=await O.oid(),z=await v.oid();n.delete({filepath:D}),n.insert({filepath:D,oid:q,stage:1}),n.insert({filepath:D,oid:z,stage:2})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:N}}if(O&&!v&&!E&&(await O.type()==="blob"||await O.type()==="tree"))return;throw new fs}}},"map"),reduce:g.length!==0&&(!r||d)?void 0:async(D,v)=>{let O=v.filter(Boolean);if(D&&!(D&&D.type==="tree"&&O.length===0&&D.path!==".")){if(O.length>0||D.path==="."&&O.length===0){let N=new rt(O).toObject(),x=await nt({fs:t,gitdir:i,type:"tree",object:N,dryRun:h});D.oid=x}return D}}});return g.length!==0?(r&&!d&&await Gr({fs:t,cache:e,dir:r,gitdir:i,trees:[ht({ref:k.oid})],map:l(async function(D,[v]){let O=`${r}/${D}`;if(await v.type()==="blob"){let E=await v.mode(),N=new TextDecoder().decode(await v.content());await t.write(O,N,{mode:E})}return!0},"map")}),new us(g,_,F,R)):k.oid}l(H2,"mergeTree");async function V2({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:f,baseName:o,dryRun:c,mergeDriver:u=z2}){let h="blob",d="100755",p="",m="";n&&await n.type()==="blob"&&(d=await n.mode(),p=await n.oid(),m=Buffer.from(await n.content()).toString("utf8"));let w=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};if(await i.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await s.oid(),type:h}};if(await s.oid()===p)return{cleanMerge:!0,mergeResult:{mode:w,path:r,oid:await i.oid(),type:h}};let y=Buffer.from(await i.content()).toString("utf8"),g=Buffer.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:F}=await u({branches:[o,a,f],contents:[m,y,g],path:r}),R=await nt({fs:t,gitdir:e,type:"blob",object:Buffer.from(_,"utf8"),dryRun:c});return{cleanMerge:F,mergeResult:{mode:w,path:r,oid:R,type:h}}}l(V2,"mergeBlobs");async function eF({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:f=!1,dryRun:o=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:h,author:d,committer:p,signingKey:m,onSign:w,mergeDriver:y,allowUnrelatedHistories:g=!1}){n===void 0&&(n=await Xr({fs:t,gitdir:i,fullname:!0})),n=await $.expand({fs:t,gitdir:i,ref:n}),s=await $.expand({fs:t,gitdir:i,ref:s});let _=await $.resolve({fs:t,gitdir:i,ref:n}),F=await $.resolve({fs:t,gitdir:i,ref:s}),R=await am({fs:t,cache:e,gitdir:i,oids:[_,F]});if(R.length!==1)if(R.length===0&&g)R.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new fs;let k=R[0];if(k===F)return{oid:_,alreadyMerged:!0};if(a&&k===_)return!o&&!c&&await $.writeRef({fs:t,gitdir:i,ref:n,value:F}),{oid:F,fastForward:!0};{if(f)throw new eo;let D=await ge.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async O=>H2({fs:t,cache:e,dir:r,gitdir:i,index:O,ourOid:_,theirOid:F,baseOid:k,ourName:Pi(n),baseName:"base",theirName:Pi(s),dryRun:o,abortOnConflict:u,mergeDriver:y}));if(D instanceof us)throw D;return h||(h=`Merge branch '${Pi(s)}' into ${Pi(n)}`),{oid:await vf({fs:t,cache:e,gitdir:i,message:h,ref:n,tree:D,parent:[_,F],author:d,committer:p,signingKey:m,onSign:w,dryRun:o,noUpdateBranch:c}),tree:D,mergeCommit:!0}}}l(eF,"_merge");async function tF({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,dir:o,gitdir:c,ref:u,url:h,remote:d,remoteRef:p,prune:m,pruneTags:w,fastForward:y,fastForwardOnly:g,corsProxy:_,singleBranch:F,headers:R,author:k,committer:D,signingKey:v}){try{if(!u){let N=await Xr({fs:t,gitdir:c});if(!N)throw new tt("ref");u=N}let{fetchHead:O,fetchHeadDescription:E}=await sm({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,gitdir:c,corsProxy:_,ref:u,url:h,remote:d,remoteRef:p,singleBranch:F,headers:R,prune:m,pruneTags:w});await eF({fs:t,cache:e,gitdir:c,ours:u,theirs:O,fastForward:y,fastForwardOnly:g,message:`Merge ${E}`,author:k,committer:D,signingKey:v,dryRun:!1,noUpdateBranch:!1}),await im({fs:t,cache:e,onProgress:i,dir:o,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(O){throw O.caller="git.pull",O}}l(tF,"_pull");async function rF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o=C.join(f,".git"),ref:c,url:u,remote:h,remoteRef:d,corsProxy:p,singleBranch:m,headers:w={},cache:y={}}){try{S("fs",t),S("http",e),S("gitdir",o);let g={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await tF({fs:new M(t),cache:y,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o,ref:c,url:u,remote:h,remoteRef:d,fastForwardOnly:!0,corsProxy:p,singleBranch:m,headers:w,author:g,committer:g})}catch(g){throw g.caller="git.fastForward",g}}l(rF,"fastForward");async function iF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o=C.join(f,".git"),ref:c,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m=null,since:w=null,exclude:y=[],relative:g=!1,tags:_=!1,singleBranch:F=!1,headers:R={},prune:k=!1,pruneTags:D=!1,cache:v={}}){try{return S("fs",t),S("http",e),S("gitdir",o),await sm({fs:new M(t),cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,gitdir:o,ref:c,remote:u,remoteRef:h,url:d,corsProxy:p,depth:m,since:w,exclude:y,relative:g,tags:_,singleBranch:F,headers:R,prune:k,pruneTags:D})}catch(O){throw O.caller="git.fetch",O}}l(iF,"fetch");async function nF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oids:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oids",i),await am({fs:new M(t),cache:n,gitdir:r,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}l(nF,"findMergeBase");async function sF({fs:t,filepath:e}){if(await t.exists(C.join(e,".git")))return e;{let r=cs(e);if(r===e)throw new oe(`git root for ${e}`);return sF({fs:t,filepath:r})}}l(sF,"_findRoot");async function aF({fs:t,filepath:e}){try{return S("fs",t),S("filepath",e),await sF({fs:new M(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}l(aF,"findRoot");async function oF({fs:t,dir:e,gitdir:r=C.join(e,".git"),path:i}){try{return S("fs",t),S("gitdir",r),S("path",i),await lo({fs:new M(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfig",n}}l(oF,"getConfig");async function G2({fs:t,gitdir:e,path:r}){return(await me.get({fs:t,gitdir:e})).getall(r)}l(G2,"_getConfigAll");async function cF({fs:t,dir:e,gitdir:r=C.join(e,".git"),path:i}){try{return S("fs",t),S("gitdir",r),S("path",i),await G2({fs:new M(t),gitdir:r,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}l(cF,"getConfigAll");async function lF({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:f=!1}){try{S("http",t),S("url",s);let c=await gs.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[h,d]of c.refs){let p=h.split("/"),m=p.pop(),w=u;for(let y of p)w[y]=w[y]||{},w=w[y];w[m]=d}for(let[h,d]of c.symrefs){let p=h.split("/"),m=p.pop(),w=u;for(let y of p)w[y]=w[y]||{},w=w[y];w[m]=d}return u}catch(o){throw o.caller="git.getRemoteInfo",o}}l(lF,"getRemoteInfo");function fF(t,e,r,i){let n=[];for(let[s,a]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let o=s.replace("^{}",""),c=n[n.length-1],u=c.ref===o?c:n.find(h=>h.ref===o);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=a}continue}let f={ref:s,oid:a};r&&t.symrefs.has(s)&&(f.target=t.symrefs.get(s)),n.push(f)}return n}l(fF,"formatInfoRefs");async function uF({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:f=!1,protocolVersion:o=2}){try{S("http",t),S("url",s);let u=await gs.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:o});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let h={};for(let d of u.capabilities){let[p,m]=d.split("=");m?h[p]=m:h[p]=!0}return{protocolVersion:1,capabilities:h,refs:fF(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}l(uF,"getRemoteInfo2");async function K2({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Hr.wrap({type:t,object:e})),i=await Er(e)),{oid:i,object:e}}l(K2,"hashObject");async function hF({object:t}){try{S("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await K2({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}l(hF,"hashBlob");async function J2({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=C.join(i,s);let a=await t.read(s),f=l(c=>fe({fs:t,cache:e,gitdir:n,oid:c}),"getExternalRefDelta"),o=await Ja.fromPack({pack:a,getExternalRefDelta:f,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await o.toBuffer()),{oids:[...o.hashes]}}catch(a){throw a.caller="git.indexPack",a}}l(J2,"_indexPack");async function dF({fs:t,onProgress:e,dir:r,gitdir:i=C.join(r,".git"),filepath:n,cache:s={}}){try{return S("fs",t),S("dir",r),S("gitdir",r),S("filepath",n),await J2({fs:new M(t),cache:s,onProgress:e,dir:r,gitdir:i,filepath:n})}catch(a){throw a.caller="git.indexPack",a}}l(dF,"indexPack");async function pF({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:C.join(r,".git"),defaultBranch:n="master"}){try{return S("fs",t),S("gitdir",i),e||S("dir",r),await zS({fs:new M(t),bare:e,dir:r,gitdir:i,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}l(pF,"init");async function mF({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let a=await Di.read({fs:t,gitdir:r});if(!i)throw new tt("oid");if(!n)throw new tt("ancestor");if(i===n)return!1;let f=[i],o=new Set,c=0;for(;f.length;){if(c++===s)throw new ro(s);let u=f.shift(),{type:h,object:d}=await fe({fs:t,cache:e,gitdir:r,oid:u});if(h!=="commit")throw new Ye(u,h,"commit");let p=it.from(d).parse();for(let m of p.parent)if(m===n)return!0;if(!a.has(u))for(let m of p.parent)o.has(m)||(f.push(m),o.add(m))}return!1}l(mF,"_isDescendent");async function wF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:a={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),S("ancestor",n),await mF({fs:new M(t),cache:a,gitdir:r,oid:i,ancestor:n,depth:s})}catch(f){throw f.caller="git.isDescendent",f}}l(wF,"isDescendent");async function yF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i}){try{return S("fs",t),S("dir",e),S("gitdir",r),S("filepath",i),Kr.isIgnored({fs:new M(t),dir:e,gitdir:r,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}l(yF,"isIgnored");async function gF({fs:t,dir:e,gitdir:r=C.join(e,".git"),remote:i}){try{return S("fs",t),S("gitdir",r),$.listBranches({fs:new M(t),gitdir:r,remote:i})}catch(n){throw n.caller="git.listBranches",n}}l(gF,"listBranches");async function X2({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await $.resolve({gitdir:e,fs:t,ref:r}),s=[];return await bF({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return ge.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}l(X2,"_listFiles");async function bF({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:a}=await vs({fs:t,cache:e,gitdir:r,oid:i});for(let f of a)f.type==="tree"?await bF({fs:t,cache:e,gitdir:r,oid:f.oid,filenames:n,prefix:C.join(s,f.path)}):n.push(C.join(s,f.path))}l(bF,"accumulateFilesFromOid");async function _F({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),await X2({fs:new M(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listFiles",s}}l(_F,"listFiles");async function Y2({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await $.resolve({gitdir:r,fs:t,ref:i})}catch(f){if(f instanceof oe)return[]}return(await vs({fs:t,cache:e,gitdir:r,oid:n})).tree.map(f=>({target:f.path,note:f.oid}))}l(Y2,"_listNotes");async function vF({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{return S("fs",t),S("gitdir",r),S("ref",i),await Y2({fs:new M(t),cache:n,gitdir:r,ref:i})}catch(s){throw s.caller="git.listNotes",s}}l(vF,"listNotes");async function EF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i}){try{return S("fs",t),S("gitdir",r),$.listRefs({fs:new M(t),gitdir:r,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}l(EF,"listRefs");async function Z2({fs:t,gitdir:e}){let r=await me.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let a=await r.get(`remote.${s}.url`);return{remote:s,url:a}}))}l(Z2,"_listRemotes");async function SF({fs:t,dir:e,gitdir:r=C.join(e,".git")}){try{return S("fs",t),S("gitdir",r),await Z2({fs:new M(t),gitdir:r})}catch(i){throw i.caller="git.listRemotes",i}}l(SF,"listRemotes");async function Q2(t){let e=pe.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...a]=i.split(" "),f={ref:s,oid:n};for(let o of a){let[c,u]=o.split(":");c==="symref-target"?f.target=u:c==="peeled"&&(f.peeled=u)}r.push(f)}return r}l(Q2,"parseListRefsResponse");async function e$({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(pe.encode(`command=ls-refs
|
|
89
|
+
`)),i.push(pe.encode(`agent=${Ef.agent}
|
|
90
|
+
`)),(r||e||t)&&i.push(pe.delim()),r&&i.push(pe.encode("peel")),e&&i.push(pe.encode("symrefs")),t&&i.push(pe.encode(`ref-prefix ${t}`)),i.push(pe.flush()),i}l(e$,"writeListRefsRequest");async function FF({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:f=!1,protocolVersion:o=2,prefix:c,symrefs:u,peelTags:h}){try{S("http",t),S("url",s);let d=await ys.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:o});if(d.protocolVersion===1)return fF(d,c,u,h);let p=await e$({prefix:c,symrefs:u,peelTags:h}),m=await ys.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:f?"git-receive-pack":"git-upload-pack",url:s,body:p});return Q2(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}l(FF,"listServerRefs");async function TF({fs:t,dir:e,gitdir:r=C.join(e,".git")}){try{return S("fs",t),S("gitdir",r),$.listTags({fs:new M(t),gitdir:r})}catch(i){throw i.caller="git.listTags",i}}l(TF,"listTags");function t$(t,e){return t.committer.timestamp-e.committer.timestamp}l(t$,"compareAge");var r$="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function pS({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===r$)return;let s=i,a,f=await ps({fs:t,cache:e,gitdir:r,oid:i}),o=f.tree;return n===f.oid?a=f.path:(a=await RF({fs:t,cache:e,gitdir:r,tree:o,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}l(pS,"resolveFileIdInTree");async function RF({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:f=""}){let o=i.entries().map(function(c){let u;return c.oid===n?(u=C.join(f,c.path),a.push(u)):c.type==="tree"&&(u=fe({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:h}){return RF({fs:t,cache:e,gitdir:r,tree:rt.from(h),fileId:n,oid:s,filepaths:a,parentPath:C.join(f,c.path)})})),u});return await Promise.all(o),a}l(RF,"_resolveFileId");async function i$({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:f,follow:o}){let c=typeof a>"u"?void 0:Math.floor(a.valueOf()/1e3),u=[],h=await Di.read({fs:t,gitdir:r}),d=await $.resolve({fs:t,gitdir:r,ref:n}),p=[await ws({fs:t,cache:e,gitdir:r,oid:d})],m,w,y;function g(_){y&&i&&u.push(_)}for(l(g,"endCommit");p.length>0;){let _=p.pop();if(c!==void 0&&_.commit.committer.timestamp<=c)break;if(i){let F;try{F=await fo({fs:t,cache:e,gitdir:r,oid:_.commit.tree,filepath:i}),w&&m!==F&&u.push(w),m=F,w=_,y=!0}catch(R){if(R instanceof oe){let k=o&&m;if(k&&(k=await pS({fs:t,cache:e,gitdir:r,oid:_.commit.tree,fileId:m}),k))if(Array.isArray(k)){if(w){let D=await pS({fs:t,cache:e,gitdir:r,oid:w.commit.tree,fileId:m});if(Array.isArray(D))if(k=k.filter(v=>D.indexOf(v)===-1),k.length===1)k=k[0],i=k,w&&u.push(w);else{k=!1,w&&u.push(w);break}}}else i=k,w&&u.push(w);if(!k){if(y&&m&&(u.push(w),!f))break;if(!f&&!o)throw R}w=_,y=!1}else throw R}}else u.push(_);if(s!==void 0&&u.length===s){g(_);break}if(!h.has(_.oid))for(let F of _.commit.parent){let R=await ws({fs:t,cache:e,gitdir:r,oid:F});p.map(k=>k.oid).includes(R.oid)||p.push(R)}p.length===0&&g(_),p.sort((F,R)=>t$(F.commit,R.commit))}return u}l(i$,"_log");async function OF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:f,follow:o,cache:c={}}){try{return S("fs",t),S("gitdir",r),S("ref",n),await i$({fs:new M(t),cache:c,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:f,follow:o})}catch(u){throw u.caller="git.log",u}}l(OF,"log");async function kF({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:f=!1,dryRun:o=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:h,author:d,committer:p,signingKey:m,cache:w={},mergeDriver:y,allowUnrelatedHistories:g=!1}){try{S("fs",t),m&&S("onSign",e);let _=new M(t),F=await Jr({fs:_,gitdir:i,author:d});if(!F&&(!f||!a))throw new ze("author");let R=await ms({fs:_,gitdir:i,author:F,committer:p});if(!R&&(!f||!a))throw new ze("committer");return await eF({fs:_,cache:w,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a,fastForwardOnly:f,dryRun:o,noUpdateBranch:c,abortOnConflict:u,message:h,author:F,committer:R,signingKey:m,onSign:e,mergeDriver:y,allowUnrelatedHistories:g})}catch(_){throw _.caller="git.merge",_}}l(kF,"merge");var n$={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function xF({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),oids:n}){let s=new wS,a=[];function f(u,h){let d=Buffer.from(u,h);a.push(d),s.update(d)}l(f,"write");async function o({stype:u,object:h}){let d=n$[u],p=h.length,m=p>15?128:0,w=p&15;p=p>>>4;let y=(m|d|w).toString(16);for(f(y,"hex");m;)m=p>127?128:0,y=m|p&127,f(em(2,y),"hex"),p=p>>>7;f(Buffer.from(await kS(h)))}l(o,"writeObject"),f("PACK"),f("00000002","hex"),f(em(8,n.length),"hex");for(let u of n){let{type:h,object:d}=await fe({fs:t,cache:e,gitdir:i,oid:u});await o({write:f,object:d,stype:h})}let c=s.digest();return a.push(c),a}l(xF,"_pack");async function s$({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await xF({fs:t,cache:e,gitdir:r,oids:i}),a=Buffer.from(await Al(s)),o=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(C.join(r,`objects/pack/${o}`),a),{filename:o}):{filename:o,packfile:new Uint8Array(a)}}l(s$,"_packObjects");async function AF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oids:i,write:n=!1,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("oids",i),await s$({fs:new M(t),cache:s,gitdir:r,oids:i,write:n})}catch(a){throw a.caller="git.packObjects",a}}l(AF,"packObjects");async function PF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o=C.join(f,".git"),ref:c,url:u,remote:h,remoteRef:d,prune:p=!1,pruneTags:m=!1,fastForward:w=!0,fastForwardOnly:y=!1,corsProxy:g,singleBranch:_,headers:F={},author:R,committer:k,signingKey:D,cache:v={}}){try{S("fs",t),S("gitdir",o);let O=new M(t),E=await Jr({fs:O,gitdir:o,author:R});if(!E)throw new ze("author");let N=await ms({fs:O,gitdir:o,author:E,committer:k});if(!N)throw new ze("committer");return await tF({fs:O,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:f,gitdir:o,ref:c,url:u,remote:h,remoteRef:d,fastForward:w,fastForwardOnly:y,corsProxy:g,singleBranch:_,headers:F,author:E,committer:N,signingKey:D,prune:p,pruneTags:m})}catch(O){throw O.caller="git.pull",O}}l(PF,"pull");async function a$({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),start:n,finish:s}){let a=await Di.read({fs:t,gitdir:i}),f=new Set,o=new Set;for(let h of n)f.add(await $.resolve({fs:t,gitdir:i,ref:h}));for(let h of s)try{let d=await $.resolve({fs:t,gitdir:i,ref:h});o.add(d)}catch{}let c=new Set;async function u(h){c.add(h);let{type:d,object:p}=await fe({fs:t,cache:e,gitdir:i,oid:h});if(d==="tag"){let w=dt.from(p).headers().object;return u(w)}if(d!=="commit")throw new Ye(h,d,"commit");if(!a.has(h)){let w=it.from(p).headers().parent;for(h of w)!o.has(h)&&!c.has(h)&&await u(h)}}l(u,"walk");for(let h of f)await u(h);return c}l(a$,"listCommitsAndTags");async function qp({fs:t,cache:e,dir:r,gitdir:i=C.join(r,".git"),oids:n}){let s=new Set;async function a(f){if(s.has(f))return;s.add(f);let{type:o,object:c}=await fe({fs:t,cache:e,gitdir:i,oid:f});if(o==="tag"){let h=dt.from(c).headers().object;await a(h)}else if(o==="commit"){let h=it.from(c).headers().tree;await a(h)}else if(o==="tree"){let u=rt.from(c);for(let h of u)h.type==="blob"&&s.add(h.oid),h.type==="tree"&&await a(h.oid)}}l(a,"walk");for(let f of n)await a(f);return s}l(qp,"listObjects");async function o$(t){let e={},r="",i=pe.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+`
|
|
91
|
+
`),n=await i();let s=r.toString("utf8").split(`
|
|
92
|
+
`);if(n=s.shift(),!n.startsWith("unpack "))throw new Ni('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let f=a.slice(0,2),o=a.slice(3),c=o.indexOf(" ");c===-1&&(c=o.length);let u=o.slice(0,c),h=o.slice(c+1);e.refs[u]={ok:f==="ok",error:h}}return e}l(o$,"parseReceivePackResponse");async function c$({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(pe.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
|
|
93
|
+
`)),i="";return r.push(pe.flush()),r}l(c$,"writeReceivePackRequest");async function l$({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:f,onPrePush:o,gitdir:c,ref:u,remoteRef:h,remote:d,url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:g={}}){let _=u||await Xr({fs:t,gitdir:c});if(typeof _>"u")throw new tt("ref");let F=await me.get({fs:t,gitdir:c});d=d||await F.get(`branch.${_}.pushRemote`)||await F.get("remote.pushDefault")||await F.get(`branch.${_}.remote`)||"origin";let R=p||await F.get(`remote.${d}.pushurl`)||await F.get(`remote.${d}.url`);if(typeof R>"u")throw new tt("remote OR url");let k=h||await F.get(`branch.${_}.merge`);if(typeof R>"u")throw new tt("remoteRef");y===void 0&&(y=await F.get("http.corsProxy"));let D=await $.expand({fs:t,gitdir:c,ref:_}),v=w?"0000000000000000000000000000000000000000":await $.resolve({fs:t,gitdir:c,ref:D}),O=gs.getRemoteHelperFor({url:R}),E=await O.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:f,corsProxy:y,service:"git-receive-pack",url:R,headers:g,protocolVersion:1}),N=E.auth,x;if(!k)x=D;else try{x=await $.expandAgainstMap({ref:k,map:E.refs})}catch(de){if(de instanceof oe)x=k.startsWith("refs/")?k:`refs/heads/${k}`;else throw de}let I=E.refs.get(x)||"0000000000000000000000000000000000000000";if(o&&!await o({remote:d,url:R,localRef:{ref:w?"(delete)":D,oid:v},remoteRef:{ref:x,oid:I}}))throw new ds;let q=!E.capabilities.has("no-thin"),z=new Set;if(!w){let de=[...E.refs.values()],Gt=new Set;if(I!=="0000000000000000000000000000000000000000"){let Le=await am({fs:t,cache:e,gitdir:c,oids:[v,I]});for(let Ys of Le)de.push(Ys);q&&(Gt=await qp({fs:t,cache:e,gitdir:c,oids:Le}))}if(!de.includes(v)){let Le=await a$({fs:t,cache:e,gitdir:c,start:[v],finish:de});z=await qp({fs:t,cache:e,gitdir:c,oids:Le})}if(q){try{let Le=await $.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Ys}=await $.resolveAgainstMap({ref:Le.replace(`refs/remotes/${d}/`,""),fullref:Le,map:E.refs}),ui=[Ys];for(let Te of await qp({fs:t,cache:e,gitdir:c,oids:ui}))Gt.add(Te)}catch{}for(let Le of Gt)z.delete(Le)}if(v===I&&(m=!0),!m){if(D.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new hs("tag-exists");if(v!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await mF({fs:t,cache:e,gitdir:c,oid:v,ancestor:I,depth:-1}))throw new hs("not-fast-forward")}}let be=US([...E.capabilities],["report-status","side-band-64k",`agent=${Ef.agent}`]),Vt=await c$({capabilities:be,triplets:[{oldoid:I,oid:v,fullRef:x}]}),yt=w?[]:await xF({fs:t,cache:e,gitdir:c,oids:[...z]}),Dt=await O.connect({http:r,onProgress:i,corsProxy:y,service:"git-receive-pack",url:R,auth:N,headers:g,body:[...Vt,...yt]}),{packfile:Yu,progress:Zu}=await Pl.demux(Dt.body);if(n){let de=WS(Zu);ho(de,async Gt=>{await n(Gt)})}let at=await o$(Yu);if(Dt.headers&&(at.headers=Dt.headers),d&&at.ok&&at.refs[x].ok&&!D.startsWith("refs/tags")){let de=`refs/remotes/${d}/${x.replace("refs/heads","")}`;w?await $.deleteRef({fs:t,gitdir:c,ref:de}):await $.writeRef({fs:t,gitdir:c,ref:de,value:v})}if(at.ok&&Object.values(at.refs).every(de=>de.ok))return at;{let de=Object.entries(at.refs).filter(([Gt,Le])=>!Le.ok).map(([Gt,Le])=>`
|
|
94
|
+
- ${Gt}: ${Le.error}`).join("");throw new to(de,at)}}l(l$,"_push");async function NF({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:f,dir:o,gitdir:c=C.join(o,".git"),ref:u,remoteRef:h,remote:d="origin",url:p,force:m=!1,delete:w=!1,corsProxy:y,headers:g={},cache:_={}}){try{return S("fs",t),S("http",e),S("gitdir",c),await l$({fs:new M(t),cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:f,gitdir:c,ref:u,remoteRef:h,remote:d,url:p,force:m,delete:w,corsProxy:y,headers:g})}catch(F){throw F.caller="git.push",F}}l(NF,"push");async function DF({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=dt.from(s).parse().object,DF({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new Ye(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}l(DF,"resolveBlob");async function CF({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await fo({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await DF({fs:t,cache:e,gitdir:r,oid:i})}l(CF,"_readBlob");async function IF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,filepath:n,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await CF({fs:new M(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}l(IF,"readBlob");async function om({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await ws({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readCommit",s}}l(om,"readCommit");async function f$({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await $.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await CF({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}l(f$,"_readNote");async function $F({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("ref",i),S("oid",n),await f$({fs:new M(t),cache:s,gitdir:r,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}l($F,"readNote");async function BF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:f={}}){try{S("fs",t),S("gitdir",r),S("oid",i);let o=new M(t);s!==void 0&&(i=await fo({fs:o,cache:f,gitdir:r,oid:i,filepath:s}));let u=await fe({fs:o,cache:f,gitdir:r,oid:i,format:n==="parsed"?"content":n});if(u.oid=i,n==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=it.from(u.object).parse();break;case"tree":u.object=rt.from(u.object).entries();break;case"blob":a?u.object=u.object.toString(a):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=dt.from(u.object).parse();break;default:throw new Ye(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(o){throw o.caller="git.readObject",o}}l(BF,"readObject");async function u$({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await fe({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new Ye(i,n,"tag");let a=dt.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}l(u$,"_readTag");async function MF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,cache:n={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await u$({fs:new M(t),cache:n,gitdir:r,oid:i})}catch(s){throw s.caller="git.readTag",s}}l(MF,"readTag");async function jF({fs:t,dir:e,gitdir:r=C.join(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{return S("fs",t),S("gitdir",r),S("oid",i),await vs({fs:new M(t),cache:s,gitdir:r,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}l(jF,"readTree");async function LF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,cache:n={}}){try{S("fs",t),S("gitdir",r),S("filepath",i),await ge.acquire({fs:new M(t),gitdir:r,cache:n},async function(s){s.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}l(LF,"remove");async function h$({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:f,signingKey:o}){let c;try{c=await $.resolve({gitdir:i,fs:t,ref:n})}catch(m){if(!(m instanceof oe))throw m}let h=(await vs({fs:t,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;h=h.filter(m=>m.path!==s);let d=await uo({fs:t,gitdir:i,tree:h});return await vf({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
|
|
95
|
+
`,author:a,committer:f,signingKey:o})}l(h$,"_removeNote");async function qF({fs:t,onSign:e,dir:r,gitdir:i=C.join(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:f,signingKey:o,cache:c={}}){try{S("fs",t),S("gitdir",i),S("oid",s);let u=new M(t),h=await Jr({fs:u,gitdir:i,author:a});if(!h)throw new ze("author");let d=await ms({fs:u,gitdir:i,author:h,committer:f});if(!d)throw new ze("committer");return await h$({fs:u,cache:c,onSign:e,gitdir:i,ref:n,oid:s,author:h,committer:d,signingKey:o})}catch(u){throw u.caller="git.removeNote",u}}l(qF,"removeNote");async function d$({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!Va(i,!0))throw new Lt(i,Ha.clean(i));if(!Va(r,!0))throw new Lt(r,Ha.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await $.exists({fs:t,gitdir:e,ref:a}))throw new jt("branch",i,!1);let o=await $.resolve({fs:t,gitdir:e,ref:s,depth:1});await $.writeRef({fs:t,gitdir:e,ref:a,value:o}),await $.deleteRef({fs:t,gitdir:e,ref:s});let u=await Xr({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await $.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}l(d$,"_renameBranch");async function UF({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{return S("fs",t),S("gitdir",r),S("ref",i),S("oldref",n),await d$({fs:new M(t),gitdir:r,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}l(UF,"renameBranch");async function WF({gitdir:t,type:e,object:r}){return Er(Hr.wrap({type:e,object:r}))}l(WF,"hashObject$1");async function zF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,ref:n,cache:s={}}){try{S("fs",t),S("gitdir",r),S("filepath",i);let a=new M(t),f,o;try{f=await $.resolve({fs:a,gitdir:r,ref:n||"HEAD"})}catch(h){if(n)throw h}if(f)try{f=await fo({fs:a,cache:s,gitdir:r,oid:f,filepath:i})}catch{f=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await a.read(C.join(e,i));u&&(o=await WF({gitdir:r,type:"blob",object:u}),f===o&&(c=await a.lstat(C.join(e,i)))),await ge.acquire({fs:a,gitdir:r,cache:s},async function(h){h.delete({filepath:i}),f&&h.insert({filepath:i,stats:c,oid:f})})}catch(a){throw a.caller="git.reset",a}}l(zF,"resetIndex");async function HF({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,depth:n}){try{return S("fs",t),S("gitdir",r),S("ref",i),await $.resolve({fs:new M(t),gitdir:r,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}l(HF,"resolveRef");async function VF({fs:t,dir:e,gitdir:r=C.join(e,".git"),path:i,value:n,append:s=!1}){try{S("fs",t),S("gitdir",r),S("path",i);let a=new M(t),f=await me.get({fs:a,gitdir:r});s?await f.append(i,n):await f.set(i,n),await me.save({fs:a,gitdir:r,config:f})}catch(a){throw a.caller="git.setConfig",a}}l(VF,"setConfig");async function GF({fs:t,gitdir:e,commit:r}){let i=it.from(r).toObject();return await nt({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}l(GF,"_writeCommit");var gf=class gf{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),f=gf.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${f} ${i}
|
|
96
|
+
`}static getStashReflogEntry(e,r=!1){return e.split(`
|
|
97
|
+
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}};l(gf,"GitRefStash");var Nl=gf,p$={stage:Ii,workdir:_s},Up;async function bs(t,e){return Up===void 0&&(Up=new za),Up.acquire(t,e)}l(bs,"acquireLock$1");async function m$(t,e,r,i,n=null){let s=C.join(r,i),a=await t.lstat(s);if(!a)throw new oe(s);if(a.isDirectory())throw new W(`${s}: file expected, but found directory`);let f=n?await ES({fs:t,gitdir:e,oid:n}):void 0,o=f?n:void 0;return f||await bs({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(xS):await t.read(s);if(c===null)throw new oe(s);o=await nt({fs:t,gitdir:e,type:"blob",object:c})}),o}l(m$,"checkAndWriteBlob");async function w$({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await uo({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await m$(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return l(n,"processTreeEntry"),Promise.all(i.map(n))}l(w$,"processTreeEntries");async function mS({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(p=>typeof p=="string"?p$[p]():p),a=[],u=await Gr({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:l(async(p,[m,w])=>{if(!(p==="."||await Kr.isIgnored({fs:t,dir:e,gitdir:r,filepath:p}))&&w)return(!m||await m.oid()!==await w.oid()&&await w.oid()!==void 0)&&a.push([m,w]),{mode:await w.mode(),path:p,oid:await w.oid(),type:await w.type()}},"map"),reduce:l(async(p,m)=>(m=m.filter(Boolean),p?(p.children=m,p):m.length>0?m:void 0),"reduce"),iterate:l(async(p,m)=>{let w=[];for(let y of m){let[g,_]=y;n?_&&(await t.exists(`${e}/${_.toString()}`)?w.push(y):a.push([null,_])):g&&(_?w.push(y):a.push([g,null]))}return w.length?Promise.all(w.map(p)):[]},"iterate")});if(a.length===0||u.length===0)return null;let d=(await w$({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(p=>({mode:p.mode,path:p.path,oid:p.oid,type:p.type}));return uo({fs:t,gitdir:r,tree:d})}l(mS,"writeTreeChanges");async function y$({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let a=[],f=[],o=await Gr({fs:t,cache:{},dir:e,gitdir:r,trees:[ht({ref:n}),ht({ref:i})],map:l(async(c,[u,h])=>{if(c==="."||await Kr.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=h?await h.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!h&&u){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&a.push(c),d==="blob"&&s&&f.push({filepath:c,oid:await u.oid()}),{method:m,filepath:c}}let p=await h.oid();if(!u||await u.oid()!==p)return d==="tree"?{method:"mkdir",filepath:c}:(s&&f.push({filepath:c,oid:p,stats:await t.lstat(C.join(e,c))}),{method:"write",filepath:c,oid:p})},"map")});await bs({fs:t,gitdir:r,dirRemoved:a,ops:o},async()=>{for(let c of o){let u=C.join(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!a.some(h=>u.startsWith(h))){let{object:h}=await fe({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,h)}break}}}),await ge.acquire({fs:t,gitdir:r,cache:{}},async c=>{f.forEach(({filepath:u,stats:h,oid:d})=>{c.insert({filepath:u,stats:h,oid:d})})})}l(y$,"applyTreeChanges");var ns=class ns{constructor({fs:e,dir:r,gitdir:i=C.join(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return C.join(this.gitdir,ns.refStash)}get refLogsStashPath(){return C.join(this.gitdir,ns.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Jr({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new ze("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return GF({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Lt(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?ws({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return $.writeRef({fs:this.fs,gitdir:this.gitdir,ref:ns.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=Nl.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await bs({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Nl.getStashReflogEntry(r,e)}};l(ns,"GitStashManager");var Ci=ns;async function KF({fs:t,dir:e,gitdir:r,message:i=""}){let n=new Ci({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Xr({fs:t,gitdir:r,fullname:!1}),a=await $.resolve({fs:t,gitdir:r,ref:"HEAD"}),o=(await om({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,h=ht({ref:"HEAD"}),d=await mS({fs:t,dir:e,gitdir:r,treePair:[ht({ref:"HEAD"}),"stage"]});if(d){let y=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(y),u=d,h=Ii()}let p=await mS({fs:t,dir:e,gitdir:r,treePair:[h,"workdir"]});if(p){let y=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:p,parent:[c[c.length-1]]});c.push(y),u=p}if(!u||!d&&!p)throw new oe("changes, nothing to stash");let m=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${o}`;return{stashCommit:await n.writeStashCommit({message:m,tree:u,parent:c}),stashMsg:m,branch:s,stashMgr:n}}l(KF,"_createStashCommit");async function g$({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:f}=await KF({fs:t,dir:e,gitdir:r,message:i});return await f.writeStashRef(n),await f.writeStashReflogEntry({stashCommit:n,message:s}),await nm({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}l(g$,"_stashPush");async function b$({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await KF({fs:t,dir:e,gitdir:r,message:i});return n}l(b$,"_stashCreate");async function JF({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new Ci({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let f=0;f<a.length-1;f++){let c=(await ws({fs:t,cache:{},gitdir:r,oid:a[f+1]})).commit.message.startsWith("stash-Index");await y$({fs:t,dir:e,gitdir:r,stashCommit:a[f+1],parentCommit:a[f],wasStaged:c})}}l(JF,"_stashApply");async function XF({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new Ci({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await bs(a,async()=>{await t.exists(a)&&await t.rm(a)});let f=await n.readStashReflogs({parsed:!1});if(!f.length)return;f.splice(i,1);let o=n.refLogsStashPath;await bs({reflogEntries:f,stashReflogPath:o,stashMgr:n},async()=>{if(f.length){await t.write(o,f.reverse().join(`
|
|
98
|
+
`)+`
|
|
99
|
+
`,"utf8");let c=f[f.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(o)})}l(XF,"_stashDrop");async function _$({fs:t,dir:e,gitdir:r}){return new Ci({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}l(_$,"_stashList");async function v$({fs:t,dir:e,gitdir:r}){let i=new Ci({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await bs(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}l(v$,"_stashClear");async function E$({fs:t,dir:e,gitdir:r,refIdx:i=0}){await JF({fs:t,dir:e,gitdir:r,refIdx:i}),await XF({fs:t,dir:e,gitdir:r,refIdx:i})}l(E$,"_stashPop");async function YF({fs:t,dir:e,gitdir:r=C.join(e,".git"),op:i="push",message:n="",refIdx:s=0}){S("fs",t),S("dir",e),S("gitdir",r),S("op",i);let a={push:g$,apply:JF,drop:XF,list:_$,clear:v$,pop:E$,create:b$},f=["apply","drop","pop"];try{let o=new M(t);["refs","logs","logs/refs"].map(h=>C.join(r,h)).forEach(async h=>{await o.exists(h)||await o.mkdir(h)});let u=a[i];if(u){if(f.includes(i)&&s<0)throw new Lt(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await u({fs:o,dir:e,gitdir:r,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(o){throw o.caller="git.stash",o}}l(YF,"stash");async function ZF({fs:t,dir:e,gitdir:r=C.join(e,".git"),filepath:i,cache:n={}}){try{S("fs",t),S("gitdir",r),S("filepath",i);let s=new M(t);if(await Kr.isIgnored({fs:s,gitdir:r,dir:e,filepath:i}))return"ignored";let f=await S$({fs:s,cache:n,gitdir:r}),o=await QF({fs:s,cache:n,gitdir:r,tree:f,path:i}),c=await ge.acquire({fs:s,gitdir:r,cache:n},async function(w){for(let y of w)if(y.path===i)return y;return null}),u=await s.lstat(C.join(e,i)),h=o!==null,d=c!==null,p=u!==null,m=l(async()=>{if(d&&!Sl(c,u))return c.oid;{let w=await s.read(C.join(e,i)),y=await WF({gitdir:r,type:"blob",object:w});return d&&c.oid===y&&u.size!==-1&&ge.acquire({fs:s,gitdir:r,cache:n},async function(g){g.insert({filepath:i,stats:u,oid:y})}),y}},"getWorkdirOid");if(!h&&!p&&!d)return"absent";if(!h&&!p&&d)return"*absent";if(!h&&p&&!d)return"*added";if(!h&&p&&d)return await m()===c.oid?"added":"*added";if(h&&!p&&!d)return"deleted";if(h&&!p&&d)return o===c.oid,"*deleted";if(h&&p&&!d)return await m()===o?"*undeleted":"*undeletemodified";if(h&&p&&d){let w=await m();return w===o?w===c.oid?"unmodified":"*unmodified":w===c.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}l(ZF,"status");async function QF({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:f,object:o}=await fe({fs:t,cache:e,gitdir:r,oid:a.oid});if(f==="tree"){let c=rt.from(o);return QF({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(f==="blob")throw new Ye(a.oid,f,"blob",n.join("/"))}return null}l(QF,"getOidAtPath");async function S$({fs:t,cache:e,gitdir:r}){let i;try{i=await $.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof oe)return[]}let{tree:n}=await vs({fs:t,cache:e,gitdir:r,oid:i});return n}l(S$,"getHeadTree");async function e1({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:f=!1}){try{S("fs",t),S("gitdir",r),S("ref",i);let o=new M(t);return await Gr({fs:o,cache:a,dir:e,gitdir:r,trees:[ht({ref:i}),_s(),Ii()],map:l(async function(c,[u,h,d]){if(!u&&!d&&h&&!f&&await Kr.isIgnored({fs:o,dir:e,filepath:c})||!n.some(D=>LS(c,D)))return null;if(s&&!s(c))return;let[p,m,w]=await Promise.all([u&&u.type(),h&&h.type(),d&&d.type()]),y=[p,m,w].includes("blob");if((p==="tree"||p==="special")&&!y)return;if(p==="commit")return null;if((m==="tree"||m==="special")&&!y)return;if(w==="commit")return null;if((w==="tree"||w==="special")&&!y)return;let g=p==="blob"?await u.oid():void 0,_=w==="blob"?await d.oid():void 0,F;p!=="blob"&&m==="blob"&&w!=="blob"?F="42":m==="blob"&&(F=await h.oid());let R=[void 0,g,F,_],k=R.map(D=>R.indexOf(D));return k.shift(),[c,...k]},"map")})}catch(o){throw o.caller="git.statusMatrix",o}}l(e1,"statusMatrix");async function t1({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,object:n,force:s=!1}){try{S("fs",t),S("gitdir",r),S("ref",i);let a=new M(t);if(i===void 0)throw new tt("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let f=await $.resolve({fs:a,gitdir:r,ref:n||"HEAD"});if(!s&&await $.exists({fs:a,gitdir:r,ref:i}))throw new jt("tag",i);await $.writeRef({fs:a,gitdir:r,ref:i,value:f})}catch(a){throw a.caller="git.tag",a}}l(t1,"tag");async function r1({fs:t,dir:e,gitdir:r=C.join(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:f,remove:o,force:c}){try{S("fs",t),S("gitdir",r),S("filepath",n);let u=new M(t);if(o)return await ge.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!c){let p=await u.lstat(C.join(e,n));if(p){if(p.isDirectory())throw new Vr("directory");return}}d.has({filepath:n})&&d.delete({filepath:n})});let h;if(!s){if(h=await u.lstat(C.join(e,n)),!h)throw new oe(`file at "${n}" on disk and "remove" not set`);if(h.isDirectory())throw new Vr("directory")}return await ge.acquire({fs:u,gitdir:r,cache:i},async function(d){if(!f&&!d.has({filepath:n}))throw new oe(`file at "${n}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:a,uid:0,gid:0,size:0};else{p=h;let m=p.isSymbolicLink()?await u.readlink(C.join(e,n)):await u.read(C.join(e,n));s=await nt({fs:u,gitdir:r,type:"blob",format:"content",object:m})}return d.insert({filepath:n,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}l(r1,"updateIndex$1");function i1(){try{return Ef.version}catch(t){throw t.caller="git.version",t}}l(i1,"version");async function n1({fs:t,dir:e,gitdir:r=C.join(e,".git"),trees:i,map:n,reduce:s,iterate:a,cache:f={}}){try{return S("fs",t),S("gitdir",r),S("trees",i),await Gr({fs:new M(t),cache:f,dir:e,gitdir:r,trees:i,map:n,reduce:s,iterate:a})}catch(o){throw o.caller="git.walk",o}}l(n1,"walk");async function s1({fs:t,dir:e,gitdir:r=C.join(e,".git"),blob:i}){try{return S("fs",t),S("gitdir",r),S("blob",i),await nt({fs:new M(t),gitdir:r,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}l(s1,"writeBlob");async function a1({fs:t,dir:e,gitdir:r=C.join(e,".git"),commit:i}){try{return S("fs",t),S("gitdir",r),S("commit",i),await GF({fs:new M(t),gitdir:r,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}l(a1,"writeCommit");async function o1({fs:t,dir:e,gitdir:r=C.join(e,".git"),type:i,object:n,format:s="parsed",oid:a,encoding:f=void 0}){try{let o=new M(t);if(s==="parsed"){switch(i){case"commit":n=it.from(n).toObject();break;case"tree":n=rt.from(n).toObject();break;case"blob":n=Buffer.from(n,f);break;case"tag":n=dt.from(n).toObject();break;default:throw new Ye(a||"",i,"blob|commit|tag|tree")}s="content"}return a=await nt({fs:o,gitdir:r,type:i,object:n,oid:a,format:s}),a}catch(o){throw o.caller="git.writeObject",o}}l(o1,"writeObject");async function c1({fs:t,dir:e,gitdir:r=C.join(e,".git"),ref:i,value:n,force:s=!1,symbolic:a=!1}){try{S("fs",t),S("gitdir",r),S("ref",i),S("value",n);let f=new M(t);if(!Va(i,!0))throw new Lt(i,Ha.clean(i));if(!s&&await $.exists({fs:f,gitdir:r,ref:i}))throw new jt("ref",i);a?await $.writeSymbolicRef({fs:f,gitdir:r,ref:i,value:n}):(n=await $.resolve({fs:f,gitdir:r,ref:n}),await $.writeRef({fs:f,gitdir:r,ref:i,value:n}))}catch(f){throw f.caller="git.writeRef",f}}l(c1,"writeRef");async function F$({fs:t,gitdir:e,tag:r}){let i=dt.from(r).toObject();return await nt({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}l(F$,"_writeTag");async function l1({fs:t,dir:e,gitdir:r=C.join(e,".git"),tag:i}){try{return S("fs",t),S("gitdir",r),S("tag",i),await F$({fs:new M(t),gitdir:r,tag:i})}catch(n){throw n.caller="git.writeTag",n}}l(l1,"writeTag");async function f1({fs:t,dir:e,gitdir:r=C.join(e,".git"),tree:i}){try{return S("fs",t),S("gitdir",r),S("tree",i),await uo({fs:new M(t),gitdir:r,tree:i})}catch(n){throw n.caller="git.writeTree",n}}l(f1,"writeTree");var T$={Errors:TS,STAGE:Ii,TREE:ht,WORKDIR:_s,add:AS,abortMerge:OS,addNote:IS,addRemote:BS,annotatedTag:MS,branch:jS,checkout:nm,clone:HS,commit:VS,getConfig:oF,getConfigAll:cF,setConfig:VF,currentBranch:GS,deleteBranch:KS,deleteRef:JS,deleteRemote:XS,deleteTag:YS,expandOid:ZS,expandRef:QS,fastForward:rF,fetch:iF,findMergeBase:nF,findRoot:aF,getRemoteInfo:lF,getRemoteInfo2:uF,hashBlob:hF,indexPack:dF,init:pF,isDescendent:wF,isIgnored:yF,listBranches:gF,listFiles:_F,listNotes:vF,listRefs:EF,listRemotes:SF,listServerRefs:FF,listTags:TF,log:OF,merge:kF,packObjects:AF,pull:PF,push:NF,readBlob:IF,readCommit:om,readNote:$F,readObject:BF,readTag:MF,readTree:jF,remove:LF,removeNote:qF,renameBranch:UF,resetIndex:zF,updateIndex:r1,resolveRef:HF,status:ZF,statusMatrix:e1,tag:t1,version:i1,walk:n1,writeBlob:s1,writeCommit:a1,writeObject:o1,writeRef:c1,writeTag:l1,writeTree:f1,stash:YF};B.Errors=TS;B.STAGE=Ii;B.TREE=ht;B.WORKDIR=_s;B.abortMerge=OS;B.add=AS;B.addNote=IS;B.addRemote=BS;B.annotatedTag=MS;B.branch=jS;B.checkout=nm;B.clone=HS;B.commit=VS;B.currentBranch=GS;B.default=T$;B.deleteBranch=KS;B.deleteRef=JS;B.deleteRemote=XS;B.deleteTag=YS;B.expandOid=ZS;B.expandRef=QS;B.fastForward=rF;B.fetch=iF;B.findMergeBase=nF;B.findRoot=aF;B.getConfig=oF;B.getConfigAll=cF;B.getRemoteInfo=lF;B.getRemoteInfo2=uF;B.hashBlob=hF;B.indexPack=dF;B.init=pF;B.isDescendent=wF;B.isIgnored=yF;B.listBranches=gF;B.listFiles=_F;B.listNotes=vF;B.listRefs=EF;B.listRemotes=SF;B.listServerRefs=FF;B.listTags=TF;B.log=OF;B.merge=kF;B.packObjects=AF;B.pull=PF;B.push=NF;B.readBlob=IF;B.readCommit=om;B.readNote=$F;B.readObject=BF;B.readTag=MF;B.readTree=jF;B.remove=LF;B.removeNote=qF;B.renameBranch=UF;B.resetIndex=zF;B.resolveRef=HF;B.setConfig=VF;B.stash=YF;B.status=ZF;B.statusMatrix=e1;B.tag=t1;B.updateIndex=r1;B.version=i1;B.walk=n1;B.writeBlob=s1;B.writeCommit=a1;B.writeObject=o1;B.writeRef=c1;B.writeTag=l1;B.writeTree=f1});var h1=T((nz,u1)=>{u1.exports=function(t,e){var r=[];t.on("data",function(i){r.push(i)}),t.once("end",function(){e&&e(null,Buffer.concat(r)),e=null}),t.once("error",function(i){e&&e(i),e=null})}});var p1=T((sz,d1)=>{"use strict";var R$=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];d1.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(R$)),i={};for(let n of r)n in e||(i[n]={get(){let s=t[n];return typeof s=="function"?s.bind(t):s},set(s){t[n]=s},enumerable:!0,configurable:!1});return Object.defineProperties(e,i),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var w1=T((az,m1)=>{"use strict";var{Transform:O$,PassThrough:k$}=se("stream"),Tm=se("zlib"),x$=p1();m1.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof Tm.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let i=!0,n=new O$({transform(f,o,c){i=!1,c(null,f)},flush(f){f()}}),s=new k$({autoDestroy:!1,destroy(f,o){t.destroy(),o(f)}}),a=r?Tm.createBrotliDecompress():Tm.createUnzip();return a.once("error",f=>{if(i&&!t.readable){s.end();return}s.destroy(f)}),x$(t,s),t.pipe(n).pipe(a).pipe(s),s}});var b1=T((oz,g1)=>{g1.exports=y1;function y1(t,e){if(t&&e)return y1(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){r[i]=t[i]}),r;function r(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];var s=t.apply(this,i),a=i[i.length-1];return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(f){s[f]=a[f]}),s}l(r,"wrapper")}l(y1,"wrappy")});var E1=T((lz,Rm)=>{var _1=b1();Rm.exports=_1(Sf);Rm.exports.strict=_1(v1);Sf.proto=Sf(function(){Object.defineProperty(Function.prototype,"once",{value:l(function(){return Sf(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:l(function(){return v1(this)},"value"),configurable:!0})});function Sf(t){var e=l(function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))},"f");return e.called=!1,e}l(Sf,"once");function v1(t){var e=l(function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},"f"),r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}l(v1,"onceStrict")});var R1=T((uz,T1)=>{T1.exports=Es;var A$=h1(),S1=w1(),P$=se("http"),N$=se("https"),D$=E1(),C$=se("querystring"),F1=se("url"),Om=l(t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function","isStream");function Es(t,e){if(t=Object.assign({maxRedirects:10},typeof t=="string"?{url:t}:t),e=D$(e),t.url){let{hostname:f,port:o,protocol:c,auth:u,path:h}=F1.parse(t.url);delete t.url,!f&&!o&&!c&&!u?t.path=h:Object.assign(t,{hostname:f,port:o,protocol:c,auth:u,path:h})}let r={"accept-encoding":"gzip, deflate"};t.headers&&Object.keys(t.headers).forEach(f=>r[f.toLowerCase()]=t.headers[f]),t.headers=r;let i;t.body?i=t.json&&!Om(t.body)?JSON.stringify(t.body):t.body:t.form&&(i=typeof t.form=="string"?t.form:C$.stringify(t.form),t.headers["content-type"]="application/x-www-form-urlencoded"),i&&(t.method||(t.method="POST"),Om(i)||(t.headers["content-length"]=Buffer.byteLength(i)),t.json&&!t.form&&(t.headers["content-type"]="application/json")),delete t.body,delete t.form,t.json&&(t.headers.accept="application/json"),t.method&&(t.method=t.method.toUpperCase());let n=t.hostname,a=(t.protocol==="https:"?N$:P$).request(t,f=>{if(t.followRedirects!==!1&&f.statusCode>=300&&f.statusCode<400&&f.headers.location){t.url=f.headers.location,delete t.headers.host,f.resume();let c=F1.parse(t.url).hostname;return c!==null&&c!==n&&(delete t.headers.cookie,delete t.headers.authorization),t.method==="POST"&&[301,302].includes(f.statusCode)&&(t.method="GET",delete t.headers["content-length"],delete t.headers["content-type"]),t.maxRedirects--===0?e(new Error("too many redirects")):Es(t,e)}let o=typeof S1=="function"&&t.method!=="HEAD";e(null,o?S1(f):f)});return a.on("timeout",()=>{a.abort(),e(new Error("Request timed out"))}),a.on("error",e),Om(i)?i.on("error",e).pipe(a):a.end(i),a}l(Es,"simpleGet");Es.concat=(t,e)=>Es(t,(r,i)=>{if(r)return e(r);A$(i,(n,s)=>{if(n)return e(n);if(t.json)try{s=JSON.parse(s.toString())}catch(a){return e(a,i,s)}e(null,i,s)})});["get","post","put","patch","head","delete"].forEach(t=>{Es[t]=(e,r)=>(typeof e=="string"&&(e={url:e}),Es(Object.assign({method:t.toUpperCase()},e),r))})});var km=T((dz,O1)=>{O1.exports=se("stream")});var D1=T((pz,N1)=>{"use strict";function k1(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}l(k1,"ownKeys");function x1(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?k1(Object(r),!0).forEach(function(i){I$(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k1(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}l(x1,"_objectSpread");function I$(t,e,r){return e=P1(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}l(I$,"_defineProperty");function $$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}l($$,"_classCallCheck");function A1(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,P1(i.key),i)}}l(A1,"_defineProperties");function B$(t,e,r){return e&&A1(t.prototype,e),r&&A1(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}l(B$,"_createClass");function P1(t){var e=M$(t,"string");return typeof e=="symbol"?e:String(e)}l(P1,"_toPropertyKey");function M$(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}l(M$,"_toPrimitive");var j$=se("buffer"),Ff=j$.Buffer,L$=se("util"),xm=L$.inspect,q$=xm&&xm.custom||"inspect";function U$(t,e,r){Ff.prototype.copy.call(t,e,r)}l(U$,"copyBuffer");N1.exports=function(){function t(){$$(this,t),this.head=null,this.tail=null,this.length=0}return l(t,"BufferList"),B$(t,[{key:"push",value:l(function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},"push")},{key:"unshift",value:l(function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},"unshift")},{key:"shift",value:l(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift")},{key:"clear",value:l(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:l(function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n},"join")},{key:"concat",value:l(function(r){if(this.length===0)return Ff.alloc(0);for(var i=Ff.allocUnsafe(r>>>0),n=this.head,s=0;n;)U$(n.data,i,s),s+=n.data.length,n=n.next;return i},"concat")},{key:"consume",value:l(function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n},"consume")},{key:"first",value:l(function(){return this.head.data},"first")},{key:"_getString",value:l(function(r){var i=this.head,n=1,s=i.data;for(r-=s.length;i=i.next;){var a=i.data,f=r>a.length?a.length:r;if(f===a.length?s+=a:s+=a.slice(0,r),r-=f,r===0){f===a.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(f));break}++n}return this.length-=n,s},"_getString")},{key:"_getBuffer",value:l(function(r){var i=Ff.allocUnsafe(r),n=this.head,s=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var a=n.data,f=r>a.length?a.length:r;if(a.copy(i,i.length-r,0,f),r-=f,r===0){f===a.length?(++s,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(f));break}++s}return this.length-=s,i},"_getBuffer")},{key:q$,value:l(function(r,i){return xm(this,x1(x1({},i),{},{depth:0,customInspect:!1}))},"value")}]),t}()});var Pm=T((wz,I1)=>{"use strict";function W$(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(Am,this,t)):process.nextTick(Am,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Tf,r):(r._writableState.errorEmitted=!0,process.nextTick(C1,r,s)):process.nextTick(C1,r,s):e?(process.nextTick(Tf,r),e(s)):process.nextTick(Tf,r)}),this)}l(W$,"destroy");function C1(t,e){Am(t,e),Tf(t)}l(C1,"emitErrorAndCloseNT");function Tf(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}l(Tf,"emitCloseNT");function z$(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}l(z$,"undestroy");function Am(t,e){t.emit("error",e)}l(Am,"emitErrorNT");function H$(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}l(H$,"errorOrDestroy");I1.exports={destroy:W$,undestroy:z$,errorOrDestroy:H$}});var Yr=T((gz,M1)=>{"use strict";var B1={};function Ot(t,e,r){r||(r=Error);function i(a,f,o){return typeof e=="string"?e:e(a,f,o)}l(i,"getMessage");let s=class s extends r{constructor(f,o,c){super(i(f,o,c))}};l(s,"NodeError");let n=s;n.prototype.name=r.name,n.prototype.code=t,B1[t]=n}l(Ot,"createErrorType");function $1(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(i=>String(i)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}l($1,"oneOf");function V$(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}l(V$,"startsWith");function G$(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}l(G$,"endsWith");function K$(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}l(K$,"includes");Ot("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ot("ERR_INVALID_ARG_TYPE",function(t,e,r){let i;typeof e=="string"&&V$(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";let n;if(G$(t," argument"))n=`The ${t} ${i} ${$1(e,"type")}`;else{let s=K$(t,".")?"property":"argument";n=`The "${t}" ${s} ${i} ${$1(e,"type")}`}return n+=`. Received type ${typeof r}`,n},TypeError);Ot("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ot("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ot("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ot("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ot("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ot("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ot("ERR_STREAM_WRITE_AFTER_END","write after end");Ot("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ot("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ot("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");M1.exports.codes=B1});var Nm=T((_z,j1)=>{"use strict";var J$=Yr().codes.ERR_INVALID_OPT_VALUE;function X$(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}l(X$,"highWaterMarkFrom");function Y$(t,e,r,i){var n=X$(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var s=i?r:"highWaterMark";throw new J$(s,n)}return Math.floor(n)}return t.objectMode?16:16*1024}l(Y$,"getHighWaterMark");j1.exports={getHighWaterMark:Y$}});var q1=T((Ez,L1)=>{L1.exports=se("util").deprecate});var Im=T((Sz,G1)=>{"use strict";G1.exports=we;function W1(t){var e=this;this.next=null,this.entry=null,this.finish=function(){FB(e,t)}}l(W1,"CorkedRequest");var Ss;we.WritableState=mo;var Z$={deprecate:q1()},z1=km(),Of=se("buffer").Buffer,Q$=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function eB(t){return Of.from(t)}l(eB,"_uint8ArrayToBuffer");function tB(t){return Of.isBuffer(t)||t instanceof Q$}l(tB,"_isUint8Array");var Cm=Pm(),rB=Nm(),iB=rB.getHighWaterMark,Zr=Yr().codes,nB=Zr.ERR_INVALID_ARG_TYPE,sB=Zr.ERR_METHOD_NOT_IMPLEMENTED,aB=Zr.ERR_MULTIPLE_CALLBACK,oB=Zr.ERR_STREAM_CANNOT_PIPE,cB=Zr.ERR_STREAM_DESTROYED,lB=Zr.ERR_STREAM_NULL_VALUES,fB=Zr.ERR_STREAM_WRITE_AFTER_END,uB=Zr.ERR_UNKNOWN_ENCODING,Fs=Cm.errorOrDestroy;bi()(we,z1);function hB(){}l(hB,"nop");function mo(t,e,r){Ss=Ss||$i(),t=t||{},typeof r!="boolean"&&(r=e instanceof Ss),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=iB(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=t.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){bB(e,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new W1(this)}l(mo,"WritableState");mo.prototype.getBuffer=l(function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r},"getBuffer");(function(){try{Object.defineProperty(mo.prototype,"buffer",{get:Z$.deprecate(l(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Rf;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Rf=Function.prototype[Symbol.hasInstance],Object.defineProperty(we,Symbol.hasInstance,{value:l(function(e){return Rf.call(this,e)?!0:this!==we?!1:e&&e._writableState instanceof mo},"value")})):Rf=l(function(e){return e instanceof this},"realHasInstance");function we(t){Ss=Ss||$i();var e=this instanceof Ss;if(!e&&!Rf.call(we,this))return new we(t);this._writableState=new mo(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),z1.call(this)}l(we,"Writable");we.prototype.pipe=function(){Fs(this,new oB)};function dB(t,e){var r=new fB;Fs(t,r),process.nextTick(e,r)}l(dB,"writeAfterEnd");function pB(t,e,r,i){var n;return r===null?n=new lB:typeof r!="string"&&!e.objectMode&&(n=new nB("chunk",["string","Buffer"],r)),n?(Fs(t,n),process.nextTick(i,n),!1):!0}l(pB,"validChunk");we.prototype.write=function(t,e,r){var i=this._writableState,n=!1,s=!i.objectMode&&tB(t);return s&&!Of.isBuffer(t)&&(t=eB(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=hB),i.ending?dB(this,r):(s||pB(this,i,t,r))&&(i.pendingcb++,n=wB(this,i,s,t,e,r)),n};we.prototype.cork=function(){this._writableState.corked++};we.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&H1(this,t))};we.prototype.setDefaultEncoding=l(function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new uB(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");Object.defineProperty(we.prototype,"writableBuffer",{enumerable:!1,get:l(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function mB(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=Of.from(e,r)),e}l(mB,"decodeChunk");Object.defineProperty(we.prototype,"writableHighWaterMark",{enumerable:!1,get:l(function(){return this._writableState.highWaterMark},"get")});function wB(t,e,r,i,n,s){if(!r){var a=mB(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var f=e.objectMode?1:i.length;e.length+=f;var o=e.length<e.highWaterMark;if(o||(e.needDrain=!0),e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else Dm(t,e,!1,f,i,n,s);return o}l(wB,"writeOrBuffer");function Dm(t,e,r,i,n,s,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new cB("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}l(Dm,"doWrite");function yB(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(po,t,e),t._writableState.errorEmitted=!0,Fs(t,i)):(n(i),t._writableState.errorEmitted=!0,Fs(t,i),po(t,e))}l(yB,"onwriteError");function gB(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}l(gB,"onwriteStateUpdate");function bB(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new aB;if(gB(r),e)yB(t,r,i,e,n);else{var s=V1(r)||t.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&H1(t,r),i?process.nextTick(U1,t,r,s,n):U1(t,r,s,n)}}l(bB,"onwrite");function U1(t,e,r,i){r||_B(t,e),e.pendingcb--,i(),po(t,e)}l(U1,"afterWrite");function _B(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}l(_B,"onwriteDrain");function H1(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,f=!0;r;)n[a]=r,r.isBuf||(f=!1),r=r.next,a+=1;n.allBuffers=f,Dm(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new W1(e),e.bufferedRequestCount=0}else{for(;r;){var o=r.chunk,c=r.encoding,u=r.callback,h=e.objectMode?1:o.length;if(Dm(t,e,!1,h,o,c,u),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}l(H1,"clearBuffer");we.prototype._write=function(t,e,r){r(new sB("_write()"))};we.prototype._writev=null;we.prototype.end=function(t,e,r){var i=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||SB(this,i,r),this};Object.defineProperty(we.prototype,"writableLength",{enumerable:!1,get:l(function(){return this._writableState.length},"get")});function V1(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}l(V1,"needFinish");function vB(t,e){t._final(function(r){e.pendingcb--,r&&Fs(t,r),e.prefinished=!0,t.emit("prefinish"),po(t,e)})}l(vB,"callFinal");function EB(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(vB,t,e)):(e.prefinished=!0,t.emit("prefinish")))}l(EB,"prefinish");function po(t,e){var r=V1(e);if(r&&(EB(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}l(po,"finishMaybe");function SB(t,e,r){e.ending=!0,po(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}l(SB,"endWritable");function FB(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}l(FB,"onCorkedFinish");Object.defineProperty(we.prototype,"destroyed",{enumerable:!1,get:l(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:l(function(e){this._writableState&&(this._writableState.destroyed=e)},"set")});we.prototype.destroy=Cm.destroy;we.prototype._undestroy=Cm.undestroy;we.prototype._destroy=function(t,e){e(t)}});var $i=T((Tz,J1)=>{"use strict";var TB=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};J1.exports=ar;var K1=Mm(),Bm=Im();bi()(ar,K1);for($m=TB(Bm.prototype),kf=0;kf<$m.length;kf++)xf=$m[kf],ar.prototype[xf]||(ar.prototype[xf]=Bm.prototype[xf]);var $m,xf,kf;function ar(t){if(!(this instanceof ar))return new ar(t);K1.call(this,t),Bm.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",RB)))}l(ar,"Duplex");Object.defineProperty(ar.prototype,"writableHighWaterMark",{enumerable:!1,get:l(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(ar.prototype,"writableBuffer",{enumerable:!1,get:l(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(ar.prototype,"writableLength",{enumerable:!1,get:l(function(){return this._writableState.length},"get")});function RB(){this._writableState.ended||process.nextTick(OB,this)}l(RB,"onend");function OB(t){t.end()}l(OB,"onEndNT");Object.defineProperty(ar.prototype,"destroyed",{enumerable:!1,get:l(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:l(function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)},"set")})});var qm=T(Y1=>{"use strict";var Lm=_a().Buffer,X1=Lm.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function kB(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}l(kB,"_normalizeEncoding");function xB(t){var e=kB(t);if(typeof e!="string"&&(Lm.isEncoding===X1||!X1(t)))throw new Error("Unknown encoding: "+t);return e||t}l(xB,"normalizeEncoding");Y1.StringDecoder=wo;function wo(t){this.encoding=xB(t);var e;switch(this.encoding){case"utf16le":this.text=IB,this.end=$B,e=4;break;case"utf8":this.fillLast=NB,e=4;break;case"base64":this.text=BB,this.end=MB,e=3;break;default:this.write=jB,this.end=LB;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Lm.allocUnsafe(e)}l(wo,"StringDecoder");wo.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};wo.prototype.end=CB;wo.prototype.text=DB;wo.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function jm(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}l(jm,"utf8CheckByte");function AB(t,e,r){var i=e.length-1;if(i<r)return 0;var n=jm(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=jm(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=jm(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}l(AB,"utf8CheckIncomplete");function PB(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}l(PB,"utf8CheckExtraBytes");function NB(t){var e=this.lastTotal-this.lastNeed,r=PB(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}l(NB,"utf8FillLast");function DB(t,e){var r=AB(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}l(DB,"utf8Text");function CB(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}l(CB,"utf8End");function IB(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}l(IB,"utf16Text");function $B(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}l($B,"utf16End");function BB(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}l(BB,"base64Text");function MB(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}l(MB,"base64End");function jB(t){return t.toString(this.encoding)}l(jB,"simpleWrite");function LB(t){return t&&t.length?this.write(t):""}l(LB,"simpleEnd")});var Af=T((xz,eT)=>{"use strict";var Z1=Yr().codes.ERR_STREAM_PREMATURE_CLOSE;function qB(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}l(qB,"once");function UB(){}l(UB,"noop");function WB(t){return t.setHeader&&typeof t.abort=="function"}l(WB,"isRequest");function Q1(t,e,r){if(typeof e=="function")return Q1(t,null,e);e||(e={}),r=qB(r||UB);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,s=l(function(){t.writable||f()},"onlegacyfinish"),a=t._writableState&&t._writableState.finished,f=l(function(){n=!1,a=!0,i||r.call(t)},"onfinish"),o=t._readableState&&t._readableState.endEmitted,c=l(function(){i=!1,o=!0,n||r.call(t)},"onend"),u=l(function(m){r.call(t,m)},"onerror"),h=l(function(){var m;if(i&&!o)return(!t._readableState||!t._readableState.ended)&&(m=new Z1),r.call(t,m);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(m=new Z1),r.call(t,m)},"onclose"),d=l(function(){t.req.on("finish",f)},"onrequest");return WB(t)?(t.on("complete",f),t.on("abort",h),t.req?d():t.on("request",d)):n&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",c),t.on("finish",f),e.error!==!1&&t.on("error",u),t.on("close",h),function(){t.removeListener("complete",f),t.removeListener("abort",h),t.removeListener("request",d),t.req&&t.req.removeListener("finish",f),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",f),t.removeListener("end",c),t.removeListener("error",u),t.removeListener("close",h)}}l(Q1,"eos");eT.exports=Q1});var rT=T((Pz,tT)=>{"use strict";var Pf;function Qr(t,e,r){return e=zB(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}l(Qr,"_defineProperty");function zB(t){var e=HB(t,"string");return typeof e=="symbol"?e:String(e)}l(zB,"_toPropertyKey");function HB(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}l(HB,"_toPrimitive");var VB=Af(),ei=Symbol("lastResolve"),Bi=Symbol("lastReject"),yo=Symbol("error"),Nf=Symbol("ended"),Mi=Symbol("lastPromise"),Um=Symbol("handlePromise"),ji=Symbol("stream");function ti(t,e){return{value:t,done:e}}l(ti,"createIterResult");function GB(t){var e=t[ei];if(e!==null){var r=t[ji].read();r!==null&&(t[Mi]=null,t[ei]=null,t[Bi]=null,e(ti(r,!1)))}}l(GB,"readAndResolve");function KB(t){process.nextTick(GB,t)}l(KB,"onReadable");function JB(t,e){return function(r,i){t.then(function(){if(e[Nf]){r(ti(void 0,!0));return}e[Um](r,i)},i)}}l(JB,"wrapForNext");var XB=Object.getPrototypeOf(function(){}),YB=Object.setPrototypeOf((Pf={get stream(){return this[ji]},next:l(function(){var e=this,r=this[yo];if(r!==null)return Promise.reject(r);if(this[Nf])return Promise.resolve(ti(void 0,!0));if(this[ji].destroyed)return new Promise(function(a,f){process.nextTick(function(){e[yo]?f(e[yo]):a(ti(void 0,!0))})});var i=this[Mi],n;if(i)n=new Promise(JB(i,this));else{var s=this[ji].read();if(s!==null)return Promise.resolve(ti(s,!1));n=new Promise(this[Um])}return this[Mi]=n,n},"next")},Qr(Pf,Symbol.asyncIterator,function(){return this}),Qr(Pf,"return",l(function(){var e=this;return new Promise(function(r,i){e[ji].destroy(null,function(n){if(n){i(n);return}r(ti(void 0,!0))})})},"_return")),Pf),XB),ZB=l(function(e){var r,i=Object.create(YB,(r={},Qr(r,ji,{value:e,writable:!0}),Qr(r,ei,{value:null,writable:!0}),Qr(r,Bi,{value:null,writable:!0}),Qr(r,yo,{value:null,writable:!0}),Qr(r,Nf,{value:e._readableState.endEmitted,writable:!0}),Qr(r,Um,{value:l(function(s,a){var f=i[ji].read();f?(i[Mi]=null,i[ei]=null,i[Bi]=null,s(ti(f,!1))):(i[ei]=s,i[Bi]=a)},"value"),writable:!0}),r));return i[Mi]=null,VB(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=i[Bi];s!==null&&(i[Mi]=null,i[ei]=null,i[Bi]=null,s(n)),i[yo]=n;return}var a=i[ei];a!==null&&(i[Mi]=null,i[ei]=null,i[Bi]=null,a(ti(void 0,!0))),i[Nf]=!0}),e.on("readable",KB.bind(null,i)),i},"createReadableStreamAsyncIterator");tT.exports=ZB});var aT=T((Dz,sT)=>{"use strict";function iT(t,e,r,i,n,s,a){try{var f=t[s](a),o=f.value}catch(c){r(c);return}f.done?e(o):Promise.resolve(o).then(i,n)}l(iT,"asyncGeneratorStep");function QB(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var s=t.apply(e,r);function a(o){iT(s,i,n,a,f,"next",o)}l(a,"_next");function f(o){iT(s,i,n,a,f,"throw",o)}l(f,"_throw"),a(void 0)})}}l(QB,"_asyncToGenerator");function nT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}l(nT,"ownKeys");function eM(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nT(Object(r),!0).forEach(function(i){tM(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nT(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}l(eM,"_objectSpread");function tM(t,e,r){return e=rM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}l(tM,"_defineProperty");function rM(t){var e=iM(t,"string");return typeof e=="symbol"?e:String(e)}l(rM,"_toPropertyKey");function iM(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}l(iM,"_toPrimitive");var nM=Yr().codes.ERR_INVALID_ARG_TYPE;function sM(t,e,r){var i;if(e&&typeof e.next=="function")i=e;else if(e&&e[Symbol.asyncIterator])i=e[Symbol.asyncIterator]();else if(e&&e[Symbol.iterator])i=e[Symbol.iterator]();else throw new nM("iterable",["Iterable"],e);var n=new t(eM({objectMode:!0},r)),s=!1;n._read=function(){s||(s=!0,a())};function a(){return f.apply(this,arguments)}l(a,"next");function f(){return f=QB(function*(){try{var o=yield i.next(),c=o.value,u=o.done;u?n.push(null):n.push(yield c)?a():s=!1}catch(h){n.destroy(h)}}),f.apply(this,arguments)}return l(f,"_next2"),n}l(sM,"from");sT.exports=sM});var Mm=T(($z,wT)=>{"use strict";wT.exports=ee;var Ts;ee.ReadableState=fT;var Iz=se("events").EventEmitter,lT=l(function(e,r){return e.listeners(r).length},"EElistenerCount"),bo=km(),Df=se("buffer").Buffer,aM=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oM(t){return Df.from(t)}l(oM,"_uint8ArrayToBuffer");function cM(t){return Df.isBuffer(t)||t instanceof aM}l(cM,"_isUint8Array");var Wm=se("util"),K;Wm&&Wm.debuglog?K=Wm.debuglog("stream"):K=l(function(){},"debug");var lM=D1(),Xm=Pm(),fM=Nm(),uM=fM.getHighWaterMark,Cf=Yr().codes,hM=Cf.ERR_INVALID_ARG_TYPE,dM=Cf.ERR_STREAM_PUSH_AFTER_EOF,pM=Cf.ERR_METHOD_NOT_IMPLEMENTED,mM=Cf.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Rs,zm,Hm;bi()(ee,bo);var go=Xm.errorOrDestroy,Vm=["error","close","destroy","pause","resume"];function wM(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}l(wM,"prependListener");function fT(t,e,r){Ts=Ts||$i(),t=t||{},typeof r!="boolean"&&(r=e instanceof Ts),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=uM(this,t,"readableHighWaterMark",r),this.buffer=new lM,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Rs||(Rs=qm().StringDecoder),this.decoder=new Rs(t.encoding),this.encoding=t.encoding)}l(fT,"ReadableState");function ee(t){if(Ts=Ts||$i(),!(this instanceof ee))return new ee(t);var e=this instanceof Ts;this._readableState=new fT(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),bo.call(this)}l(ee,"Readable");Object.defineProperty(ee.prototype,"destroyed",{enumerable:!1,get:l(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:l(function(e){this._readableState&&(this._readableState.destroyed=e)},"set")});ee.prototype.destroy=Xm.destroy;ee.prototype._undestroy=Xm.undestroy;ee.prototype._destroy=function(t,e){e(t)};ee.prototype.push=function(t,e){var r=this._readableState,i;return r.objectMode?i=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Df.from(t,e),e=""),i=!0),uT(this,t,e,!1,i)};ee.prototype.unshift=function(t){return uT(this,t,null,!0,!1)};function uT(t,e,r,i,n){K("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,bM(t,s);else{var a;if(n||(a=yM(s,e)),a)go(t,a);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Df.prototype&&(e=oM(e)),i)s.endEmitted?go(t,new mM):Gm(t,s,e,!0);else if(s.ended)go(t,new dM);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?Gm(t,s,e,!1):Jm(t,s)):Gm(t,s,e,!1)}else i||(s.reading=!1,Jm(t,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}l(uT,"readableAddChunk");function Gm(t,e,r,i){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&If(t)),Jm(t,e)}l(Gm,"addChunk");function yM(t,e){var r;return!cM(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new hM("chunk",["string","Buffer","Uint8Array"],e)),r}l(yM,"chunkInvalid");ee.prototype.isPaused=function(){return this._readableState.flowing===!1};ee.prototype.setEncoding=function(t){Rs||(Rs=qm().StringDecoder);var e=new Rs(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var oT=1073741824;function gM(t){return t>=oT?t=oT:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}l(gM,"computeNewHighWaterMark");function cT(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=gM(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}l(cT,"howMuchToRead");ee.prototype.read=function(t){K("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return K("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Km(this):If(this),null;if(t=cT(t,e),t===0&&e.ended)return e.length===0&&Km(this),null;var i=e.needReadable;K("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,K("length less than watermark",i)),e.ended||e.reading?(i=!1,K("reading or ended",i)):i&&(K("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=cT(r,e)));var n;return t>0?n=pT(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Km(this)),n!==null&&this.emit("data",n),n};function bM(t,e){if(K("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?If(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,hT(t)))}}l(bM,"onEofChunk");function If(t){var e=t._readableState;K("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(K("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(hT,t))}l(If,"emitReadable");function hT(t){var e=t._readableState;K("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Ym(t)}l(hT,"emitReadable_");function Jm(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(_M,t,e))}l(Jm,"maybeReadMore");function _M(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(K("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}l(_M,"maybeReadMore_");ee.prototype._read=function(t){go(this,new pM("_read()"))};ee.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t);break}i.pipesCount+=1,K("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,s=n?f:w;i.endEmitted?process.nextTick(s):r.once("end",s),t.on("unpipe",a);function a(y,g){K("onunpipe"),y===r&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,u())}l(a,"onunpipe");function f(){K("onend"),t.end()}l(f,"onend");var o=vM(r);t.on("drain",o);var c=!1;function u(){K("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",o),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",f),r.removeListener("end",w),r.removeListener("data",h),c=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&o()}l(u,"cleanup"),r.on("data",h);function h(y){K("ondata");var g=t.write(y);K("dest.write",g),g===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&mT(i.pipes,t)!==-1)&&!c&&(K("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}l(h,"ondata");function d(y){K("onerror",y),w(),t.removeListener("error",d),lT(t,"error")===0&&go(t,y)}l(d,"onerror"),wM(t,"error",d);function p(){t.removeListener("finish",m),w()}l(p,"onclose"),t.once("close",p);function m(){K("onfinish"),t.removeListener("close",p),w()}l(m,"onfinish"),t.once("finish",m);function w(){K("unpipe"),r.unpipe(t)}return l(w,"unpipe"),t.emit("pipe",r),i.flowing||(K("pipe resume"),r.resume()),t};function vM(t){return l(function(){var r=t._readableState;K("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&lT(t,"data")&&(r.flowing=!0,Ym(t))},"pipeOnDrainFunctionResult")}l(vM,"pipeOnDrain");ee.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=mT(e.pipes,t);return a===-1?this:(e.pipes.splice(a,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};ee.prototype.on=function(t,e){var r=bo.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,K("on readable",i.length,i.reading),i.length?If(this):i.reading||process.nextTick(EM,this)),r};ee.prototype.addListener=ee.prototype.on;ee.prototype.removeListener=function(t,e){var r=bo.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(dT,this),r};ee.prototype.removeAllListeners=function(t){var e=bo.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(dT,this),e};function dT(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}l(dT,"updateReadableListening");function EM(t){K("readable nexttick read 0"),t.read(0)}l(EM,"nReadingNextTick");ee.prototype.resume=function(){var t=this._readableState;return t.flowing||(K("resume"),t.flowing=!t.readableListening,SM(this,t)),t.paused=!1,this};function SM(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(FM,t,e))}l(SM,"resume");function FM(t,e){K("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Ym(t),e.flowing&&!e.reading&&t.read(0)}l(FM,"resume_");ee.prototype.pause=function(){return K("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(K("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ym(t){var e=t._readableState;for(K("flow",e.flowing);e.flowing&&t.read()!==null;);}l(Ym,"flow");ee.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(K("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&e.push(a)}e.push(null)}),t.on("data",function(a){if(K("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var f=e.push(a);f||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=l(function(f){return l(function(){return t[f].apply(t,arguments)},"methodWrapReturnFunction")},"methodWrap")(n));for(var s=0;s<Vm.length;s++)t.on(Vm[s],this.emit.bind(this,Vm[s]));return this._read=function(a){K("wrapped _read",a),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(ee.prototype[Symbol.asyncIterator]=function(){return zm===void 0&&(zm=rT()),zm(this)});Object.defineProperty(ee.prototype,"readableHighWaterMark",{enumerable:!1,get:l(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(ee.prototype,"readableBuffer",{enumerable:!1,get:l(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(ee.prototype,"readableFlowing",{enumerable:!1,get:l(function(){return this._readableState.flowing},"get"),set:l(function(e){this._readableState&&(this._readableState.flowing=e)},"set")});ee._fromList=pT;Object.defineProperty(ee.prototype,"readableLength",{enumerable:!1,get:l(function(){return this._readableState.length},"get")});function pT(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}l(pT,"fromList");function Km(t){var e=t._readableState;K("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(TM,e,t))}l(Km,"endReadable");function TM(t,e){if(K("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}l(TM,"endReadableNT");typeof Symbol=="function"&&(ee.from=function(t,e){return Hm===void 0&&(Hm=aT()),Hm(ee,t,e)});function mT(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}l(mT,"indexOf")});var Zm=T((Mz,gT)=>{"use strict";gT.exports=Fr;var $f=Yr().codes,RM=$f.ERR_METHOD_NOT_IMPLEMENTED,OM=$f.ERR_MULTIPLE_CALLBACK,kM=$f.ERR_TRANSFORM_ALREADY_TRANSFORMING,xM=$f.ERR_TRANSFORM_WITH_LENGTH_0,Bf=$i();bi()(Fr,Bf);function AM(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new OM);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}l(AM,"afterTransform");function Fr(t){if(!(this instanceof Fr))return new Fr(t);Bf.call(this,t),this._transformState={afterTransform:AM.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",PM)}l(Fr,"Transform");function PM(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){yT(t,e,r)}):yT(this,null,null)}l(PM,"prefinish");Fr.prototype.push=function(t,e){return this._transformState.needTransform=!1,Bf.prototype.push.call(this,t,e)};Fr.prototype._transform=function(t,e,r){r(new RM("_transform()"))};Fr.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};Fr.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};Fr.prototype._destroy=function(t,e){Bf.prototype._destroy.call(this,t,function(r){e(r)})};function yT(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new xM;if(t._transformState.transforming)throw new kM;return t.push(null)}l(yT,"done")});var vT=T((Lz,_T)=>{"use strict";_T.exports=_o;var bT=Zm();bi()(_o,bT);function _o(t){if(!(this instanceof _o))return new _o(t);bT.call(this,t)}l(_o,"PassThrough");_o.prototype._transform=function(t,e,r){r(null,t)}});var RT=T((Uz,TT)=>{"use strict";var Qm;function NM(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}l(NM,"once");var FT=Yr().codes,DM=FT.ERR_MISSING_ARGS,CM=FT.ERR_STREAM_DESTROYED;function ET(t){if(t)throw t}l(ET,"noop");function IM(t){return t.setHeader&&typeof t.abort=="function"}l(IM,"isRequest");function $M(t,e,r,i){i=NM(i);var n=!1;t.on("close",function(){n=!0}),Qm===void 0&&(Qm=Af()),Qm(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var s=!1;return function(a){if(!n&&!s){if(s=!0,IM(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new CM("pipe"))}}}l($M,"destroyer");function ST(t){t()}l(ST,"call");function BM(t,e){return t.pipe(e)}l(BM,"pipe");function MM(t){return!t.length||typeof t[t.length-1]!="function"?ET:t.pop()}l(MM,"popCallback");function jM(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=MM(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new DM("streams");var n,s=e.map(function(a,f){var o=f<e.length-1,c=f>0;return $M(a,o,c,function(u){n||(n=u),u&&s.forEach(ST),!o&&(s.forEach(ST),i(n))})});return e.reduce(BM)}l(jM,"pipeline");TT.exports=jM});var OT=T((kt,Eo)=>{var vo=se("stream");process.env.READABLE_STREAM==="disable"&&vo?(Eo.exports=vo.Readable,Object.assign(Eo.exports,vo),Eo.exports.Stream=vo):(kt=Eo.exports=Mm(),kt.Stream=vo||kt,kt.Readable=kt,kt.Writable=Im(),kt.Duplex=$i(),kt.Transform=Zm(),kt.PassThrough=vT(),kt.finished=Af(),kt.pipeline=RT())});var zt=T(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.constants=Ms.SEP=void 0;Ms.SEP="/";Ms.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}});var uw=T(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Stats=void 0;var cj=zt(),{S_IFMT:lj,S_IFDIR:fj,S_IFREG:uj,S_IFBLK:hj,S_IFCHR:dj,S_IFLNK:pj,S_IFIFO:mj,S_IFSOCK:wj}=cj.constants,tu=class tu{static build(e,r=!1){let i=new tu,{uid:n,gid:s,atime:a,mtime:f,ctime:o}=e,c=r?h=>BigInt(h):h=>h;i.uid=c(n),i.gid=c(s),i.rdev=c(e.rdev),i.blksize=c(4096),i.ino=c(e.ino),i.size=c(e.getSize()),i.blocks=c(1),i.atime=a,i.mtime=f,i.ctime=o,i.birthtime=o,i.atimeMs=c(a.getTime()),i.mtimeMs=c(f.getTime());let u=c(o.getTime());if(i.ctimeMs=u,i.birthtimeMs=u,r){i.atimeNs=BigInt(a.getTime())*BigInt(1e6),i.mtimeNs=BigInt(f.getTime())*BigInt(1e6);let h=BigInt(o.getTime())*BigInt(1e6);i.ctimeNs=h,i.birthtimeNs=h}return i.dev=c(0),i.mode=c(e.mode),i.nlink=c(e.nlink),i}_checkModeProperty(e){return(Number(this.mode)&lj)===e}isDirectory(){return this._checkModeProperty(fj)}isFile(){return this._checkModeProperty(uj)}isBlockDevice(){return this._checkModeProperty(hj)}isCharacterDevice(){return this._checkModeProperty(dj)}isSymbolicLink(){return this._checkModeProperty(pj)}isFIFO(){return this._checkModeProperty(mj)}isSocket(){return this._checkModeProperty(wj)}};l(tu,"Stats");var eu=tu;Fo.Stats=eu;Fo.default=eu});var hR=T(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.Buffer=void 0;var yj=se("node:buffer");Object.defineProperty(ru,"Buffer",{enumerable:!0,get:l(function(){return yj.Buffer},"get")})});var si=T(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.bufferFrom=ni.bufferAllocUnsafe=ni.Buffer=void 0;var iu=hR();Object.defineProperty(ni,"Buffer",{enumerable:!0,get:l(function(){return iu.Buffer},"get")});function dR(t,...e){return new iu.Buffer(t,...e)}l(dR,"bufferV0P12Ponyfill");var gj=iu.Buffer.allocUnsafe||dR;ni.bufferAllocUnsafe=gj;var bj=iu.Buffer.from||dR;ni.bufferFrom=bj});var dw=T(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.inherits=_j;js.promisify=vj;js.inspect=hw;js.format=Ej;function _j(t,e){if(t==null)throw new TypeError("The constructor to inherit from is not defined");if(e==null)throw new TypeError("The super constructor to inherit from is not defined");t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}l(_j,"inherits");function vj(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');return function(...e){return new Promise((r,i)=>{t.call(this,...e,(n,s)=>{n?i(n):r(s)})})}}l(vj,"promisify");function hw(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`'${t}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[ ${t.map(r=>hw(r)).join(", ")} ]`:typeof t=="object"?`{ ${Object.entries(t).map(([r,i])=>`${r}: ${hw(i)}`).join(", ")} }`:String(t)}l(hw,"inspect");function Ej(t,...e){if(e.length===0)return t;let r=t,i=0;for(r=r.replace(/%[sdj%]/g,n=>{if(i>=e.length)return n;let s=e[i++];switch(n){case"%s":return String(s);case"%d":return Number(s).toString();case"%j":try{return JSON.stringify(s)}catch{return"[Circular]"}case"%%":return"%";default:return n}});i<e.length;)r+=" "+String(e[i++]);return r}l(Ej,"format")});var To=T(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.AssertionError=Ve.RangeError=Ve.TypeError=Ve.Error=void 0;Ve.message=wR;Ve.E=ai;var pw=dw(),pR=typeof Symbol>"u"?"_kCode":Symbol("code"),mR={};function ww(t){var e;return e=class extends t{constructor(i,...n){super(wR(i,n)),this.code=i,this[pR]=i,this.name=`${super.name} [${this[pR]}]`}},l(e,"NodeError"),e}l(ww,"makeNodeError");var nu=globalThis,yw=class yw extends nu.Error{constructor(e){if(typeof e!="object"||e===null)throw new Ve.TypeError("ERR_INVALID_ARG_TYPE","options","object");e.message?super(e.message):super(`${(0,pw.inspect)(e.actual).slice(0,128)} ${e.operator} ${(0,pw.inspect)(e.expected).slice(0,128)}`),this.generatedMessage=!e.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,Ve.Error.captureStackTrace(this,e.stackStartFunction)}};l(yw,"AssertionError");var mw=yw;Ve.AssertionError=mw;function wR(t,e){if(typeof t!="string")throw new Ve.Error("Error message key must be a string");let r=mR[t];if(!r)throw new Ve.Error(`An invalid error message key was used: ${t}.`);let i;if(typeof r=="function")i=r;else{if(i=pw.format,e===void 0||e.length===0)return r;e.unshift(r)}return String(i.apply(null,e))}l(wR,"message");function ai(t,e){mR[t]=typeof e=="function"?e:String(e)}l(ai,"E");Ve.Error=ww(nu.Error);Ve.TypeError=ww(nu.TypeError);Ve.RangeError=ww(nu.RangeError);ai("ERR_DIR_CLOSED","Directory handle was closed");ai("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations");ai("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s');ai("ERR_INVALID_FILE_URL_PATH","File URL path %s");ai("ERR_INVALID_OPT_VALUE",(t,e)=>`The value "${String(e)}" is invalid for option "${t}"`);ai("ERR_INVALID_OPT_VALUE_ENCODING",t=>`The value "${String(t)}" is invalid for option "encoding"`);ai("ERR_INVALID_ARG_VALUE","Unable to open file as blob")});var Ro=T(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.ENCODING_UTF8=void 0;Wi.assertEncoding=Fj;Wi.strToEncoding=Tj;var gw=si(),Sj=To();Wi.ENCODING_UTF8="utf8";function Fj(t){if(t&&!gw.Buffer.isEncoding(t))throw new Sj.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",t)}l(Fj,"assertEncoding");function Tj(t,e){return!e||e===Wi.ENCODING_UTF8?t:e==="buffer"?new gw.Buffer(t):new gw.Buffer(t).toString(e)}l(Tj,"strToEncoding")});var ou=T(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.Dirent=void 0;var Rj=zt(),Oj=Ro(),{S_IFMT:kj,S_IFDIR:xj,S_IFREG:Aj,S_IFBLK:Pj,S_IFCHR:Nj,S_IFLNK:Dj,S_IFIFO:Cj,S_IFSOCK:Ij}=Rj.constants,au=class au{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(e,r){let i=new au,{mode:n}=e.getNode();return i.name=(0,Oj.strToEncoding)(e.getName(),r),i.mode=n,i.path=e.getParentPath(),i.parentPath=i.path,i}_checkModeProperty(e){return(this.mode&kj)===e}isDirectory(){return this._checkModeProperty(xj)}isFile(){return this._checkModeProperty(Aj)}isBlockDevice(){return this._checkModeProperty(Pj)}isCharacterDevice(){return this._checkModeProperty(Nj)}isSymbolicLink(){return this._checkModeProperty(Dj)}isFIFO(){return this._checkModeProperty(Cj)}isSocket(){return this._checkModeProperty(Ij)}};l(au,"Dirent");var su=au;Oo.Dirent=su;Oo.default=su});var Ls=T(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.basename=Se.isAbsolute=Se.normalize=Se.dirname=Se.relative=Se.join=Se.posix=Se.sep=Se.resolve=void 0;var Rr=se("node:path");Object.defineProperty(Se,"resolve",{enumerable:!0,get:l(function(){return Rr.resolve},"get")});Object.defineProperty(Se,"sep",{enumerable:!0,get:l(function(){return Rr.sep},"get")});Object.defineProperty(Se,"posix",{enumerable:!0,get:l(function(){return Rr.posix},"get")});Object.defineProperty(Se,"join",{enumerable:!0,get:l(function(){return Rr.join},"get")});Object.defineProperty(Se,"relative",{enumerable:!0,get:l(function(){return Rr.relative},"get")});Object.defineProperty(Se,"dirname",{enumerable:!0,get:l(function(){return Rr.dirname},"get")});Object.defineProperty(Se,"normalize",{enumerable:!0,get:l(function(){return Rr.normalize},"get")});Object.defineProperty(Se,"isAbsolute",{enumerable:!0,get:l(function(){return Rr.isAbsolute},"get")});Object.defineProperty(Se,"basename",{enumerable:!0,get:l(function(){return Rr.basename},"get")})});var gR=T(yR=>{"use strict";Object.defineProperty(yR,"__esModule",{value:!0})});var _w=T(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.flattenJSON=void 0;var bR=si(),bw=Ls(),$j=bw.posix?bw.posix.join:bw.join,Bj=l(t=>{let e={};function r(i,n){for(let s in n){let a=n[s],f=$j(i,s);typeof a=="string"||a instanceof bR.Buffer?e[f]=a:typeof a=="object"&&a!==null&&!(a instanceof bR.Buffer)&&Object.keys(a).length>0?r(f,a):e[f]=null}}return l(r,"flatten"),r("",t),e},"flattenJSON");cu.flattenJSON=Bj});var fu=T(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.createProcess=_R;var Mj=l(()=>{if(typeof process<"u")return process;try{return se("process")}catch{return}},"maybeReturnProcess");function _R(){let t=Mj()||{};return t.cwd||(t.cwd=()=>"/"),t.emitWarning||(t.emitWarning=(e,r)=>{console.warn(`${r}${r?": ":""}${e}`)}),t.env||(t.env={}),t}l(_R,"createProcess");lu.default=_R()});var Sw=T(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.Node=void 0;var jj=da(),SR=fu(),kr=si(),Lj=zt(),{S_IFMT:Or,S_IFDIR:qj,S_IFREG:Uj,S_IFLNK:vR,S_IFCHR:Wj}=Lj.constants,uu=l(()=>SR.default.getuid?.()??0,"getuid"),hu=l(()=>SR.default.getgid?.()??0,"getgid"),ER=(0,kr.bufferAllocUnsafe)(0),Ew=class Ew{constructor(e,r=438){this.changes=new jj.FanOut,this._uid=uu(),this._gid=hu(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.buf=ER,this.capacity=0,this.size=0,this.rdev=0,this._nlink=1,this.mode=r,this.ino=e}set ctime(e){this._ctime=e}get ctime(){return this._ctime}set uid(e){this._uid=e,this.ctime=new Date}get uid(){return this._uid}set gid(e){this._gid=e,this.ctime=new Date}get gid(){return this._gid}set atime(e){this._atime=e}get atime(){return this._atime}set mtime(e){this._mtime=e,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~Or}set perm(e){this.mode=this.mode&Or|e&~Or,this.ctime=new Date}set nlink(e){this._nlink=e,this.ctime=new Date}get nlink(){return this._nlink}getString(e="utf8"){return this.atime=new Date,this.getBuffer().toString(e)}setString(e){this._setBuf((0,kr.bufferFrom)(e,"utf8"))}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,kr.bufferAllocUnsafe)(0)),(0,kr.bufferFrom)(this.buf.subarray(0,this.size))}setBuffer(e){let r=(0,kr.bufferFrom)(e);this._setBuf(r)}_setBuf(e){let r=e.length;this.buf=e,this.capacity=r,this.size=r,this.touch()}getSize(){return this.size}setModeProperty(e){this.mode=e}isFile(){return(this.mode&Or)===Uj}isDirectory(){return(this.mode&Or)===qj}isSymlink(){return(this.mode&Or)===vR}isCharacterDevice(){return(this.mode&Or)===Wj}makeSymlink(e){this.mode=vR|438,this.symlink=e}write(e,r=0,i=e.length,n=0){let s=e.length;if(r+i>s&&(i=s-r),i<=0)return 0;let a=n+i;if(a>this.capacity){let f=Math.max(this.capacity*2,64);for(;f<a;)f*=2;let o=(0,kr.bufferAllocUnsafe)(f);this.size>0&&this.buf.copy(o,0,0,this.size),this.buf=o,this.capacity=f}return n>this.size&&this.buf.fill(0,this.size,n),e.copy(this.buf,n,r,r+i),a>this.size&&(this.size=a),this.touch(),i}read(e,r=0,i=e.byteLength,n=0){if(this.atime=new Date,n>=this.size)return 0;let s=i;if(s>e.byteLength&&(s=e.byteLength),s+n>this.size&&(s=this.size-n),s<=0)return 0;let a=e instanceof kr.Buffer?e:kr.Buffer.from(e.buffer,e.byteOffset,e.byteLength);return this.buf.copy(a,r,n,n+s),s}truncate(e=0){if(!e){this.buf=ER,this.capacity=0,this.size=0,this.touch();return}if(e<=this.size)this.size=e;else{if(e>this.capacity){let r=Math.max(this.capacity*2,64);for(;r<e;)r*=2;let i=(0,kr.bufferAllocUnsafe)(r);this.size>0&&this.buf.copy(i,0,0,this.size),i.fill(0,this.size,e),this.buf=i,this.capacity=r}else this.buf.fill(0,this.size,e);this.size=e}this.touch()}chmod(e){this.mode=this.mode&Or|e&~Or,this.touch()}chown(e,r){this.uid=e,this.gid=r,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(e=uu(),r=hu()){return!!(this.perm&4||r===this.gid&&this.perm&32||e===this.uid&&this.perm&256)}canWrite(e=uu(),r=hu()){return!!(this.perm&2||r===this.gid&&this.perm&16||e===this.uid&&this.perm&128)}canExecute(e=uu(),r=hu()){return!!(this.perm&1||r===this.gid&&this.perm&8||e===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}};l(Ew,"Node");var vw=Ew;du.Node=vw});var Tw=T(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.Link=void 0;var zj=zt(),Hj=da(),{S_IFREG:Vj}=zj.constants,ko=class ko{get steps(){return this._steps}set steps(e){this._steps=e;for(let[r,i]of this.children.entries())r==="."||r===".."||i?.syncSteps()}constructor(e,r,i){this.changes=new Hj.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=e,this.parent=r,this.name=i,this.syncSteps()}setNode(e){this.node=e,this.ino=e.ino}getNode(){return this.node}createChild(e,r=this.vol.createNode(Vj|438)){let i=new ko(this.vol,this,e);return i.setNode(r),r.isDirectory()&&(i.children.set(".",i),i.getNode().nlink++),this.setChild(e,i),i}setChild(e,r=new ko(this.vol,this,e)){return this.children.set(e,r),r.parent=this,this.length++,r.getNode().isDirectory()&&(r.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",r,this]),r}deleteChild(e){e.getNode().isDirectory()&&(e.children.delete(".."),this.getNode().nlink--),this.children.delete(e.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",e,this])}getChild(e){return this.getNode().atime=new Date,this.children.get(e)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}};l(ko,"Link");var Fw=ko;pu.Link=Fw});var kw=T(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.File=void 0;var Gj=zt(),{O_APPEND:Kj}=Gj.constants,Ow=class Ow{constructor(e,r,i,n){this.link=e,this.node=r,this.flags=i,this.fd=n,this.position=0,this.flags&Kj&&(this.position=this.getSize())}getString(e="utf8"){return this.node.getString()}setString(e){this.node.setString(e)}getBuffer(){return this.node.getBuffer()}setBuffer(e){this.node.setBuffer(e)}getSize(){return this.node.getSize()}truncate(e){this.node.truncate(e)}seekTo(e){this.position=e}write(e,r=0,i=e.length,n){typeof n!="number"&&(n=this.position);let s=this.node.write(e,r,i,n);return this.position=n+s,s}read(e,r=0,i=e.byteLength,n){typeof n!="number"&&(n=this.position);let s=this.node.read(e,r,i,n);return this.position=n+s,s}chmod(e){this.node.chmod(e)}chown(e,r){this.node.chown(e,r)}};l(Ow,"File");var Rw=Ow;mu.File=Rw});var Ws=T(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.FLAGS=Us.ERRSTR=void 0;var Jj=zt();Us.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:FR,O_WRONLY:wu,O_RDWR:qs,O_CREAT:oi,O_EXCL:yu,O_TRUNC:gu,O_APPEND:bu,O_SYNC:TR}=Jj.constants,RR;(function(t){t[t.r=FR]="r",t[t["r+"]=qs]="r+",t[t.rs=FR|TR]="rs",t[t.sr=t.rs]="sr",t[t["rs+"]=qs|TR]="rs+",t[t["sr+"]=t["rs+"]]="sr+",t[t.w=wu|oi|gu]="w",t[t.wx=wu|oi|gu|yu]="wx",t[t.xw=t.wx]="xw",t[t["w+"]=qs|oi|gu]="w+",t[t["wx+"]=qs|oi|gu|yu]="wx+",t[t["xw+"]=t["wx+"]]="xw+",t[t.a=wu|bu|oi]="a",t[t.ax=wu|bu|oi|yu]="ax",t[t.xa=t.ax]="xa",t[t["a+"]=qs|bu|oi]="a+",t[t["ax+"]=qs|bu|oi|yu]="ax+",t[t["xa+"]=t["ax+"]]="xa+"})(RR||(Us.FLAGS=RR={}))});var Aw=T(xw=>{"use strict";Object.defineProperty(xw,"__esModule",{value:!0});xw.default=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(()=>t()).catch(()=>{})});var Su=T(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.filenameToSteps=De.resolve=De.unixify=De.isWin=void 0;De.isFd=kR;De.validateFd=sL;De.dataToBuffer=aL;var vu=Ls(),_u=si(),OR=fu(),Xj=Ro(),Yj=Ws();De.isWin=OR.default.platform==="win32";var Zj=vu.resolve,Qj=vu.posix?vu.posix.sep:vu.sep,eL=l((t,e)=>{let r=t[e];return e>0&&(r==="/"||De.isWin&&r==="\\")},"isSeparator"),tL=l(t=>{let e=t.length-1;if(e<2)return t;for(;eL(t,e);)e--;return t.substr(0,e+1)},"removeTrailingSeparator"),rL=l((t,e)=>{if(typeof t!="string")throw new TypeError("expected a string");return t=t.replace(/[\\\/]+/g,"/"),e!==!1&&(t=tL(t)),t},"normalizePath"),iL=l((t,e=!0)=>De.isWin?(t=rL(t,e),t.replace(/^([a-zA-Z]+:|\.\/)/,"")):t,"unixify");De.unixify=iL;var Eu=l((t,e=OR.default.cwd())=>Zj(e,t),"resolve");De.resolve=Eu;if(De.isWin){let t=Eu;De.resolve=Eu=l((e,r)=>(0,De.unixify)(t(e,r)),"resolve")}var nL=l((t,e)=>{let i=Eu(t,e).substring(1);return i?i.split(Qj):[]},"filenameToSteps");De.filenameToSteps=nL;function kR(t){return t>>>0===t}l(kR,"isFd");function sL(t){if(!kR(t))throw TypeError(Yj.ERRSTR.FD)}l(sL,"validateFd");function aL(t,e=Xj.ENCODING_UTF8){return _u.Buffer.isBuffer(t)?t:t instanceof Uint8Array?(0,_u.bufferFrom)(t):e==="buffer"?(0,_u.bufferFrom)(String(t),"utf8"):(0,_u.bufferFrom)(String(t),e)}l(aL,"dataToBuffer")});var ci=T(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.getWriteSyncArgs=xe.getWriteArgs=xe.bufToUint8=void 0;xe.promisify=cL;xe.validateCallback=xR;xe.modeToNumber=AR;xe.nullCheck=PR;xe.pathToFilename=uL;xe.createError=OL;xe.genRndStr6=kL;xe.flagsToNumber=xL;xe.streamToBuffer=AL;xe.bufferToEncoding=CL;xe.isReadableStream=IL;var xo=Ws(),Pw=To(),Nw=si(),oL=Aw(),Fu=Su();function cL(t,e,r=i=>i){return(...i)=>new Promise((n,s)=>{t[e].bind(t)(...i,(a,f)=>a?s(a):n(r(f)))})}l(cL,"promisify");function xR(t){if(typeof t!="function")throw TypeError(xo.ERRSTR.CB);return t}l(xR,"validateCallback");function lL(t,e){if(typeof t=="number")return t;if(typeof t=="string")return parseInt(t,8);if(e)return AR(e)}l(lL,"_modeToNumber");function AR(t,e){let r=lL(t,e);if(typeof r!="number"||isNaN(r))throw new TypeError(xo.ERRSTR.MODE_INT);return r}l(AR,"modeToNumber");function PR(t,e){if((""+t).indexOf("\0")!==-1){let r=new Error("Path must be a string without null bytes");if(r.code="ENOENT",typeof e!="function")throw r;return(0,oL.default)(()=>{e(r)}),!1}return!0}l(PR,"nullCheck");function fL(t){if(t.hostname!=="")throw new Pw.TypeError("ERR_INVALID_FILE_URL_HOST",process.platform);let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)|32;if(e[r+1]==="2"&&i===102)throw new Pw.TypeError("ERR_INVALID_FILE_URL_PATH","must not include encoded / characters")}return decodeURIComponent(e)}l(fL,"getPathFromURLPosix");function uL(t){if(t instanceof Uint8Array&&(t=(0,Nw.bufferFrom)(t)),typeof t!="string"&&!Nw.Buffer.isBuffer(t)){try{if(!(t instanceof se("url").URL))throw new TypeError(xo.ERRSTR.PATH_STR)}catch{throw new TypeError(xo.ERRSTR.PATH_STR)}t=fL(t)}let e=String(t);return PR(e),e}l(uL,"pathToFilename");var hL="ENOENT",dL="EBADF",pL="EINVAL",mL="EPERM",wL="EPROTO",yL="EEXIST",gL="ENOTDIR",bL="EMFILE",_L="EACCES",vL="EISDIR",EL="ENOTEMPTY",SL="ENOSYS",FL="ERR_FS_EISDIR",TL="ERR_OUT_OF_RANGE";function RL(t,e="",r="",i=""){let n="";switch(r&&(n=` '${r}'`),i&&(n+=` -> '${i}'`),t){case hL:return`ENOENT: no such file or directory, ${e}${n}`;case dL:return`EBADF: bad file descriptor, ${e}${n}`;case pL:return`EINVAL: invalid argument, ${e}${n}`;case mL:return`EPERM: operation not permitted, ${e}${n}`;case wL:return`EPROTO: protocol error, ${e}${n}`;case yL:return`EEXIST: file already exists, ${e}${n}`;case gL:return`ENOTDIR: not a directory, ${e}${n}`;case vL:return`EISDIR: illegal operation on a directory, ${e}${n}`;case _L:return`EACCES: permission denied, ${e}${n}`;case EL:return`ENOTEMPTY: directory not empty, ${e}${n}`;case bL:return`EMFILE: too many open files, ${e}${n}`;case SL:return`ENOSYS: function not implemented, ${e}${n}`;case FL:return`[ERR_FS_EISDIR]: Path is a directory: ${e} returned EISDIR (is a directory) ${r}`;case TL:return`[ERR_OUT_OF_RANGE]: value out of range, ${e}${n}`;default:return`${t}: error occurred, ${e}${n}`}}l(RL,"formatError");function OL(t,e="",r="",i="",n=Error){let s=new n(RL(t,e,r,i));return s.code=t,r&&(s.path=r),s}l(OL,"createError");function kL(){return Math.random().toString(36).slice(2,8).padEnd(6,"0")}l(kL,"genRndStr6");function xL(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=xo.FLAGS[t];if(typeof e<"u")return e}throw new Pw.TypeError("ERR_INVALID_OPT_VALUE","flags",t)}l(xL,"flagsToNumber");function AL(t){let e=[];return new Promise((r,i)=>{t.on("data",n=>e.push(n)),t.on("end",()=>r(Nw.Buffer.concat(e))),t.on("error",i)})}l(AL,"streamToBuffer");var PL=l(t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),"bufToUint8");xe.bufToUint8=PL;var NL=l((t,e,r,i,n,s)=>{(0,Fu.validateFd)(t);let a=0,f,o=null,c,u,h=typeof e,d=typeof r,p=typeof i,m=typeof n;h!=="string"?d==="function"?u=r:p==="function"?(a=r|0,u=i):m==="function"?(a=r|0,f=i,u=n):(a=r|0,f=i,o=n,u=s):d==="function"?u=r:p==="function"?(o=r,u=i):m==="function"&&(o=r,c=i,u=n);let w=(0,Fu.dataToBuffer)(e,c);h!=="string"?typeof f>"u"&&(f=w.length):(a=0,f=w.length);let y=xR(u);return[t,h==="string",w,a,f,o,y]},"getWriteArgs");xe.getWriteArgs=NL;var DL=l((t,e,r,i,n)=>{(0,Fu.validateFd)(t);let s,a,f,o,c=typeof e!="string";c?(a=(r||0)|0,f=i,o=n):(o=r,s=i);let u=(0,Fu.dataToBuffer)(e,s);return c?typeof f>"u"&&(f=u.length):(a=0,f=u.length),[t,u,a||0,f,o]},"getWriteSyncArgs");xe.getWriteSyncArgs=DL;function CL(t,e){return!e||e==="buffer"?t:t.toString(e)}l(CL,"bufferToEncoding");function IL(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"&&t.readable===!0}l(IL,"isReadableStream")});var BR=T(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.Superblock=void 0;var Ce=Ls(),$L=Sw(),NR=Tw(),BL=kw(),ML=si(),DR=fu(),cr=zt(),CR=Ws(),V=ci(),Ht=Su(),jL=_w(),zs=Ce.posix?Ce.posix.sep:Ce.sep,IR=Ce.posix?Ce.posix.relative:Ce.relative,LL=Ce.posix?Ce.posix.join:Ce.join,{O_RDONLY:Dw,O_WRONLY:Tu,O_RDWR:Cw,O_CREAT:$R,O_EXCL:qL,O_TRUNC:UL,O_APPEND:WL,O_DIRECTORY:zL}=cr.constants,Hs=class Hs{static fromJSON(e,r){let i=new Hs;return i.fromJSON(e,r),i}static fromNestedJSON(e,r){let i=new Hs;return i.fromNestedJSON(e,r),i}constructor(e={}){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.maxFiles=1e4,this.openFiles=0,this.open=(i,n,s,a=!0)=>{let f=this.openFile(i,n,s,a);if(!f)throw(0,V.createError)("ENOENT","open",i);return f.fd},this.writeFile=(i,n,s,a)=>{let f=typeof i=="number",o;f?o=i:o=this.open((0,V.pathToFilename)(i),s,a);let c=0,u=n.length,h=s&WL?void 0:0;try{for(;u>0;){let d=this.write(o,n,c,u,h);c+=d,u-=d,h!==void 0&&(h+=d)}}finally{f||this.close(o)}},this.read=(i,n,s,a,f)=>{if(n.byteLength<a)throw(0,V.createError)("ERR_OUT_OF_RANGE","read",void 0,void 0,RangeError);let o=this.getFileByFdOrThrow(i);if(o.node.isSymlink())throw(0,V.createError)("EPERM","read",o.link.getPath());return o.read(n,Number(s),Number(a),f===-1||typeof f!="number"?void 0:f)},this.readv=(i,n,s)=>{let a=this.getFileByFdOrThrow(i),f=s??void 0;f===-1&&(f=void 0);let o=0;for(let c of n){let u=a.read(c,0,c.byteLength,f);if(f=void 0,o+=u,u<c.byteLength)break}return o},this.link=(i,n)=>{let s;try{s=this.getLinkOrThrow(i,"link")}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"link",i,n)),u}let a=(0,Ce.dirname)(n),f;try{f=this.getLinkOrThrow(a,"link")}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"link",i,n)),u}let o=(0,Ce.basename)(n);if(f.getChild(o))throw(0,V.createError)("EEXIST","link",i,n);let c=s.getNode();c.nlink++,f.createChild(o,c)},this.unlink=i=>{let n=this.getLinkOrThrow(i,"unlink");if(n.length)throw Error("Dir not empty...");this.deleteLink(n);let s=n.getNode();s.nlink--,s.nlink<=0&&this.deleteNode(s)},this.symlink=(i,n)=>{let s=(0,Ht.filenameToSteps)(n),a;try{a=this.getLinkParentAsDirOrThrow(s)}catch(u){throw u.code&&(u=(0,V.createError)(u.code,"symlink",i,n)),u}let f=s[s.length-1];if(a.getChild(f))throw(0,V.createError)("EEXIST","symlink",i,n);let o=a.getNode();if(!o.canExecute()||!o.canWrite())throw(0,V.createError)("EACCES","symlink",i,n);let c=a.createChild(f);return c.getNode().makeSymlink(i),c},this.rename=(i,n)=>{let s;try{s=this.getResolvedLinkOrThrow(i)}catch(h){throw h.code&&(h=(0,V.createError)(h.code,"rename",i,n)),h}let a;try{a=this.getLinkParentAsDirOrThrow(n)}catch(h){throw h.code&&(h=(0,V.createError)(h.code,"rename",i,n)),h}let f=s.parent;if(!f)throw(0,V.createError)("EINVAL","rename",i,n);let o=f.getNode(),c=a.getNode();if(!o.canExecute()||!o.canWrite()||!c.canExecute()||!c.canWrite())throw(0,V.createError)("EACCES","rename",i,n);f.deleteChild(s);let u=(0,Ce.basename)(n);s.name=u,s.steps=[...a.steps,u],a.setChild(s.getName(),s)},this.mkdir=(i,n)=>{let s=(0,Ht.filenameToSteps)(i);if(!s.length)throw(0,V.createError)("EEXIST","mkdir",i);let a=this.getLinkParentAsDirOrThrow(i,"mkdir"),f=s[s.length-1];if(a.getChild(f))throw(0,V.createError)("EEXIST","mkdir",i);let o=a.getNode();if(!o.canWrite()||!o.canExecute())throw(0,V.createError)("EACCES","mkdir",i);a.createChild(f,this.createNode(cr.constants.S_IFDIR|n))},this.mkdirp=(i,n)=>{let s=!1,a=(0,Ht.filenameToSteps)(i),f=null,o=a.length;for(o=a.length;o>=0&&(f=this.getResolvedLink(a.slice(0,o)),!f);o--);for(f||(f=this.root,o=0),f=this.getResolvedLinkOrThrow(Ce.sep+a.slice(0,o).join(Ce.sep),"mkdir"),o;o<a.length;o++){let c=f.getNode();if(c.isDirectory()){if(!c.canExecute()||!c.canWrite())throw(0,V.createError)("EACCES","mkdir",i)}else throw(0,V.createError)("ENOTDIR","mkdir",i);s=!0,f=f.createChild(a[o],this.createNode(cr.constants.S_IFDIR|n))}return s?i:void 0},this.rmdir=(i,n=!1)=>{let s=this.getLinkAsDirOrThrow(i,"rmdir");if(s.length&&!n)throw(0,V.createError)("ENOTEMPTY","rmdir",i);this.deleteLink(s)},this.rm=(i,n=!1,s=!1)=>{let a;try{a=this.getResolvedLinkOrThrow(i,"stat")}catch(f){if(f.code==="ENOENT"&&n)return;throw f}if(a.getNode().isDirectory()&&!s)throw(0,V.createError)("ERR_FS_EISDIR","rm",i);if(!a.parent?.getNode().canWrite())throw(0,V.createError)("EACCES","rm",i);this.deleteLink(a)},this.close=i=>{(0,Ht.validateFd)(i);let n=this.getFileByFdOrThrow(i,"close");this.closeFile(n)};let r=this.createLink();r.setNode(this.createNode(cr.constants.S_IFDIR|511)),r.setChild(".",r),r.getNode().nlink++,r.setChild("..",r),r.getNode().nlink++,this.root=r}createLink(e,r,i=!1,n){if(!e)return new NR.Link(this,void 0,"");if(!r)throw new Error("createLink: name cannot be empty");let s=n??(i?511:438),f=n&&n&cr.constants.S_IFMT?n&cr.constants.S_IFMT:i?cr.constants.S_IFDIR:cr.constants.S_IFREG,o=s&~cr.constants.S_IFMT|f;return e.createChild(r,this.createNode(o))}deleteLink(e){let r=e.parent;return r?(r.deleteChild(e),!0):!1}newInoNumber(){let e=this.releasedInos.pop();return e||(this.ino=(this.ino+1)%4294967295,this.ino)}newFdNumber(){let e=this.releasedFds.pop();return typeof e=="number"?e:Hs.fd--}createNode(e){let r=new $L.Node(this.newInoNumber(),e);return this.inodes[r.ino]=r,r}deleteNode(e){e.del(),delete this.inodes[e.ino],this.releasedInos.push(e.ino)}walk(e,r=!1,i=!1,n=!1,s){let a,f;e instanceof NR.Link?(a=e.steps,f=zs+a.join(zs)):typeof e=="string"?(a=(0,Ht.filenameToSteps)(e),f=e):(a=e,f=zs+a.join(zs));let o=this.root,c=0;for(;c<a.length;){let u=o.getNode();if(u.isDirectory()){if(n&&!u.canExecute())throw(0,V.createError)("EACCES",s,f)}else if(c<a.length-1)throw(0,V.createError)("ENOTDIR",s,f);if(o=o.getChild(a[c])??null,!o){if(i)throw(0,V.createError)("ENOENT",s,f);return null}if(u=o?.getNode(),u.isSymlink()&&(r||c<a.length-1)){let h=(0,Ce.isAbsolute)(u.symlink)?u.symlink:LL((0,Ce.dirname)(o.getPath()),u.symlink);a=(0,Ht.filenameToSteps)(h).concat(a.slice(c+1)),o=this.root,c=0;continue}if(i&&!u.isDirectory()&&c<a.length-1){let h=DR.default.platform==="win32"?"ENOENT":"ENOTDIR";throw(0,V.createError)(h,s,f)}c++}return o}getLink(e){return this.walk(e,!1,!1,!1)}getLinkOrThrow(e,r){return this.walk(e,!1,!0,!0,r)}getResolvedLink(e){return this.walk(e,!0,!1,!1)}getResolvedLinkOrThrow(e,r){return this.walk(e,!0,!0,!0,r)}resolveSymlinks(e){return this.getResolvedLink(e.steps.slice(1))}getLinkAsDirOrThrow(e,r){let i=this.getLinkOrThrow(e,r);if(!i.getNode().isDirectory())throw(0,V.createError)("ENOTDIR",r,e);return i}getLinkParent(e){return this.getLink(e.slice(0,-1))}getLinkParentAsDirOrThrow(e,r){let i=(e instanceof Array?e:(0,Ht.filenameToSteps)(e)).slice(0,-1),n=zs+i.join(zs),s=this.getLinkOrThrow(n,r);if(!s.getNode().isDirectory())throw(0,V.createError)("ENOTDIR",r,n);return s}getFileByFd(e){return this.fds[String(e)]}getFileByFdOrThrow(e,r){if(!(0,Ht.isFd)(e))throw TypeError(CR.ERRSTR.FD);let i=this.getFileByFd(e);if(!i)throw(0,V.createError)("EBADF",r);return i}_toJSON(e=this.root,r={},i,n){let s=!0,a=e.children;e.getNode().isFile()&&(a=new Map([[e.getName(),e.parent.getChild(e.getName())]]),e=e.parent);for(let o of a.keys()){if(o==="."||o==="..")continue;s=!1;let c=e.getChild(o);if(!c)throw new Error("_toJSON: unexpected undefined");let u=c.getNode();if(u.isFile()){let h=c.getPath();i&&(h=IR(i,h)),r[h]=n?u.getBuffer():u.getString()}else u.isDirectory()&&this._toJSON(c,r,i,n)}let f=e.getPath();return i&&(f=IR(i,f)),f&&s&&(r[f]=null),r}toJSON(e,r={},i=!1,n=!1){let s=[];if(e){Array.isArray(e)||(e=[e]);for(let a of e){let f=(0,V.pathToFilename)(a),o=this.getResolvedLink(f);o&&s.push(o)}}else s.push(this.root);if(!s.length)return r;for(let a of s)this._toJSON(a,r,i?a.getPath():"",n);return r}fromJSON(e,r=DR.default.cwd()){for(let i in e){let n=e[i];if(i=(0,Ht.resolve)(i,r),typeof n=="string"||n instanceof ML.Buffer){let s=(0,Ce.dirname)(i);this.mkdirp(s,511);let a=(0,Ht.dataToBuffer)(n);this.writeFile(i,a,CR.FLAGS.w,438)}else this.mkdirp(i,511)}}fromNestedJSON(e,r){this.fromJSON((0,jL.flattenJSON)(e),r)}reset(){this.ino=0,this.inodes={},this.releasedInos=[],this.fds={},this.releasedFds=[],this.openFiles=0,this.root=this.createLink(),this.root.setNode(this.createNode(cr.constants.S_IFDIR|511))}mountSync(e,r){this.fromJSON(r,e)}openLink(e,r,i=!0){if(this.openFiles>=this.maxFiles)throw(0,V.createError)("EMFILE","open",e.getPath());let n=e;i&&(n=this.getResolvedLinkOrThrow(e.getPath(),"open"));let s=n.getNode();if(s.isDirectory()){if((r&(Dw|Cw|Tu))!==Dw)throw(0,V.createError)("EISDIR","open",e.getPath())}else if(r&zL)throw(0,V.createError)("ENOTDIR","open",e.getPath());if((r&(Dw|Cw|Tu))!==Tu&&!s.canRead()||r&(Tu|Cw)&&!s.canWrite())throw(0,V.createError)("EACCES","open",e.getPath());let a=new BL.File(e,s,r,this.newFdNumber());return this.fds[a.fd]=a,this.openFiles++,r&UL&&a.truncate(),a}openFile(e,r,i,n=!0){let s=(0,Ht.filenameToSteps)(e),a;try{if(a=n?this.getResolvedLinkOrThrow(e,"open"):this.getLinkOrThrow(e,"open"),a&&r&$R&&r&qL)throw(0,V.createError)("EEXIST","open",e)}catch(f){if(f.code==="ENOENT"&&r&$R){let o=(0,Ce.dirname)(e),c=this.getResolvedLinkOrThrow(o),u=c.getNode();if(!u.isDirectory())throw(0,V.createError)("ENOTDIR","open",e);if(!u.canExecute()||!u.canWrite())throw(0,V.createError)("EACCES","open",e);i??(i=438),a=this.createLink(c,s[s.length-1],!1,i)}else throw f}if(a)return this.openLink(a,r,n);throw(0,V.createError)("ENOENT","open",e)}closeFile(e){this.fds[e.fd]&&(this.openFiles--,delete this.fds[e.fd],this.releasedFds.push(e.fd))}write(e,r,i,n,s){let a=this.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,V.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}};l(Hs,"Superblock");var Ru=Hs;Ou.Superblock=Ru;Ru.fd=2147483647});var jR=T(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.Superblock=At.File=At.Link=At.Node=void 0;var MR=(Yo(),th(Xo));MR.__exportStar(gR(),At);MR.__exportStar(_w(),At);var HL=Sw();Object.defineProperty(At,"Node",{enumerable:!0,get:l(function(){return HL.Node},"get")});var VL=Tw();Object.defineProperty(At,"Link",{enumerable:!0,get:l(function(){return VL.Link},"get")});var GL=kw();Object.defineProperty(At,"File",{enumerable:!0,get:l(function(){return GL.File},"get")});var KL=BR();Object.defineProperty(At,"Superblock",{enumerable:!0,get:l(function(){return KL.Superblock},"get")})});var LR=T(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.StatFs=void 0;var xu=class xu{static build(e,r=!1){let i=new xu,n=r?u=>BigInt(u):u=>u;i.type=n(2240043254),i.bsize=n(4096);let s=Object.keys(e.inodes).length,a=1e6,f=Math.min(s*2,a),o=a-f;i.blocks=n(a),i.bfree=n(o),i.bavail=n(o);let c=1e6;return i.files=n(c),i.ffree=n(c-s),i}};l(xu,"StatFs");var ku=xu;Ao.StatFs=ku;Ao.default=ku});var qR=T(Iw=>{"use strict";Object.defineProperty(Iw,"__esModule",{value:!0});function JL(t,e,r){let i=setTimeout.apply(globalThis,arguments);return i&&typeof i=="object"&&typeof i.unref=="function"&&i.unref(),i}l(JL,"setTimeoutUnref");Iw.default=JL});var WR=T(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.Writable=Vs.Readable=void 0;var UR=se("node:stream");Object.defineProperty(Vs,"Readable",{enumerable:!0,get:l(function(){return UR.Readable},"get")});Object.defineProperty(Vs,"Writable",{enumerable:!0,get:l(function(){return UR.Writable},"get")})});var $w=T(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.EventEmitter=void 0;var XL=se("node:events");Object.defineProperty(Au,"EventEmitter",{enumerable:!0,get:l(function(){return XL.EventEmitter},"get")})});var zR=T(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.FileHandle=void 0;var Ge=ci(),YL=$w(),Mw=class Mw extends YL.EventEmitter{constructor(e,r){super(),this.refs=1,this.closePromise=null,this.position=0,this.readableWebStreamLocked=!1,this.fs=e,this.fd=r}getAsyncId(){return this.fd}appendFile(e,r){return(0,Ge.promisify)(this.fs,"appendFile")(this.fd,e,r)}chmod(e){return(0,Ge.promisify)(this.fs,"fchmod")(this.fd,e)}chown(e,r){return(0,Ge.promisify)(this.fs,"fchown")(this.fd,e,r)}close(){if(this.fd===-1)return Promise.resolve();if(this.closePromise)return this.closePromise;if(this.refs--,this.refs===0){let e=this.fd;this.fd=-1,this.closePromise=(0,Ge.promisify)(this.fs,"close")(e).finally(()=>{this.closePromise=null})}else this.closePromise=new Promise((e,r)=>{this.closeResolve=e,this.closeReject=r}).finally(()=>{this.closePromise=null,this.closeReject=void 0,this.closeResolve=void 0});return this.emit("close"),this.closePromise}datasync(){return(0,Ge.promisify)(this.fs,"fdatasync")(this.fd)}createReadStream(e){return this.fs.createReadStream("",{...e,fd:this})}createWriteStream(e){return this.fs.createWriteStream("",{...e,fd:this})}readableWebStream(e={}){let{type:r="bytes",autoClose:i=!1}=e,n=0;if(this.fd===-1)throw new Error("The FileHandle is closed");if(this.closePromise)throw new Error("The FileHandle is closing");if(this.readableWebStreamLocked)throw new Error("An error will be thrown if this method is called more than once or is called after the FileHandle is closed or closing.");this.readableWebStreamLocked=!0,this.ref();let s=l(()=>{this.readableWebStreamLocked=!1,this.unref(),i&&this.close().catch(()=>{})},"unlockAndCleanup");return new ReadableStream({type:r==="bytes"?"bytes":void 0,autoAllocateChunkSize:16384,pull:l(async a=>{try{let f=a.byobRequest?.view;if(!f){let c=new Uint8Array(16384),u=await this.read(c,0,c.length,n);if(u.bytesRead===0){a.close(),s();return}n+=u.bytesRead,a.enqueue(c.slice(0,u.bytesRead));return}let o=await this.read(f,f.byteOffset,f.byteLength,n);if(o.bytesRead===0){a.close(),s();return}n+=o.bytesRead,a.byobRequest.respond(o.bytesRead)}catch(f){a.error(f),s()}},"pull"),cancel:l(async()=>{s()},"cancel")})}async read(e,r,i,n){let s=n??this.position,a=await(0,Ge.promisify)(this.fs,"read",f=>({bytesRead:f,buffer:e}))(this.fd,e,r,i,s);return n==null&&(this.position+=a.bytesRead),a}readv(e,r){return(0,Ge.promisify)(this.fs,"readv",i=>({bytesRead:i,buffers:e}))(this.fd,e,r)}readFile(e){return(0,Ge.promisify)(this.fs,"readFile")(this.fd,e)}stat(e){return(0,Ge.promisify)(this.fs,"fstat")(this.fd,e)}sync(){return(0,Ge.promisify)(this.fs,"fsync")(this.fd)}truncate(e){return(0,Ge.promisify)(this.fs,"ftruncate")(this.fd,e)}utimes(e,r){return(0,Ge.promisify)(this.fs,"futimes")(this.fd,e,r)}async write(e,r,i,n){let s=typeof n!="number",a=s?this.position:n,f=await(0,Ge.promisify)(this.fs,"write",o=>({bytesWritten:o,buffer:e}))(this.fd,e,r,i,a);return s&&(this.position+=f.bytesWritten),f}writev(e,r){return(0,Ge.promisify)(this.fs,"writev",i=>({bytesWritten:i,buffers:e}))(this.fd,e,r)}writeFile(e,r){return(0,Ge.promisify)(this.fs,"writeFile")(this.fd,e,r)}async[Symbol.asyncDispose](){await this.close()}ref(){this.refs++}unref(){this.refs--,this.refs===0&&(this.fd=-1,this.closeResolve&&(0,Ge.promisify)(this.fs,"close")(this.fd).then(this.closeResolve,this.closeReject))}};l(Mw,"FileHandle");var Bw=Mw;Pu.FileHandle=Bw});var HR=T(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.FsPromises=void 0;var ie=ci(),ZL=zt(),qw=class qw{constructor(e,r,i={}){if(this.fs=e,this.path=r,this.options=i,this.eventQueue=[],this.resolveQueue=[],this.finished=!1,this.maxQueue=i.maxQueue||2048,this.overflow=i.overflow||"ignore",this.startWatching(),i.signal){if(i.signal.aborted){this.finish();return}i.signal.addEventListener("abort",()=>{this.finish()})}}startWatching(){try{this.watcher=this.fs.watch(this.path,this.options,(e,r)=>{this.enqueueEvent({eventType:e,filename:r})})}catch(e){throw this.finish(),e}}enqueueEvent(e){if(!this.finished){if(this.eventQueue.length>=this.maxQueue)if(this.overflow==="throw"){let r=new Error(`Watch queue overflow: more than ${this.maxQueue} events queued`);this.finish(r);return}else this.eventQueue.shift(),console.warn(`Watch queue overflow: dropping event due to exceeding maxQueue of ${this.maxQueue}`);if(this.eventQueue.push(e),this.resolveQueue.length>0){let{resolve:r}=this.resolveQueue.shift(),i=this.eventQueue.shift();r({value:i,done:!1})}}}finish(e){if(!this.finished)for(this.finished=!0,this.watcher&&(this.watcher.close(),this.watcher=null);this.resolveQueue.length>0;){let{resolve:r,reject:i}=this.resolveQueue.shift();e?i(e):r({value:void 0,done:!0})}}async next(){return this.finished?{value:void 0,done:!0}:this.eventQueue.length>0?{value:this.eventQueue.shift(),done:!1}:new Promise((e,r)=>{this.resolveQueue.push({resolve:e,reject:r})})}async return(){return this.finish(),{value:void 0,done:!0}}async throw(e){throw this.finish(e),e}[Symbol.asyncIterator](){return this}};l(qw,"FSWatchAsyncIterator");var jw=qw,Uw=class Uw{constructor(e,r){this.fs=e,this.FileHandle=r,this.constants=ZL.constants,this.cp=(0,ie.promisify)(this.fs,"cp"),this.opendir=(0,ie.promisify)(this.fs,"opendir"),this.statfs=(0,ie.promisify)(this.fs,"statfs"),this.lutimes=(0,ie.promisify)(this.fs,"lutimes"),this.glob=(0,ie.promisify)(this.fs,"glob"),this.access=(0,ie.promisify)(this.fs,"access"),this.chmod=(0,ie.promisify)(this.fs,"chmod"),this.chown=(0,ie.promisify)(this.fs,"chown"),this.copyFile=(0,ie.promisify)(this.fs,"copyFile"),this.lchmod=(0,ie.promisify)(this.fs,"lchmod"),this.lchown=(0,ie.promisify)(this.fs,"lchown"),this.link=(0,ie.promisify)(this.fs,"link"),this.lstat=(0,ie.promisify)(this.fs,"lstat"),this.mkdir=(0,ie.promisify)(this.fs,"mkdir"),this.mkdtemp=(0,ie.promisify)(this.fs,"mkdtemp"),this.readdir=(0,ie.promisify)(this.fs,"readdir"),this.readlink=(0,ie.promisify)(this.fs,"readlink"),this.realpath=(0,ie.promisify)(this.fs,"realpath"),this.rename=(0,ie.promisify)(this.fs,"rename"),this.rmdir=(0,ie.promisify)(this.fs,"rmdir"),this.rm=(0,ie.promisify)(this.fs,"rm"),this.stat=(0,ie.promisify)(this.fs,"stat"),this.symlink=(0,ie.promisify)(this.fs,"symlink"),this.truncate=(0,ie.promisify)(this.fs,"truncate"),this.unlink=(0,ie.promisify)(this.fs,"unlink"),this.utimes=(0,ie.promisify)(this.fs,"utimes"),this.readFile=(i,n)=>(0,ie.promisify)(this.fs,"readFile")(i instanceof this.FileHandle?i.fd:i,n),this.appendFile=(i,n,s)=>(0,ie.promisify)(this.fs,"appendFile")(i instanceof this.FileHandle?i.fd:i,n,s),this.open=(i,n="r",s)=>(0,ie.promisify)(this.fs,"open",a=>new this.FileHandle(this.fs,a))(i,n,s),this.writeFile=(i,n,s)=>((0,ie.isReadableStream)(n)?(0,ie.streamToBuffer)(n):Promise.resolve(n)).then(f=>(0,ie.promisify)(this.fs,"writeFile")(i instanceof this.FileHandle?i.fd:i,f,s)),this.watch=(i,n)=>{let s=typeof n=="string"?{encoding:n}:n||{};return new jw(this.fs,i,s)}}};l(Uw,"FsPromises");var Lw=Uw;Nu.FsPromises=Lw});var VR=T(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.newNotAllowedError=Ke.newTypeMismatchError=Ke.newNotFoundError=Ke.assertCanWrite=Ke.assertName=Ke.basename=Ke.ctx=void 0;var QL=l((t={})=>({separator:"/",syncHandleAllowed:!1,mode:"read",...t}),"ctx");Ke.ctx=QL;var eq=l((t,e)=>{t[t.length-1]===e&&(t=t.slice(0,-1));let r=t.lastIndexOf(e);return r===-1?t:t.slice(r+1)},"basename");Ke.basename=eq;var tq=/^(\.{1,2})$|^(.*([\/\\]).*)$/,rq=l((t,e,r)=>{if(!t||tq.test(t))throw new TypeError(`Failed to execute '${e}' on '${r}': Name is not allowed.`)},"assertName");Ke.assertName=rq;var iq=l(t=>{if(t!=="readwrite")throw new DOMException("The request is not allowed by the user agent or the platform in the current context.","NotAllowedError")},"assertCanWrite");Ke.assertCanWrite=iq;var nq=l(()=>new DOMException("A requested file or directory could not be found at the time an operation was processed.","NotFoundError"),"newNotFoundError");Ke.newNotFoundError=nq;var sq=l(()=>new DOMException("The path supplied exists, but was not an entry of requested type.","TypeMismatchError"),"newTypeMismatchError");Ke.newTypeMismatchError=sq;var aq=l(()=>new DOMException("Permission not granted.","NotAllowedError"),"newNotAllowedError");Ke.newNotAllowedError=aq});var GR=T(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.toTreeSync=void 0;var oq=Hh(),cq=VR(),lq=l((t,e={})=>{let r=e.separator||"/",i=e.dir||r;i[i.length-1]!==r&&(i+=r);let n=e.tab||"",s=e.depth??10,a=" (...)";if(s>0){let o=t.readdirSync(i,{withFileTypes:!0});a=(0,oq.printTree)(n,o.map(c=>u=>c.isDirectory()?(0,Po.toTreeSync)(t,{dir:i+c.name,depth:s-1,tab:u}):c.isSymbolicLink()?""+c.name+" \u2192 "+t.readlinkSync(i+c.name):""+c.name))}return(0,cq.basename)(i,r)+r+a},"toTreeSync");Po.toTreeSync=lq});var XR=T(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.getWriteFileOptions=L.writeFileDefaults=L.getRealpathOptsAndCb=L.getRealpathOptions=L.getStatfsOptsAndCb=L.getStatfsOptions=L.getStatOptsAndCb=L.getStatOptions=L.getAppendFileOptsAndCb=L.getAppendFileOpts=L.getOpendirOptsAndCb=L.getOpendirOptions=L.getReaddirOptsAndCb=L.getReaddirOptions=L.getReadFileOptions=L.getRmOptsAndCb=L.getRmdirOptions=L.getDefaultOptsAndCb=L.getDefaultOpts=L.optsDefaults=L.getMkdirOptions=void 0;L.getOptions=JR;L.optsGenerator=xr;L.optsAndCbGenerator=zi;var Du=Ws(),fq=Ro(),Ww=ci(),KR={mode:511,recursive:!1},uq=l(t=>typeof t=="number"?Object.assign({},KR,{mode:t}):Object.assign({},KR,t),"getMkdirOptions");L.getMkdirOptions=uq;var hq=l(t=>`Expected options to be either an object or a string, but got ${t} instead`,"ERRSTR_OPTS");function JR(t,e){let r;if(e){let i=typeof e;switch(i){case"string":r=Object.assign({},t,{encoding:e});break;case"object":r=Object.assign({},t,e);break;default:throw TypeError(hq(i))}}else return t;return r.encoding!=="buffer"&&(0,fq.assertEncoding)(r.encoding),r}l(JR,"getOptions");function xr(t){return e=>JR(t,e)}l(xr,"optsGenerator");function zi(t){return(e,r)=>typeof e=="function"?[t(),e]:[t(e),(0,Ww.validateCallback)(r)]}l(zi,"optsAndCbGenerator");L.optsDefaults={encoding:"utf8"};L.getDefaultOpts=xr(L.optsDefaults);L.getDefaultOptsAndCb=zi(L.getDefaultOpts);var dq={recursive:!1},pq=l(t=>Object.assign({},dq,t),"getRmdirOptions");L.getRmdirOptions=pq;var mq=xr(L.optsDefaults);L.getRmOptsAndCb=zi(mq);var wq={flag:"r"};L.getReadFileOptions=xr(wq);var yq={encoding:"utf8",recursive:!1,withFileTypes:!1};L.getReaddirOptions=xr(yq);L.getReaddirOptsAndCb=zi(L.getReaddirOptions);var gq={encoding:"utf8",bufferSize:32,recursive:!1};L.getOpendirOptions=xr(gq);L.getOpendirOptsAndCb=zi(L.getOpendirOptions);var bq={encoding:"utf8",mode:438,flag:Du.FLAGS[Du.FLAGS.a]};L.getAppendFileOpts=xr(bq);L.getAppendFileOptsAndCb=zi(L.getAppendFileOpts);var _q={bigint:!1},vq=l((t={})=>Object.assign({},_q,t),"getStatOptions");L.getStatOptions=vq;var Eq=l((t,e)=>typeof t=="function"?[(0,L.getStatOptions)(),t]:[(0,L.getStatOptions)(t),(0,Ww.validateCallback)(e)],"getStatOptsAndCb");L.getStatOptsAndCb=Eq;var Sq={bigint:!1},Fq=l((t={})=>Object.assign({},Sq,t),"getStatfsOptions");L.getStatfsOptions=Fq;var Tq=l((t,e)=>typeof t=="function"?[(0,L.getStatfsOptions)(),t]:[(0,L.getStatfsOptions)(t),(0,Ww.validateCallback)(e)],"getStatfsOptsAndCb");L.getStatfsOptsAndCb=Tq;var Rq=L.optsDefaults;L.getRealpathOptions=xr(Rq);L.getRealpathOptsAndCb=zi(L.getRealpathOptions);L.writeFileDefaults={encoding:"utf8",mode:438,flag:Du.FLAGS[Du.FLAGS.w]};L.getWriteFileOptions=xr(L.writeFileDefaults)});var ZR=T(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.Dir=void 0;var YR=ci(),Oq=ou(),Hi=To(),Hw=class Hw{constructor(e,r){this.link=e,this.options=r,this.iteratorInfo=[],this.closed=!1,this.operationQueue=null,this.path=e.getPath(),this.iteratorInfo.push(e.children[Symbol.iterator]())}closeBase(){}readBase(e){let r,i,n,s;do{do if({done:r,value:i}=e[e.length-1].next(),!r)[n,s]=i;else break;while(n==="."||n==="..");if(r){if(e.pop(),e.length===0)break;r=!1}else return this.options.recursive&&s.children.size&&e.push(s.children[Symbol.iterator]()),Oq.default.build(s,this.options.encoding)}while(!r);return null}close(e){if(e===void 0)return this.closed?Promise.reject(new Hi.Error("ERR_DIR_CLOSED")):new Promise((r,i)=>{this.close(n=>{n?i(n):r()})});if((0,YR.validateCallback)(e),this.closed){process.nextTick(e,new Hi.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.close(e)});return}this.closed=!0;try{this.closeBase(),process.nextTick(e)}catch(r){process.nextTick(e,r)}}closeSync(){if(this.closed)throw new Hi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new Hi.Error("ERR_DIR_CONCURRENT_OPERATION");this.closed=!0,this.closeBase()}read(e){if(e===void 0)return new Promise((r,i)=>{this.read((n,s)=>{n?i(n):r(s??null)})});if((0,YR.validateCallback)(e),this.closed){process.nextTick(e,new Hi.Error("ERR_DIR_CLOSED"));return}if(this.operationQueue!==null){this.operationQueue.push(()=>{this.read(e)});return}this.operationQueue=[];try{let r=this.readBase(this.iteratorInfo);process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(null,r)})}catch(r){process.nextTick(()=>{let i=this.operationQueue;this.operationQueue=null;for(let n of i)n();e(r)})}}readSync(){if(this.closed)throw new Hi.Error("ERR_DIR_CLOSED");if(this.operationQueue!==null)throw new Hi.Error("ERR_DIR_CONCURRENT_OPERATION");return this.readBase(this.iteratorInfo)}[Symbol.asyncIterator](){return{next:l(async()=>{try{let e=await this.read();return e!==null?{done:!1,value:e}:{done:!0,value:void 0}}catch(e){throw e}},"next"),[Symbol.asyncIterator](){return this}}}};l(Hw,"Dir");var zw=Hw;Cu.Dir=zw});var tO=T(Gw=>{"use strict";Object.defineProperty(Gw,"__esModule",{value:!0});Gw.globSync=Dq;var Vi=Ls(),kq=Jh(),QR=ci(),xq=Vi.posix.join,Aq=Vi.posix.relative,Pq=Vi.posix.resolve;function eO(t,e){return(0,kq.toRegex)(e).test(t)}l(eO,"matchesPattern");function Nq(t,e){return e?typeof e=="function"?e(t):(Array.isArray(e)?e:[e]).some(i=>eO(t,i)):!1}l(Nq,"isExcluded");function Vw(t,e,r,i,n=0){let s=[],a=i.maxdepth??1/0,f=i.cwd?(0,QR.pathToFilename)(i.cwd):process.cwd();if(n>a)return s;try{let o=t.readdirSync(e,{withFileTypes:!0});for(let c of o){let u=xq(e,c.name.toString()),h=Aq(f,u);if(Nq(h,i.exclude))continue;if(r.some(p=>eO(h,p))&&s.push(h),c.isDirectory()&&n<a){let p=Vw(t,u,r,i,n+1);s.push(...p)}}}catch{}return s}l(Vw,"walkDirectory");function Dq(t,e,r={}){let i=r.cwd?(0,QR.pathToFilename)(r.cwd):process.cwd(),n=Pq(i),s={cwd:n,exclude:r.exclude,maxdepth:r.maxdepth,withFileTypes:r.withFileTypes||!1},a=[];if(Vi.posix.isAbsolute(e)){let f=Vi.posix.dirname(e),o=Vi.posix.basename(e),c=Vw(t,f,[o],{...s,cwd:f});a.push(...c.map(u=>Vi.posix.resolve(f,u)))}else{let f=Vw(t,n,[e],s);a.push(...f)}return a=[...new Set(a)].sort(),a}l(Dq,"globSync")});var cO=T(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.FSWatcher=mt.StatWatcher=mt.Volume=void 0;mt.pathToSteps=Xq;mt.dataToStr=Yq;mt.toUnixTimestamp=pt;var Fe=Ls(),Yw=jR(),Kw=uw(),Cq=ou(),Iq=LR(),Js=si(),ju=Aw(),$q=qR(),Lu=WR(),Bq=zt(),sO=$w(),Gi=Ro(),Mq=zR(),aO=dw(),jq=HR(),Lq=GR(),$u=Ws(),qq=To(),Q=XR(),P=ci(),Uq=ZR(),je=Su(),Wq=Fe.resolve,{O_SYMLINK:rO,F_OK:Jw,R_OK:zq,W_OK:Hq,X_OK:Vq,COPYFILE_EXCL:Gq,COPYFILE_FICLONE_FORCE:Kq}=Bq.constants,r5=Fe.posix?Fe.posix.sep:Fe.sep,Iu=Fe.posix?Fe.posix.relative:Fe.relative,Xw=Fe.posix?Fe.posix.join:Fe.join,iO=Fe.posix?Fe.posix.dirname:Fe.dirname,nO=Fe.posix?Fe.posix.normalize:Fe.normalize,Jq=128;function Xq(t){return(0,je.filenameToSteps)((0,P.pathToFilename)(t))}l(Xq,"pathToSteps");function Yq(t,e=Gi.ENCODING_UTF8){return Js.Buffer.isBuffer(t)?t.toString(e):t instanceof Uint8Array?(0,Js.bufferFrom)(t).toString(e):String(t)}l(Yq,"dataToStr");function pt(t){if(typeof t=="string"&&+t==t)return+t;if(t instanceof Date)return t.getTime()/1e3;if(isFinite(t))return t<0?Date.now()/1e3:t;throw new Error("Cannot parse time: "+t)}l(pt,"toUnixTimestamp");function Gs(t){if(typeof t!="number")throw TypeError($u.ERRSTR.UID)}l(Gs,"validateUid");function Ks(t){if(typeof t!="number")throw TypeError($u.ERRSTR.GID)}l(Ks,"validateGid");var Zw=class Zw{get promises(){if(this.promisesApi===null)throw new Error("Promise is not supported in this environment.");return this.promisesApi}constructor(e=new Yw.Superblock){this._core=e,this.promisesApi=new jq.FsPromises(this,Mq.FileHandle),this.openSync=(o,c,u=438)=>{let h=(0,P.modeToNumber)(u),d=(0,P.pathToFilename)(o),p=(0,P.flagsToNumber)(c);return this._core.open(d,p,h,!(p&rO))},this.open=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&(d=438,p=u),d=d||438;let m=(0,P.modeToNumber)(d),w=(0,P.pathToFilename)(o),y=(0,P.flagsToNumber)(c);this.wrapAsync(this._core.open,[w,y,m,!(y&rO)],p)},this.closeSync=o=>{this._core.close(o)},this.close=(o,c)=>{(0,je.validateFd)(o);let u=this._core.getFileByFdOrThrow(o,"close");this.wrapAsync(this._core.close,[u.fd],c)},this.readSync=(o,c,u,h,d)=>((0,je.validateFd)(o),this._core.read(o,c,u,h,d)),this.read=(o,c,u,h,d,p)=>{if((0,P.validateCallback)(p),h===0)return(0,ju.default)(()=>{p&&p(null,0,c)});Promise.resolve().then(()=>{try{let m=this._core.read(o,c,u,h,d);p(null,m,c)}catch(m){p(m)}})},this.readv=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,P.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this._core.readv(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.readvSync=(o,c,u)=>((0,je.validateFd)(o),this._core.readv(o,c,u??null)),this._readfile=(o,c,u)=>{let h,p=typeof o=="number"&&(0,je.isFd)(o),m;if(p)m=o;else{let w=(0,P.pathToFilename)(o),y=String(o),g=y.length>1&&y.endsWith("/"),_=this._core.getResolvedLinkOrThrow(w,"open"),F=_.getNode();if(F.isDirectory())throw(0,P.createError)("EISDIR","open",_.getPath());if(g&&F.isFile())throw(0,P.createError)("ENOTDIR","open",y);m=this.openSync(o,c)}try{h=(0,P.bufferToEncoding)(this._core.getFileByFdOrThrow(m).getBuffer(),u)}finally{p||this.closeSync(m)}return h},this.readFileSync=(o,c)=>{let u=(0,Q.getReadFileOptions)(c),h=(0,P.flagsToNumber)(u.flag);return this._readfile(o,h,u.encoding)},this.readFile=(o,c,u)=>{let[h,d]=(0,Q.optsAndCbGenerator)(Q.getReadFileOptions)(c,u),p=(0,P.flagsToNumber)(h.flag);this.wrapAsync(this._readfile,[o,p,h.encoding],d)},this.writeSync=(o,c,u,h,d)=>{let[,p,m,w,y]=(0,P.getWriteSyncArgs)(o,c,u,h,d);return this._write(o,p,m,w,y)},this.write=(o,c,u,h,d,p)=>{let[,m,w,y,g,_,F]=(0,P.getWriteArgs)(o,c,u,h,d,p);Promise.resolve().then(()=>{try{let R=this._write(o,w,y,g,_);m?F(null,R,c):F(null,R,w)}catch(R){F(R)}})},this.writev=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[null,u]),(0,P.validateCallback)(p),Promise.resolve().then(()=>{try{let m=this.writevBase(o,c,d);p(null,m,c)}catch(m){p(m)}})},this.writevSync=(o,c,u)=>((0,je.validateFd)(o),this.writevBase(o,c,u??null)),this.writeFileSync=(o,c,u)=>{let h=(0,Q.getWriteFileOptions)(u),d=(0,P.flagsToNumber)(h.flag),p=(0,P.modeToNumber)(h.mode),m=(0,je.dataToBuffer)(c,h.encoding);this._core.writeFile(o,m,d,p)},this.writeFile=(o,c,u,h)=>{let d=u,p=h;typeof u=="function"&&([d,p]=[Q.writeFileDefaults,u]);let m=(0,P.validateCallback)(p),w=(0,Q.getWriteFileOptions)(d),y=(0,P.flagsToNumber)(w.flag),g=(0,P.modeToNumber)(w.mode),_=(0,je.dataToBuffer)(c,w.encoding);this.wrapAsync(this._core.writeFile,[o,_,y,g],m)},this.copyFileSync=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);return this._copyFile(h,d,(u||0)|0)},this.copyFile=(o,c,u,h)=>{let d=(0,P.pathToFilename)(o),p=(0,P.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[0,u]:[m,w]=[u,h],(0,P.validateCallback)(w),this.wrapAsync(this._copyFile,[d,p,m],w)},this._cp=(o,c,u)=>{if(u.filter&&!u.filter(o,c))return;let h=u.dereference?this.statSync(o):this.lstatSync(o),d=null;try{d=this.lstatSync(c)}catch(p){if(p.code!=="ENOENT")throw p}if(d&&h.ino===d.ino&&h.dev===d.dev)throw(0,P.createError)("EINVAL","cp",o,c);if(d){if(h.isDirectory()&&!d.isDirectory())throw(0,P.createError)("EISDIR","cp",o,c);if(!h.isDirectory()&&d.isDirectory())throw(0,P.createError)("ENOTDIR","cp",o,c)}if(h.isDirectory()&&this.isSrcSubdir(o,c))throw(0,P.createError)("EINVAL","cp",o,c);{let p=iO(c);this.existsSync(p)||this.mkdirSync(p,{recursive:!0})}if(h.isDirectory()){if(!u.recursive)throw(0,P.createError)("EISDIR","cp",o);this.cpDirSync(h,d,o,c,u)}else if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())this.cpFileSync(h,d,o,c,u);else if(h.isSymbolicLink()&&!u.dereference)this.cpSymlinkSync(d,o,c,u);else throw(0,P.createError)("EINVAL","cp",o)},this.linkSync=(o,c)=>{let u=(0,P.pathToFilename)(o),h=(0,P.pathToFilename)(c);this._core.link(u,h)},this.link=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);this.wrapAsync(this._core.link,[h,d],u)},this.unlinkSync=o=>{let c=(0,P.pathToFilename)(o);this._core.unlink(c)},this.unlink=(o,c)=>{let u=(0,P.pathToFilename)(o);this.wrapAsync(this._core.unlink,[u],c)},this.symlinkSync=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);this._core.symlink(h,d)},this.symlink=(o,c,u,h)=>{let d=(0,P.validateCallback)(typeof u=="function"?u:h),p=(0,P.pathToFilename)(o),m=(0,P.pathToFilename)(c);this.wrapAsync(this._core.symlink,[p,m],d)},this._lstat=(o,c=!1,u=!1)=>{let h;try{h=this._core.getLinkOrThrow(o,"lstat")}catch(d){if(d.code==="ENOENT"&&!u)return;throw d}return Kw.default.build(h.getNode(),c)},this.lstatSync=(o,c)=>{let{throwIfNoEntry:u=!0,bigint:h=!1}=(0,Q.getStatOptions)(c);return this._lstat((0,P.pathToFilename)(o),h,u)},this.renameSync=(o,c)=>{let u=(0,P.pathToFilename)(o),h=(0,P.pathToFilename)(c);this._core.rename(u,h)},this.rename=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c);this.wrapAsync(this._core.rename,[h,d],u)},this.existsSync=o=>{try{return this._exists((0,P.pathToFilename)(o))}catch{return!1}},this.exists=(o,c)=>{let u=(0,P.pathToFilename)(o);if(typeof c!="function")throw Error($u.ERRSTR.CB);Promise.resolve().then(()=>{try{c(this._exists(u))}catch{c(!1)}})},this.accessSync=(o,c=Jw)=>{let u=(0,P.pathToFilename)(o);c=c|0,this._access(u,c)},this.access=(o,c,u)=>{let h=Jw,d;typeof c!="function"?[h,d]=[c|0,(0,P.validateCallback)(u)]:d=c;let p=(0,P.pathToFilename)(o);this.wrapAsync(this._access,[p,h],d)},this.appendFileSync=(o,c,u)=>{let h=(0,Q.getAppendFileOpts)(u);(!h.flag||(0,je.isFd)(o))&&(h.flag="a"),this.writeFileSync(o,c,h)},this.appendFile=(o,c,u,h)=>{let[d,p]=(0,Q.getAppendFileOptsAndCb)(u,h);(!d.flag||(0,je.isFd)(o))&&(d.flag="a"),this.writeFile(o,c,d,p)},this._readdir=(o,c)=>{let u=(0,je.filenameToSteps)(o),h=this._core.getResolvedLinkOrThrow(o,"scandir"),d=h.getNode();if(!d.isDirectory())throw(0,P.createError)("ENOTDIR","scandir",o);if(!d.canRead())throw(0,P.createError)("EACCES","scandir",o);let p=[];for(let w of h.children.keys()){let y=h.getChild(w);if(!(!y||w==="."||w==="..")&&(p.push(Cq.default.build(y,c.encoding)),c.recursive&&y.children.size)){let g={...c,recursive:!0,withFileTypes:!0},_=this._readdir(y.getPath(),g);p.push(..._)}}if(!je.isWin&&c.encoding!=="buffer"&&p.sort((w,y)=>w.name<y.name?-1:w.name>y.name?1:0),c.withFileTypes)return p;let m=o;return je.isWin&&(m=m.replace(/\\/g,"/")),p.map(w=>{if(c.recursive){let y=Xw(w.parentPath,w.name.toString());return je.isWin&&(y=y.replace(/\\/g,"/")),y.replace(m+Fe.posix.sep,"")}return w.name})},this.readdirSync=(o,c)=>{let u=(0,Q.getReaddirOptions)(c),h=(0,P.pathToFilename)(o);return this._readdir(h,u)},this.readdir=(o,c,u)=>{let[h,d]=(0,Q.getReaddirOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);this.wrapAsync(this._readdir,[p,h],d)},this._readlink=(o,c)=>{let h=this._core.getLinkOrThrow(o,"readlink").getNode();if(!h.isSymlink())throw(0,P.createError)("EINVAL","readlink",o);return(0,Gi.strToEncoding)(h.symlink,c)},this.readlinkSync=(o,c)=>{let u=(0,Q.getDefaultOpts)(c),h=(0,P.pathToFilename)(o);return this._readlink(h,u.encoding)},this.readlink=(o,c,u)=>{let[h,d]=(0,Q.getDefaultOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);this.wrapAsync(this._readlink,[p,h.encoding],d)},this._fsync=o=>{this._core.getFileByFdOrThrow(o,"fsync")},this.fsyncSync=o=>{this._fsync(o)},this.fsync=(o,c)=>{this.wrapAsync(this._fsync,[o],c)},this._fdatasync=o=>{this._core.getFileByFdOrThrow(o,"fdatasync")},this.fdatasyncSync=o=>{this._fdatasync(o)},this.fdatasync=(o,c)=>{this.wrapAsync(this._fdatasync,[o],c)},this._ftruncate=(o,c)=>{this._core.getFileByFdOrThrow(o,"ftruncate").truncate(c)},this.ftruncateSync=(o,c)=>{this._ftruncate(o,c)},this.ftruncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,P.validateCallback)(typeof c=="number"?u:c);this.wrapAsync(this._ftruncate,[o,h],d)},this._truncate=(o,c)=>{let u=this.openSync(o,"r+");try{this.ftruncateSync(u,c)}finally{this.closeSync(u)}},this.truncateSync=(o,c)=>{if((0,je.isFd)(o))return this.ftruncateSync(o,c);this._truncate(o,c)},this.truncate=(o,c,u)=>{let h=typeof c=="number"?c:0,d=(0,P.validateCallback)(typeof c=="number"?u:c);if((0,je.isFd)(o))return this.ftruncate(o,h,d);this.wrapAsync(this._truncate,[o,h],d)},this._futimes=(o,c,u)=>{let d=this._core.getFileByFdOrThrow(o,"futimes").node;d.atime=new Date(c*1e3),d.mtime=new Date(u*1e3)},this.futimesSync=(o,c,u)=>{this._futimes(o,pt(c),pt(u))},this.futimes=(o,c,u,h)=>{this.wrapAsync(this._futimes,[o,pt(c),pt(u)],h)},this._utimes=(o,c,u,h=!0)=>{let d=this._core,m=(h?d.getResolvedLinkOrThrow(o,"utimes"):d.getLinkOrThrow(o,"lutimes")).getNode();m.atime=new Date(c*1e3),m.mtime=new Date(u*1e3)},this.utimesSync=(o,c,u)=>{this._utimes((0,P.pathToFilename)(o),pt(c),pt(u),!0)},this.utimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(o),pt(c),pt(u),!0],h)},this.lutimesSync=(o,c,u)=>{this._utimes((0,P.pathToFilename)(o),pt(c),pt(u),!1)},this.lutimes=(o,c,u,h)=>{this.wrapAsync(this._utimes,[(0,P.pathToFilename)(o),pt(c),pt(u),!1],h)},this.mkdirSync=(o,c)=>{let u=(0,Q.getMkdirOptions)(c),h=(0,P.modeToNumber)(u.mode,511),d=(0,P.pathToFilename)(o);if(u.recursive)return this._core.mkdirp(d,h);this._core.mkdir(d,h)},this.mkdir=(o,c,u)=>{let h=(0,Q.getMkdirOptions)(c),d=(0,P.validateCallback)(typeof c=="function"?c:u),p=(0,P.modeToNumber)(h.mode,511),m=(0,P.pathToFilename)(o);h.recursive?this.wrapAsync(this._core.mkdirp,[m,p],d):this.wrapAsync(this._core.mkdir,[m,p],d)},this._mkdtemp=(o,c,u=5)=>{let h=o+(0,P.genRndStr6)();try{return this._core.mkdir(h,511),(0,Gi.strToEncoding)(h,c)}catch(d){if(d.code==="EEXIST"){if(u>1)return this._mkdtemp(o,c,u-1);throw Error("Could not create temp dir.")}else throw d}},this.mkdtempSync=(o,c)=>{let{encoding:u}=(0,Q.getDefaultOpts)(c);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");return(0,P.nullCheck)(o),this._mkdtemp(o,u)},this.mkdtemp=(o,c,u)=>{let[{encoding:h},d]=(0,Q.getDefaultOptsAndCb)(c,u);if(!o||typeof o!="string")throw new TypeError("filename prefix is required");(0,P.nullCheck)(o)&&this.wrapAsync(this._mkdtemp,[o,h],d)},this.rmdirSync=(o,c)=>{let u=(0,Q.getRmdirOptions)(c);this._core.rmdir((0,P.pathToFilename)(o),u.recursive)},this.rmdir=(o,c,u)=>{let h=(0,Q.getRmdirOptions)(c),d=(0,P.validateCallback)(typeof c=="function"?c:u);this.wrapAsync(this._core.rmdir,[(0,P.pathToFilename)(o),h.recursive],d)},this.rmSync=(o,c)=>{this._core.rm((0,P.pathToFilename)(o),c?.force,c?.recursive)},this.rm=(o,c,u)=>{let[h,d]=(0,Q.getRmOptsAndCb)(c,u);this.wrapAsync(this._core.rm,[(0,P.pathToFilename)(o),h?.force,h?.recursive],d)},this._fchmod=(o,c)=>{this._core.getFileByFdOrThrow(o,"fchmod").chmod(c)},this.fchmodSync=(o,c)=>{this._fchmod(o,(0,P.modeToNumber)(c))},this.fchmod=(o,c,u)=>{this.wrapAsync(this._fchmod,[o,(0,P.modeToNumber)(c)],u)},this._chmod=(o,c,u=!0)=>{(u?this._core.getResolvedLinkOrThrow(o,"chmod"):this._core.getLinkOrThrow(o,"chmod")).getNode().chmod(c)},this.chmodSync=(o,c)=>{let u=(0,P.modeToNumber)(c),h=(0,P.pathToFilename)(o);this._chmod(h,u,!0)},this.chmod=(o,c,u)=>{let h=(0,P.modeToNumber)(c),d=(0,P.pathToFilename)(o);this.wrapAsync(this._chmod,[d,h],u)},this._lchmod=(o,c)=>{this._chmod(o,c,!1)},this.lchmodSync=(o,c)=>{let u=(0,P.modeToNumber)(c),h=(0,P.pathToFilename)(o);this._lchmod(h,u)},this.lchmod=(o,c,u)=>{let h=(0,P.modeToNumber)(c),d=(0,P.pathToFilename)(o);this.wrapAsync(this._lchmod,[d,h],u)},this._fchown=(o,c,u)=>{this._core.getFileByFdOrThrow(o,"fchown").chown(c,u)},this.fchownSync=(o,c,u)=>{Gs(c),Ks(u),this._fchown(o,c,u)},this.fchown=(o,c,u,h)=>{Gs(c),Ks(u),this.wrapAsync(this._fchown,[o,c,u],h)},this._chown=(o,c,u)=>{this._core.getResolvedLinkOrThrow(o,"chown").getNode().chown(c,u)},this.chownSync=(o,c,u)=>{Gs(c),Ks(u),this._chown((0,P.pathToFilename)(o),c,u)},this.chown=(o,c,u,h)=>{Gs(c),Ks(u),this.wrapAsync(this._chown,[(0,P.pathToFilename)(o),c,u],h)},this._lchown=(o,c,u)=>{this._core.getLinkOrThrow(o,"lchown").getNode().chown(c,u)},this.lchownSync=(o,c,u)=>{Gs(c),Ks(u),this._lchown((0,P.pathToFilename)(o),c,u)},this.lchown=(o,c,u,h)=>{Gs(c),Ks(u),this.wrapAsync(this._lchown,[(0,P.pathToFilename)(o),c,u],h)},this.statWatchers={},this.cpSync=(o,c,u)=>{let h=(0,P.pathToFilename)(o),d=(0,P.pathToFilename)(c),p={dereference:u?.dereference??!1,errorOnExist:u?.errorOnExist??!1,filter:u?.filter,force:u?.force??!0,mode:u?.mode??0,preserveTimestamps:u?.preserveTimestamps??!1,recursive:u?.recursive??!1,verbatimSymlinks:u?.verbatimSymlinks??!1};return this._cp(h,d,p)},this.cp=(o,c,u,h)=>{let d=(0,P.pathToFilename)(o),p=(0,P.pathToFilename)(c),m,w;typeof u=="function"?[m,w]=[{},u]:[m,w]=[u||{},h],(0,P.validateCallback)(w);let y={dereference:m?.dereference??!1,errorOnExist:m?.errorOnExist??!1,filter:m?.filter,force:m?.force??!0,mode:m?.mode??0,preserveTimestamps:m?.preserveTimestamps??!1,recursive:m?.recursive??!1,verbatimSymlinks:m?.verbatimSymlinks??!1};this.wrapAsync(this._cp,[d,p,y],w)},this.openAsBlob=async(o,c)=>{let u=(0,P.pathToFilename)(o),h;try{h=this._core.getResolvedLinkOrThrow(u,"open")}catch(w){throw w&&typeof w=="object"&&w.code==="ENOENT"?new qq.TypeError("ERR_INVALID_ARG_VALUE"):w}let p=h.getNode().getBuffer(),m=c?.type||"";return new Blob([p],{type:m})},this.glob=(o,...c)=>{let[u,h]=c.length===1?[{},c[0]]:[c[0],c[1]];this.wrapAsync(this._globSync,[o,u||{}],h)},this.globSync=(o,c={})=>this._globSync(o,c),this._globSync=(o,c={})=>{let{globSync:u}=tO();return u(this,o,c)},this._opendir=(o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"scandir");if(!u.getNode().isDirectory())throw(0,P.createError)("ENOTDIR","scandir",o);return new Uq.Dir(u,c)},this.opendirSync=(o,c)=>{let u=(0,Q.getOpendirOptions)(c),h=(0,P.pathToFilename)(o);return this._opendir(h,u)},this.opendir=(o,c,u)=>{let[h,d]=(0,Q.getOpendirOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);this.wrapAsync(this._opendir,[p,h],d)};let r=this;this.StatWatcher=class extends Bu{constructor(){super(r)}};let i=lr;this.ReadStream=class extends i{constructor(...o){super(r,...o)}};let n=Nt;this.WriteStream=class extends n{constructor(...o){super(r,...o)}},this.FSWatcher=class extends Mu{constructor(){super(r)}};let s=l((o,c)=>{let u=this._core.getResolvedLinkOrThrow(o,"realpath");return(0,Gi.strToEncoding)(u.getPath()||"/",c)},"_realpath"),a=l((o,c,u)=>{let[h,d]=(0,Q.getRealpathOptsAndCb)(c,u),p=(0,P.pathToFilename)(o);r.wrapAsync(s,[p,h.encoding],d)},"realpathImpl"),f=l((o,c)=>s((0,P.pathToFilename)(o),(0,Q.getRealpathOptions)(c).encoding),"realpathSyncImpl");this.realpath=a,this.realpath.native=a,this.realpathSync=f,this.realpathSync.native=f}wrapAsync(e,r,i){(0,P.validateCallback)(i),Promise.resolve().then(()=>{let n;try{n=e.apply(this,r)}catch(s){i(s);return}i(null,n)})}toTree(e={separator:Fe.sep}){return(0,Lq.toTreeSync)(this,e)}reset(){this._core.reset()}toJSON(e,r={},i=!1,n=!1){return this._core.toJSON(e,r,i,n)}fromJSON(e,r){return this._core.fromJSON(e,r)}fromNestedJSON(e,r){return this._core.fromNestedJSON(e,r)}mountSync(e,r){this._core.fromJSON(r,e)}_write(e,r,i,n,s){let a=this._core.getFileByFdOrThrow(e,"write");if(a.node.isSymlink())throw(0,P.createError)("EBADF","write",a.link.getPath());return a.write(r,i,n,s===-1||typeof s!="number"?void 0:s)}writevBase(e,r,i){let n=this._core.getFileByFdOrThrow(e),s=i??void 0;s===-1&&(s=void 0);let a=0;for(let f of r){let o=Js.Buffer.from(f.buffer,f.byteOffset,f.byteLength),c=n.write(o,0,o.byteLength,s);if(s=void 0,a+=c,c<o.byteLength)break}return a}_copyFile(e,r,i){let n=this.readFileSync(e);if(i&Gq&&this.existsSync(r))throw(0,P.createError)("EEXIST","copyFile",e,r);if(i&Kq)throw(0,P.createError)("ENOSYS","copyFile",e,r);this._core.writeFile(r,n,$u.FLAGS.w,438)}isSrcSubdir(e,r){try{let i=nO(e.startsWith("/")?e:"/"+e),n=nO(r.startsWith("/")?r:"/"+r);if(i===n)return!0;let s=Iu(i,n);return s===""||!s.startsWith("..")&&!(0,Fe.isAbsolute)(s)}catch{return!1}}cpFileSync(e,r,i,n,s){if(r){if(s.errorOnExist)throw(0,P.createError)("EEXIST","cp",n);if(!s.force)return;this.unlinkSync(n)}this.copyFileSync(i,n,s.mode),s.preserveTimestamps&&this.utimesSync(n,e.atime,e.mtime),this.chmodSync(n,Number(e.mode))}cpDirSync(e,r,i,n,s){r||this.mkdirSync(n);let a=this.readdirSync(i);for(let f of a){let o=Xw(i,String(f)),c=Xw(n,String(f));s.filter&&!s.filter(o,c)||this._cp(o,c,s)}this.chmodSync(n,Number(e.mode))}cpSymlinkSync(e,r,i,n){let s=String(this.readlinkSync(r));!n.verbatimSymlinks&&!(0,Fe.isAbsolute)(s)&&(s=Wq(iO(r),s)),e&&this.unlinkSync(i),this.symlinkSync(s,i)}lstat(e,r,i){let[{throwIfNoEntry:n=!0,bigint:s=!1},a]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._lstat,[(0,P.pathToFilename)(e),s,n],a)}_stat(e,r=!1,i=!0){let n;try{n=this._core.getResolvedLinkOrThrow(e,"stat")}catch(s){if(s.code==="ENOENT"&&!i)return;throw s}return Kw.default.build(n.getNode(),r)}statSync(e,r){let{bigint:i=!0,throwIfNoEntry:n=!0}=(0,Q.getStatOptions)(r);return this._stat((0,P.pathToFilename)(e),i,n)}stat(e,r,i){let[{bigint:n=!1,throwIfNoEntry:s=!0},a]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this._stat,[(0,P.pathToFilename)(e),n,s],a)}fstatBase(e,r=!1){let i=this._core.getFileByFd(e);if(!i)throw(0,P.createError)("EBADF","fstat");return Kw.default.build(i.node,r)}fstatSync(e,r){return this.fstatBase(e,(0,Q.getStatOptions)(r).bigint)}fstat(e,r,i){let[n,s]=(0,Q.getStatOptsAndCb)(r,i);this.wrapAsync(this.fstatBase,[e,n.bigint],s)}_exists(e){return!!this._stat(e)}_access(e,r){let n=this._core.getLinkOrThrow(e,"access").getNode();if(r!==Jw&&(r&zq&&!n.canRead()||r&Hq&&!n.canWrite()||r&Vq&&!n.canExecute()))throw(0,P.createError)("EACCES","access",e)}watchFile(e,r,i){let n=(0,P.pathToFilename)(e),s=r,a=i;if(typeof s=="function"&&(a=r,s=null),typeof a!="function")throw Error('"watchFile()" requires a listener function');let f=5007,o=!0;s&&typeof s=="object"&&(typeof s.interval=="number"&&(f=s.interval),typeof s.persistent=="boolean"&&(o=s.persistent));let c=this.statWatchers[n];return c||(c=new this.StatWatcher,c.start(n,o,f),this.statWatchers[n]=c),c.addListener("change",a),c}unwatchFile(e,r){let i=(0,P.pathToFilename)(e),n=this.statWatchers[i];n&&(typeof r=="function"?n.removeListener("change",r):n.removeAllListeners("change"),n.listenerCount("change")===0&&(n.stop(),delete this.statWatchers[i]))}createReadStream(e,r){return new this.ReadStream(e,r)}createWriteStream(e,r){return new this.WriteStream(e,r)}watch(e,r,i){let n=(0,P.pathToFilename)(e),s=r;typeof r=="function"&&(i=r,s=null);let{persistent:a,recursive:f,encoding:o}=(0,Q.getDefaultOpts)(s);a===void 0&&(a=!0),f===void 0&&(f=!1);let c=new this.FSWatcher;return c.start(n,a,f,o),i&&c.addListener("change",i),c}_statfs(e,r=!1){return this._core.getResolvedLinkOrThrow(e,"statfs"),Iq.default.build(this._core,r)}statfsSync(e,r){let{bigint:i=!1}=(0,Q.getStatfsOptions)(r);return this._statfs((0,P.pathToFilename)(e),i)}statfs(e,r,i){let[{bigint:n=!1},s]=(0,Q.getStatfsOptsAndCb)(r,i);this.wrapAsync(this._statfs,[(0,P.pathToFilename)(e),n],s)}};l(Zw,"Volume");var Ki=Zw;mt.Volume=Ki;Ki.fromJSON=(t,e)=>new Ki(Yw.Superblock.fromJSON(t,e));Ki.fromNestedJSON=(t,e)=>new Ki(Yw.Superblock.fromNestedJSON(t,e));function Zq(t){t.emit("stop")}l(Zq,"emitStop");var Qw=class Qw extends sO.EventEmitter{constructor(e){super(),this.onInterval=()=>{try{let r=this.vol.statSync(this.filename);this.hasChanged(r)&&(this.emit("change",r,this.prev),this.prev=r)}finally{this.loop()}},this.vol=e}loop(){this.timeoutRef=this.setTimeout(this.onInterval,this.interval)}hasChanged(e){return e.mtimeMs>this.prev.mtimeMs||e.nlink!==this.prev.nlink}start(e,r=!0,i=5007){this.filename=(0,P.pathToFilename)(e),this.setTimeout=r?setTimeout.bind(globalThis):$q.default,this.interval=i,this.prev=this.vol.statSync(this.filename),this.loop()}stop(){clearTimeout(this.timeoutRef),(0,ju.default)(()=>{Zq.call(this,this)})}};l(Qw,"StatWatcher");var Bu=Qw;mt.StatWatcher=Bu;var Pt;function Qq(t){Pt=(0,Js.bufferAllocUnsafe)(t),Pt.used=0}l(Qq,"allocNewPool");(0,aO.inherits)(lr,Lu.Readable);mt.ReadStream=lr;function lr(t,e,r){if(!(this instanceof lr))return new lr(t,e,r);if(this._vol=t,r=Object.assign({},(0,Q.getOptions)(r,{})),r.highWaterMark===void 0&&(r.highWaterMark=64*1024),Lu.Readable.call(this,r),this.path=(0,P.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"r":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.end=r.end,this.autoClose=r.autoClose===void 0?!0:r.autoClose,this.pos=void 0,this.bytesRead=0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw new TypeError('"end" option must be a Number');if(this.start>this.end)throw new Error('"start" option must be <= "end" option');this.pos=this.start}typeof this.fd!="number"&&this.open(),this.on("end",function(){this.autoClose&&this.destroy&&this.destroy()})}l(lr,"FsReadStream");lr.prototype.open=function(){var t=this;this._vol.open(this.path,this.flags,this.mode,(e,r)=>{if(e){t.autoClose&&t.destroy&&t.destroy(),t.emit("error",e);return}t.fd=r,t.emit("open",r),t.read()})};lr.prototype._read=function(t){if(typeof this.fd!="number")return this.once("open",function(){this._read(t)});if(this.destroyed)return;(!Pt||Pt.length-Pt.used<Jq)&&Qq(this._readableState.highWaterMark);var e=Pt,r=Math.min(Pt.length-Pt.used,t),i=Pt.used;if(this.pos!==void 0&&(r=Math.min(this.end-this.pos+1,r)),r<=0)return this.push(null);var n=this;this._vol.read(this.fd,Pt,Pt.used,r,this.pos,s),this.pos!==void 0&&(this.pos+=r),Pt.used+=r;function s(a,f){if(a)n.autoClose&&n.destroy&&n.destroy(),n.emit("error",a);else{var o=null;f>0&&(n.bytesRead+=f,o=e.slice(i,i+f)),n.push(o)}}l(s,"onread")};lr.prototype._destroy=function(t,e){this.close(r=>{e(t||r)})};lr.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",oO);return}return(0,ju.default)(()=>this.emit("close"))}typeof this._readableState?.closed=="boolean"?this._readableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};function oO(t){this.close()}l(oO,"closeOnOpen");(0,aO.inherits)(Nt,Lu.Writable);mt.WriteStream=Nt;function Nt(t,e,r){if(!(this instanceof Nt))return new Nt(t,e,r);if(this._vol=t,r=Object.assign({},(0,Q.getOptions)(r,{})),Lu.Writable.call(this,r),this.path=(0,P.pathToFilename)(e),this.fd=r.fd===void 0?null:typeof r.fd!="number"?r.fd.fd:r.fd,this.flags=r.flags===void 0?"w":r.flags,this.mode=r.mode===void 0?438:r.mode,this.start=r.start,this.autoClose=r.autoClose===void 0?!0:!!r.autoClose,this.pos=void 0,this.bytesWritten=0,this.pending=!0,this.start!==void 0){if(typeof this.start!="number")throw new TypeError('"start" option must be a Number');if(this.start<0)throw new Error('"start" must be >= zero');this.pos=this.start}r.encoding&&this.setDefaultEncoding(r.encoding),typeof this.fd!="number"&&this.open(),this.once("finish",function(){this.autoClose&&this.close()})}l(Nt,"FsWriteStream");Nt.prototype.open=function(){this._vol.open(this.path,this.flags,this.mode,function(t,e){if(t){this.autoClose&&this.destroy&&this.destroy(),this.emit("error",t);return}this.fd=e,this.pending=!1,this.emit("open",e)}.bind(this))};Nt.prototype._write=function(t,e,r){if(!(t instanceof Js.Buffer||t instanceof Uint8Array))return this.emit("error",new Error("Invalid data"));if(typeof this.fd!="number")return this.once("open",function(){this._write(t,e,r)});var i=this;this._vol.write(this.fd,t,0,t.length,this.pos,(n,s)=>{if(n)return i.autoClose&&i.destroy&&i.destroy(),r(n);i.bytesWritten+=s,r()}),this.pos!==void 0&&(this.pos+=t.length)};Nt.prototype._writev=function(t,e){if(typeof this.fd!="number")return this.once("open",function(){this._writev(t,e)});let r=this,i=t.length,n=new Array(i);for(var s=0,a=0;a<i;a++){var f=t[a].chunk;n[a]=f,s+=f.length}let o=Js.Buffer.concat(n);this._vol.write(this.fd,o,0,o.length,this.pos,(c,u)=>{if(c)return r.destroy&&r.destroy(),e(c);r.bytesWritten+=u,e()}),this.pos!==void 0&&(this.pos+=s)};Nt.prototype.close=function(t){if(t&&this.once("close",t),this.closed||typeof this.fd!="number"){if(typeof this.fd!="number"){this.once("open",oO);return}return(0,ju.default)(()=>this.emit("close"))}typeof this._writableState?.closed=="boolean"?this._writableState.closed=!0:this.closed=!0,this._vol.close(this.fd,e=>{e?this.emit("error",e):this.emit("close")}),this.fd=null};Nt.prototype._destroy=lr.prototype._destroy;Nt.prototype.destroySoon=Nt.prototype.end;var ey=class ey extends sO.EventEmitter{constructor(e){super(),this._filename="",this._filenameEncoded="",this._recursive=!1,this._encoding=Gi.ENCODING_UTF8,this._listenerRemovers=new Map,this._onParentChild=r=>{r.getName()===this._getName()&&this._emit("rename")},this._emit=r=>{this.emit("change",r,this._filenameEncoded)},this._persist=()=>{this._timer=setTimeout(this._persist,1e6)},this._vol=e}_getName(){return this._steps[this._steps.length-1]}start(e,r=!0,i=!1,n=Gi.ENCODING_UTF8){this._filename=(0,P.pathToFilename)(e),this._steps=(0,je.filenameToSteps)(this._filename),this._filenameEncoded=(0,Gi.strToEncoding)(this._filename),this._recursive=i,this._encoding=n;try{this._link=this._vol._core.getLinkOrThrow(this._filename,"FSWatcher")}catch(o){let c=new Error(`watch ${this._filename} ${o.code}`);throw c.code=o.code,c.errno=o.code,c}let s=l(o=>{let c=o.getPath(),u=o.getNode(),h=l(()=>{let m=Iu(this._filename,c);return m||(m=this._getName()),this.emit("change","change",m)},"onNodeChange"),d=u.changes.listen(([m])=>{m==="modify"&&h()}),p=this._listenerRemovers.get(u.ino)??[];p.push(()=>d()),this._listenerRemovers.set(u.ino,p)},"watchLinkNodeChanged"),a=l(o=>{let c=o.getNode(),u=l(m=>{this.emit("change","rename",Iu(this._filename,m.getPath())),s(m),a(m)},"onLinkChildAdd"),h=l(m=>{let w=l(y=>{let g=y.getNode().ino,_=this._listenerRemovers.get(g);_&&(_.forEach(F=>F()),this._listenerRemovers.delete(g));for(let[F,R]of y.children.entries())R&&F!=="."&&F!==".."&&w(R)},"removeLinkNodeListeners");w(m),this.emit("change","rename",Iu(this._filename,m.getPath()))},"onLinkChildDelete");for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&s(w);let d=o.changes.listen(([m,w])=>{m==="child:add"?u(w):m==="child:del"&&h(w)});if((this._listenerRemovers.get(c.ino)??[]).push(()=>{d()}),i)for(let[m,w]of o.children.entries())w&&m!=="."&&m!==".."&&a(w)},"watchLinkChildrenChanged");s(this._link),a(this._link);let f=this._link.parent;f&&f.changes.listen(([o,c])=>{o==="child:del"&&this._onParentChild(c)}),r&&this._persist()}close(){clearTimeout(this._timer),this._listenerRemovers.forEach(e=>{e.forEach(r=>r())}),this._listenerRemovers.clear(),this._parentChangesUnsub?.()}};l(ey,"FSWatcher");var Mu=ey;mt.FSWatcher=Mu});var lO=T(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.fsSynchronousApiList=void 0;qu.fsSynchronousApiList=["accessSync","appendFileSync","chmodSync","chownSync","closeSync","copyFileSync","existsSync","fchmodSync","fchownSync","fdatasyncSync","fstatSync","fsyncSync","ftruncateSync","futimesSync","lchmodSync","lchownSync","linkSync","lstatSync","mkdirSync","mkdtempSync","openSync","opendirSync","readdirSync","readFileSync","readlinkSync","readSync","readvSync","realpathSync","renameSync","rmdirSync","rmSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","lutimesSync","writeFileSync","writeSync","writevSync"]});var fO=T(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.fsCallbackApiList=void 0;Uu.fsCallbackApiList=["access","appendFile","chmod","chown","close","copyFile","cp","createReadStream","createWriteStream","exists","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","openAsBlob","opendir","read","readv","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","unwatchFile","utimes","lutimes","watch","watchFile","write","writev","writeFile"]});var hO=T((wt,Wu)=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.memfs=wt.fs=wt.vol=wt.Volume=void 0;wt.createFsFromVolume=ty;var e8=uw(),t8=ou(),zu=cO();Object.defineProperty(wt,"Volume",{enumerable:!0,get:l(function(){return zu.Volume},"get")});var uO=zt(),r8=lO(),i8=fO(),{F_OK:n8,R_OK:s8,W_OK:a8,X_OK:o8}=uO.constants;wt.vol=new zu.Volume;function ty(t){let e={F_OK:n8,R_OK:s8,W_OK:a8,X_OK:o8,constants:uO.constants,Stats:e8.default,Dirent:t8.default};for(let r of r8.fsSynchronousApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));for(let r of i8.fsCallbackApiList)typeof t[r]=="function"&&(e[r]=t[r].bind(t));return e.StatWatcher=t.StatWatcher,e.FSWatcher=t.FSWatcher,e.WriteStream=t.WriteStream,e.ReadStream=t.ReadStream,e.promises=t.promises,typeof t.realpath=="function"&&(e.realpath=t.realpath.bind(t),typeof t.realpath.native=="function"&&(e.realpath.native=t.realpath.native.bind(t))),typeof t.realpathSync=="function"&&(e.realpathSync=t.realpathSync.bind(t),typeof t.realpathSync.native=="function"&&(e.realpathSync.native=t.realpathSync.native.bind(t))),e._toUnixTimestamp=zu.toUnixTimestamp,e.__vol=t,e}l(ty,"createFsFromVolume");wt.fs=ty(wt.vol);var c8=l((t={},e="/")=>{let r=zu.Volume.fromNestedJSON(t,e);return{fs:ty(r),vol:r}},"memfs");wt.memfs=c8;Wu.exports={...Wu.exports,...wt.fs};Wu.exports.semantic=!0});var dy=l(t=>{try{let r=t.split(".")[1];if(!r)throw new Error("Invalid JWT format");let i=r.replace(/-/g,"+").replace(/_/g,"/");for(;i.length%4!==0;)i+="=";let n=atob(i),a=JSON.parse(n).exp;if(!a||typeof a!="number")throw new Error('JWT does not contain a valid "exp" field');return a*1e3}catch(e){throw new Error("Unable to determine the token expiry: "+e)}},"getJwtExpiry"),ia,Xi,rh=(Xi=class{constructor(e){G(this,"strategy","jwt");G(this,"cachedToken",null);G(this,"tokenExpiry",null);ta(this,ia);ra(this,ia,e)}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>30*1e3)return{Authorization:`Bearer ${this.cachedToken}`};let r=await ea(this,ia).call(this);return r?(this.cachedToken=r,this.tokenExpiry=dy(r),{Authorization:`Bearer ${r}`}):!1}readAuthHeaders(e){let r=e.get("Authorization");if(!r)return;let[i,n]=r.split(" ");if(i!=="Bearer"||!n)throw new Error("Invalid auth header received");this.cachedToken=n,this.tokenExpiry=dy(n)}},ia=new WeakMap,l(Xi,"AssistantCloudJWTAuthStrategy"),Xi),na,sa,aa,Yi,py=(Yi=class{constructor(e,r,i){G(this,"strategy","api-key");ta(this,na);ta(this,sa);ta(this,aa);ra(this,na,e),ra(this,sa,r),ra(this,aa,i)}async getAuthHeaders(){return{Authorization:`Bearer ${ea(this,na)}`,"Aui-User-Id":ea(this,sa),"Aui-Workspace-Id":ea(this,aa)}}readAuthHeaders(){}},na=new WeakMap,sa=new WeakMap,aa=new WeakMap,l(Yi,"AssistantCloudAPIKeyAuthStrategy"),Yi),Io="aui:refresh_token",Zi,my=(Zi=class{constructor(e){G(this,"strategy","anon");G(this,"baseUrl");G(this,"jwtStrategy");this.baseUrl=e,this.jwtStrategy=new rh(async()=>{let r=Date.now(),i=localStorage.getItem(Io),n=i?JSON.parse(i):void 0;if(n)if(new Date(n.expires_at).getTime()-r>30*1e3){let u=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:n.token})});if(u.ok){let h=await u.json(),{access_token:d,refresh_token:p}=h;return p&&localStorage.setItem(Io,JSON.stringify(p)),d}}else localStorage.removeItem(Io);let s=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!s.ok)return null;let a=await s.json(),{access_token:f,refresh_token:o}=a;return!f||!o?null:(localStorage.setItem(Io,JSON.stringify(o)),f)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},l(Zi,"AssistantCloudAnonymousAuthStrategy"),Zi);var Qi,PO=(Qi=class extends Error{constructor(e){super(e),this.name="APIError"}},l(Qi,"CloudAPIError"),Qi),en,wy=(en=class{constructor(e){G(this,"_auth");G(this,"_baseUrl");if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new rh(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new py(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new my(e.baseUrl);else throw new Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,r={}){let i=await this._auth.getAuthHeaders();if(!i)throw new Error("Authorization failed");let n={...i,...r.headers,"Content-Type":"application/json"},s=new URLSearchParams;if(r.query)for(let[o,c]of Object.entries(r.query))c!==!1&&(c===!0?s.set(o,"true"):s.set(o,c.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=s.toString();let f=await fetch(a,{method:r.method??"GET",headers:n,body:r.body?JSON.stringify(r.body):null});if(this._auth.readAuthHeaders(f.headers),!f.ok){let o=await f.text();try{let c=JSON.parse(o);throw new PO(c.message)}catch{throw new Error(`Request failed with status ${f.status}, ${o}`)}}return f}async makeRequest(e,r={}){return(await this.makeRawRequest(e,r)).json()}},l(en,"AssistantCloudAPI"),en);var tn,yy=(tn=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},l(tn,"AssistantCloudAuthTokens"),tn);var fr={toResponse(t,e){return new Response(fr.toByteStream(t,e),{headers:e.headers??{}})},fromResponse(t,e){return fr.fromByteStream(t.body,e)},toByteStream(t,e){return t.pipeThrough(e)},fromByteStream(t,e){return t.pipeThrough(e)}};var $o=l(function(){let t,e,r=new Promise((i,n)=>{t=i,e=n});if(!t||!e)throw new Error("Failed to create promise");return{promise:r,resolve:t,reject:e}},"promiseWithResolvers");var gy=l(()=>{let t=[],e=!1,r,i,n=l(a=>{a.promise||(a.promise=a.reader.read().then(({done:f,value:o})=>{a.promise=void 0,f?(t.splice(t.indexOf(a),1),e&&t.length===0&&r.close()):r.enqueue(o),i?.resolve(),i=void 0}).catch(f=>{console.error(f),t.forEach(o=>{o.reader.cancel()}),t.length=0,r.error(f),i?.reject(f),i=void 0}))},"handlePull");return{readable:new ReadableStream({start(a){r=a},pull(){return i=$o(),t.forEach(a=>{n(a)}),i.promise},cancel(){t.forEach(a=>{a.reader.cancel()}),t.length=0}}),isSealed(){return e},seal(){e=!0,t.length===0&&r.close()},addStream(a){if(e)throw new Error("Cannot add streams after the run callback has settled.");let f={reader:a.getReader()};t.push(f),n(f)},enqueue(a){this.addStream(new ReadableStream({start(f){f.enqueue(a),f.close()}}))}}},"createMergeStream");var rn,by=(rn=class{constructor(e){G(this,"_controller");G(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(rn,"TextStreamControllerImpl"),rn),ih=l(t=>new ReadableStream({start(e){return t.start?.(new by(e))},pull(e){return t.pull?.(new by(e))},cancel(e){return t.cancel?.(e)}}),"createTextStream"),nh=l(()=>{let t;return[ih({start(r){t=r}}),t]},"createTextStreamController");var nn,_y=(nn=class{constructor(e){G(this,"_isClosed",!1);G(this,"_mergeTask");G(this,"_argsTextController");this._controller=e;let r=ih({start:l(n=>{this._argsTextController=n},"start")}),i=!1;this._mergeTask=r.pipeTo(new WritableStream({write:l(n=>{switch(n.type){case"text-delta":i=!0,this._controller.enqueue(n);break;case"part-finish":i||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}},"write")}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}},l(nn,"ToolCallStreamControllerImpl"),nn),NO=l(t=>new ReadableStream({start(e){return t.start?.(new _y(e))},pull(e){return t.pull?.(new _y(e))},cancel(e){return t.cancel?.(e)}}),"createToolCallStream"),vy=l(()=>{let t;return[NO({start(r){t=r}}),t]},"createToolCallStreamController");var sn,Bo=(sn=class{constructor(){G(this,"value",-1)}up(){return++this.value}},l(sn,"Counter"),sn);var an,Ey=(an=class extends TransformStream{constructor(e){super({transform(r,i){i.enqueue({...r,path:[e,...r.path]})}})}},l(an,"PathAppendEncoder"),an),on,K8=(on=class extends TransformStream{constructor(e){super({transform(r,i){let{path:[n,...s]}=r;if(e!==n)throw new Error(`Path mismatch: expected ${e}, got ${n}`);i.enqueue({...r,path:s})}})}},l(on,"PathAppendDecoder"),on),cn,Sy=(cn=class extends TransformStream{constructor(e){let r=new Bo,i=new Map;super({transform(n,s){n.type==="part-start"&&n.path.length===0&&i.set(r.up(),e.up());let[a,...f]=n.path;if(a===void 0){s.enqueue(n);return}let o=i.get(a);if(o===void 0)throw new Error("Path not found");s.enqueue({...n,path:[o,...f]})}})}},l(cn,"PathMergeEncoder"),cn);var ln,Fy=(ln=class extends TransformStream{constructor(e,r,i){let[n,s]=oa(),a;super({start(f){return a=n.pipeTo(new WritableStream({write(o){f.enqueue(o)},abort(o){f.error(o)},close(){f.terminate()}})).catch(o=>{f.error(o)}),e.start?.(s)},transform(f){return e.transform?.(f,s)},async flush(){await e.flush?.(s),s.close(),await a}},r,i)}},l(ln,"AssistantTransformStream"),ln);var fn,Mo=(fn=class extends TransformStream{constructor(e){super();let r=e(super.readable);Object.defineProperty(this,"readable",{value:r,writable:!1})}},l(fn,"PipeableTransformStream"),fn);var le=(t=>(t.TextDelta="0",t.Data="2",t.Error="3",t.Annotation="8",t.ToolCall="9",t.ToolCallResult="a",t.StartToolCall="b",t.ToolCallArgsTextDelta="c",t.FinishMessage="d",t.FinishStep="e",t.StartStep="f",t.ReasoningDelta="g",t.Source="h",t.RedactedReasoning="i",t.ReasoningSignature="j",t.File="k",t.AuiUpdateStateOperations="aui-state",t.AuiTextDelta="aui-text-delta",t.AuiReasoningDelta="aui-reasoning-delta",t))(le||{});var un,Ty=(un=class extends TransformStream{constructor(){super({transform:l((e,r)=>{r.enqueue(`${e.type}:${JSON.stringify(e.value)}
|
|
100
|
+
`)},"transform")})}},l(un,"DataStreamChunkEncoder"),un),hn,DO=(hn=class extends TransformStream{constructor(){super({transform:l((e,r)=>{let i=e.indexOf(":");if(i===-1)throw new Error("Invalid stream part");r.enqueue({type:e.slice(0,i),value:JSON.parse(e.slice(i+1))})},"transform")})}},l(hn,"DataStreamChunkDecoder"),hn);var dn,Ry=(dn=class extends TransformStream{constructor(){let e=[];super({transform(r,i){if(r.type==="part-start"){if(r.path.length!==0){i.error(new Error("Nested parts are not supported"));return}e.push(r.part),i.enqueue(r);return}if(r.type==="text-delta"||r.type==="result"||r.type==="part-finish"||r.type==="tool-call-args-text-finish"){if(r.path.length!==1){i.error(new Error(`${r.type} chunks must have a path of length 1`));return}let n=r.path[0];if(n<0||n>=e.length){i.error(new Error(`Invalid path index: ${n}`));return}let s=e[n];i.enqueue({...r,meta:s});return}i.enqueue(r)}})}},l(dn,"AssistantMetaTransformStream"),dn);var pn,sh=(pn=class extends Mo{constructor(){super(r=>{let i=new TransformStream({transform(n,s){let a=n.type;switch(a){case"part-start":{let f=n.part;if(f.type==="tool-call"){let{type:o,...c}=f;s.enqueue({type:le.StartToolCall,value:c})}if(f.type==="source"){let{type:o,...c}=f;s.enqueue({type:le.Source,value:c})}break}case"text-delta":{let f=n.meta;switch(f.type){case"text":{f.parentId?s.enqueue({type:le.AuiTextDelta,value:{textDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:le.TextDelta,value:n.textDelta});break}case"reasoning":{f.parentId?s.enqueue({type:le.AuiReasoningDelta,value:{reasoningDelta:n.textDelta,parentId:f.parentId}}):s.enqueue({type:le.ReasoningDelta,value:n.textDelta});break}case"tool-call":{s.enqueue({type:le.ToolCallArgsTextDelta,value:{toolCallId:f.toolCallId,argsTextDelta:n.textDelta}});break}default:throw new Error(`Unsupported part type for text-delta: ${f.type}`)}break}case"result":{let f=n.meta;if(f.type!=="tool-call")throw new Error(`Result chunk on non-tool-call part not supported: ${f.type}`);s.enqueue({type:le.ToolCallResult,value:{toolCallId:f.toolCallId,result:n.result,artifact:n.artifact,...n.isError?{isError:n.isError}:{}}});break}case"step-start":{let{type:f,...o}=n;s.enqueue({type:le.StartStep,value:o});break}case"step-finish":{let{type:f,...o}=n;s.enqueue({type:le.FinishStep,value:o});break}case"message-finish":{let{type:f,...o}=n;s.enqueue({type:le.FinishMessage,value:o});break}case"error":{s.enqueue({type:le.Error,value:n.error});break}case"annotations":{s.enqueue({type:le.Annotation,value:n.annotations});break}case"data":{s.enqueue({type:le.Data,value:n.data});break}case"update-state":{s.enqueue({type:le.AuiUpdateStateOperations,value:n.operations});break}case"tool-call-args-text-finish":case"part-finish":break;default:{let f=a;throw new Error(`Unsupported chunk type: ${f}`)}}}});return r.pipeThrough(new Ry).pipeThrough(i).pipeThrough(new Ty).pipeThrough(new TextEncoderStream)});G(this,"headers",new Headers({"Content-Type":"text/plain; charset=utf-8","x-vercel-ai-data-stream":"v1"}))}},l(pn,"DataStreamEncoder"),pn),uU=[le.StartToolCall,le.ToolCall,le.TextDelta,le.ReasoningDelta,le.Source,le.Error,le.FinishStep,le.FinishMessage,le.AuiTextDelta,le.AuiReasoningDelta];var Oy=l((t,e=21)=>(r=e)=>{let i="",n=r|0;for(;n--;)i+=t[Math.random()*t.length|0];return i},"customAlphabet");var ky=Oy("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var hi,CO=(hi=class{constructor(e){G(this,"_state");G(this,"_parentId");this._state=e||{merger:gy(),contentCounter:new Bo}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:e,path:[]}),this._state.merger.addStream(r.pipeThrough(new Ey(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new Sy(this._state.contentCounter)))}appendText(e){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,r]=nh();return this._addPart({type:"text"},e),r}addReasoningPart(){let[e,r]=nh();return this._addPart({type:"reasoning"},e),r}addToolCallPart(e){let r=typeof e=="string"?{toolName:e}:e,i=r.toolName,n=r.toolCallId??ky(),[s,a]=vy();return this._addPart({type:"tool-call",toolName:i,toolCallId:n,...this._parentId&&{parentId:this._parentId}},s),r.argsText!==void 0&&(a.argsText.append(r.argsText),a.argsText.close()),r.args!==void 0&&(a.argsText.append(JSON.stringify(r.args)),a.argsText.close()),r.response!==void 0&&a.setResponse(r.response),a}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type==="part-start"&&e.path.length===0&&this._state.contentCounter.up()}withParentId(e){let r=new hi(this._state);return r._parentId=e,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}},l(hi,"_AssistantStreamControllerImpl"),hi);function xy(t){let e=new CO;return l(async()=>{try{await t(e)}catch(i){throw e.__internal_isClosed||e.enqueue({type:"error",path:[],error:String(i)}),i}finally{e.__internal_isClosed||e.close()}},"runTask")(),e.__internal_getReadable()}l(xy,"createAssistantStream");function oa(){let{resolve:t,promise:e}=$o(),r;return[xy(n=>(r=n,r.__internal_subscribeToClose(t),e)),r]}l(oa,"createAssistantStreamController");var mn,ca=(mn=class extends Mo{constructor(){super(e=>{let r=new Fy({transform(i,n){n.appendText(i)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(r)})}},l(mn,"PlainTextDecoder"),mn);var wn,Ay=(wn=class{constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:this.cloud._baseUrl+"/v1/runs/stream",headers:l(async()=>{let r=await this.cloud._auth.getAuthHeaders();if(!r)throw new Error("Authorization failed");return{...r,Accept:"text/plain"}},"headers"),body:{assistant_id:e,response_format:"vercel-ai-data-stream/v1",thread_id:"unstable_todo"}}}async stream(e){let r=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return fr.fromResponse(r,new ca)}},l(wn,"AssistantCloudRuns"),wn);var yn,Py=(yn=class{constructor(e){this.cloud=e}async list(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:r})}async create(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:r})}},l(yn,"AssistantCloudThreadMessages"),yn);var gn,Ny=(gn=class{constructor(e){G(this,"messages");this.cloud=e,this.messages=new Py(e)}async list(e){return this.cloud.makeRequest("/threads",{query:e})}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,r){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:r})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}},l(gn,"AssistantCloudThreads"),gn);var bn,Dy=(bn=class{constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest("/files/pdf-to-images",{method:"POST",body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest("/files/attachments/generate-presigned-upload-url",{method:"POST",body:e})}},l(bn,"AssistantCloudFiles"),bn);var _n,ah=(_n=class{constructor(e){G(this,"threads");G(this,"auth");G(this,"runs");G(this,"files");let r=new wy(e);this.threads=new Ny(r),this.auth={tokens:new yy(r)},this.runs=new Ay(r),this.files=new Dy(r)}},l(_n,"AssistantCloud"),_n);var Kf=ce(Cn(),1),Jf=ce(Cn(),1),KT=ce(md(),1),Xf=ce(Cn(),1),XT=ce(md(),1),tw=ce(ke(),1),Yf=ce(Cn(),1),iw=ce(ke(),1),Wt=ce(ke(),1),ne=ce(ke(),1),Hf=ce(ke(),1),ii=ce(ke(),1),Lf=ce(ke(),1),qf=ce(ke(),1),Uf=ce(ke(),1),st=ce(ke(),1),oR=ce(ke(),1),Li=ce(ke(),1),Os=ce(ke(),1),lw=ce(ke(),1),or=ce(ke(),1),Ze=ce(ke(),1);import*as ew from"path";import*as UT from"path";import*as HT from"path";import*as jf from"path";import*as rw from"path";var kT=ce(R1(),1);function LM(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}l(LM,"fromValue");function qM(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:LM(t)}l(qM,"getIterator");async function xT(t,e){let r=qM(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}l(xT,"forAwait");function UM(t){let{PassThrough:e}=OT(),r=new e;return setTimeout(async()=>{await xT(t,i=>r.write(i)),r.end()},1),r}l(UM,"asyncIteratorToStream");async function WM(t){let e=0,r=[];await xT(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}l(WM,"collect");function zM(t){let e=Object.getOwnPropertyDescriptor(t,Symbol.asyncIterator);if(e&&e.enumerable)return t;let r=!1,i=[],n={};return t.on("data",s=>{i.push(s),n.resolve&&(n.resolve({value:i.shift(),done:!1}),n={})}),t.on("error",s=>{n.reject&&(n.reject(s),n={})}),t.on("end",()=>{r=!0,n.resolve&&(n.resolve({done:!0}),n={})}),{next(){return new Promise((s,a)=>{if(i.length===0&&r)return s({done:!0});if(i.length>0)return s({value:i.shift(),done:!1});i.length===0&&!r&&(n={resolve:s,reject:a})})},return(){t.removeAllListeners(),t.destroy&&t.destroy()},[Symbol.asyncIterator](){return this}}}l(zM,"fromNodeStream");async function HM({onProgress:t,url:e,method:r="GET",headers:i={},agent:n,body:s}){return s&&Array.isArray(s)?s=Buffer.from(await WM(s)):s&&(s=UM(s)),new Promise((a,f)=>{(0,kT.default)({url:e,method:r,headers:i,agent:n,body:s},(o,c)=>{if(o)return f(o);try{let u=zM(c);a({url:c.url,method:c.method,statusCode:c.statusCode,statusMessage:c.statusMessage,body:u,headers:c.headers})}catch(u){f(u)}})})}l(HM,"request");var VM={request:HM},Mf=VM;var He=ce(ke(),1),Zf=ce(Cn(),1),fw=ce(ke(),1);var MT=Object.defineProperty,GM=l((t,e,r)=>e in t?MT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"ot"),b=l((t,e)=>MT(t,"name",{value:e,configurable:!0}),"n"),U=l((t,e,r)=>GM(t,typeof e!="symbol"?e+"":e,r),"p"),xs,jT=(xs=class{constructor(e,r){U(this,"entries",[]),U(this,"currentIndex",0),U(this,"closed",!1),U(this,"compositFs"),U(this,"dirPath"),U(this,"initialized",!1),this.compositFs=e,this.dirPath=r}async initialize(){if(this.initialized)return;let e=new Set;for(let r of[...this.compositFs.subFilesystems].reverse()){let i=await r.readdir(this.dirPath);for(let n of i)e.add(n)}for(let r of Array.from(e)){let i=this.dirPath+"/"+r;await this.compositFs.hiddenFilesFileSystem?.responsible(i)||this.entries.push({name:r,path:i})}this.initialized=!0}async*[Symbol.asyncIterator](){for(await this.initialize();this.currentIndex<this.entries.length&&!this.closed;){let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);yield{name:e.name,isFile:b(()=>r.isFile(),"isFile"),isDirectory:b(()=>r.isDirectory(),"isDirectory"),isBlockDevice:b(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:b(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:b(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:b(()=>r.isFIFO(),"isFIFO"),isSocket:b(()=>r.isSocket(),"isSocket")}}catch(r){console.debug(`Failed to stat ${e.path}:`,r)}}}async read(){if(this.closed)throw new Error("Directory handle is closed");if(await this.initialize(),this.currentIndex>=this.entries.length)return null;let e=this.entries[this.currentIndex++];try{let r=await this.compositFs.stat(e.path);return{name:e.name,isFile:b(()=>r.isFile(),"isFile"),isDirectory:b(()=>r.isDirectory(),"isDirectory"),isBlockDevice:b(()=>r.isBlockDevice(),"isBlockDevice"),isCharacterDevice:b(()=>r.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:b(()=>r.isSymbolicLink(),"isSymbolicLink"),isFIFO:b(()=>r.isFIFO(),"isFIFO"),isSocket:b(()=>r.isSocket(),"isSocket")}}catch{return this.read()}}async close(){this.closed=!0,this.entries=[]}get path(){return this.dirPath}},l(xs,"he"),xs);b(jT,"CompositeFsDir");var LT=jT,As,qT=(As=class{constructor(e){U(this,"delegate"),U(this,"compositeFs"),U(this,"_subFsFileDescriptor"),U(this,"handleType","file"),U(this,"_compositFsFileDescriptor",-1),this.delegate=e.fs,this._subFsFileDescriptor=e.subFsFileDescriptor,this._compositFsFileDescriptor=-1,this.compositeFs=e.compositeFs;let r=this._subFsFileDescriptor}get fsType(){return this.delegate.fileType()}get subFsFileDescriptor(){return this._subFsFileDescriptor}get fd(){return this._compositFsFileDescriptor}realize(e){if(this._compositFsFileDescriptor!==-1)throw new Error("was already realized");this._compositFsFileDescriptor=e}readableWebStream(e){throw new Error("Method not implemented.")}async appendFile(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"appendFile",{data:e,options:r}),await this.delegate.appendFile(this,e,r)}async chmod(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chmod",{mode:e}),this.delegate.fchmod(this,e)}async chown(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chown",{uid:e,gid:r}),this.delegate.fchown(this,e,r)}async close(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"close",{}),this.compositeFs.close(this)}async datasync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"datasync",{}),this.delegate.dataSync(this)}async read(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"read",{targetBufferLength:e.length,offset:r,length:i,position:n}),await this.delegate.read(this,e,r,i,n)}async readv(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"readv",{buffers:e,position:r}),this.delegate.readv(this,e,r)}async stat(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"stat",{options:e}),this.delegate.fstat(this,e)}async truncate(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"truncate",{len:e}),this.delegate.ftruncate(this,e)}async utimes(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"utimes",{atime:e,mtime:r}),this.delegate.futimes(this,e,r)}async write(e,r,i,n){return await this.compositeFs.logOperationOnFileDescsriptor(this,"write",{buffer:e,offset:r,length:i,position:n}),this.delegate.write(this,e,r,i,n)}async writev(e,r){return await this.compositeFs.logOperationOnFileDescsriptor(this,"writev",{buffers:e,position:r}),this.delegate.writev(this,e,r)}async sync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"sync",{}),this.delegate.dataSync(this)}},l(As,"pe"),As);b(qT,"CompositFsFileHandle");var Gf=qT,Ps,WT=(Ps=class{constructor({name:e,parentFs:r,gitRoot:i}){U(this,"compositFs"),U(this,"gitRoot"),U(this,"name"),this.name=e,this.compositFs=r,this.gitRoot=i}toStr(e){return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e&&typeof e=="object"&&"fd"in e?`FileHandle(fd=${e.fd})`:String(e)}async open(e,r,i){throw new Error(`open not implemented for: ${this.toStr(e)}`)}async access(e,r){throw new Error(`access not implemented for: ${this.toStr(e)}`)}async stat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async lstat(e,r){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async opendir(e,r){throw new Error(`opendir not implemented for: ${this.toStr(e)}`)}async link(e,r){throw new Error(`link not implemented for: ${this.toStr(e)}`)}async mkdir(e,r){throw new Error(`mkdir not implemented for: ${this.toStr(e)}`)}async readdir(e,r){throw new Error(`readdir not implemented for: ${this.toStr(e)}`)}async readlink(e,...r){throw new Error(`readlink not implemented for: ${this.toStr(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${this.toStr(e)}`)}async rename(e,r){throw new Error(`rename not implemented for: ${this.toStr(e)}`)}async rmdir(e,...r){throw new Error(`rmdir not implemented for: ${this.toStr(e)}`)}async symlink(e,r,i){throw new Error(`symlink not implemented for: ${this.toStr(r)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${this.toStr(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositFs.close(e)}async dataSync(e){throw new Error(`dataSync not implemented for: ${e.subFsFileDescriptor}`)}async read(e,r,i,n,s){throw new Error(`read not implemented for: ${e.subFsFileDescriptor}`)}async appendFile(e,r,i){throw new Error(`appendFile not implemented for: ${e.subFsFileDescriptor}`)}async fchmod(e,r){throw new Error(`fchmod not implemented for: ${e.subFsFileDescriptor}`)}async fchown(e,r,i){throw new Error(`fchown not implemented for: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){throw new Error(`ftruncate not implemented for: ${e.subFsFileDescriptor}`)}async fstat(e,r){throw new Error(`fstat not implemented for: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){throw new Error(`futimes not implemented for: ${e.subFsFileDescriptor}`)}async write(e,r,i,n,s){throw new Error(`write not implemented for: ${e.subFsFileDescriptor}`)}async writev(e,r,i){throw new Error(`writev not implemented for: ${e.subFsFileDescriptor}`)}async readv(e,r,i){throw new Error(`readv not implemented for: ${e.subFsFileDescriptor}`)}async readFile(e,r){throw new Error(`readFile not implemented for: ${this.toStr(e)}`)}async writeFile(e,r,i){throw new Error(`writeFile not implemented for: ${this.toStr(e)}`)}},l(Ps,"ue"),Ps);b(WT,"BaseCompositeSubFs");var So=WT,Ns,zT=(Ns=class extends So{constructor({name:e,parentFs:r,gitRoot:i}){if(super({name:e,parentFs:r,gitRoot:i}),U(this,"openFh",new Map),U(this,"memFs",(0,Kf.createFsFromVolume)(new Kf.Volume)),U(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.compositFs.parentFs===void 0)throw new Error("PassThroughSubFs not allowed in root fs");this.targetFs=this.compositFs.parentFs}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=UT.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new Gf({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:s.fd,parentFsFileDescriptors:[s.fd]})}async access(e,r){return await this.targetFs.promises.access(e,r)}async stat(e,r){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,r){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,r){return await this.targetFs.promises.opendir(e,r)}async link(e,r){return await this.targetFs.promises.link(e,r)}async mkdir(e,r){let i=typeof e=="string"?e:e.toString();return await this.targetFs.promises.mkdir(i,r)}async readdir(e,...r){return this.targetFs.promises.readdir(e,...r)}async readlink(e,...r){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,r){return await this.targetFs.promises.rename(e,r)}async rmdir(e,r){return await this.targetFs.promises.rmdir(e,r)}async symlink(e,r,i){return await this.targetFs.promises.symlink(e,r,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.sync()}async read(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){return typeof e=="string"||Buffer.isBuffer(e)?this.targetFs.readFile(e.toString(),r):super.readFile(e,r)}async writeFile(e,r,i){let n=typeof i=="object"&&i.flag?i.flag:"w",s=await this.targetFs.open(e,n);try{let a;if(typeof r=="string"){let f=typeof i=="object"&&i.encoding?i.encoding:"utf8";a=Buffer.from(r,f)}else Buffer.isBuffer(r)?a=r:a=Buffer.from(r);await s.write(a,0,a.length,0)}finally{await this.targetFs.close(s)}}},l(Ns,"Fe"),Ns);b(zT,"PassThroughSubFs");var KM=zT,Ds,VT=(Ds=class extends So{constructor({name:e,parentFs:r,gitRoot:i,passThroughFs:n}){super({name:e,parentFs:r,gitRoot:i}),U(this,"openFh",new Map),U(this,"memFs",(0,Jf.createFsFromVolume)(new Jf.Volume)),U(this,"targetFs"),this.compositFs=r,this.gitRoot=i,this.targetFs=n}async responsible(e){return!0}fileType(){return 4}async open(e,r,i){let n=HT.dirname(e),s=await this.targetFs.promises.open(e,r,i);return this.openFh.set(s.fd,s),new Gf({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:s.fd,parentFsFileDescriptors:[]})}async access(e,r){return await this.targetFs.promises.access(e,r)}async stat(e,...r){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,...r){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,r){let i=await this.targetFs.promises.opendir(e,r);return new LT(this.compositFs,e.toString())}async link(e,r){return await this.targetFs.promises.link(e,r)}async mkdir(e,r){await this.targetFs.promises.mkdir(e,r)}async readdir(e,...r){return this.targetFs.promises.readdir(e,...r)}async readlink(e,...r){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,r){return await this.targetFs.promises.rename(e,r)}async rmdir(e,r){return await this.targetFs.promises.rmdir(e,r)}async symlink(e,r,i){return await this.targetFs.promises.symlink(e,r,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(this.openFh.delete(e.subFsFileDescriptor),await r.close())}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.sync()}async read(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){return this.targetFs.promises.readFile(e,r)}async writeFile(e,r,i){return this.targetFs.promises.writeFile(e,r,i)}},l(Ds,"ge"),Ds);b(VT,"PassThroughToAsyncFsSubFs");var JM=VT,Cs,GT=(Cs=class{constructor({name:e,parentFs:r,storageFs:i,gitRoot:n,defaultBranch:s="main"}){if(U(this,"promises"),U(this,"gitRoot"),U(this,"ephemeralFilesFileSystem"),U(this,"hiddenFilesFileSystem"),U(this,"passThroughFileSystem"),U(this,"subFilesystems",[]),U(this,"parentFs"),U(this,"name"),U(this,"defaultBranch"),U(this,"pathToFileDescriptors",new Map),U(this,"openFileHandles",new Map),U(this,"logOperation"),this.name=e,this.parentFs=r,this.gitRoot=n,this.defaultBranch=s,this.promises={access:this.access.bind(this),opendir:this.opendir.bind(this),mkdir:this.mkdir.bind(this),readdir:this.readdir.bind(this),open:this.open.bind(this),stat:this.stat.bind(this),lstat:this.lstat.bind(this),link:this.link.bind(this),readlink:this.readlink.bind(this),unlink:this.unlink.bind(this),rename:this.rename.bind(this),rmdir:this.rmdir.bind(this),symlink:this.symlink.bind(this),readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),getFilehandle:this.getFilehandle.bind(this)},!r&&i){this.passThroughFileSystem=new JM({name:e+"-passthrough",passThroughFs:i,gitRoot:n,parentFs:this});return}if(!i&&r){this.passThroughFileSystem=new KM({name:e+"-passthrough",parentFs:this,gitRoot:n});return}throw new Error("invalid configuration")}getNextFileDescriptor(){let e=Array.from(this.openFileHandles.keys());return e.length===0?1:Math.max(...e)+1}setLoggger(e){this.logOperation=e}async logOperationOnFileDescsriptor(e,r,i){if(!this.logOperation)return;let n=[];for(let[s,a]of this.pathToFileDescriptors.entries())a.includes(e.fd)&&n.push(s);if(n.length!==0)return this.logOperation?.({fsName:e.delegate.name,fd:e,path:n[0],operation:r,operationArgs:i})}getFilehandle(e){return this.openFileHandles.get(e)}setEphemeralFilesSubFs(e){this.ephemeralFilesFileSystem=e}setHiddenFilesSubFs(e){this.hiddenFilesFileSystem=e}addSubFs(e){this.subFilesystems.push(e)}async getResponsibleFs(e){if(!e.toString().startsWith(this.gitRoot)&&this.gitRoot!=="./")throw new Error("tried to access a file ("+e+") outside of the legit folder: "+this.gitRoot);if(!this.hiddenFilesFileSystem)throw new Error(this.name+" intialize hidden fs first!");if(!this.ephemeralFilesFileSystem)throw new Error(this.name+" intialize ephemeral fs first!");if(await this.hiddenFilesFileSystem.responsible(e.toString()))return this.hiddenFilesFileSystem;if(await this.ephemeralFilesFileSystem.responsible(e.toString()))return this.ephemeralFilesFileSystem;for(let r of this.subFilesystems)if(await r.responsible(e.toString()))return r;return this.passThroughFileSystem}async access(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e,operation:"access",operationArgs:{mode:r}}),i.access(e,r)}async opendir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:r}});let i=e.toString();if(!i.startsWith(this.gitRoot))throw new Error("tried to access a directory ("+i+") outside of the legit folder: "+this.gitRoot);return new LT(this,i)}async mkdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"mkdir",operationArgs:{options:r}}),i.mkdir(e,r)}async readdir(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:r}});let i=new Set;for(let n of[...this.subFilesystems].reverse()){let s=await n.readdir(e,r);for(let a of s)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+a)||i.add(a)}try{let n=await this.passThroughFileSystem.readdir(e,r);for(let s of n)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+s)||i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}try{let n=await this.ephemeralFilesFileSystem.readdir(e,r);for(let s of n)i.add(s)}catch(n){if(n.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+n)}for(let n of i){let s=(e=="/"?"":e)+"/"+n;await this.hiddenFilesFileSystem.responsible(s)&&i.delete(n)}return Array.from(i)}async open(e,r,i){let n=await this.getResponsibleFs(e);await this.logOperation?.({fsName:n.name,path:e,operation:"open",operationArgs:{flags:r,mode:i}});let s=await n.open(e,r,i),a=this.getNextFileDescriptor();return s.realize(a),this.openFileHandles.set(a,s),this.pathToFileDescriptors.get(e)||this.pathToFileDescriptors.set(e,[]),this.pathToFileDescriptors.get(e).push(a),s}async close(e){try{await e.delegate.close(e)}catch(r){throw r}finally{for(let[r,i]of this.pathToFileDescriptors.entries()){let n=i.indexOf(e.fd);if(n!==-1){i.splice(n,1),i.length===0&&this.pathToFileDescriptors.delete(r);break}}this.openFileHandles.delete(e.fd)}}async stat(e,r){let i=e.toString(),n=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:n.name,path:i,operation:"stat",operationArgs:{opts:r}}),n.stat(e)}async lstat(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"lstat",operationArgs:{opts:r}}),i.lstat(e,r)}async link(e,r){throw new Error("not implemented")}async readlink(e,r){throw new Error("not implemented")}async unlink(e){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"unlink",operationArgs:{}}),r.unlink(e)}async rename(e,r){if(this.hiddenFilesFileSystem){if(await this.hiddenFilesFileSystem.responsible(ew.basename(e.toString())))throw new Error("Renaming of hidden Files is not allowed "+e);if(await this.hiddenFilesFileSystem.responsible(ew.basename(r.toString())))throw new Error("Renaming to hidden Files is not allowed "+r)}let i=await this.getResponsibleFs(e),n=await this.getResponsibleFs(r);if(i===n)return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:r}}),i.rename(e,r);let s=await i.open(e.toString(),"r");try{let a=await i.fstat(s),f=Buffer.alloc(a.size);await i.read(s,f,0,a.size,0),await i.close(s),await n.writeFile(r.toString(),f,"utf8"),await i.unlink(e)}catch(a){try{await i.close(s)}catch{}throw a}}async rmdir(e,r){let i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:e.toString(),operation:"rmdir",operationArgs:{dirPath:e,options:r}}),i.rmdir(e,r)}async symlink(e,r,i){throw new Error("not implemented")}async readFile(e,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readFile",operationArgs:{path:e,options:r}});let i=!0,n;if(typeof e=="number"){i=!1;let s=this.getFilehandle(e);if(!s)throw new Error("Invalid file descriptor");n=s}else if(typeof e=="string")n=await this.open(e,"r");else throw new Error("only filehandle and path are supported atm");try{let s=(await n.stat()).size;if(typeof s=="bigint"){if(s>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("File too large to read into buffer");s=Number(s)}let a=Buffer.alloc(s),{bytesRead:f}=await n.read(a,0,s,0);if(r&&typeof r.encoding=="string")return a.slice(0,f).toString(r.encoding);if(typeof r=="string"){if(r==="utf8"||r==="utf-8")return a.slice(0,f).toString(r);throw new Error("Unsupported encoding: "+r)}return a.slice(0,f)}finally{n&&i&&await n.close()}}async writeFile(e,r,i){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"writeFile",operationArgs:{data:r,options:i}});let n=typeof e!="number",s,a,f,o="w";if(typeof i=="string"?a=i:i&&typeof i=="object"&&(a=i.encoding,f=i.mode,o=i.flag||"w"),typeof e=="number"){let c=this.getFilehandle(e);if(!c)throw new Error("Invalid file descriptor");s=c}else if(typeof e=="string")s=await this.open(e,o,f);else throw new Error("only filehandle and path are supported atm");try{let c;if(typeof r=="string")c=Buffer.from(r,a||"utf8");else if(r instanceof Buffer)c=r;else if(r instanceof Uint8Array)c=Buffer.from(r);else throw new Error("Invalid data type for writeFile");let u=0;for(;u<c.length;){let{bytesWritten:h}=await s.write(c,u,c.length-u,u);u+=h}}finally{s&&n&&await s.close()}}},l(Cs,"ye"),Cs);b(GT,"CompositeFs");var AT=GT,Is,JT=(Is=class extends So{constructor({name:e,parentFs:r,gitRoot:i,hiddenFiles:n}){super({name:e,parentFs:r,gitRoot:i}),U(this,"ig"),this.ig=(0,KT.default)(),this.ig.add(n)}async responsible(e){let r=e.replace(/\\/g,"/"),i=r.startsWith("./")?r.slice(2):r;return i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 255}error(e){return new Error(`Access to hidden file is not allowed: ${this.toStr(e)}`)}async open(e,r,i){throw this.error(e)}async access(e){throw this.error(e)}async stat(e){throw this.error(e)}async lstat(e){throw this.error(e)}async opendir(e){throw this.error(e)}async link(e){throw this.error(e)}async mkdir(e){throw this.error(e)}async readdir(e){throw this.error(e)}async readlink(e){throw this.error(e)}async unlink(e){throw this.error(e)}async rename(e){throw this.error(e)}async rmdir(e){throw this.error(e)}async symlink(e,r){throw this.error(r)}async lookup(e){throw this.error(e)}resolvePath(e){throw new Error(`Access to hidden file is not allowed: resolvePath(${e})`)}async close(e){throw new Error("Access to hidden file is not allowed: close: "+e.subFsFileDescriptor)}async dataSync(e){throw new Error("Access to hidden file is not allowed: dataSync: "+e.subFsFileDescriptor)}async read(e,r,i,n,s){throw new Error("Access to hidden file is not allowed: readFileHandle: "+e.subFsFileDescriptor)}},l(Is,"be"),Is);b(JT,"HiddenFileSubFs");var PT=JT,$s,YT=($s=class extends So{constructor({name:e,parentFs:r,gitRoot:i,ephemeralPatterns:n}){super({name:e,parentFs:r,gitRoot:i}),U(this,"openFh",new Map),U(this,"memFs",(0,Xf.createFsFromVolume)(new Xf.Volume)),U(this,"ig"),U(this,"patterns"),this.compositFs=r,this.gitRoot=i,this.ig=(0,XT.default)(),this.ig.add(n),this.patterns=n}normalizePath(e){let r=typeof e=="string"?e:e.toString();return r.startsWith("/")?r:"/"+r}async responsible(e){let r=e.replace(/\\/g,"/"),i=r.startsWith("./")?r.slice(2):r;return i=i.startsWith("/")?i.slice(1):i,i===""||i==="."?!1:this.ig.ignores(i)}fileType(){return 5}async open(e,r,i){let n=this.normalizePath(e),s=jf.dirname(n);s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0});let a=await this.memFs.promises.open(n,r,i);return this.openFh.set(a.fd,a),new Gf({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:a.fd,parentFsFileDescriptors:[a.fd]})}async access(e,r){let i=this.normalizePath(e);return await this.memFs.promises.access(i,r)}async stat(e,r){let i=this.normalizePath(e);return this.memFs.promises.stat(i,{bigint:!1})}async lstat(e,r){let i=this.normalizePath(e);return this.memFs.promises.lstat(i,{bigint:!1})}async opendir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.opendir(i,r)}async link(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.link(i,n)}async mkdir(e,r){let i=this.normalizePath(e);if(!(typeof r=="object"&&r&&"recursive"in r&&r.recursive)){let n=jf.dirname(i);if(n&&n!=="/"&&n!==".")try{await this.memFs.promises.stat(n)}catch{await this.memFs.promises.mkdir(n,{recursive:!0})}}await this.memFs.promises.mkdir(i,r)}async readdir(e,...r){let i=this.normalizePath(e),n=await this.memFs.promises.readdir(i,...r);return console.log("EPHEMERAL: READDIR: ",n),n}async readlink(e){throw new Error("readlink is not implemented for EphemeralFileSubFs")}async unlink(e){let r=this.normalizePath(e);return await this.memFs.promises.unlink(r)}async rename(e,r){let i=this.normalizePath(e),n=this.normalizePath(r);return await this.memFs.promises.rename(i,n)}async rmdir(e,r){let i=this.normalizePath(e);return await this.memFs.promises.rmdir(i,r)}async symlink(e,r,i){let n=this.normalizePath(e),s=this.normalizePath(r);return await this.memFs.promises.symlink(n,s,i)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let r=this.openFh.get(e.subFsFileDescriptor);r&&(await r.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.datasync()}async read(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.read(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chmod(r)}async fchown(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.chown(r,i)}async write(e,r,i,n,s){let a=this.openFh.get(e.subFsFileDescriptor);if(a)return await a.write(r,i,n,s);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.truncate(r)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.stat(r);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.utimes(r,i)}async writev(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.writev(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,r,i){let n=this.openFh.get(e.subFsFileDescriptor);if(n)return await n.readv(r,i??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,r){if(typeof e=="string"||Buffer.isBuffer(e)){let i=this.normalizePath(e);return this.memFs.promises.readFile(i,r)}return super.readFile(e,r)}async writeFile(e,r,i){let n=this.normalizePath(e),s=jf.dirname(n);return s&&s!=="/"&&s!=="."&&await this.memFs.promises.mkdir(s,{recursive:!0}),this.memFs.promises.writeFile(n,r,i)}},l($s,"ve"),$s);b(YT,"EphemeralSubFs");var NT=YT,XM=new Set([" ","~","^",":","?","*","[","\\"]),YM=[/^\/|\/$/,/\/\//,/\.$/,/\.lock$/,/^@$/,/@\{/],ZT="\u2002";function nw(t){let e=t.codePointAt(0);return!(e>=0&&e<=31||e===127||XM.has(t))}l(nw,"xe");b(nw,"isValidChar");function QT(t){let e="";for(let r of t)r===" "?e+=ZT:nw(r)?e+=r:e+="%"+r.codePointAt(0);for(let r of YM)if(r.test(e))return Array.from(e).map(i=>nw(i)?i:"%"+i.codePointAt(0)).join("");return e}l(QT,"Me");b(QT,"encodeName");function eR(t){return t.replace(/%(\d+)/g,(e,r)=>String.fromCodePoint(parseInt(r,10))).replace(new RegExp(ZT,"g")," ")}l(eR,"ze");b(eR,"decodeName");function zf(t){return t.replace(/\./g,"%2E").replace(/\//g,".")}l(zf,"Q");b(zf,"encodeBranchNameForVfs");function qt(t){return t.replace(/\./g,"/").replace(/%2E/g,".")}l(qt,"N");b(qt,"decodeBranchNameFromVfs");async function Me(t,e,r){try{return await Wt.default.resolveRef({fs:t,dir:e,ref:`refs/heads/${qt(r)}`})}catch{return}}l(Me,"D");b(Me,"tryResolveRef");async function Tr({dir:t,fs:e,treeOid:r,deletePathParts:i,addPathParts:n,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f,keepFilename:o=".keep"}){let[c,...u]=n??[],[h,...d]=i??[],p=[];if(r){let{tree:m}=await Wt.default.readTree({fs:e,dir:t,oid:r});p=[...m]}if(c===h){let m=c;if(m===void 0)throw new Error("illegal arguement - called with out a path part");if(u.length===0)throw new Error("can not move into it self");if(d.length===0)throw new Error("can not move from it self");let w=p.findIndex(F=>F.path===m),y=(w!==-1?p[w]:void 0)?.oid,g=await Tr({dir:t,fs:e,treeOid:y,addPathParts:u,deletePathParts:d,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f});if(g===void 0)throw new Error("on the same path we expect an update - respectivly a newly created subTreeOid");let _=!1;if(g!==y){_=!0;let F={mode:"040000",path:m,oid:g,type:"tree"};w!==-1?p[w]=F:p.push(F)}if(r==null&&!_)throw new Error("Illegal state - if the currentOid is undefined - a new tree should have been created (an update should have happened)");if(_)return await Wt.default.writeTree({fs:e,dir:t,tree:p});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}else{let m=!1,w;if(h){let y=p.findIndex(_=>_.path===h),g=y!==-1?p[y]:void 0;if(g===void 0)throw new Error("Element doesnt exist in tree");if(d.length>0){if(g&&g.type!=="tree")throw new Error("SubPart of the path for the obj to delete is not a tree");let _=await Tr({dir:t,fs:e,treeOid:g.oid,addPathParts:void 0,deletePathParts:d,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f});if(_===g.oid)throw new Error("in case of a delete we expect a different subtree oid");m=!0,_===void 0?p.splice(y,1):p[y]={mode:"040000",path:h,oid:_,type:"tree"}}else if(m=!0,p.splice(y,1),p.length===0&&a){let _=new Uint8Array(0),F=await Wt.default.writeBlob({fs:e,dir:t,blob:_});p.push({mode:"100644",oid:F,path:o,type:"blob"})}w=g}if(c){let y=p.findIndex(_=>_.path===c),g=y!==-1?p[y]:void 0;if(u.length>0){if(g&&g.type!=="tree")throw new Error("SubPart of the path for the obj to add is not a tree");let _=await Tr({dir:t,fs:e,treeOid:g?.oid,addPathParts:u,deletePathParts:void 0,addObj:s,addKeepIfEmpty:a,deleteKeepIfNotEmpty:f});if(_===void 0)throw new Error("in case we add, we expect an update - respectivly a newly created subTreeOid");if(_!==g?.oid){m=!0;let F={mode:"040000",path:c,oid:_,type:"tree"};if(y!==-1)p[y]=F;else if(p.push(F),f&&p.length>1){let R=p.findIndex(k=>k.path===o);R!==-1&&p.splice(R,1)}}}else{if(m=!0,s){let _={mode:s.type==="tree"?"040000":"100644",path:c,oid:s.oid,type:s.type};if(y!==-1)p[y]=_;else{if(f&&p.length>0){let F=p.findIndex(R=>R.path===o);F!==-1&&p.splice(F,1)}p.push(_)}}if(a&&p.length===0){let _=new Uint8Array(0),F=await Wt.default.writeBlob({fs:e,dir:t,blob:_});p.push({mode:"100644",oid:F,path:o,type:"blob"})}}}if(p.length===0)return;if(m)return await Wt.default.writeTree({fs:e,dir:t,tree:p});if(r===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return r}}l(Tr,"x");b(Tr,"buildUpdatedTree");async function ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:i,pathParams:n}){if(!n.filePath){let s=await Wt.default.readTree({fs:r,dir:e,oid:i});return{type:"tree",entries:s.tree.map(a=>Ui({parent:t,name:a.path,isDir:a.type==="tree"})),oid:s.oid}}return(await Wt.default.walk({fs:r,dir:e,trees:[Wt.default.TREE({ref:i})],map:b(async(s,[a])=>{if(s===n.filePath&&a){let f=await a.type();if(f==="blob")return{type:"blob",oid:await a.oid()};if(f=="tree"){let o=await Wt.default.readTree({fs:r,dir:e,oid:await a.oid()});return{type:"tree",entries:o.tree.map(c=>Ui({parent:t,name:c.path,isDir:c.type==="tree"})),oid:o.oid}}}},"map")})).find(s=>s!==void 0)}l(ks,"_");b(ks,"resolveGitObjAtPath");function Ui(t){return{name:t.name,isFile:b(()=>!t.isDir,"isFile"),isDirectory:b(()=>t.isDir,"isDirectory"),isBlockDevice:b(()=>!0,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isFIFO:b(()=>!1,"isFIFO"),isSocket:b(()=>!1,"isSocket"),parentPath:t.parent,path:t.parent}}l(Ui,"$");b(Ui,"toDirEntry");var tR={type:"gitBranchesListVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e,filePath:r})=>{try{let i=await iw.default.listBranches({fs:e,dir:t}),n=await Promise.all(i.map(async s=>{let a=await iw.default.resolveRef({fs:e,dir:t,ref:s});return Ui({parent:r,name:zf(s),isDir:!0})}));return{type:"directory",content:n,mode:493,size:n}}catch(i){throw i}},"getFile"),rename:b(async t=>{throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},qi,rR=(qi=class extends Error{constructor(e,r){super(e),U(this,"code","ENOENT"),U(this,"path"),this.name="ENOENTError",this.path=r,Object.setPrototypeOf(this,qi.prototype)}},l(qi,"ne"),qi);b(rR,"ENOENTError");var sw=rR;async function he(t,e){try{let r=await Hf.default.getConfig({fs:e,dir:t,path:"user.legit-current-branch"});if(r)return zf(r)}catch{}try{let r=await Hf.default.getConfig({fs:e,dir:t,path:"init.defaultBranch"});return zf(r)||"main"}catch{return"main"}}l(he,"b");b(he,"getCurrentBranch");async function iR(t,e,r){await Hf.default.setConfig({fs:e,dir:t,path:"user.legit-current-branch",value:qt(r)})}l(iR,"We");b(iR,"setCurrentBranch");var Vf={type:"gitBranchFileVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e,filePath:r,cacheFs:i,pathParams:n})=>{n.branchName===void 0&&(n.branchName=await he(t,e));let s=await Me(e,t,n.branchName);if(!s)throw new sw(`ENOENT: no such file or directory, stat '${r}'`,r);let a=await ks({filePath:r,gitRoot:t,nodeFs:e,commitSha:s,pathParams:n});if(!a)throw new sw(`ENOENT: no such file or directory, stat '${r}'`,r);let f=await ne.default.readCommit({fs:e,dir:t,oid:s}),{commit:o}=f,c=await ne.default.log({fs:e,dir:t,ref:s,filepath:n.filePath,depth:1}),u=o.committer.timestamp*1e3,h=c.length>0?c[0].commit.committer.timestamp*1e3:u;if(a.type==="tree")return{mode:420,size:0,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!0,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:h,mtimeMs:h,ctimeMs:h,birthtimeMs:u,atime:new Date(h),mtime:new Date(h),ctime:new Date(h),birthtime:new Date(h)};{let{blob:d}=await ne.default.readBlob({fs:e,dir:t,oid:a.oid});return{mode:420,size:d.length,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(d.length/4096),atimeMs:h,mtimeMs:h,ctimeMs:h,birthtimeMs:h,atime:new Date(h),mtime:new Date(h),ctime:new Date(h),birthtime:new Date(h)}}},"getStats"),getFile:b(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n})=>{n.branchName===void 0&&(n.branchName=await he(e,r));try{let s=await Me(r,e,n.branchName);if(!s){let f=await ne.default.resolveRef({fs:r,dir:e,ref:"HEAD"});await ne.default.branch({fs:r,dir:e,ref:n.branchName,object:f}),s=await ne.default.resolveRef({fs:r,ref:`refs/heads/${n.branchName}`,dir:e})}let a=await ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:s,pathParams:n});if(!a)return;if(a.type==="blob"){let{blob:f}=await ne.default.readBlob({fs:r,dir:e,oid:a.oid});return{type:"file",content:Buffer.from(f),mode:420,size:f.length,oid:a.oid}}else{let f=[];try{let o=await i.promises.stat(t);if(o&&o.isDirectory()){let c=await i.promises.readdir(t,{withFileTypes:!0});f.push(...c)}}catch{}return{type:"directory",content:Array.from(new Set([...f,...a.entries])).map(o=>({...o,name:o.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}}catch{return}},"getFile"),unlink:b(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await he(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let a=await Me(r,e,n.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let f=await ne.default.readTree({fs:r,dir:e,oid:a}),o=await Tr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(o!==f.oid){let c=await ne.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:o,noUpdateBranch:!0,parent:[a],author:s});await ne.default.writeRef({fs:r,dir:e,ref:`refs/heads/${qt(n.branchName)}`,value:c,force:!0})}},"unlink"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:a})=>{if(s.branchName===void 0&&(s.branchName=await he(e,r)),s.filePath===void 0)throw new Error("filePath should be in pathParams");let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let o=await ne.default.writeBlob({fs:r,dir:e,blob:f}),c=await Me(r,e,s.branchName);if(!c){let d=await ne.default.resolveRef({fs:r,dir:e,ref:"HEAD"});if(await ne.default.branch({fs:r,dir:e,ref:qt(s.branchName),object:d}),c=await Me(r,e,s.branchName),!c)throw new Error("Could not create branch for writeFile")}let u=await ne.default.readTree({fs:r,dir:e,oid:c}),h=await Tr({dir:e,fs:r,treeOid:u.oid,deletePathParts:void 0,addPathParts:s.filePath.split("/"),addObj:{type:"blob",oid:o},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(h!==u.oid){let d=await ne.default.commit({fs:r,dir:e,message:`\u{1F4BE} Change '${s.filePath}'`,tree:h,noUpdateBranch:!0,parent:[c],author:a});await ne.default.writeRef({fs:r,dir:e,ref:`refs/heads/${qt(s.branchName)}`,value:d,force:!0})}},"writeFile"),rename:b(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s,author:a}){if(n.branchName===void 0&&(n.branchName=await he(r,i)),n.filePath===void 0)throw new Error("filePath should be in pathParams");if(s.branchName===void 0&&(s.branchName=await he(r,i)),s.filePath===void 0)throw new Error("filePath should be in newPathParams");let f=await Me(i,r,n.branchName);if(!f)throw new Error("Invalid branch file path - source branch must exist");let o=await Me(i,r,s.branchName);if(!o){let d=await ne.default.resolveRef({fs:i,dir:r,ref:"HEAD"});if(await ne.default.branch({fs:i,dir:r,ref:qt(s.branchName),object:d}),o=await Me(i,r,s.branchName),o===void 0)throw new Error("Could not create branch for rename operation")}if(s.branchName!==n.branchName)throw new Error("cross branch move not implemented yet");let c=await ks({gitRoot:r,nodeFs:i,commitSha:f,filePath:t,pathParams:n});if(c===void 0)throw new Error("no obj at path exists");let u=await Tr({dir:r,fs:i,deletePathParts:n.filePath.split("/"),addPathParts:s.filePath.split("/"),addObj:c.type==="blob"?{type:"blob",oid:c.oid}:{type:"tree",oid:c.oid,entries:c.entries.map(d=>d.name.toString())},treeOid:o,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),h=await ne.default.readTree({fs:i,dir:r,oid:f});if(u!==h.oid){let d=await ne.default.commit({fs:i,dir:r,message:`\u{1F500} Rename '${n.filePath}' to '${s.filePath}'`,tree:u,noUpdateBranch:!0,parent:[o],author:a});await ne.default.writeRef({fs:i,dir:r,ref:`refs/heads/${qt(s.branchName)}`,value:d,force:!0})}},"rename"),mkdir:b(async function(t){if(t.pathParams.branchName===void 0&&(t.pathParams.branchName=await he(t.gitRoot,t.nodeFs)),t.pathParams.filePath===void 0)throw new Error("filePath should be in pathParams");try{throw await Vf.getStats(t),new Error("Folder exists")}catch{}t.filePath.endsWith("/")&&(t.filePath=t.filePath.replace(/\/+$/,"")),t.pathParams&&typeof t.pathParams.filePath=="string"&&(t.pathParams.filePath=t.pathParams.filePath.replace(/\/+$/,""));let e=await Me(t.nodeFs,t.gitRoot,t.pathParams.branchName);if(!e){let a=await ne.default.resolveRef({fs:t.nodeFs,dir:t.gitRoot,ref:"HEAD"});if(await ne.default.branch({fs:t.nodeFs,dir:t.gitRoot,ref:qt(t.pathParams.branchName),object:a}),e=await Me(t.nodeFs,t.gitRoot,t.pathParams.branchName),e===void 0)throw new Error("Could not create branch for mkdir operation")}let r=await ne.default.readTree({fs:t.nodeFs,dir:t.gitRoot,oid:e}),i=new Uint8Array(0),n=await ne.default.writeBlob({fs:t.nodeFs,dir:t.gitRoot,blob:i}),s=await Tr({dir:t.gitRoot,fs:t.nodeFs,treeOid:r.oid,deletePathParts:void 0,addPathParts:[...t.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:n},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(s!==r.oid){let a=await ne.default.commit({fs:t.nodeFs,dir:t.gitRoot,message:`\u{1F4BE} Change '${t.pathParams.filePath}'`,tree:s,noUpdateBranch:!0,parent:[e],author:t.author});await ne.default.writeRef({fs:t.nodeFs,dir:t.gitRoot,ref:`refs/heads/${qt(t.pathParams.branchName)}`,value:a,force:!0})}},"mkdir"),rmdir:b(async({filePath:t,gitRoot:e,nodeFs:r,cacheFs:i,pathParams:n,author:s})=>{if(n.branchName===void 0&&(n.branchName=await he(e,r)),!n.filePath)throw new Error("filePath should be in pathParams");let a=await Me(r,e,n.branchName);if(!a)throw new Error("Invalid branch file path - branch must exist");let f=await ne.default.readTree({fs:r,dir:e,oid:a}),o=await Tr({dir:e,fs:r,treeOid:f.oid,deletePathParts:n.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(o!==f.oid){let c=await ne.default.commit({fs:r,dir:e,message:`Delete ${n.filePath}`,tree:o,noUpdateBranch:!0,parent:[a],author:s});await ne.default.writeRef({fs:r,dir:e,ref:`refs/heads/${qt(n.branchName)}`,value:c,force:!0})}},"rmdir")},aw={type:"gitBranchHeadVirtualFile",rootType:"file",getStats:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i;try{i=await ii.default.resolveRef({fs:e,dir:t,ref:r.branchName})}catch{i=await ii.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${r.branchName}`})}let n=await ii.default.readCommit({fs:e,dir:t,oid:i}),{commit:s}=n,a=s.committer.timestamp*1e3;return{mode:420,size:40,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));try{let i;try{i=await ii.default.resolveRef({fs:e,dir:t,ref:r.branchName})}catch{i=await ii.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${r.branchName}`})}return{type:"file",content:i+`
|
|
101
|
+
`,mode:420,size:i.length}}catch{return}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{console.log("gitBranchHeadVirtualFile writeFile called",{pathParams:s,content:i}),s.branchName===void 0&&(s.branchName=await he(e,r));let a=i.toString().trim();try{await ii.default.readCommit({fs:r,dir:e,oid:a})}catch{throw new Error(`Commit ${a} does not exist in the repository`)}await ii.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:a,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ZM={type:"gitBranchTipVirtualFile",rootType:"file",getStats:b(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{if(!i.branchName)throw new Error("branchName should be in pathParams");let n=await Me(r,e,i.branchName);if(n!==void 0)return{type:"file",content:n+`
|
|
102
|
+
`,mode:420,size:n.length+1}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},nR={type:"gitCommitFileVirtualFile",rootType:"file",getStats:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let n=i.sha_1_1_2+i.sha1_3__40,s=await ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:n,pathParams:i});if(!s)throw new sw(`ENOENT: no such file or directory, stat '${t}'`,t);let a=await Lf.default.readCommit({fs:r,dir:e,oid:n}),{commit:f}=a,o=f.committer.timestamp*1e3;if(s.type==="tree")return{mode:420,size:0,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!0,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:new Date(o),mtime:new Date(o),ctime:new Date(o),birthtime:new Date(o)};{let{blob:c}=await Lf.default.readBlob({fs:r,dir:e,oid:s.oid});return{mode:420,size:c.length,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(c.length/4096),atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:new Date(o),mtime:new Date(o),ctime:new Date(o),birthtime:new Date(o)}}},"getStats"),getFile:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{if(!i.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!i.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let n=i.sha_1_1_2+i.sha1_3__40;try{let s=await ks({filePath:t,gitRoot:e,nodeFs:r,commitSha:n,pathParams:i});if(!s)return;if(s.type==="blob"){let{blob:a}=await Lf.default.readBlob({fs:r,dir:e,oid:s.oid});return{type:"file",content:Buffer.from(a),mode:420,size:a.length,oid:s.oid}}else return{type:"directory",content:Array.from(new Set([...s.entries.filter(a=>a.name!==".keep")])).map(a=>({...a,name:a.name.toString(),path:`${t}`,parentPath:`${t}`})),mode:493}}catch{return}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")};function sR(t,e,r){return t===0&&e===2&&r===0?"untracked":t===1&&e===0&&r===0?"deleted":t===1&&e===2&&r!==0?"modified":t===0&&e===2&&r===2?"added":"unknown"}l(sR,"gt");b(sR,"getFileStatus");var QM={type:"gitStatusVirtualFile",rootType:"file",getStats:b(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e})=>{try{let r=await qf.default.currentBranch({fs:e,dir:t})||"HEAD",i=await qf.default.resolveRef({fs:e,dir:t,ref:"HEAD"}),n=(await qf.default.statusMatrix({fs:e,dir:t})).filter(([,a,f,o])=>a!==f||f!==o).map(([a,f,o,c])=>({path:a,status:sR(f,o,c)})),s=JSON.stringify({branch:r,commit:i,clean:n.length===0,files:n},null,2);return{type:"file",content:s,mode:33188,size:Buffer.byteLength(s)}}catch(r){throw console.error(r),r}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ow={type:"legitVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e})=>{let r=t+"/.git";try{return await e.stat(r)}catch{throw new Error(`ENOENT: no such file or directory, stat '${r}'`)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e})=>{throw new Error("not implemented")},"getFile"),rename(t){throw new Error("not implemented")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ej=[ow,QM,nR,tR,Vf,aw,ZM],Bs,aR=(Bs=class{constructor(e){this.routes=e,U(this,"compiledRoutes");let r={},i=b((n,s)=>{if(typeof n.type=="string"){r[s]={handler:n,siblings:[]};let a=n}else{let a=[];for(let[f,o]of Object.entries(n))if(f==="."){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:o,siblings:a}}else if(f.startsWith("[[")&&f.endsWith("]]")){if(r[s])throw new Error(`Conflict: multiple handlers for path '${s}', '.' and optional '[[parameter_name]]' defined?`);r[s]={handler:o,siblings:a},f.startsWith("[[...")?r[s?`${s}/${f}`:f]={handler:o,siblings:[]}:i(o,s?`${s}/${f}`:f)}else f.startsWith("[")&&f.endsWith("]")?f.startsWith("[...")?r[s?`${s}/${f}`:f]={handler:o,siblings:[]}:i(o,s?`${s}/${f}`:f):(a.push({segment:f,type:o["."]?"folder":"file"}),i(o,s?`${s}/${f}`:f))}},"walk");i(e,""),this.compiledRoutes=Object.entries(r).map(([n,s])=>{let a=[],f=n.split("/").map(o=>{if(o.startsWith("[[")&&o.endsWith("]]")){let c=o.slice(2,-2).replace(/^\.\.\./,"");return a.push(c),"(.*)"}if(o.startsWith("[")&&o.endsWith("]")){let c=o.slice(1,-1);return a.push(c),"([^/]+)"}return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("/");return{regex:new RegExp(`^${f}$`),paramNames:a,staticSiblings:s.siblings,handler:s.handler}})}match(e){e.length>1&&e.endsWith("/")&&(e=e.replace(/\/+$/,""));for(let{regex:r,paramNames:i,handler:n,staticSiblings:s}of this.compiledRoutes){let a=e.match(r);if(!a)continue;let f={};for(let o=0;o<i.length;o++)f[i[o]]=decodeURIComponent(a[o+1]||"");return{handler:n,params:f,staticSiblings:s}}}},l(Bs,"Se"),Bs);b(aR,"LegitPathRouter");var tj=aR,DT={type:"gitCommitVirtualFolder",rootType:"folder",getStats:b(async t=>{let e=t.gitRoot+"/.git";try{return await t.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:b(async({filePath:t,gitRoot:e,nodeFs:r,pathParams:i})=>{let n=await Uf.default.listBranches({fs:r,dir:e}),s=new Set,a=new Set;for(let c of n){let u=`refs/heads/${c}`;try{let h=await Uf.default.resolveRef({fs:r,dir:e,ref:u});s.add(h)}catch{}}for(let c of s){let u=await Uf.default.log({fs:r,dir:e,ref:c});for(let h of u)a.add(h.oid)}if(!i.sha_1_1_2){let c=new Set;for(let h of a)if(c.add(h.slice(0,2)),c.size>=256)break;let u=Array.from(c).sort().map(h=>Ui({parent:t,name:h,isDir:!0}));return{type:"directory",content:u,mode:493,size:u}}let f=new Set;for(let c of a)c.startsWith(i.sha_1_1_2)&&f.add(c.slice(2,40));let o=Array.from(f).sort().map(c=>Ui({parent:t,name:c,isDir:!0}));return{type:"directory",content:o,mode:493,size:o.length}},"getFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},cR="-operation";async function xt(t,e,r){return(await oR.default.listBranches({fs:t,dir:e})).filter(i=>i.endsWith("__"+r+cR))[0]}l(xt,"O");b(xt,"resolveOperationBranchName");var CT={type:"gitBranchOperationVirtualFile",rootType:"file",getStats:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n;try{n=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let s=await xt(r,e,i.branchName),a=!1;if(s)try{n=await st.default.resolveRef({fs:r,dir:e,ref:s}),a=!0}catch{try{n=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),a=!0}catch{}}let f=await st.default.readCommit({fs:r,dir:e,oid:n}),{commit:o}=f,c=o.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n=await xt(r,e,i.branchName),s,a=!1;return n?(s=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),a=!0):s=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`}),{type:"file",content:Buffer.from(s),mode:420,size:s.length}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s,author:a})=>{s.branchName===void 0&&(s.branchName=await he(e,r));let f;typeof i=="string"?f=new TextEncoder().encode(i):f=new Uint8Array(i);let o=await st.default.writeBlob({fs:r,dir:e,blob:f}),c=await Me(r,e,s.branchName);if(!c)throw new Error("Invalid branch file path - branch doesn't exist");let u=await xt(r,e,s.branchName),h=!1;u||(u="legit/__"+s.branchName+cR,await st.default.branch({fs:r,dir:e,ref:u,object:c}),h=!0);let d=await st.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${u}`}),p=await st.default.readTree({fs:r,dir:e,oid:c}),m;i instanceof ArrayBuffer?m=Buffer.from(i).toString("utf-8"):typeof i=="string"?m=i:i instanceof Uint8Array?m=Buffer.from(i).toString("utf-8"):m=String(i);let w=!1;if(!h){let g=await st.default.findMergeBase({fs:r,dir:e,oids:w?[d]:[d,c]});g.length===1&&g[0]===c&&(w=!0)}let y=await st.default.commit({fs:r,dir:e,message:m,tree:p.oid,noUpdateBranch:!0,author:a,parent:w?h?[c,c]:[d]:[d,c]});await st.default.writeRef({fs:r,dir:e,ref:`refs/heads/${u}`,value:y,force:!0})},"writeFile"),rename:b(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},cw={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n=await xt(r,e,i.branchName),s,a=!1;if(n)try{s=await Li.default.resolveRef({fs:r,dir:e,ref:n}),a=!0}catch{try{s=await Li.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),a=!0}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}}else try{s=await Li.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let f=await Li.default.readCommit({fs:r,dir:e,oid:s}),{commit:o}=f,c=o.committer.timestamp*1e3;try{return{mode:420,size:(a?await cw.getFile(t):void 0)?.content?.length??0,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t;i.branchName===void 0&&(i.branchName=await he(e,r));let n=await xt(r,e,i.branchName),s=[];if(n){let o=await Li.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${n}`}),c=!1,u=o;for(;u&&!c;){let h=await Li.default.readCommit({fs:r,dir:e,oid:u});s.push({oid:h.oid,parentOids:h.commit.parent,message:h.commit.message,originBranchOid:"unset"}),u=h.commit.parent&&h.commit.parent.length>0?h.commit.parent[0]:null,h.commit.parent.length===2&&h.commit.parent[0]===h.commit.parent[1]&&(c=!0)}}let a;for(let o=s.length-1;o>=0;o--){let c=s[o];if(a===void 0){if(c.parentOids.length!==2&&c.parentOids[0]!==c.parentOids[1])throw new Error(`Operation commit ${c.oid} does not have two parents as expected`);a=c.parentOids[1]}c.parentOids.length===2&&(a=c.parentOids[1]),c.originBranchOid=a}let f=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:f,mode:420,size:f.length}},"getFile"),rename:b(async function(t){throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},rj={type:"getThreadName",rootType:"file",getStats:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n;try{n=await Os.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${i.branchName}`})}catch{throw new Error(`Base Branch ${i.branchName} for operations does not exis`)}let s=await xt(r,e,i.branchName),a=!1;if(s)try{n=await Os.default.resolveRef({fs:r,dir:e,ref:s}),a=!0}catch{try{n=await Os.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${s}`}),a=!0}catch{}}let f=await Os.default.readCommit({fs:r,dir:e,oid:n}),{commit:o}=f,c=o.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=await xt(r,e,i.branchName),s;if(n){let a="legit/",f=`__${i.branchName}-operation`;return n.startsWith(a)&&n.endsWith(f)?s=n.slice(a.length,n.length-f.length):s=n,{type:"file",content:Buffer.from(eR(s)),mode:420,size:s.length}}return{type:"file",content:Buffer.from(""),mode:420,size:0}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{if(s.branchName===void 0)throw new Error("branchName should be in pathParams");let a=await xt(r,e,s.branchName);if(a){let f=`legit/${QT(i.toString())}__${s.branchName}-operation`;await Os.default.renameBranch({fs:r,dir:e,oldref:a,ref:f}),a=f}},"writeFile"),rename:b(async function({filePath:t,newPath:e,gitRoot:r,nodeFs:i,pathParams:n,newPathParams:s}){throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},IT={type:"gitBranchHistory",rootType:"file",getStats:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i=await Me(e,t,r.branchName);if(!i)throw new Error(`Branch ${r.branchName} does not exist`);let n=await lw.default.readCommit({fs:e,dir:t,oid:i}),{commit:s}=n,a=s.committer.timestamp*1e3;return{mode:420,size:1e5,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:a,mtimeMs:a,ctimeMs:a,birthtimeMs:a,atime:new Date(a),mtime:new Date(a),ctime:new Date(a),birthtime:new Date(a)}},"getStats"),getFile:b(async t=>{let{gitRoot:e,nodeFs:r,pathParams:i}=t,n=i.branchName;n===void 0&&(n=await he(e,r));let s=[];if(n){let f=await Me(r,e,n),o=!1,c=f;for(;c&&!o;){let u=await lw.default.readCommit({fs:r,dir:e,oid:c});s.push({oid:u.oid,...u.commit}),c=u.commit.parent[0]}}let a=Buffer.from(JSON.stringify(s,null,2),"utf-8");return{type:"file",content:a,mode:420,size:a.length}},"getFile"),rename:b(async t=>{throw new Error("not implemented")},"rename"),mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},$T={type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i=await xt(e,t,r.branchName);if(!i){let o=new Date(0);return{mode:420,size:0,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:o.getTime(),mtimeMs:o.getTime(),ctimeMs:o.getTime(),birthtimeMs:o.getTime(),atime:o,mtime:o,ctime:o,birthtime:o}}let n;try{n=await or.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await or.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}let s=await or.default.readCommit({fs:e,dir:t,oid:n}),{commit:a}=s,f=a.committer.timestamp*1e3;return{mode:420,size:40,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:f,mtimeMs:f,ctimeMs:f,birthtimeMs:f,atime:new Date(f),mtime:new Date(f),ctime:new Date(f),birthtime:new Date(f)}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e,pathParams:r})=>{r.branchName===void 0&&(r.branchName=await he(t,e));let i=await xt(e,t,r.branchName);if(!i)return{type:"file",content:"",mode:420,size:0};try{let n;try{n=await or.default.resolveRef({fs:e,dir:t,ref:i})}catch{n=await or.default.resolveRef({fs:e,dir:t,ref:`refs/heads/${i}`})}return{type:"file",content:n+`
|
|
103
|
+
`,mode:420,size:n.length}}catch{return}},"getFile"),writeFile:b(async({filePath:t,gitRoot:e,nodeFs:r,content:i,cacheFs:n,pathParams:s})=>{s.branchName===void 0&&(s.branchName=await he(e,r));let a=await xt(r,e,s.branchName),f=await or.default.resolveRef({fs:r,dir:e,ref:`refs/heads/${a}`});if(!a)throw new Error(`Operation branch name could not be resolved for branch ${s.branchName}`);let o=i.toString().trim(),c,u,h=!1;if(!f)throw new Error(`Operation branch ref could not be resolved for branch ${a}`);let d=f;for(;d&&!h;){let p=await or.default.readCommit({fs:r,dir:e,oid:d});if(p.oid===o&&(c=p.oid),d=p.commit.parent&&p.commit.parent.length>0?p.commit.parent[0]:null,p.commit.parent.length===2){if(p.commit.parent[0]===p.commit.parent[1])h=!0;else if(c!==void 0){u=p.commit.parent[1];break}}}if(c===void 0)throw new Error(`Cant rollback to ${o} couldn't find newOperationBranchHead ${c}`);if(u===void 0)throw new Error(`Cant rollback to ${o} couldn't find newBranchHead ${u}`);await or.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+a,value:c,force:!0}),await or.default.writeRef({fs:r,dir:e,ref:"refs/heads/"+s.branchName,value:u,force:!0})},"writeFile"),rename(t){throw new Error("not implementsd")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},ij={type:"gitCurrentBranchVirtualFile",rootType:"folder",getStats:b(async({gitRoot:t,nodeFs:e})=>{let r=(await he(t,e)).length;return{mode:420,size:r,isFile:b(()=>!0,"isFile"),isDirectory:b(()=>!1,"isDirectory"),isSymbolicLink:b(()=>!1,"isSymbolicLink"),isBlockDevice:b(()=>!1,"isBlockDevice"),isCharacterDevice:b(()=>!1,"isCharacterDevice"),isSocket:b(()=>!1,"isSocket"),isFIFO:b(()=>!1,"isFIFO"),isFileSync:b(()=>!0,"isFileSync"),isDirectorySync:b(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(r/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:b(async({gitRoot:t,nodeFs:e})=>{let r=await he(t,e);return{type:"file",content:r+`
|
|
104
|
+
`,mode:420,size:r.length+1}},"getFile"),writeFile:b(async({gitRoot:t,nodeFs:e,content:r})=>{let i=r.toString().trim();if(!await Me(e,t,i))throw new Error(`Branch ${i} does not exist in the repository`);await iR(t,e,i)},"writeFile"),rename(t){throw new Error("not implemented")},mkdir:b(async function(t){throw new Error("not implemented")},"mkdir")},Ut,Wf=(Ut=class extends So{constructor({name:e,parentFs:r,gitStorageFs:i,gitRoot:n,virtualFiles:s=ej}){super({name:e,parentFs:r,gitRoot:n}),U(this,"memFs"),U(this,"openFh",{}),U(this,"virtualFiles"),U(this,"legitFileNames"),U(this,"storageFs"),this.gitRoot=n,this.storageFs=i,this.memFs=(0,Yf.createFsFromVolume)(new Yf.Volume),this.virtualFiles=s,this.legitFileNames=["branches","commits"]}async getAuthor(){let e=await tw.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.name"}),r=await tw.default.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.email"}),i=Math.floor(Date.now()/1e3),n=new Date().getTimezoneOffset();return{name:e,email:r,date:i,timezoneOffset:n}}async responsible(e){return!0}isLegitPath(e){return e.includes(`/${Ut.LEGIT_DIR}/`)||e.includes(`/${Ut.LEGIT_DIR}`)}getRouteHandler(e){let r=e;this.gitRoot&&e.startsWith(this.gitRoot)&&(this.gitRoot==="/"?r=e.slice(this.gitRoot.length):r=e.slice(this.gitRoot.length+1));let i=r.indexOf(`/${Ut.LEGIT_DIR}`);if(i===-1)return Ut.pathRouter.match(r);let n=r.slice(i+1);return Ut.pathRouter.match(r)}async open(e,r,i){let n=this.getRouteHandler(e);if(!n)throw new Error("Not a virtual legit file");if(n?.handler.writeFile===void 0&&(r.includes("w")||r.includes("a")))throw new Error(`Write operations not allowed for ${n?.handler.type}`);if(r.includes("x")&&n?.handler.type!=="gitBranchFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${n?.handler.type}`);let s=await n.handler.getFile({cacheFs:this.memFs,filePath:e,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:await this.getAuthor()}),a=!1;for(let h of Object.values(this.openFh))h.path===e&&(a=!0);if((s||a)&&r.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!s&&!a&&!(r.includes("w")||r.includes("a")))throw Object.assign(new Error(`ENOENT: no such file or directory, open '${e}'`),{code:"ENOENT",errno:-2,syscall:"open",path:e});let f=rw.dirname(e);if(await this.memFs.promises.mkdir(f,{recursive:!0}),s===void 0&&!r.includes("x")||s&&s.type==="file")try{let h=await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let o=await this.memFs.promises.open(e,r,i),c=o.fd,u=new Gf({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:c,parentFsFileDescriptors:[]});return this.openFh[c]={path:e,mode:r,fh:o,openSha:s?.oid,readSha:void 0,unflushed:[]},(r.includes("x")||r.includes("w"))&&this.openFh[c].unflushed.push({length:0,start:0}),u}async mkdir(e,r){let i=e.toString(),n=this.getRouteHandler(i),s=r?{options:r}:{};try{await n?.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,...s,author:await this.getAuthor()});let a=typeof r=="object"?{...r,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,a);let f=i.split("/"),o="";for(let c=1;c<=f.length;c++){o=f.slice(0,c).join("/");try{if((await this.memFs.promises.stat(o)).isDirectory()){let u=await this.memFs.promises.open(o,"r");this.openFh[u.fd]={path:o,mode:"r",fh:u,openSha:void 0,readSha:void 0,unflushed:[]}}}catch{}}}catch(a){throw a}}async access(e,r){await this.stat(e)}async futimes(e,r,i){let n=this.openFh[e.subFsFileDescriptor];if(!n)throw new Error("Invalid file handle");return await n.fh.utimes(r,i)}async fstat(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return this.stat(i.path,r)}async ftruncate(e,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return i.unflushed.push({length:0,start:0}),await i.fh.truncate(r)}async stat(e,r){let i=e.toString(),n=Object.values(this.openFh).find(a=>a.path===i&&a.unflushed.length>0);if(n&&n.unflushed.length>0)return await n.fh.stat(r);let s=this.getRouteHandler(i);if(!s)throw new Error(`ENOENT: no such file or directory, stat '${i}'`);return await s.handler.getStats({cacheFs:this.memFs,filePath:i,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:s.params,author:await this.getAuthor()})}async lstat(e,r){return this.stat(e,r)}async readdir(e,r){let i=e.toString(),n=this.getRouteHandler(i);if(!n)throw new Error(`ENOENT: no such file or directory, scandir '${i}'`);let s=await n?.handler.getFile({cacheFs:this.memFs,filePath:i,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:n.params,author:await this.getAuthor()});if(s){if(s.type!=="directory")throw new Error("not a folder");let a=n?.staticSiblings??[],f=Array.from(new Set([...s.content,...a.map(o=>Ui({name:o.segment,parent:i,isDir:o.type==="folder"}))])).sort((o,c)=>o.name.localeCompare(c.name,void 0,{numeric:!0,sensitivity:"base"}));return r?.withFileTypes?f:f.map(o=>o.name)}return[]}async read(e,r,i,n,s){let a=e.subFsFileDescriptor,f=this.openFh[a];if(!f)throw new Error("Invalid file handle");if(f.unflushed.length===0){let o=this.getRouteHandler(f.path),c=await o.handler.getFile({cacheFs:this.memFs,filePath:f.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:o?.params,author:await this.getAuthor()});if(!c?.content)throw new Error("couldnt access content");if(c.type!=="file")throw new Error("not a file");let u=typeof c.content=="string"?Buffer.from(c.content):c.content,h=typeof s=="number"?s:0,d=Math.min(h+n,u.length),p=Math.max(0,d-h);return u.copy(r,i,h,h+p),{bytesRead:p,buffer:r}}return await f.fh.read(r,i,n,s)}async write(e,r,i,n,s){let a=this.openFh[e.subFsFileDescriptor];if(!a)throw new Error("Invalid file handle");let f=a.mode;if(!f.includes("w")&&!f.includes("a")&&!f.includes("+"))throw Object.assign(new Error("EBADF: bad file descriptor, write"),{code:"EBADF",errno:-9,syscall:"write"});if(a.unflushed.length===0){let h=this.getRouteHandler(a.path),d=await h.handler.getFile({cacheFs:this.memFs,filePath:a.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:h.params,author:await this.getAuthor()});d&&d.oid&&(await this.memFs.promises.writeFile(a.path,d.content),a.readSha=d.oid)}let o=await a.fh.write(r,i,n,s),c=i??0,u=s??0;return a.unflushed.push({start:u,length:n||r.byteLength-c+u}),o}async close(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");try{await this.dataSync(e),await i.fh.close()}finally{delete this.openFh[r]}}async dataSync(e){let r=e.subFsFileDescriptor,i=this.openFh[r];if(!i)throw new Error("Invalid file handle");if(i.unflushed.length>0){let n=this.getRouteHandler(i.path);if(n&&n.handler.writeFile){let s=await this.memFs.promises.readFile(i.path);await n.handler.writeFile({cacheFs:this.memFs,filePath:i.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,content:s,pathParams:n.params,author:await this.getAuthor()})}i.unflushed=[]}}async readFile(e,r){let i=typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e.fd?`FileHandle(${e.fd})`:e.toString(),n=null;typeof r=="string"?n=r:r&&typeof r=="object"&&r.encoding&&(n=r.encoding);let s=await this.open(i,"r");try{let a=(await this.fstat(s)).size,f=Buffer.alloc(a);return await this.read(s,f,0,a,0),await this.close(s),n?f.toString(n):f}catch(a){try{await this.close(s)}catch{}throw a}}async writeFile(e,r,i){let n="w",s="utf8",a;typeof i=="string"?s=i:i&&typeof i=="object"&&(i.flag&&(n=String(i.flag)),i.encoding&&(s=i.encoding),i.mode&&(a=typeof i.mode=="string"?parseInt(i.mode,8):i.mode));let f=await this.open(e,n,a);try{let o;typeof r=="string"?o=Buffer.from(r,s):Buffer.isBuffer(r)?o=r:r instanceof Uint8Array?o=Buffer.from(r):ArrayBuffer.isView(r)?o=Buffer.from(r.buffer,r.byteOffset,r.byteLength):o=Buffer.from(r),await this.write(f,o,0,o.length,0)}finally{await this.close(f)}}async rename(e,r){let i=e.toString(),n=r.toString(),s=this.getRouteHandler(i),a=this.getRouteHandler(n);if(s?.handler.type==="gitBranchFileVirtualFile"&&a?.handler.type==="gitBranchFileVirtualFile"){let f=!0;try{await this.memFs.promises.access(n)}catch{f=!1}let o=!0;try{await this.stat(n)}catch{o=!1}let c=!0;try{await this.stat(i)}catch{c=!1}let u=!0;try{await this.memFs.promises.access(i)}catch{u=!1}if(u){let p=rw.dirname(n);try{await this.memFs.promises.access(p)}catch{await this.memFs.promises.mkdir(p,{recursive:!0})}await this.memFs.promises.rename(e,r)}let h=this.getRouteHandler(i);if(!h)throw new Error("VF not found");let d=await h.handler.rename({cacheFs:this.memFs,filePath:i,gitRoot:this.gitRoot,nodeFs:this.storageFs,newPath:n,pathParams:h?.params??{},newPathParams:a?.params??{},author:await this.getAuthor()})}else throw new Error(`Unsupported rename operation from ${s?.handler.type} to ${a?.handler.type}`)}async fchmod(e,r){}async unlink(e){let r=e.toString(),i=this.getRouteHandler(r);if(i?.handler.unlink!==void 0)try{await i.handler.unlink({cacheFs:this.memFs,filePath:r,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:i.params,author:await this.getAuthor()})}catch(n){let s=!1;for(let[a,f]of Object.entries(this.openFh))f.path===r&&f.unflushed.length>0&&(s=!0);if(!s)throw n}finally{let n=!1;for(let[s,a]of Object.entries(this.openFh))a.path===r&&(n=!0,await a.fh.close(),delete this.openFh[Number(s)]);n&&await this.memFs.promises.unlink(r)}else throw new Error(`Cannot unlink ${i?.handler.type} files`)}async rmdir(e,...r){let i=e.toString(),n=this.getRouteHandler(i);if(n?.handler.rmdir!==void 0){await n.handler.rmdir({cacheFs:this.memFs,filePath:i,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:n.params,author:await this.getAuthor()});let s=!1;for(let[a,f]of Object.entries(this.openFh))f.path===i&&(s=!0,await f.fh.close(),delete this.openFh[Number(a)]);s&&await this.memFs.promises.rmdir(i,{recursive:!0})}else throw new Error(`Cannot rmdir
|
|
105
|
+
${n?.handler.type} directories`)}fileType(){return 10}},l(Ut,"V"),Ut);b(Wf,"GitSubFs"),U(Wf,"LEGIT_DIR",".legit"),U(Wf,"pathRouter",new tj({".legit":{".":ow,operation:CT,head:aw,operationHead:$T,operationHistory:cw,history:IT,currentBranch:ij,branches:{".":tR,"[branchName]":{".legit":{".":ow,operation:CT,head:aw,operationHead:$T,operationHistory:cw,history:IT,threadName:rj},"[[...filePath]]":Vf}},commits:{".":DT,"[sha_1_1_2]":{".":DT,"[sha1_3__40]":{"[[...filePath]]":nR}}}},"[[...filePath]]":Vf}));var nj=Wf,ri="legit",sj=b(({fs:t,gitRepoPath:e,serverUrl:r="https://hub.legitcontrol.com",auth:i,anonymousBranch:n,authHeaderPrefix:s="Bearer "})=>{let a=!1;async function f(y){let g=await i.getMaxAccessTokenForBranch(y);if(!g)throw new Error(`No access token for branch ${y}`);await Ze.default.fetch({fs:t,http:Mf,dir:e,singleBranch:!0,ref:`${y}`,remote:ri,url:r,headers:{Authorization:`${s}${g}`}});let _=await Ze.default.resolveRef({fs:t,dir:e,ref:`${ri}/${y}`});await Ze.default.writeRef({fs:t,dir:e,ref:`refs/heads/${y}`,value:_})}l(f,"l"),b(f,"loadBranch");let o=[];async function c(){let y=await i.getMaxAccessTokenForBranch("todo");await Ze.default.fetch({fs:t,http:Mf,dir:e,remote:ri,url:r,headers:{Authorization:`${s}${y}`}});let g=await Ze.default.listBranches({fs:t,dir:e});for(let _ of g){if(_===n)continue;let F=`${ri}/${_}`,R,k;try{R=await Ze.default.resolveRef({fs:t,dir:e,ref:_})}catch(D){console.log(`Could not resolve local ref ${_}:`,D)}try{k=await Ze.default.resolveRef({fs:t,dir:e,ref:F})}catch{k=void 0}if(R&&k){if(R!==k){let D=await Ze.default.findMergeBase({fs:t,dir:e,oids:[R,k]});if(D[0]!==R&&D[0]!==k){let v=await Ze.default.merge({fs:t,dir:e,ours:R,theirs:k,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:b(async({branches:O,contents:E,path:N})=>{let[x,I,q]=E;return console.log(`Merging ${O[0]} with ${O[1]}...`),console.log("merged:"),console.log(E),{cleanMerge:!0,mergedText:q===void 0?I:q}},"mergeDriver")});await Ze.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:v.oid,force:!0})}D[0]===R?(console.log(`branch ${_} differs - remote ahaed, not behind`),await Ze.default.writeRef({fs:t,dir:e,ref:`refs/heads/${_}`,value:k,force:!0})):D[0]===k?(console.log(`branch ${_} differs - local ahead, not behind`),o.push(_)):(console.log(`branch ${_} differs - both changed`),o.push(_))}}else R&&!k&&o.push(_)}}l(c,"m"),b(c,"pull");async function u(y){if((await i.getUser()).type!=="local")for(let g of y){let _=await i.getMaxAccessTokenForBranch(g);await Ze.default.push({fs:t,http:Mf,dir:e,remote:ri,url:r,ref:g,headers:{Authorization:`Bearer ${_}`}})}}l(u,"c"),b(u,"push");let h=Promise.resolve();async function d(y){h=h.then(()=>u(y)),await h}l(d,"u"),b(d,"sequentialPush");async function p(){await Ze.default.getConfig({fs:t,dir:e,path:`remote.${ri}.fetch`})||await Ze.default.setConfig({fs:t,dir:e,path:`remote.${ri}.fetch`,value:`+refs/heads/*:refs/remotes/${ri}/*`});try{await c();let y=[...new Set(o)].filter(g=>g.indexOf(n)===-1);await d(y),o=[]}catch(y){console.error("Error monitoring changes:",y)}finally{a&&setTimeout(p,1e3)}}l(p,"h"),b(p,"pullPushTick");function m(){a=!0,p()}l(m,"g"),b(m,"startSync");function w(){a=!1}return l(w,"T"),b(w,"stopSync"),{start:b(()=>{a||(m(),a=!0)},"start"),stop:b(()=>{w()},"stop"),isRunning:b(()=>a,"isRunning"),loadBranch:f,sequentialPush:d}},"createLegitSyncService"),aj=b((t,e)=>{let r={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"};return{getUser:b(async()=>r,"getUser"),signInAnonymously:b(async()=>{r.type="anonymous",r.id=crypto.randomUUID(),r.email=`anonymous-sha1-${r.id}-@legitcontrol.com`},"signInAnonymously"),addAccessToken:b(async i=>{let n=await t.getUserTokens(r.id);n.accessTokens.push(i),await t.setUserTokens(r.id,n)},"addAccessToken"),getMaxAccessTokenForBranch:b(async i=>{let n=await t.getUserTokens(r.id);if(!(n.accessTokens===void 0||n.accessTokens.length===0))return n.accessTokens[0]},"getMaxAccessTokenForBranch")}},"createSessionManager");function lR(t){let e=JSON.stringify(t),r=new TextEncoder().encode(e),i="";return typeof btoa=="function"?i=btoa(String.fromCharCode(...r)):i=Buffer.from(r).toString("base64"),i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}l(lR,"Ze");b(lR,"encodeConfigJson");function fR(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((t.length+3)%4),r;typeof atob=="function"?r=atob(e):r=Buffer.from(e,"base64").toString("binary");let i=Uint8Array.from(r,s=>s.charCodeAt(0)),n=new TextDecoder().decode(i);return JSON.parse(n)}l(fR,"et");b(fR,"decodeConfigJson");var BT="user.legit-tokens";function uR({storageFs:t,gitRoot:e}){return{getUserTokens:b(async r=>{let i=await fw.default.getConfig({fs:t,dir:e,path:BT});return i?fR(i):{accessTokens:[]}},"getUserTokens"),setUserTokens:b(async(r,i)=>await fw.default.setConfig({fs:t,dir:e,path:BT,value:lR(i)}),"setUserTokens")}}l(uR,"rt");b(uR,"createGitConfigTokenStore");async function oj(t){let e=new Zf.Volume,r=(0,Zf.createFsFromVolume)(e);return Qf({...t,storageFs:t?.storageFs?t.storageFs:r,gitRoot:t?.gitRoot||"/"})}l(oj,"$s");b(oj,"openLegitFsWithMemoryFs");async function Qf({storageFs:t,gitRoot:e,anonymousBranch:r="anonymous",showKeepFiles:i=!1,initialAuthor:n={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"},serverUrl:s="https://sync.legitcontrol.com",publicKey:a}){await t.promises.readdir(e+"/.git").then(()=>!0).catch(()=>!1)||(await He.default.init({fs:t,dir:"/",defaultBranch:r}),await t.promises.writeFile(e+"/.keep",""),await He.default.add({fs:t,dir:"/",filepath:".keep"}),await He.default.commit({fs:t,dir:"/",message:"Initial commit",author:{name:"Test",email:"test@example.com"}}),await He.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:r})),await He.default.getConfig({fs:t,dir:e,path:"user.legit_user_id"})||await He.default.setConfig({fs:t,dir:e,path:"user.legit_user_id",value:n.name}),await He.default.getConfig({fs:t,dir:e,path:"user.name"})||await He.default.setConfig({fs:t,dir:e,path:"user.name",value:n.name}),await He.default.getConfig({fs:t,dir:e,path:"user.email"})||await He.default.setConfig({fs:t,dir:e,path:"user.email",value:n.email});let f=new AT({name:"root",parentFs:void 0,storageFs:t,gitRoot:e}),o=new NT({name:"root-ephemeral",parentFs:f,gitRoot:e,ephemeralPatterns:[]}),c=new PT({name:"root-hidden",parentFs:f,gitRoot:e,hiddenFiles:[]});f.setHiddenFilesSubFs(c),f.setEphemeralFilesSubFs(o);let u=new AT({name:"git",parentFs:f,storageFs:void 0,gitRoot:e,defaultBranch:r}),h=new nj({name:"git-subfs",parentFs:u,gitRoot:e,gitStorageFs:f}),d=i?[".git"]:[".git",".keep"],p=new PT({name:"git-hidden-subfs",parentFs:u,gitRoot:e,hiddenFiles:d}),m=new NT({name:"git-ephemeral-subfs",parentFs:u,gitRoot:e,ephemeralPatterns:["**/._*","**/.DS_Store","**/.AppleDouble/","**/.AppleDB","**/.AppleDesktop","**/.Spotlight-V100","**/.TemporaryItems","**/.Trashes","**/.fseventsd","**/.VolumeIcon.icns","**/.ql_disablethumbnails","**/.~lock.*","**/lu[0-9a-zA-Z]*.tmp","**/.metaentries.json.tmp","**/**.sb-**"]});u.addSubFs(h),u.setHiddenFilesSubFs(p),u.setEphemeralFilesSubFs(m);let w=uR({storageFs:t,gitRoot:e}),y=aj(w,a),g=sj({fs:t,gitRepoPath:e,serverUrl:s,auth:y,anonymousBranch:r}),_=Object.assign(u,{auth:y,sync:g,setLogger(F){f.setLoggger(F),u.setLoggger(F)},push:b(async F=>{},"push"),shareCurrentBranch:b(async()=>{if((await y.getUser()).type==="local")throw new Error("login first - for example anonymously using legitfs.auth.signInAnonymously()");let F=await _.getCurrentBranch();return F===r&&(F=(await y.getUser()).id,await He.default.renameBranch({fs:t,dir:e,oldref:r,ref:F})),await g.sequentialPush([F]),_.setCurrentBranch(F),F},"shareCurrentBranch"),setCurrentBranch:b(async F=>{(await He.default.listBranches({fs:t,dir:e})).includes(F)||await g?.loadBranch(F);let R=(await He.default.listBranches({fs:t,dir:e})).includes(F);if(console.log("branchExistsAfter",R),!R)throw new Error(`Branch ${F} does not exist`);await He.default.setConfig({fs:t,dir:e,path:"init.defaultBranch",value:F})},"setCurrentBranch"),getCurrentBranch:b(async()=>{let F=await He.default.getConfig({fs:t,dir:e,path:"init.defaultBranch"});if(!F)throw new Error("No current branch set");return F},"getCurrentBranch")});return _}l(Qf,"kt");b(Qf,"openLegitFs");var Gz=b(t=>async e=>{if(!e.path.includes(".legit/branches/")||(e.path.match(/\.legit/g)||[]).length>1)return;let[r,i]=e.path.split(".legit/branches/"),[n,...s]=i.split("/"),a=s.join("/"),f=r+".legit/branches/"+n+"/.legit/operation",o=JSON.stringify(e.operationArgs,(c,u)=>Buffer.isBuffer(u)?{__buffer__:u.toString("base64")}:u);await t.writeFile(f,`[${e.fsName}].${e.operation}(${e.fd?e.fd.fd+" - ":""}${e.path})
|
|
106
|
+
|
|
107
|
+
${o}
|
|
108
|
+
|
|
109
|
+
`)},"createFsOperationFileLogger");var gO=ce(hO(),1);import{createContext as l8,useContext as f8,useEffect as u8,useMemo as h8,useState as ry,useCallback as Hu}from"react";import{jsx as m8}from"react/jsx-runtime";var No="main",li="/.legit/branches",pO="/.legit/commits",dO=l(t=>(t.startsWith("/")&&(t=t.slice(1)),`${li}/${No}/${t}`),"resolveThreadPath"),d8=l(t=>t instanceof Error?t:new Error(String(t??"Unknown error")),"normalizeError"),mO=l8(void 0);function p8({children:t}){let[e,r]=ry(null),[i,n]=ry(!0),[s,a]=ry(null);u8(()=>{let d=!1,p=l(async()=>{try{let m=await fi();d||(r(m),a(null),n(!1))}catch(m){if(!d){let w=d8(m);r(null),a(w),n(!1)}}},"load");return n(!0),a(null),p(),()=>{d=!0}},[]);let f=Hu(async(d,p)=>{if(e){let m=dO(d);await e.promises.writeFile(m,p)}},[e]),o=Hu(async d=>{if(e){let p=await Xs(No);if(!p)return;let m=p.find(_=>_.oid===d),w=p.find(_=>_.oid===m?.parentOids[0]);if(!m||!w)return;let y=m?.parentOids[1],g=w?.originBranchOid;return!y||!g?void 0:{newOid:y,oldOid:g}}},[e]),c=Hu(async(d,p)=>{if(e)return await yO(d,p)},[e]),u=Hu(async d=>(e&&(console.log("rollback",d),await wO(No,d)),await Vu(No)),[e]),h=h8(()=>({legitFs:e,loading:i,error:s,saveData:f,getMessageDiff:o,getPastState:c,rollback:u,threadId:No,resolvePath:dO}),[e,i,s,f]);return m8(mO.Provider,{value:h,children:t})}l(p8,"LegitFsProvider");function iy(){let t=f8(mO);if(t===void 0)throw new Error("useLegitFs must be used within a LegitFsProvider");return t}l(iy,"useLegitFs");var Gu=null;async function fi(){return Gu||(Gu=Qf({storageFs:gO.default,gitRoot:"/"}),window&&(window.legitFs=await Gu)),Gu}l(fi,"getLegitFs");async function bO(){let t=await fi();try{return(await t.promises.readdir(li)).filter(r=>!r.startsWith("."))}catch(e){if(e.code==="ENOENT")return await t.promises.mkdir(li,{recursive:!0}),[];throw e}}l(bO,"listBranches");async function Vu(t){try{return await(await fi()).promises.readFile(`${li}/${t}/.legit/head`,"utf8")}catch(e){throw console.error("Error reading head from path:",t,e),e}}l(Vu,"readHead");async function wO(t,e){try{await(await fi()).promises.writeFile(`${li}/${t}/.legit/operationHead`,e,"utf8")}catch(r){throw console.error("Error writing head to path:",t,r),r}}l(wO,"writeOperationHead");async function _O(t,e){try{await(await fi()).promises.writeFile(`${li}/${t}/.legit/operation`,e,"utf8")}catch(r){throw console.error("Error writing operation to path:",t,r),r}}l(_O,"writeOperation");async function Xs(t){try{let r=await(await fi()).promises.readFile(`${li}/${t}/.legit/operationHistory`,"utf8");return r.length>0?JSON.parse(r):JSON.parse("[]")}catch(e){throw console.error("Error reading operation history from path:",t,e),e}}l(Xs,"readOperationHistory");async function yO(t,e){try{e.startsWith("/")&&(e=e.slice(1));let r=await fi(),i=`${pO}/${t.slice(0,2)}/${t.slice(2)}/${e}`;return await r.promises.readFile(i,"utf8")}catch(r){throw console.error("Error reading past state from path:",t,r),r}}l(yO,"readPastState");var Ku=l(async t=>{let e=[];for(let r of t){let i,n;try{i=JSON.parse(r.message),n={id:r.oid,height:e.length,parent_id:r.parentOids[0]===r.parentOids[1]?null:r.parentOids[0],metadata:{custom:{depending_branch_commit_id:r.originBranchOid??null}},...i},e.unshift(n)}catch{console.log("Skipping operation with invalid JSON message:",r);continue}}return e},"createUIMessages");var ny=class ny{async list(e,r){let i=await Xs(e);return{messages:(await Ku(i)).map((a,f)=>({...a,height:f,created_at:new Date(a.created_at),updated_at:new Date(a.updated_at)}))}}async create(e,r){let i=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`,n={created_at:new Date,updated_at:new Date,format:r.format,content:r.content};return await _O(e,JSON.stringify(n)),{message_id:i}}};l(ny,"LegitThreadMessages");var Ju=ny;var sy=class sy{constructor(){G(this,"messages",new Ju)}async list(e){return{threads:(await bO()).map(i=>({id:i,title:i,last_message_at:new Date,metadata:{},external_id:null,project_id:"",created_at:new Date,updated_at:new Date,workspace_id:"local-workspace",is_archived:!1}))}}async create(e){return{thread_id:"main"}}async update(e,r){}async delete(e){}};l(sy,"LegitThreads");var Xu=sy;var oy=class oy extends ah{constructor(r){super(r);G(this,"runtime");G(this,"legitFs",null);this.legitFs=r.legitFs,this.threads=new Xu;let i=this.runs.stream;this.runs.stream=async n=>{if(!this.runtime)throw new Error("LegitLocal runtime not set");let f=this.runtime.thread.__internal_threadBinding?.getState?.()?.adapters?.chatModel?.options??{},o=new Headers;o.set("Content-Type","application/json");try{let c=await fetch(f.api??"/api/chat",{method:"POST",headers:o,credentials:f.credentials??"same-origin",body:JSON.stringify({messages:n.messages,system:n.system,tools:n.tools,runConfig:f.runConfig??{}})});if(!c.ok)throw new Error(`Request failed with status ${c.status}`);return fr.fromResponse(c,new ca)}catch(c){return console.error("LegitLocal stream failed, falling back to default handler.",c),i.call(this.runs,n)}}}};l(oy,"LegitLocal");var ay=oy;import{ExportedMessageRepository as w8}from"@assistant-ui/react";var y8=l(t=>{if(t&&typeof t=="object"){let e=t,r=e.custom&&typeof e.custom=="object"?e.custom:{};return{...e,custom:r}}return{custom:{}}},"normalizeMetadata"),g8="aui/v0";function b8(t){if(t.format!==g8)return null;let e=t.content;if(!e||typeof e!="object")return null;let r=e.role;if(r!=="assistant"&&r!=="user"&&r!=="system")return null;let i=e.content??[],n=typeof i=="string"||Array.isArray(i)?i:[],s=e.createdAt instanceof Date?e.createdAt:e.createdAt?new Date(e.createdAt):new Date(t.created_at),a=y8(t.metadata);return{...e,role:r,content:n,id:e.id??t.id,createdAt:s,metadata:a}}l(b8,"toThreadMessageLike");async function cy({threadId:t,threadApi:e}){console.log("sync initiated");let r=await Xs(t),n=(await Ku(r)).map(b8).filter(s=>s!==null);e?.reset?.(n),e.import(w8.fromArray(n))}l(cy,"syncThreadFromLegitFs");var vO=l(t=>{if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t)}catch{return""}},"serializeStructuredData");var Do=l(t=>t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(e=>Do(e)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Do(r)])):JSON.stringify(t),"toJsonValue"),_8=l((t,e)=>e?typeof t=="string"?{type:"error-text",value:t}:{type:"error-json",value:Do(t)}:typeof t=="string"?{type:"text",value:t}:{type:"json",value:Do(t)},"buildToolResultOutput"),v8=l(t=>{switch(t.type){case"text":return{type:"text",text:typeof t.text=="string"?t.text:""};case"tool-call":return{type:"tool-call",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",input:Do(t.args??t.input??{})};default:return null}},"mapAssistantContentPart"),E8=l(t=>t.type!=="tool-result"?null:{type:"tool-result",toolCallId:typeof t.toolCallId=="string"?t.toolCallId:`unknown-${Date.now()}`,toolName:typeof t.toolName=="string"?t.toolName:"unknown",output:_8(t.result??t.output,!!t.isError)},"mapToolContentPart"),W5=l(t=>t.map(e=>{let r=Array.isArray(e.content)?e.content:[];switch(e.role){case"system":return{role:"system",content:r.map(n=>n.type==="text"&&typeof n.text=="string"?n.text:"").join("")};case"user":return{role:"user",content:r.map(n=>{switch(n.type){case"text":return{type:"text",text:typeof n.text=="string"?n.text:""};default:return null}}).filter(Boolean)};case"assistant":return{role:"assistant",content:r.map(n=>v8(n)).filter(Boolean)};case"tool":{let i=r.map(n=>E8(n)).filter(Boolean);return i.length>0?{role:"tool",content:i}:null}default:return null}}).filter(e=>e!==null),"convertMessagesToModelMessages");async function z5(t){let[e,r]=oa();(async()=>{try{let n=null,s=new Map;for await(let a of t.fullStream)switch(a.type){case"text-start":n=r.addTextPart();break;case"text-delta":n||(n=r.addTextPart()),n.append(a.text);break;case"text-end":n?.close(),n=null;break;case"tool-input-start":{let f=a.id;if(!s.has(f)){let o=r.addToolCallPart({toolCallId:f,toolName:a.toolName});s.set(f,o)}break}case"tool-input-delta":{let f=a.id,o=s.get(f);o&&o.argsText.append(a.delta);break}case"tool-input-end":{let f=a.id,o=s.get(f);o&&o.argsText.close();break}case"tool-call":{let f=a.toolCallId;if(!s.get(f)){let c=r.addToolCallPart({toolCallId:f,toolName:a.toolName,args:a.input});s.set(f,c)}break}case"tool-result":{let f=a.toolCallId,o=s.get(f);o&&o.setResponse({result:vO(a.output),isError:!1});break}case"tool-error":{let f=a.toolCallId,o=s.get(f);o&&o.setResponse({result:vO(a.error),isError:!0});break}case"start-step":{let f=`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;r.enqueue({type:"step-start",path:[],messageId:f});break}case"finish-step":{let f=a.usage;r.enqueue({type:"step-finish",path:[],finishReason:a.finishReason,usage:{promptTokens:f.promptTokens??f.prompt?.tokens??0,completionTokens:f.completionTokens??f.completion?.tokens??0},isContinued:!1});break}case"finish":{let f=a.totalUsage;r.enqueue({type:"message-finish",path:[],finishReason:a.finishReason,usage:{promptTokens:f.promptTokens??f.prompt?.tokens??0,completionTokens:f.completionTokens??f.completion?.tokens??0}});break}case"error":{r.enqueue({type:"error",path:[],error:a.error instanceof Error?a.error.message:typeof a.error=="string"?a.error:"Unknown error"});break}case"start":case"abort":case"raw":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"source":case"file":break}n?.close(),s.forEach(a=>a.close()),r.close()}catch(n){r.enqueue({type:"error",path:[],error:n instanceof Error?n.message:typeof n=="string"?n:"Unknown error"}),r.close()}})();let i=new sh;return fr.toResponse(e,i)}l(z5,"streamTextToDataStreamResponse");import{useEffect as S8}from"react";import{useAssistantApi as F8}from"@assistant-ui/react";var T8=100;function Z5(){let{legitFs:t,threadId:e}=iy(),i=F8().thread();return S8(()=>{if(!t||!e)return;let n=!1,s,a=null,f=l(()=>{n||(s=setTimeout(o,T8))},"scheduleNext"),o=l(async()=>{try{let c=await Vu(e);if(n||c===a)return;let{isRunning:u,isLoading:h}=i.getState();if(u||h)return;setTimeout(async()=>{await cy({threadId:e,threadApi:i}),a=c},100)}catch(c){c.code!=="ENOENT"&&console.error("Failed to poll Legit head",c)}finally{f()}},"tick");return f(),()=>{n=!0,s!==void 0&&clearTimeout(s)}},[t,i,e]),null}l(Z5,"LegitFsHeadPoller");export{Z5 as LegitFsHeadPoller,p8 as LegitFsProvider,ay as LegitLocal,W5 as convertMessagesToModelMessages,z5 as streamTextToDataStreamResponse,cy as syncThreadFromLegitFs,iy as useLegitFs};
|
|
110
|
+
/*! Bundled license information:
|
|
111
|
+
|
|
112
|
+
safe-buffer/index.js:
|
|
113
|
+
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
114
|
+
|
|
115
|
+
crc-32/crc32.js:
|
|
116
|
+
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
|
|
117
|
+
|
|
118
|
+
simple-concat/index.js:
|
|
119
|
+
(*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
120
|
+
|
|
121
|
+
simple-get/index.js:
|
|
122
|
+
(*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
123
|
+
*/
|