@wp-playground/storage 3.0.22 → 3.0.31
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/index.cjs +60 -60
- package/index.cjs.map +1 -1
- package/index.d.ts +8 -0
- package/index.js +2378 -1987
- package/index.js.map +1 -1
- package/lib/browser-fs.d.ts +5 -0
- package/lib/changeset.d.ts +62 -0
- package/lib/filesystems.d.ts +211 -0
- package/lib/git-create-dotgit-directory.d.ts +16 -0
- package/lib/git-sparse-checkout.d.ts +88 -0
- package/lib/github.d.ts +47 -0
- package/lib/paths.d.ts +3 -0
- package/lib/playground.d.ts +4 -0
- package/package.json +10 -8
package/index.cjs
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
"use strict";var nn=Object.create;var _t=Object.defineProperty;var on=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames;var sn=Object.getPrototypeOf,fn=Object.prototype.hasOwnProperty;var cn=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of an(e))!fn.call(r,a)&&a!==t&&_t(r,a,{get:()=>e[a],enumerable:!(i=on(e,a))||i.enumerable});return r};var Ut=(r,e,t)=>(t=r!=null?nn(sn(r)):{},cn(e||!r||!r.__esModule?_t(t,"default",{value:r,enumerable:!0}):t,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("@php-wasm/util"),un=require("octokit"),ln=require("crc-32"),ut=require("pako"),se=require("@php-wasm/stream-compression"),oe=require("@zip.js/zip.js");function hn(r){return new un.Octokit({auth:r})}function pn(r,e=""){e.length&&!e.endsWith("/")&&(e+="/");const t={};for(const i of r)i.path.startsWith(e)&&(t[i.path.substring(e.length)]=i.content);return t}async function or(r,e,t,i,a,f={}){f.progress||(f.progress={foundFiles:0,downloadedFiles:0});const{onProgress:u}=f,s=[],h=[],{data:d}=await r.rest.repos.getContent({owner:e,repo:t,path:a,ref:i});if(!Array.isArray(d))throw new Error(`Expected the list of files to be an array, but got ${typeof d}`);for(const w of d)w.type==="file"?(++f.progress.foundFiles,u==null||u(f.progress),s.push(dn(r,e,t,i,w).then(v=>(++f.progress.downloadedFiles,u==null||u(f.progress),v)))):w.type==="dir"&&h.push(or(r,e,t,i,w.path,f));const y=await Promise.all(s),g=(await Promise.all(h)).flatMap(w=>w);return[...y,...g]}const yn=new te.Semaphore({concurrency:15});async function dn(r,e,t,i,a){const f=await yn.acquire();try{const{data:u}=await r.rest.repos.getContent({owner:e,repo:t,ref:i,path:a.path});if(!("content"in u))throw new Error(`No content found for ${a.path}`);return{name:a.name,path:a.path,content:gn(u.content)}}finally{f()}}function gn(r){const e=window.atob(r),t=e.length,i=new Uint8Array(t);for(let a=0;a<t;a++)i[a]=e.charCodeAt(a);return i}async function mn(r,e,t,i,a){var y;const{data:f}=await r.rest.pulls.get({owner:e,repo:t,pull_number:i}),s=(y=(await r.rest.actions.listWorkflowRuns({owner:e,repo:t,branch:f.head.ref,workflow_id:a})).data.workflow_runs[0])==null?void 0:y.id,h=await r.rest.actions.listWorkflowRunArtifacts({owner:e,repo:t,run_id:s});return(await r.rest.actions.downloadArtifact({owner:e,repo:t,artifact_id:h.data.artifacts[0].id,archive_format:"zip"})).data}async function wn(r,e,t){var f;const{data:i,headers:a}=await r.request("GET /repos/{owner}/{repo}",{owner:e,repo:t});return!(!a["x-oauth-scopes"]||!((f=i.permissions)!=null&&f.push))}async function bn(r,e,t,i,a){await r.request("GET /repos/{owner}/{repo}/branches/{branch}",{owner:e,repo:t,branch:i}).then(()=>!0,()=>!1)?await r.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}",{owner:e,repo:t,sha:a,ref:`heads/${i}`}):await r.request("POST /repos/{owner}/{repo}/git/refs",{owner:e,repo:t,sha:a,ref:`refs/heads/${i}`})}async function vn(r,e,t){const i=await r.request("GET /user");return(await r.request("GET /repos/{owner}/{repo}/forks",{owner:e,repo:t})).data.find(u=>u.owner&&u.owner.login===i.data.login)||await r.request("POST /repos/{owner}/{repo}/forks",{owner:e,repo:t}),i.data.login}async function En(r,e,t,i,a,f){const{data:{sha:u}}=await r.request("POST /repos/{owner}/{repo}/git/commits",{owner:e,repo:t,message:i,tree:f,parents:[a]});return u}async function xn(r,e,t,i,a){const f=await ar(r,e,t,i,a);if(f.length===0)return null;const{data:{sha:u}}=await r.request("POST /repos/{owner}/{repo}/git/trees",{owner:e,repo:t,base_tree:i,tree:f});return u}async function ar(r,e,t,i,a){const f=[];for(const[u,s]of a.create)f.push(ot(r,e,t,u,s));for(const[u,s]of a.update)f.push(ot(r,e,t,u,s));for(const u of a.delete)f.push(fr(r,e,t,i,u));return Promise.all(f).then(u=>u.filter(s=>!!s))}const sr=new te.Semaphore({concurrency:10});async function ot(r,e,t,i,a){const f=await sr.acquire();try{if(ArrayBuffer.isView(a))try{const u=new TextDecoder("utf-8",{fatal:!0}).decode(a);return{path:i,content:u,mode:"100644"}}catch{const{data:{sha:u}}=await r.rest.git.createBlob({owner:e,repo:t,encoding:"base64",content:An(a)});return{path:i,sha:u,mode:"100644"}}else return{path:i,content:a,mode:"100644"}}finally{f()}}async function fr(r,e,t,i,a){const f=await sr.acquire();try{return await r.request("HEAD /repos/{owner}/{repo}/contents/:path",{owner:e,repo:t,ref:i,path:a}),{path:a,mode:"100644",sha:null}}catch{return}finally{f()}}function An(r){const e=[],t=r.byteLength;for(let i=0;i<t;i++)e.push(String.fromCharCode(r[i]));return window.btoa(e.join(""))}async function*Bn(r,e,{exceptPaths:t=[]}={}){if(e=te.normalizePath(e),!await r.isDir(e)){await r.fileExists(e)&&(yield{path:e,read:async()=>await r.readFileAsBuffer(e)});return}const i=[e];for(;i.length;){const a=i.pop();if(!a)return;const f=await r.listFiles(a);for(const u of f){const s=te.joinPaths(a,u);t.includes(s.substring(e.length+1))||(await r.isDir(s)?i.push(s):yield{path:s,read:async()=>await r.readFileAsBuffer(s)})}}}async function Sn(r,e){const t={create:new Map,update:new Map,delete:new Set},i=new Set;for await(const a of e){i.add(a.path);const f=r.get(a.path),u=await a.read();f?In(f,u)||t.update.set(a.path,u):t.create.set(a.path,u)}for(const a of r.keys())i.has(a)||t.delete.add(a);return t}function In(r,e){return r.length===e.length&&r.every((t,i)=>t===e[i])}async function cr(r){return r.type==="local-fs"?r.handle:ur(r.path)}async function ur(r){const e=r.split("/").filter(i=>i.length>0);let t=await navigator.storage.getDirectory();for(const i of e)t=await t.getDirectoryHandle(i,{create:!0});return t}async function Fn(r){const t=await(await navigator.storage.getDirectory()).resolve(r);if(t===null)throw new DOMException("Unable to resolve path of OPFS directory handle.","NotFoundError");return"/"+t.join("/")}async function _n(r){const e=await cr(r);for await(const t of e.keys())await e.removeEntry(t,{recursive:!0})}function Un(r){let e=[r];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function lr(r){return r[Symbol.asyncIterator]?r[Symbol.asyncIterator]():r[Symbol.iterator]?r[Symbol.iterator]():r.next?r:Un(r)}class hr{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=lr(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:t}=await this.stream.next();return e&&(this._ended=!0,!t)?Buffer.alloc(0):(t&&(t=Buffer.from(t)),t)}_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;const t=[this.buffer];for(;this.cursor+e>Pn(t);){const i=await this._next();if(this._ended)break;t.push(i)}this.buffer=Buffer.concat(t)}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()}}function Pn(r){return r.reduce((e,t)=>e+t.length,0)}function $n(r,e){const t=e.toString(16);return"0".repeat(r-t.length)+t}class j{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));const t=e.length+4,i=$n(4,t);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){const t=new hr(e);return async function(){try{let a=await t.read(4);if(a==null)return!0;if(a=parseInt(a.toString("utf8"),16),a===0||a===1)return null;const f=await t.read(a-4);return f??!0}catch(a){return e.error=a,!0}}}}class ie 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){const t=new ie(e.message);return t.code=e.code,t.data=e.data,t.caller=e.caller,t.stack=e.stack,t}get isIsomorphicGitError(){return!0}}class I extends ie{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=I.code,this.data={message:e}}}I.code="InternalError";class he extends ie{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=he.code,this.data={filepath:e}}}he.code="UnsafeFilepathError";function pr(r,e){return-(r<e)||+(r>e)}function yr(r,e){return pr(r.path,e.path)}function Tn(r,e){return pr(Pt(r),Pt(e))}function Pt(r){return r.mode==="040000"?r.path+"/":r.path}function dr(r){switch(r){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new I(`Unexpected GitTree entry mode: ${r}`)}function On(r){const e=[];let t=0;for(;t<r.length;){const i=r.indexOf(32,t);if(i===-1)throw new I(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next space character.`);const a=r.indexOf(0,t);if(a===-1)throw new I(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next null character.`);let f=r.slice(t,i).toString("utf8");f==="40000"&&(f="040000");const u=dr(f),s=r.slice(i+1,a).toString("utf8");if(s.includes("\\")||s.includes("/"))throw new he(s);const h=r.slice(a+1,a+21).toString("hex");t=a+21,e.push({mode:f,path:s,oid:h,type:u})}return e}function kn(r){if(typeof r=="number"&&(r=r.toString(8)),r.match(/^0?4.*/))return"040000";if(r.match(/^1006.*/))return"100644";if(r.match(/^1007.*/))return"100755";if(r.match(/^120.*/))return"120000";if(r.match(/^160.*/))return"160000";throw new I(`Could not understand file mode: ${r}`)}function Rn(r){return!r.oid&&r.sha&&(r.oid=r.sha),r.mode=kn(r.mode),r.type||(r.type=dr(r.mode)),r}class lt{constructor(e){if(Buffer.isBuffer(e))this._entries=On(e);else if(Array.isArray(e))this._entries=e.map(Rn);else throw new I("invalid type passed to GitTree constructor");this._entries.sort(yr)}static from(e){return new lt(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
|
2
|
-
`)}toObject(){const
|
|
3
|
-
`,
|
|
4
|
-
type ${
|
|
5
|
-
tag ${
|
|
6
|
-
tagger ${
|
|
1
|
+
"use strict";var an=Object.create;var Ue=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var cn=Object.getOwnPropertyNames;var fn=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var ln=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of cn(t))!un.call(n,o)&&o!==e&&Ue(n,o,{get:()=>t[o],enumerable:!(r=sn(t,o))||r.enumerable});return n};var Pe=(n,t,e)=>(e=n!=null?an(fn(n)):{},ln(t||!n||!n.__esModule?Ue(e,"default",{value:n,enumerable:!0}):e,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const rt=require("@php-wasm/util"),hn=require("octokit"),pn=require("crc-32"),he=require("pako"),K=require("@php-wasm/stream-compression"),at=require("@zip.js/zip.js");function dn(n){return new hn.Octokit({auth:n})}function yn(n,t=""){t.length&&!t.endsWith("/")&&(t+="/");const e={};for(const r of n)r.path.startsWith(t)&&(e[r.path.substring(t.length)]=r.content);return e}async function sr(n,t,e,r,o,c={}){c.progress||(c.progress={foundFiles:0,downloadedFiles:0});const{onProgress:f}=c,s=[],h=[],{data:y}=await n.rest.repos.getContent({owner:t,repo:e,path:o,ref:r});if(!Array.isArray(y))throw new Error(`Expected the list of files to be an array, but got ${typeof y}`);for(const b of y)b.type==="file"?(++c.progress.foundFiles,f==null||f(c.progress),s.push(gn(n,t,e,r,b).then(v=>(++c.progress.downloadedFiles,f==null||f(c.progress),v)))):b.type==="dir"&&h.push(sr(n,t,e,r,b.path,c));const d=await Promise.all(s),w=(await Promise.all(h)).flatMap(b=>b);return[...d,...w]}const wn=new rt.Semaphore({concurrency:15});async function gn(n,t,e,r,o){const c=await wn.acquire();try{const{data:f}=await n.rest.repos.getContent({owner:t,repo:e,ref:r,path:o.path});if(!("content"in f))throw new Error(`No content found for ${o.path}`);return{name:o.name,path:o.path,content:mn(f.content)}}finally{c()}}function mn(n){const t=window.atob(n),e=t.length,r=new Uint8Array(e);for(let o=0;o<e;o++)r[o]=t.charCodeAt(o);return r}async function bn(n,t,e,r,o){var d;const{data:c}=await n.rest.pulls.get({owner:t,repo:e,pull_number:r}),s=(d=(await n.rest.actions.listWorkflowRuns({owner:t,repo:e,branch:c.head.ref,workflow_id:o})).data.workflow_runs[0])==null?void 0:d.id,h=await n.rest.actions.listWorkflowRunArtifacts({owner:t,repo:e,run_id:s});return(await n.rest.actions.downloadArtifact({owner:t,repo:e,artifact_id:h.data.artifacts[0].id,archive_format:"zip"})).data}async function vn(n,t,e){var c;const{data:r,headers:o}=await n.request("GET /repos/{owner}/{repo}",{owner:t,repo:e});return!(!o["x-oauth-scopes"]||!((c=r.permissions)!=null&&c.push))}async function En(n,t,e,r,o){await n.request("GET /repos/{owner}/{repo}/branches/{branch}",{owner:t,repo:e,branch:r}).then(()=>!0,()=>!1)?await n.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}",{owner:t,repo:e,sha:o,ref:`heads/${r}`}):await n.request("POST /repos/{owner}/{repo}/git/refs",{owner:t,repo:e,sha:o,ref:`refs/heads/${r}`})}async function xn(n,t,e){const r=await n.request("GET /user");return(await n.request("GET /repos/{owner}/{repo}/forks",{owner:t,repo:e})).data.find(f=>f.owner&&f.owner.login===r.data.login)||await n.request("POST /repos/{owner}/{repo}/forks",{owner:t,repo:e}),r.data.login}async function An(n,t,e,r,o,c){const{data:{sha:f}}=await n.request("POST /repos/{owner}/{repo}/git/commits",{owner:t,repo:e,message:r,tree:c,parents:[o]});return f}async function Bn(n,t,e,r,o){const c=await cr(n,t,e,r,o);if(c.length===0)return null;const{data:{sha:f}}=await n.request("POST /repos/{owner}/{repo}/git/trees",{owner:t,repo:e,base_tree:r,tree:c});return f}async function cr(n,t,e,r,o){const c=[];for(const[f,s]of o.create)c.push(se(n,t,e,f,s));for(const[f,s]of o.update)c.push(se(n,t,e,f,s));for(const f of o.delete)c.push(ur(n,t,e,r,f));return Promise.all(c).then(f=>f.filter(s=>!!s))}const fr=new rt.Semaphore({concurrency:10});async function se(n,t,e,r,o){const c=await fr.acquire();try{if(ArrayBuffer.isView(o))try{const f=new TextDecoder("utf-8",{fatal:!0}).decode(o);return{path:r,content:f,mode:"100644"}}catch{const{data:{sha:f}}=await n.rest.git.createBlob({owner:t,repo:e,encoding:"base64",content:Sn(o)});return{path:r,sha:f,mode:"100644"}}else return{path:r,content:o,mode:"100644"}}finally{c()}}async function ur(n,t,e,r,o){const c=await fr.acquire();try{return await n.request("HEAD /repos/{owner}/{repo}/contents/:path",{owner:t,repo:e,ref:r,path:o}),{path:o,mode:"100644",sha:null}}catch{return}finally{c()}}function Sn(n){const t=[],e=n.byteLength;for(let r=0;r<e;r++)t.push(String.fromCharCode(n[r]));return window.btoa(t.join(""))}async function*Fn(n,t,{exceptPaths:e=[]}={}){if(t=rt.normalizePath(t),!await n.isDir(t)){await n.fileExists(t)&&(yield{path:t,read:async()=>await n.readFileAsBuffer(t)});return}const r=[t];for(;r.length;){const o=r.pop();if(!o)return;const c=await n.listFiles(o);for(const f of c){const s=rt.joinPaths(o,f);e.includes(s.substring(t.length+1))||(await n.isDir(s)?r.push(s):yield{path:s,read:async()=>await n.readFileAsBuffer(s)})}}}async function In(n,t){const e={create:new Map,update:new Map,delete:new Set},r=new Set;for await(const o of t){r.add(o.path);const c=n.get(o.path),f=await o.read();c?_n(c,f)||e.update.set(o.path,f):e.create.set(o.path,f)}for(const o of n.keys())r.has(o)||e.delete.add(o);return e}function _n(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}async function lr(n){return n.type==="local-fs"?n.handle:hr(n.path)}async function hr(n){const t=n.split("/").filter(r=>r.length>0);let e=await navigator.storage.getDirectory();for(const r of t)e=await e.getDirectoryHandle(r,{create:!0});return e}async function $n(n){const e=await(await navigator.storage.getDirectory()).resolve(n);if(e===null)throw new DOMException("Unable to resolve path of OPFS directory handle.","NotFoundError");return"/"+e.join("/")}async function Un(n){const t=await lr(n);for await(const e of t.keys())await t.removeEntry(e,{recursive:!0})}function Pn(n){let t=[n];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function pr(n){return n[Symbol.asyncIterator]?n[Symbol.asyncIterator]():n[Symbol.iterator]?n[Symbol.iterator]():n.next?n:Pn(n)}class dr{constructor(t){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=pr(t),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(t){if(!this.eof())return this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t),this.buffer.slice(this.undoCursor,this.cursor)}async skip(t){this.eof()||(this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:t,value:e}=await this.stream.next();return t&&(this._ended=!0,!e)?Buffer.alloc(0):(e&&(e=Buffer.from(e)),e)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(t){this.undoCursor=this.cursor,this.cursor+=t,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(t){if(this._ended)return;const e=[this.buffer];for(;this.cursor+t>kn(e);){const r=await this._next();if(this._ended)break;e.push(r)}this.buffer=Buffer.concat(e)}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()}}function kn(n){return n.reduce((t,e)=>t+e.length,0)}function Tn(n,t){const e=t.toString(16);return"0".repeat(n-e.length)+e}class D{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(t){typeof t=="string"&&(t=Buffer.from(t));const e=t.length+4,r=Tn(4,e);return Buffer.concat([Buffer.from(r,"utf8"),t])}static streamReader(t){const e=new dr(t);return async function(){try{let o=await e.read(4);if(o==null)return!0;if(o=parseInt(o.toString("utf8"),16),o===0||o===1)return null;const c=await e.read(o-4);return c??!0}catch(o){return t.error=o,!0}}}}class ot extends Error{constructor(t){super(t),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(t){const e=new ot(t.message);return e.code=t.code,e.data=t.data,e.caller=t.caller,e.stack=t.stack,e}get isIsomorphicGitError(){return!0}}class F extends ot{constructor(t){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: ${t}`),this.code=this.name=F.code,this.data={message:t}}}F.code="InternalError";class ht extends ot{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=ht.code,this.data={filepath:t}}}ht.code="UnsafeFilepathError";function yr(n,t){return-(n<t)||+(n>t)}function wr(n,t){return yr(n.path,t.path)}function On(n,t){return yr(ke(n),ke(t))}function ke(n){return n.mode==="040000"?n.path+"/":n.path}function gr(n){switch(n){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new F(`Unexpected GitTree entry mode: ${n}`)}function Rn(n){const t=[];let e=0;for(;e<n.length;){const r=n.indexOf(32,e);if(r===-1)throw new F(`GitTree: Error parsing buffer at byte location ${e}: Could not find the next space character.`);const o=n.indexOf(0,e);if(o===-1)throw new F(`GitTree: Error parsing buffer at byte location ${e}: Could not find the next null character.`);let c=n.slice(e,r).toString("utf8");c==="40000"&&(c="040000");const f=gr(c),s=n.slice(r+1,o).toString("utf8");if(s.includes("\\")||s.includes("/"))throw new ht(s);const h=n.slice(o+1,o+21).toString("hex");e=o+21,t.push({mode:c,path:s,oid:h,type:f})}return t}function Dn(n){if(typeof n=="number"&&(n=n.toString(8)),n.match(/^0?4.*/))return"040000";if(n.match(/^1006.*/))return"100644";if(n.match(/^1007.*/))return"100755";if(n.match(/^120.*/))return"120000";if(n.match(/^160.*/))return"160000";throw new F(`Could not understand file mode: ${n}`)}function jn(n){return!n.oid&&n.sha&&(n.oid=n.sha),n.mode=Dn(n.mode),n.type||(n.type=gr(n.mode)),n}class pe{constructor(t){if(Buffer.isBuffer(t))this._entries=Rn(t);else if(Array.isArray(t))this._entries=t.map(jn);else throw new F("invalid type passed to GitTree constructor");this._entries.sort(wr)}static from(t){return new pe(t)}render(){return this._entries.map(t=>`${t.mode} ${t.type} ${t.oid} ${t.path}`).join(`
|
|
2
|
+
`)}toObject(){const t=[...this._entries];return t.sort(On),Buffer.concat(t.map(e=>{const r=Buffer.from(e.mode.replace(/^0/,"")),o=Buffer.from(" "),c=Buffer.from(e.path,"utf8"),f=Buffer.from([0]),s=Buffer.from(e.oid,"hex");return Buffer.concat([r,o,c,f,s])}))}entries(){return this._entries}*[Symbol.iterator](){for(const t of this._entries)yield t}}function ce({name:n,email:t,timestamp:e,timezoneOffset:r}){return r=Cn(r),`${n} <${t}> ${e} ${r}`}function Cn(n){const t=Nn(Mn(n));n=Math.abs(n);const e=Math.floor(n/60);n-=e*60;let r=String(e),o=String(n);return r.length<2&&(r="0"+r),o.length<2&&(o="0"+o),(t===-1?"-":"+")+r+o}function Nn(n){return Math.sign(n)||(Object.is(n,-0)?-1:1)}function Mn(n){return n===0?n:-n}function V(n){return n=n.replace(/\r/g,""),n=n.replace(/^\n+/,""),n=n.replace(/\n+$/,"")+`
|
|
3
|
+
`,n}function At(n){const[,t,e,r,o]=n.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:t,email:e,timestamp:Number(r),timezoneOffset:Ln(o)}}function Ln(n){let[,t,e,r]=n.match(/(\+|-)(\d\d)(\d\d)/);return r=(t==="+"?1:-1)*(Number(e)*60+Number(r)),Gn(r)}function Gn(n){return n===0?n:-n}class st{constructor(t){if(typeof t=="string")this._tag=t;else if(Buffer.isBuffer(t))this._tag=t.toString("utf8");else if(typeof t=="object")this._tag=st.render(t);else throw new F("invalid type passed to GitAnnotatedTag constructor")}static from(t){return new st(t)}static render(t){return`object ${t.object}
|
|
4
|
+
type ${t.type}
|
|
5
|
+
tag ${t.tag}
|
|
6
|
+
tagger ${ce(t.tagger)}
|
|
7
7
|
|
|
8
|
-
${
|
|
9
|
-
${
|
|
8
|
+
${t.message}
|
|
9
|
+
${t.gpgsig?t.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
|
10
10
|
|
|
11
|
-
`))}message(){const
|
|
11
|
+
`))}message(){const t=this.withoutSignature();return t.slice(t.indexOf(`
|
|
12
12
|
|
|
13
|
-
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){const
|
|
14
|
-
`),
|
|
15
|
-
`+
|
|
16
|
-
-----BEGIN PGP SIGNATURE-----`)===-1?
|
|
13
|
+
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){const t=this.justHeaders().split(`
|
|
14
|
+
`),e=[];for(const o of t)o[0]===" "?e[e.length-1]+=`
|
|
15
|
+
`+o.slice(1):e.push(o);const r={};for(const o of e){const c=o.slice(0,o.indexOf(" ")),f=o.slice(o.indexOf(" ")+1);Array.isArray(r[c])?r[c].push(f):r[c]=f}return r.tagger&&(r.tagger=At(r.tagger)),r.committer&&(r.committer=At(r.committer)),r}withoutSignature(){const t=V(this._tag);return t.indexOf(`
|
|
16
|
+
-----BEGIN PGP SIGNATURE-----`)===-1?t:t.slice(0,t.lastIndexOf(`
|
|
17
17
|
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
|
18
|
-
-----BEGIN PGP SIGNATURE-----`)===-1)return;const
|
|
19
|
-
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,
|
|
20
|
-
`).map(
|
|
18
|
+
-----BEGIN PGP SIGNATURE-----`)===-1)return;const t=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return V(t)}payload(){return this.withoutSignature()+`
|
|
19
|
+
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(t,e,r){const o=t.payload();let{signature:c}=await e({payload:o,secretKey:r});c=V(c);const f=o+c;return st.from(f)}}function Dt(n){return n.trim().split(`
|
|
20
|
+
`).map(t=>" "+t).join(`
|
|
21
21
|
`)+`
|
|
22
|
-
`}function
|
|
23
|
-
`).map(
|
|
24
|
-
`)}class M{constructor(
|
|
25
|
-
gpgsig`+
|
|
26
|
-
`+
|
|
22
|
+
`}function qn(n){return n.split(`
|
|
23
|
+
`).map(t=>t.replace(/^ /,"")).join(`
|
|
24
|
+
`)}class M{constructor(t){if(typeof t=="string")this._commit=t;else if(Buffer.isBuffer(t))this._commit=t.toString("utf8");else if(typeof t=="object")this._commit=M.render(t);else throw new F("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:t,signature:e}){const r=M.justHeaders(t),o=M.justMessage(t),c=V(r+`
|
|
25
|
+
gpgsig`+Dt(e)+`
|
|
26
|
+
`+o);return new M(c)}static from(t){return new M(t)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return M.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(t){return V(t.slice(t.indexOf(`
|
|
27
27
|
|
|
28
|
-
`)+2))}static justHeaders(
|
|
28
|
+
`)+2))}static justHeaders(t){return t.slice(0,t.indexOf(`
|
|
29
29
|
|
|
30
|
-
`))}parseHeaders(){const
|
|
31
|
-
`),
|
|
32
|
-
`+
|
|
33
|
-
`:
|
|
34
|
-
`,
|
|
35
|
-
`}const
|
|
36
|
-
`;const
|
|
37
|
-
`,
|
|
38
|
-
`+V(
|
|
39
|
-
gpgsig`)===-1)return
|
|
40
|
-
gpgsig`)),
|
|
41
|
-
`)+28);return V(
|
|
42
|
-
`+
|
|
43
|
-
gpgsig`+
|
|
44
|
-
`+
|
|
30
|
+
`))}parseHeaders(){const t=M.justHeaders(this._commit).split(`
|
|
31
|
+
`),e=[];for(const o of t)o[0]===" "?e[e.length-1]+=`
|
|
32
|
+
`+o.slice(1):e.push(o);const r={parent:[]};for(const o of e){const c=o.slice(0,o.indexOf(" ")),f=o.slice(o.indexOf(" ")+1);Array.isArray(r[c])?r[c].push(f):r[c]=f}return r.author&&(r.author=At(r.author)),r.committer&&(r.committer=At(r.committer)),r}static renderHeaders(t){let e="";if(t.tree?e+=`tree ${t.tree}
|
|
33
|
+
`:e+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
34
|
+
`,t.parent){if(t.parent.length===void 0)throw new F("commit 'parent' property should be an array");for(const c of t.parent)e+=`parent ${c}
|
|
35
|
+
`}const r=t.author;e+=`author ${ce(r)}
|
|
36
|
+
`;const o=t.committer||t.author;return e+=`committer ${ce(o)}
|
|
37
|
+
`,t.gpgsig&&(e+="gpgsig"+Dt(t.gpgsig)),e}static render(t){return M.renderHeaders(t)+`
|
|
38
|
+
`+V(t.message)}render(){return this._commit}withoutSignature(){const t=V(this._commit);if(t.indexOf(`
|
|
39
|
+
gpgsig`)===-1)return t;const e=t.slice(0,t.indexOf(`
|
|
40
|
+
gpgsig`)),r=t.slice(t.indexOf(`-----END PGP SIGNATURE-----
|
|
41
|
+
`)+28);return V(e+`
|
|
42
|
+
`+r)}isolateSignature(){const t=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return qn(t)}static async sign(t,e,r){const o=t.withoutSignature(),c=M.justMessage(t._commit);let{signature:f}=await e({payload:o,secretKey:r});f=V(f);const h=M.justHeaders(t._commit)+`
|
|
43
|
+
gpgsig`+Dt(f)+`
|
|
44
|
+
`+c;return M.from(h)}}class Hn{static wrap({type:t,object:e}){return Buffer.concat([Buffer.from(`${t} ${e.byteLength.toString()}\0`),Buffer.from(e)])}static unwrap(t){const e=t.indexOf(32),r=t.indexOf(0),o=t.slice(0,e).toString("utf8"),c=t.slice(e+1,r).toString("utf8"),f=t.length-(r+1);if(parseInt(c)!==f)throw new F(`Length mismatch: expected ${c} bytes but got ${f} instead.`);return{type:o,object:Buffer.from(t.slice(r+1))}}}class z{constructor(t){this.buffer=t,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(t){this._start=t}slice(t){const e=this.buffer.slice(this._start,this._start+t);return this._start+=t,e}toString(t,e){const r=this.buffer.toString(t,this._start,this._start+e);return this._start+=e,r}write(t,e,r){const o=this.buffer.write(t,this._start,e,r);return this._start+=e,o}copy(t,e,r){const o=t.copy(this.buffer,this._start,e,r);return this._start+=o,o}readUInt8(){const t=this.buffer.readUInt8(this._start);return this._start+=1,t}writeUInt8(t){const e=this.buffer.writeUInt8(t,this._start);return this._start+=1,e}readUInt16BE(){const t=this.buffer.readUInt16BE(this._start);return this._start+=2,t}writeUInt16BE(t){const e=this.buffer.writeUInt16BE(t,this._start);return this._start+=2,e}readUInt32BE(){const t=this.buffer.readUInt32BE(this._start);return this._start+=4,t}writeUInt32BE(t){const e=this.buffer.writeUInt32BE(t,this._start);return this._start+=4,e}}function zn(n,t){const e=new z(n),r=Te(e);if(r!==t.byteLength)throw new F(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${t.length} bytes`);const o=Te(e);let c;const f=Re(e,t);if(f.byteLength===o)c=f;else{c=Buffer.alloc(o);const s=new z(c);for(s.copy(f);!e.eof();)s.copy(Re(e,t));const h=s.tell();if(o!==h)throw new F(`applyDelta expected target buffer to be ${o} bytes but the resulting buffer was ${h} bytes`)}return c}function Te(n){let t=0,e=0,r=null;do r=n.readUInt8(),t|=(r&127)<<e,e+=7;while(r&128);return t}function Oe(n,t,e){let r=0,o=0;for(;e--;)t&1&&(r|=n.readUInt8()<<o),t>>=1,o+=8;return r}function Re(n,t){const e=n.readUInt8(),r=128,o=15,c=112;if(e&r){const f=Oe(n,e&o,4);let s=Oe(n,(e&c)>>4,3);return s===0&&(s=65536),t.slice(f,f+s)}else return n.slice(e)}async function Wn(n,t){const e=new dr(n);let r=await e.read(4);if(r=r.toString("utf8"),r!=="PACK")throw new F(`Invalid PACK header '${r}'`);let o=await e.read(4);if(o=o.readUInt32BE(0),o!==2)throw new F(`Invalid packfile version: ${o}`);let c=await e.read(4);if(c=c.readUInt32BE(0),!(c<1))for(;!e.eof()&&c--;){const f=e.tell(),{type:s,length:h,ofs:y,reference:d}=await Vn(e),w=new he.Inflate;for(;!w.result;){const b=await e.chunk();if(!b)break;if(w.push(b,!1),w.err)throw new F(`Pako error: ${w.msg}`);if(w.result){if(w.result.length!==h)throw new F("Inflated object size is different from that stated in packfile.");await e.undo(),await e.read(b.length-w.strm.avail_in);const v=e.tell();await t({data:w.result,type:s,num:c,offset:f,end:v,reference:d,ofs:y})}}}}async function Vn(n){let t=await n.byte();const e=t>>4&7;let r=t&15;if(t&128){let f=4;do t=await n.byte(),r|=(t&127)<<f,f+=7;while(t&128)}let o,c;if(e===6){let f=0;o=0;const s=[];do t=await n.byte(),o|=(t&127)<<f,f+=7,s.push(t);while(t&128);c=Buffer.from(s)}return e===7&&(c=await n.read(20)),{type:e,length:r,ofs:o,reference:c}}async function Jn(n){return he.inflate(n)}var mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fe={exports:{}};typeof Object.create=="function"?fe.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:fe.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var Xn=fe.exports,ue={exports:{}},de={},$t={};$t.byteLength=Qn;$t.toByteArray=ei;$t.fromByteArray=ii;var W=[],L=[],Kn=typeof Uint8Array<"u"?Uint8Array:Array,jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Z=0,Zn=jt.length;Z<Zn;++Z)W[Z]=jt[Z],L[jt.charCodeAt(Z)]=Z;L[45]=62;L[95]=63;function br(n){var t=n.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=n.indexOf("=");e===-1&&(e=t);var r=e===t?0:4-e%4;return[e,r]}function Qn(n){var t=br(n),e=t[0],r=t[1];return(e+r)*3/4-r}function ti(n,t,e){return(t+e)*3/4-e}function ei(n){var t,e=br(n),r=e[0],o=e[1],c=new Kn(ti(n,r,o)),f=0,s=o>0?r-4:r,h;for(h=0;h<s;h+=4)t=L[n.charCodeAt(h)]<<18|L[n.charCodeAt(h+1)]<<12|L[n.charCodeAt(h+2)]<<6|L[n.charCodeAt(h+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=t&255;return o===2&&(t=L[n.charCodeAt(h)]<<2|L[n.charCodeAt(h+1)]>>4,c[f++]=t&255),o===1&&(t=L[n.charCodeAt(h)]<<10|L[n.charCodeAt(h+1)]<<4|L[n.charCodeAt(h+2)]>>2,c[f++]=t>>8&255,c[f++]=t&255),c}function ri(n){return W[n>>18&63]+W[n>>12&63]+W[n>>6&63]+W[n&63]}function ni(n,t,e){for(var r,o=[],c=t;c<e;c+=3)r=(n[c]<<16&16711680)+(n[c+1]<<8&65280)+(n[c+2]&255),o.push(ri(r));return o.join("")}function ii(n){for(var t,e=n.length,r=e%3,o=[],c=16383,f=0,s=e-r;f<s;f+=c)o.push(ni(n,f,f+c>s?s:f+c));return r===1?(t=n[e-1],o.push(W[t>>2]+W[t<<4&63]+"==")):r===2&&(t=(n[e-2]<<8)+n[e-1],o.push(W[t>>10]+W[t>>4&63]+W[t<<2&63]+"=")),o.join("")}var ye={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ye.read=function(n,t,e,r,o){var c,f,s=o*8-r-1,h=(1<<s)-1,y=h>>1,d=-7,w=e?o-1:0,b=e?-1:1,v=n[t+w];for(w+=b,c=v&(1<<-d)-1,v>>=-d,d+=s;d>0;c=c*256+n[t+w],w+=b,d-=8);for(f=c&(1<<-d)-1,c>>=-d,d+=r;d>0;f=f*256+n[t+w],w+=b,d-=8);if(c===0)c=1-y;else{if(c===h)return f?NaN:(v?-1:1)*(1/0);f=f+Math.pow(2,r),c=c-y}return(v?-1:1)*f*Math.pow(2,c-r)};ye.write=function(n,t,e,r,o,c){var f,s,h,y=c*8-o-1,d=(1<<y)-1,w=d>>1,b=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=r?0:c-1,_=r?1:-1,U=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,f=d):(f=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-f))<1&&(f--,h*=2),f+w>=1?t+=b/h:t+=b*Math.pow(2,1-w),t*h>=2&&(f++,h/=2),f+w>=d?(s=0,f=d):f+w>=1?(s=(t*h-1)*Math.pow(2,o),f=f+w):(s=t*Math.pow(2,w-1)*Math.pow(2,o),f=0));o>=8;n[e+v]=s&255,v+=_,s/=256,o-=8);for(f=f<<o|s,y+=o;y>0;n[e+v]=f&255,v+=_,f/=256,y-=8);n[e+v-_]|=U*128};/*!
|
|
45
45
|
* The buffer module from node.js, for the browser.
|
|
46
46
|
*
|
|
47
47
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
48
48
|
* @license MIT
|
|
49
|
-
*/(function(r){var e=_e,t=pt,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=s,r.SlowBuffer=F,r.INSPECT_MAX_BYTES=50;var a=2147483647;r.kMaxLength=a,s.TYPED_ARRAY_SUPPORT=f(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function f(){try{var c=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(c,n),c.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function u(c){if(c>a)throw new RangeError('The value "'+c+'" is invalid for option "size"');var n=new Uint8Array(c);return Object.setPrototypeOf(n,s.prototype),n}function s(c,n,o){if(typeof c=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(c)}return h(c,n,o)}s.poolSize=8192;function h(c,n,o){if(typeof c=="string")return w(c,n);if(ArrayBuffer.isView(c))return _(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(q(c,ArrayBuffer)||c&&q(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(q(c,SharedArrayBuffer)||c&&q(c.buffer,SharedArrayBuffer)))return P(c,n,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var l=c.valueOf&&c.valueOf();if(l!=null&&l!==c)return s.from(l,n,o);var p=B(c);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return s.from(c[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}s.from=function(c,n,o){return h(c,n,o)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function d(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function y(c,n,o){return d(c),c<=0?u(c):n!==void 0?typeof o=="string"?u(c).fill(n,o):u(c).fill(n):u(c)}s.alloc=function(c,n,o){return y(c,n,o)};function g(c){return d(c),u(c<0?0:x(c)|0)}s.allocUnsafe=function(c){return g(c)},s.allocUnsafeSlow=function(c){return g(c)};function w(c,n){if((typeof n!="string"||n==="")&&(n="utf8"),!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=E(c,n)|0,l=u(o),p=l.write(c,n);return p!==o&&(l=l.slice(0,p)),l}function v(c){for(var n=c.length<0?0:x(c.length)|0,o=u(n),l=0;l<n;l+=1)o[l]=c[l]&255;return o}function _(c){if(q(c,Uint8Array)){var n=new Uint8Array(c);return P(n.buffer,n.byteOffset,n.byteLength)}return v(c)}function P(c,n,o){if(n<0||c.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');var l;return n===void 0&&o===void 0?l=new Uint8Array(c):o===void 0?l=new Uint8Array(c,n):l=new Uint8Array(c,n,o),Object.setPrototypeOf(l,s.prototype),l}function B(c){if(s.isBuffer(c)){var n=x(c.length)|0,o=u(n);return o.length===0||c.copy(o,0,0,n),o}if(c.length!==void 0)return typeof c.length!="number"||Oe(c.length)?u(0):v(c);if(c.type==="Buffer"&&Array.isArray(c.data))return v(c.data)}function x(c){if(c>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return c|0}function F(c){return+c!=c&&(c=0),s.alloc(+c)}s.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==s.prototype},s.compare=function(n,o){if(q(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),q(o,Uint8Array)&&(o=s.from(o,o.offset,o.byteLength)),!s.isBuffer(n)||!s.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;for(var l=n.length,p=o.length,m=0,b=Math.min(l,p);m<b;++m)if(n[m]!==o[m]){l=n[m],p=o[m];break}return l<p?-1:p<l?1:0},s.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return s.alloc(0);var l;if(o===void 0)for(o=0,l=0;l<n.length;++l)o+=n[l].length;var p=s.allocUnsafe(o),m=0;for(l=0;l<n.length;++l){var b=n[l];if(q(b,Uint8Array))m+b.length>p.length?s.from(b).copy(p,m):Uint8Array.prototype.set.call(p,b,m);else if(s.isBuffer(b))b.copy(p,m);else throw new TypeError('"list" argument must be an Array of Buffers');m+=b.length}return p};function E(c,n){if(s.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||q(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);var o=c.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&o===0)return 0;for(var p=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Te(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return St(c).length;default:if(p)return l?-1:Te(c).length;n=(""+n).toLowerCase(),p=!0}}s.byteLength=E;function $(c,n,o){var l=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(c||(c="utf8");;)switch(c){case"hex":return Xr(this,n,o);case"utf8":case"utf-8":return vt(this,n,o);case"ascii":return Jr(this,n,o);case"latin1":case"binary":return Yr(this,n,o);case"base64":return Wr(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kr(this,n,o);default:if(l)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),l=!0}}s.prototype._isBuffer=!0;function C(c,n,o){var l=c[n];c[n]=c[o],c[o]=l}s.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)C(this,o,o+1);return this},s.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)C(this,o,o+3),C(this,o+1,o+2);return this},s.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)C(this,o,o+7),C(this,o+1,o+6),C(this,o+2,o+5),C(this,o+3,o+4);return this},s.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?vt(this,0,n):$.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(n){if(!s.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:s.compare(this,n)===0},s.prototype.inspect=function(){var n="",o=r.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(n,o,l,p,m){if(q(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),!s.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),l===void 0&&(l=n?n.length:0),p===void 0&&(p=0),m===void 0&&(m=this.length),o<0||l>n.length||p<0||m>this.length)throw new RangeError("out of range index");if(p>=m&&o>=l)return 0;if(p>=m)return-1;if(o>=l)return 1;if(o>>>=0,l>>>=0,p>>>=0,m>>>=0,this===n)return 0;for(var b=m-p,S=l-o,U=Math.min(b,S),T=this.slice(p,m),D=n.slice(o,l),O=0;O<U;++O)if(T[O]!==D[O]){b=T[O],S=D[O];break}return b<S?-1:S<b?1:0};function wt(c,n,o,l,p){if(c.length===0)return-1;if(typeof o=="string"?(l=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Oe(o)&&(o=p?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(p)return-1;o=c.length-1}else if(o<0)if(p)o=0;else return-1;if(typeof n=="string"&&(n=s.from(n,l)),s.isBuffer(n))return n.length===0?-1:bt(c,n,o,l,p);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(c,n,o):Uint8Array.prototype.lastIndexOf.call(c,n,o):bt(c,[n],o,l,p);throw new TypeError("val must be string, number or Buffer")}function bt(c,n,o,l,p){var m=1,b=c.length,S=n.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(c.length<2||n.length<2)return-1;m=2,b/=2,S/=2,o/=2}function U(It,Ft){return m===1?It[Ft]:It.readUInt16BE(Ft*m)}var T;if(p){var D=-1;for(T=o;T<b;T++)if(U(c,T)===U(n,D===-1?0:T-D)){if(D===-1&&(D=T),T-D+1===S)return D*m}else D!==-1&&(T-=T-D),D=-1}else for(o+S>b&&(o=b-S),T=o;T>=0;T--){for(var O=!0,ve=0;ve<S;ve++)if(U(c,T+ve)!==U(n,ve)){O=!1;break}if(O)return T}return-1}s.prototype.includes=function(n,o,l){return this.indexOf(n,o,l)!==-1},s.prototype.indexOf=function(n,o,l){return wt(this,n,o,l,!0)},s.prototype.lastIndexOf=function(n,o,l){return wt(this,n,o,l,!1)};function Lr(c,n,o,l){o=Number(o)||0;var p=c.length-o;l?(l=Number(l),l>p&&(l=p)):l=p;var m=n.length;l>m/2&&(l=m/2);for(var b=0;b<l;++b){var S=parseInt(n.substr(b*2,2),16);if(Oe(S))return b;c[o+b]=S}return b}function Gr(c,n,o,l){return be(Te(n,c.length-o),c,o,l)}function qr(c,n,o,l){return be(en(n),c,o,l)}function Hr(c,n,o,l){return be(St(n),c,o,l)}function zr(c,n,o,l){return be(tn(n,c.length-o),c,o,l)}s.prototype.write=function(n,o,l,p){if(o===void 0)p="utf8",l=this.length,o=0;else if(l===void 0&&typeof o=="string")p=o,l=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var m=this.length-o;if((l===void 0||l>m)&&(l=m),n.length>0&&(l<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var b=!1;;)switch(p){case"hex":return Lr(this,n,o,l);case"utf8":case"utf-8":return Gr(this,n,o,l);case"ascii":case"latin1":case"binary":return qr(this,n,o,l);case"base64":return Hr(this,n,o,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zr(this,n,o,l);default:if(b)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),b=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Wr(c,n,o){return n===0&&o===c.length?e.fromByteArray(c):e.fromByteArray(c.slice(n,o))}function vt(c,n,o){o=Math.min(c.length,o);for(var l=[],p=n;p<o;){var m=c[p],b=null,S=m>239?4:m>223?3:m>191?2:1;if(p+S<=o){var U,T,D,O;switch(S){case 1:m<128&&(b=m);break;case 2:U=c[p+1],(U&192)===128&&(O=(m&31)<<6|U&63,O>127&&(b=O));break;case 3:U=c[p+1],T=c[p+2],(U&192)===128&&(T&192)===128&&(O=(m&15)<<12|(U&63)<<6|T&63,O>2047&&(O<55296||O>57343)&&(b=O));break;case 4:U=c[p+1],T=c[p+2],D=c[p+3],(U&192)===128&&(T&192)===128&&(D&192)===128&&(O=(m&15)<<18|(U&63)<<12|(T&63)<<6|D&63,O>65535&&O<1114112&&(b=O))}}b===null?(b=65533,S=1):b>65535&&(b-=65536,l.push(b>>>10&1023|55296),b=56320|b&1023),l.push(b),p+=S}return Vr(l)}var Et=4096;function Vr(c){var n=c.length;if(n<=Et)return String.fromCharCode.apply(String,c);for(var o="",l=0;l<n;)o+=String.fromCharCode.apply(String,c.slice(l,l+=Et));return o}function Jr(c,n,o){var l="";o=Math.min(c.length,o);for(var p=n;p<o;++p)l+=String.fromCharCode(c[p]&127);return l}function Yr(c,n,o){var l="";o=Math.min(c.length,o);for(var p=n;p<o;++p)l+=String.fromCharCode(c[p]);return l}function Xr(c,n,o){var l=c.length;(!n||n<0)&&(n=0),(!o||o<0||o>l)&&(o=l);for(var p="",m=n;m<o;++m)p+=rn[c[m]];return p}function Kr(c,n,o){for(var l=c.slice(n,o),p="",m=0;m<l.length-1;m+=2)p+=String.fromCharCode(l[m]+l[m+1]*256);return p}s.prototype.slice=function(n,o){var l=this.length;n=~~n,o=o===void 0?l:~~o,n<0?(n+=l,n<0&&(n=0)):n>l&&(n=l),o<0?(o+=l,o<0&&(o=0)):o>l&&(o=l),o<n&&(o=n);var p=this.subarray(n,o);return Object.setPrototypeOf(p,s.prototype),p};function k(c,n,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+n>o)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n],m=1,b=0;++b<o&&(m*=256);)p+=this[n+b]*m;return p},s.prototype.readUintBE=s.prototype.readUIntBE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n+--o],m=1;o>0&&(m*=256);)p+=this[n+--o]*m;return p},s.prototype.readUint8=s.prototype.readUInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]|this[n+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]<<8|this[n+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},s.prototype.readIntLE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n],m=1,b=0;++b<o&&(m*=256);)p+=this[n+b]*m;return m*=128,p>=m&&(p-=Math.pow(2,8*o)),p},s.prototype.readIntBE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=o,m=1,b=this[n+--p];p>0&&(m*=256);)b+=this[n+--p]*m;return m*=128,b>=m&&(b-=Math.pow(2,8*o)),b},s.prototype.readInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},s.prototype.readInt16LE=function(n,o){n=n>>>0,o||k(n,2,this.length);var l=this[n]|this[n+1]<<8;return l&32768?l|4294901760:l},s.prototype.readInt16BE=function(n,o){n=n>>>0,o||k(n,2,this.length);var l=this[n+1]|this[n]<<8;return l&32768?l|4294901760:l},s.prototype.readInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},s.prototype.readInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},s.prototype.readFloatLE=function(n,o){return n=n>>>0,o||k(n,4,this.length),t.read(this,n,!0,23,4)},s.prototype.readFloatBE=function(n,o){return n=n>>>0,o||k(n,4,this.length),t.read(this,n,!1,23,4)},s.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||k(n,8,this.length),t.read(this,n,!0,52,8)},s.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||k(n,8,this.length),t.read(this,n,!1,52,8)};function N(c,n,o,l,p,m){if(!s.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>p||n<m)throw new RangeError('"value" argument is out of bounds');if(o+l>c.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(n,o,l,p){if(n=+n,o=o>>>0,l=l>>>0,!p){var m=Math.pow(2,8*l)-1;N(this,n,o,l,m,0)}var b=1,S=0;for(this[o]=n&255;++S<l&&(b*=256);)this[o+S]=n/b&255;return o+l},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(n,o,l,p){if(n=+n,o=o>>>0,l=l>>>0,!p){var m=Math.pow(2,8*l)-1;N(this,n,o,l,m,0)}var b=l-1,S=1;for(this[o+b]=n&255;--b>=0&&(S*=256);)this[o+b]=n/S&255;return o+l},s.prototype.writeUint8=s.prototype.writeUInt8=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,1,255,0),this[o]=n&255,o+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},s.prototype.writeIntLE=function(n,o,l,p){if(n=+n,o=o>>>0,!p){var m=Math.pow(2,8*l-1);N(this,n,o,l,m-1,-m)}var b=0,S=1,U=0;for(this[o]=n&255;++b<l&&(S*=256);)n<0&&U===0&&this[o+b-1]!==0&&(U=1),this[o+b]=(n/S>>0)-U&255;return o+l},s.prototype.writeIntBE=function(n,o,l,p){if(n=+n,o=o>>>0,!p){var m=Math.pow(2,8*l-1);N(this,n,o,l,m-1,-m)}var b=l-1,S=1,U=0;for(this[o+b]=n&255;--b>=0&&(S*=256);)n<0&&U===0&&this[o+b+1]!==0&&(U=1),this[o+b]=(n/S>>0)-U&255;return o+l},s.prototype.writeInt8=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},s.prototype.writeInt16LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},s.prototype.writeInt16BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},s.prototype.writeInt32LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},s.prototype.writeInt32BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function xt(c,n,o,l,p,m){if(o+l>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function At(c,n,o,l,p){return n=+n,o=o>>>0,p||xt(c,n,o,4),t.write(c,n,o,l,23,4),o+4}s.prototype.writeFloatLE=function(n,o,l){return At(this,n,o,!0,l)},s.prototype.writeFloatBE=function(n,o,l){return At(this,n,o,!1,l)};function Bt(c,n,o,l,p){return n=+n,o=o>>>0,p||xt(c,n,o,8),t.write(c,n,o,l,52,8),o+8}s.prototype.writeDoubleLE=function(n,o,l){return Bt(this,n,o,!0,l)},s.prototype.writeDoubleBE=function(n,o,l){return Bt(this,n,o,!1,l)},s.prototype.copy=function(n,o,l,p){if(!s.isBuffer(n))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),o>=n.length&&(o=n.length),o||(o=0),p>0&&p<l&&(p=l),p===l||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),n.length-o<p-l&&(p=n.length-o+l);var m=p-l;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,l,p):Uint8Array.prototype.set.call(n,this.subarray(l,p),o),m},s.prototype.fill=function(n,o,l,p){if(typeof n=="string"){if(typeof o=="string"?(p=o,o=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!s.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(n.length===1){var m=n.charCodeAt(0);(p==="utf8"&&m<128||p==="latin1")&&(n=m)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<l)throw new RangeError("Out of range index");if(l<=o)return this;o=o>>>0,l=l===void 0?this.length:l>>>0,n||(n=0);var b;if(typeof n=="number")for(b=o;b<l;++b)this[b]=n;else{var S=s.isBuffer(n)?n:s.from(n,p),U=S.length;if(U===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(b=0;b<l-o;++b)this[b+o]=S[b%U]}return this};var Zr=/[^+/0-9A-Za-z-_]/g;function Qr(c){if(c=c.split("=")[0],c=c.trim().replace(Zr,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function Te(c,n){n=n||1/0;for(var o,l=c.length,p=null,m=[],b=0;b<l;++b){if(o=c.charCodeAt(b),o>55295&&o<57344){if(!p){if(o>56319){(n-=3)>-1&&m.push(239,191,189);continue}else if(b+1===l){(n-=3)>-1&&m.push(239,191,189);continue}p=o;continue}if(o<56320){(n-=3)>-1&&m.push(239,191,189),p=o;continue}o=(p-55296<<10|o-56320)+65536}else p&&(n-=3)>-1&&m.push(239,191,189);if(p=null,o<128){if((n-=1)<0)break;m.push(o)}else if(o<2048){if((n-=2)<0)break;m.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;m.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;m.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return m}function en(c){for(var n=[],o=0;o<c.length;++o)n.push(c.charCodeAt(o)&255);return n}function tn(c,n){for(var o,l,p,m=[],b=0;b<c.length&&!((n-=2)<0);++b)o=c.charCodeAt(b),l=o>>8,p=o%256,m.push(p),m.push(l);return m}function St(c){return e.toByteArray(Qr(c))}function be(c,n,o,l){for(var p=0;p<l&&!(p+o>=n.length||p>=c.length);++p)n[p+o]=c[p];return p}function q(c,n){return c instanceof n||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===n.name}function Oe(c){return c!==c}var rn=function(){for(var c="0123456789abcdef",n=new Array(256),o=0;o<16;++o)for(var l=o*16,p=0;p<16;++p)n[l+p]=c[o]+c[p];return n}()})(ht);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(r,e){var t=ht,i=t.Buffer;function a(u,s){for(var h in u)s[h]=u[h]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?r.exports=t:(a(t,e),e.Buffer=f);function f(u,s,h){return i(u,s,h)}f.prototype=Object.create(i.prototype),a(i,f),f.from=function(u,s,h){if(typeof u=="number")throw new TypeError("Argument must not be a number");return i(u,s,h)},f.alloc=function(u,s,h){if(typeof u!="number")throw new TypeError("Argument must be a number");var d=i(u);return s!==void 0?typeof h=="string"?d.fill(s,h):d.fill(s):d.fill(0),d},f.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return i(u)},f.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(u)}})(ft,ft.exports);var yt=ft.exports,ni={}.toString,ii=Array.isArray||function(r){return ni.call(r)=="[object Array]"},pe=TypeError,wr=Object,oi=Error,ai=EvalError,si=RangeError,fi=ReferenceError,br=SyntaxError,ci=URIError,ui=Math.abs,li=Math.floor,hi=Math.max,pi=Math.min,yi=Math.pow,di=Math.round,gi=Number.isNaN||function(e){return e!==e},mi=gi,wi=function(e){return mi(e)||e===0?e:e<0?-1:1},bi=Object.getOwnPropertyDescriptor,Ee=bi;if(Ee)try{Ee([],"length")}catch{Ee=null}var ye=Ee,xe=Object.defineProperty||!1;if(xe)try{xe({},"a",{value:1})}catch{xe=!1}var Ue=xe,je,kt;function vr(){return kt||(kt=1,je=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(var f 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 u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==a||s.enumerable!==!0)return!1}return!0}),je}var Ce,Rt;function vi(){if(Rt)return Ce;Rt=1;var r=typeof Symbol<"u"&&Symbol,e=vr();return Ce=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Ce}var De,jt;function Er(){return jt||(jt=1,De=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),De}var Ne,Ct;function xr(){if(Ct)return Ne;Ct=1;var r=wr;return Ne=r.getPrototypeOf||null,Ne}var Ei="Function.prototype.bind called on incompatible ",xi=Object.prototype.toString,Ai=Math.max,Bi="[object Function]",Dt=function(e,t){for(var i=[],a=0;a<e.length;a+=1)i[a]=e[a];for(var f=0;f<t.length;f+=1)i[f+e.length]=t[f];return i},Si=function(e,t){for(var i=[],a=t,f=0;a<e.length;a+=1,f+=1)i[f]=e[a];return i},Ii=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t},Fi=function(e){var t=this;if(typeof t!="function"||xi.apply(t)!==Bi)throw new TypeError(Ei+t);for(var i=Si(arguments,1),a,f=function(){if(this instanceof a){var y=t.apply(this,Dt(i,arguments));return Object(y)===y?y:this}return t.apply(e,Dt(i,arguments))},u=Ai(0,t.length-i.length),s=[],h=0;h<u;h++)s[h]="$"+h;if(a=Function("binder","return function ("+Ii(s,",")+"){ return binder.apply(this,arguments); }")(f),t.prototype){var d=function(){};d.prototype=t.prototype,a.prototype=new d,d.prototype=null}return a},_i=Fi,de=Function.prototype.bind||_i,dt=Function.prototype.call,gt=Function.prototype.apply,Ui=typeof Reflect<"u"&&Reflect&&Reflect.apply,Pi=de,$i=gt,Ti=dt,Oi=Ui,Ar=Oi||Pi.call(Ti,$i),ki=de,Ri=pe,ji=dt,Ci=Ar,mt=function(e){if(e.length<1||typeof e[0]!="function")throw new Ri("a function is required");return Ci(ki,ji,e)},Me,Nt;function Di(){if(Nt)return Me;Nt=1;var r=mt,e=ye,t;try{t=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var i=!!t&&e&&e(Object.prototype,"__proto__"),a=Object,f=a.getPrototypeOf;return Me=i&&typeof i.get=="function"?r([i.get]):typeof f=="function"?function(s){return f(s==null?s:a(s))}:!1,Me}var Le,Mt;function Br(){if(Mt)return Le;Mt=1;var r=Er(),e=xr(),t=Di();return Le=r?function(a){return r(a)}:e?function(a){if(!a||typeof a!="object"&&typeof a!="function")throw new TypeError("getProto: not an object");return e(a)}:t?function(a){return t(a)}:null,Le}var Ge,Lt;function Ni(){if(Lt)return Ge;Lt=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=de;return Ge=t.call(r,e),Ge}var A,Mi=wr,Li=oi,Gi=ai,qi=si,Hi=fi,re=br,ee=pe,zi=ci,Wi=ui,Vi=li,Ji=hi,Yi=pi,Xi=yi,Ki=di,Zi=wi,Sr=Function,qe=function(r){try{return Sr('"use strict"; return ('+r+").constructor;")()}catch{}},fe=ye,Qi=Ue,He=function(){throw new ee},eo=fe?function(){try{return arguments.callee,He}catch{try{return fe(arguments,"callee").get}catch{return He}}}():He,Z=vi()(),R=Br(),to=xr(),ro=Er(),Ir=gt,ge=dt,Q={},no=typeof Uint8Array>"u"||!R?A:R(Uint8Array),Y={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?A:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?A:ArrayBuffer,"%ArrayIteratorPrototype%":Z&&R?R([][Symbol.iterator]()):A,"%AsyncFromSyncIteratorPrototype%":A,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?A:Atomics,"%BigInt%":typeof BigInt>"u"?A:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?A:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?A:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?A:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Li,"%eval%":eval,"%EvalError%":Gi,"%Float16Array%":typeof Float16Array>"u"?A:Float16Array,"%Float32Array%":typeof Float32Array>"u"?A:Float32Array,"%Float64Array%":typeof Float64Array>"u"?A:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?A:FinalizationRegistry,"%Function%":Sr,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?A:Int8Array,"%Int16Array%":typeof Int16Array>"u"?A:Int16Array,"%Int32Array%":typeof Int32Array>"u"?A:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Z&&R?R(R([][Symbol.iterator]())):A,"%JSON%":typeof JSON=="object"?JSON:A,"%Map%":typeof Map>"u"?A:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Z||!R?A:R(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Mi,"%Object.getOwnPropertyDescriptor%":fe,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?A:Promise,"%Proxy%":typeof Proxy>"u"?A:Proxy,"%RangeError%":qi,"%ReferenceError%":Hi,"%Reflect%":typeof Reflect>"u"?A:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?A:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Z||!R?A:R(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?A:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Z&&R?R(""[Symbol.iterator]()):A,"%Symbol%":Z?Symbol:A,"%SyntaxError%":re,"%ThrowTypeError%":eo,"%TypedArray%":no,"%TypeError%":ee,"%Uint8Array%":typeof Uint8Array>"u"?A:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?A:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?A:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?A:Uint32Array,"%URIError%":zi,"%WeakMap%":typeof WeakMap>"u"?A:WeakMap,"%WeakRef%":typeof WeakRef>"u"?A:WeakRef,"%WeakSet%":typeof WeakSet>"u"?A:WeakSet,"%Function.prototype.call%":ge,"%Function.prototype.apply%":Ir,"%Object.defineProperty%":Qi,"%Object.getPrototypeOf%":to,"%Math.abs%":Wi,"%Math.floor%":Vi,"%Math.max%":Ji,"%Math.min%":Yi,"%Math.pow%":Xi,"%Math.round%":Ki,"%Math.sign%":Zi,"%Reflect.getPrototypeOf%":ro};if(R)try{null.error}catch(r){var io=R(R(r));Y["%Error.prototype%"]=io}var oo=function r(e){var t;if(e==="%AsyncFunction%")t=qe("async function () {}");else if(e==="%GeneratorFunction%")t=qe("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=qe("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&R&&(t=R(a.prototype))}return Y[e]=t,t},Gt={__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"]},me=de,Be=Ni(),ao=me.call(ge,Array.prototype.concat),so=me.call(Ir,Array.prototype.splice),qt=me.call(ge,String.prototype.replace),Se=me.call(ge,String.prototype.slice),fo=me.call(ge,RegExp.prototype.exec),co=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,uo=/\\(\\)?/g,lo=function(e){var t=Se(e,0,1),i=Se(e,-1);if(t==="%"&&i!=="%")throw new re("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new re("invalid intrinsic syntax, expected opening `%`");var a=[];return qt(e,co,function(f,u,s,h){a[a.length]=s?qt(h,uo,"$1"):u||f}),a},ho=function(e,t){var i=e,a;if(Be(Gt,i)&&(a=Gt[i],i="%"+a[0]+"%"),Be(Y,i)){var f=Y[i];if(f===Q&&(f=oo(i)),typeof f>"u"&&!t)throw new ee("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:f}}throw new re("intrinsic "+e+" does not exist!")},Fr=function(e,t){if(typeof e!="string"||e.length===0)throw new ee("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ee('"allowMissing" argument must be a boolean');if(fo(/^%?[^%]*%?$/,e)===null)throw new re("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=lo(e),a=i.length>0?i[0]:"",f=ho("%"+a+"%",t),u=f.name,s=f.value,h=!1,d=f.alias;d&&(a=d[0],so(i,ao([0,1],d)));for(var y=1,g=!0;y<i.length;y+=1){var w=i[y],v=Se(w,0,1),_=Se(w,-1);if((v==='"'||v==="'"||v==="`"||_==='"'||_==="'"||_==="`")&&v!==_)throw new re("property names with quotes must have matching quotes");if((w==="constructor"||!g)&&(h=!0),a+="."+w,u="%"+a+"%",Be(Y,u))s=Y[u];else if(s!=null){if(!(w in s)){if(!t)throw new ee("base intrinsic for "+e+" exists, but the property is not available.");return}if(fe&&y+1>=i.length){var P=fe(s,w);g=!!P,g&&"get"in P&&!("originalValue"in P.get)?s=P.get:s=s[w]}else g=Be(s,w),s=s[w];g&&!h&&(Y[u]=s)}}return s},_r=Fr,Ur=mt,po=Ur([_r("%String.prototype.indexOf%")]),Pr=function(e,t){var i=_r(e,!!t);return typeof i=="function"&&po(e,".prototype.")>-1?Ur([i]):i},ze,Ht;function yo(){if(Ht)return ze;Ht=1;var r=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,t,i;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{t=Object.defineProperty({},"length",{get:function(){throw i}}),i={},e(function(){throw 42},null,t)}catch(F){F!==i&&(e=null)}else e=null;var a=/^\s*class\b/,f=function(E){try{var $=r.call(E);return a.test($)}catch{return!1}},u=function(E){try{return f(E)?!1:(r.call(E),!0)}catch{return!1}},s=Object.prototype.toString,h="[object Object]",d="[object Function]",y="[object GeneratorFunction]",g="[object HTMLAllCollection]",w="[object HTML document.all class]",v="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var x=document.all;s.call(x)===s.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var $=s.call(E);return($===g||$===w||$===v||$===h)&&E("")==null}catch{}return!1})}return ze=e?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,t)}catch($){if($!==i)return!1}return!f(E)&&u(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(_)return u(E);if(f(E))return!1;var $=s.call(E);return $!==d&&$!==y&&!/^\[object HTML/.test($)?!1:u(E)},ze}var We,zt;function go(){if(zt)return We;zt=1;var r=yo(),e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,i=function(h,d,y){for(var g=0,w=h.length;g<w;g++)t.call(h,g)&&(y==null?d(h[g],g,h):d.call(y,h[g],g,h))},a=function(h,d,y){for(var g=0,w=h.length;g<w;g++)y==null?d(h.charAt(g),g,h):d.call(y,h.charAt(g),g,h)},f=function(h,d,y){for(var g in h)t.call(h,g)&&(y==null?d(h[g],g,h):d.call(y,h[g],g,h))};function u(s){return e.call(s)==="[object Array]"}return We=function(h,d,y){if(!r(d))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=y),u(h)?i(h,d,g):typeof h=="string"?a(h,d,g):f(h,d,g)},We}var Ve,Wt;function mo(){return Wt||(Wt=1,Ve=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ve}var Je,Vt;function wo(){if(Vt)return Je;Vt=1;var r=mo(),e=typeof globalThis>"u"?gr:globalThis;return Je=function(){for(var i=[],a=0;a<r.length;a++)typeof e[r[a]]=="function"&&(i[i.length]=r[a]);return i},Je}var Ye={exports:{}},Xe,Jt;function bo(){if(Jt)return Xe;Jt=1;var r=Ue,e=br,t=pe,i=ye;return Xe=function(f,u,s){if(!f||typeof f!="object"&&typeof f!="function")throw new t("`obj` must be an object or a function`");if(typeof u!="string"&&typeof u!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var h=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,y=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,w=!!i&&i(f,u);if(r)r(f,u,{configurable:y===null&&w?w.configurable:!y,enumerable:h===null&&w?w.enumerable:!h,value:s,writable:d===null&&w?w.writable:!d});else if(g||!h&&!d&&!y)f[u]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Xe}var Ke,Yt;function vo(){if(Yt)return Ke;Yt=1;var r=Ue,e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},Ke=e,Ke}var Ze,Xt;function Eo(){if(Xt)return Ze;Xt=1;var r=Fr,e=bo(),t=vo()(),i=ye,a=pe,f=r("%Math.floor%");return Ze=function(s,h){if(typeof s!="function")throw new a("`fn` is not a function");if(typeof h!="number"||h<0||h>4294967295||f(h)!==h)throw new a("`length` must be a positive 32-bit integer");var d=arguments.length>2&&!!arguments[2],y=!0,g=!0;if("length"in s&&i){var w=i(s,"length");w&&!w.configurable&&(y=!1),w&&!w.writable&&(g=!1)}return(y||g||!d)&&(t?e(s,"length",h,!0,!0):e(s,"length",h)),s},Ze}var Qe,Kt;function xo(){if(Kt)return Qe;Kt=1;var r=de,e=gt,t=Ar;return Qe=function(){return t(r,e,arguments)},Qe}var Zt;function Ao(){return Zt||(Zt=1,function(r){var e=Eo(),t=Ue,i=mt,a=xo();r.exports=function(u){var s=i(arguments),h=u.length-(arguments.length-1);return e(s,1+(h>0?h:0),!0)},t?t(r.exports,"apply",{value:a}):r.exports.apply=a}(Ye)),Ye.exports}var et,Qt;function Bo(){if(Qt)return et;Qt=1;var r=vr();return et=function(){return r()&&!!Symbol.toStringTag},et}var tt,er;function So(){if(er)return tt;er=1;var r=go(),e=wo(),t=Ao(),i=Pr,a=ye,f=Br(),u=i("Object.prototype.toString"),s=Bo()(),h=typeof globalThis>"u"?gr:globalThis,d=e(),y=i("String.prototype.slice"),g=i("Array.prototype.indexOf",!0)||function(B,x){for(var F=0;F<B.length;F+=1)if(B[F]===x)return F;return-1},w={__proto__:null};s&&a&&f?r(d,function(P){var B=new h[P];if(Symbol.toStringTag in B&&f){var x=f(B),F=a(x,Symbol.toStringTag);if(!F&&x){var E=f(x);F=a(E,Symbol.toStringTag)}w["$"+P]=t(F.get)}}):r(d,function(P){var B=new h[P],x=B.slice||B.set;x&&(w["$"+P]=t(x))});var v=function(B){var x=!1;return r(w,function(F,E){if(!x)try{"$"+F(B)===E&&(x=y(E,1))}catch{}}),x},_=function(B){var x=!1;return r(w,function(F,E){if(!x)try{F(B),x=y(E,1)}catch{}}),x};return tt=function(B){if(!B||typeof B!="object")return!1;if(!s){var x=y(u(B),8,-1);return g(d,x)>-1?x:x!=="Object"?!1:_(B)}return a?v(B):null},tt}var rt,tr;function Io(){if(tr)return rt;tr=1;var r=So();return rt=function(t){return!!r(t)},rt}var Fo=pe,_o=Pr,Uo=_o("TypedArray.prototype.buffer",!0),Po=Io(),$o=Uo||function(e){if(!Po(e))throw new Fo("Not a Typed Array");return e.buffer},G=yt.Buffer,To=ii,Oo=$o,ko=ArrayBuffer.isView||function(e){try{return Oo(e),!0}catch{return!1}},Ro=typeof Uint8Array<"u",$r=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",jo=$r&&(G.prototype instanceof Uint8Array||G.TYPED_ARRAY_SUPPORT),Co=function(e,t){if(G.isBuffer(e))return e.constructor&&!("isBuffer"in e)?G.from(e):e;if(typeof e=="string")return G.from(e,t);if($r&&ko(e)){if(e.byteLength===0)return G.alloc(0);if(jo){var i=G.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var a=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),f=G.from(a);if(f.length===e.byteLength)return f}if(Ro&&e instanceof Uint8Array)return G.from(e);var u=To(e);if(u)for(var s=0;s<e.length;s+=1){var h=e[s];if(typeof h!="number"||h<0||h>255||~~h!==h)throw new RangeError("Array items must be numbers in the range 0-255.")}if(u||G.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return G.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},Do=yt.Buffer,No=Co;function Pe(r,e){this._block=Do.alloc(r),this._finalSize=e,this._blockSize=r,this._len=0}Pe.prototype.update=function(r,e){r=No(r,e||"utf8");for(var t=this._block,i=this._blockSize,a=r.length,f=this._len,u=0;u<a;){for(var s=f%i,h=Math.min(a-u,i-s),d=0;d<h;d++)t[s+d]=r[u+d];f+=h,u+=h,f%i===0&&this._update(t)}return this._len+=a,this};Pe.prototype.digest=function(r){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 t=this._len*8;if(t<=4294967295)this._block.writeUInt32BE(t,this._blockSize-4);else{var i=(t&4294967295)>>>0,a=(t-i)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var f=this._hash();return r?f.toString(r):f};Pe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Mo=Pe,Lo=Jn,Tr=Mo,Go=yt.Buffer,qo=[1518500249,1859775393,-1894007588,-899497514],Ho=new Array(80);function we(){this.init(),this._w=Ho,Tr.call(this,64,56)}Lo(we,Tr);we.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zo(r){return r<<1|r>>>31}function Wo(r){return r<<5|r>>>27}function Vo(r){return r<<30|r>>>2}function Jo(r,e,t,i){return r===0?e&t|~e&i:r===2?e&t|e&i|t&i:e^t^i}we.prototype._update=function(r){for(var e=this._w,t=this._a|0,i=this._b|0,a=this._c|0,f=this._d|0,u=this._e|0,s=0;s<16;++s)e[s]=r.readInt32BE(s*4);for(;s<80;++s)e[s]=zo(e[s-3]^e[s-8]^e[s-14]^e[s-16]);for(var h=0;h<80;++h){var d=~~(h/20),y=Wo(t)+Jo(d,i,a,f)+u+e[h]+qo[d]|0;u=f,f=a,a=Vo(i),i=t,t=y}this._a=t+this._a|0,this._b=i+this._b|0,this._c=a+this._c|0,this._d=f+this._d|0,this._e=u+this._e|0};we.prototype._hash=function(){var r=Go.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var Yo=we;const Xo=Vn(Yo);function Ko(r){let e="";for(const t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}let nt=null;async function Ie(r){return nt===null&&(nt=await Qo()),nt?Or(r):Zo(r)}function Zo(r){return new Xo().update(r).digest("hex")}async function Or(r){const e=await crypto.subtle.digest("SHA-1",r);return Ko(e)}async function Qo(){try{if(await Or(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function ea(r){const e=[];let t=0,i=0;do{t=r.readUInt8();const a=t&127;e.push(a),i=t&128}while(i);return e.reduce((a,f)=>a+1<<7|f,-1)}function ta(r,e){let t=e,i=4,a=null;do a=r.readUInt8(),t|=(a&127)<<i,i+=7;while(a&128);return t}class ne{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:t}){const i=new z(e);if(i.slice(4).toString("hex")!=="ff744f63")return;const f=i.readUInt32BE();if(f!==2)throw new I(`Unable to read version ${f} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new I("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);const u=i.readUInt32BE(),s=[];for(let y=0;y<u;y++){const g=i.slice(20).toString("hex");s[y]=g}i.seek(i.tell()+4*u);const h=new Map;for(let y=0;y<u;y++)h.set(s[y],i.readUInt32BE());const d=i.slice(20).toString("hex");return new ne({hashes:s,crcs:{},offsets:h,packfileSha:d,getExternalRefDelta:t})}static async fromPack({pack:e,getExternalRefDelta:t,onProgress:i}){const a={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},f={},u=e.slice(-20).toString("hex"),s=[],h={},d=new Map;let y=null,g=null;await Hn([e],async({data:B,type:x,reference:F,offset:E,num:$})=>{y===null&&(y=$);const C=Math.floor((y-$)*100/y);C!==g&&i&&await i({phase:"Receiving objects",loaded:y-$,total:y}),g=C,x=a[x],["commit","tree","blob","tag"].includes(x)?f[E]={type:x,offset:E}:x==="ofs-delta"?f[E]={type:x,offset:E}:x==="ref-delta"&&(f[E]={type:x,offset:E})});const w=Object.keys(f).map(Number);for(const[B,x]of w.entries()){const F=B+1===w.length?e.byteLength-20:w[B+1],E=f[x],$=ln.buf(e.slice(x,F))>>>0;E.end=F,E.crc=$}const v=new ne({pack:Promise.resolve(e),packfileSha:u,crcs:h,hashes:s,offsets:d,getExternalRefDelta:t});g=null;let _=0;const P=[0,0,0,0,0,0,0,0,0,0,0,0];for(let B in f){B=Number(B);const x=Math.floor(_*100/y);x!==g&&i&&await i({phase:"Resolving deltas",loaded:_,total:y}),_++,g=x;const F=f[B];if(!F.oid)try{v.readDepth=0,v.externalReadDepth=0;const{type:E,object:$}=await v.readSlice({start:B});P[v.readDepth]+=1;const C=await Ie(Gn.wrap({type:E,object:$}));F.oid=C,s.push(C),d.set(C,B),h[C]=F.crc}catch{continue}}return s.sort(),v}async toBuffer(){const e=[],t=(d,y)=>{e.push(Buffer.from(d,y))};t("ff744f63","hex"),t("00000002","hex");const i=new z(Buffer.alloc(256*4));for(let d=0;d<256;d++){let y=0;for(const g of this.hashes)parseInt(g.slice(0,2),16)<=d&&y++;i.writeUInt32BE(y)}e.push(i.buffer);for(const d of this.hashes)t(d,"hex");const a=new z(Buffer.alloc(this.hashes.length*4));for(const d of this.hashes)a.writeUInt32BE(this.crcs[d]);e.push(a.buffer);const f=new z(Buffer.alloc(this.hashes.length*4));for(const d of this.hashes)f.writeUInt32BE(this.offsets.get(d));e.push(f.buffer),t(this.packfileSha,"hex");const u=Buffer.concat(e),s=await Ie(u),h=Buffer.alloc(20);return h.write(s,"hex"),Buffer.concat([u,h])}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 I(`Could not read object ${e} from packfile`)}const t=this.offsets.get(e);return this.readSlice({start:t})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;const t={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new I("Tried to read from a GitPackIndex with no packfile loaded into memory");const i=(await this.pack).slice(e),a=new z(i),f=a.readUInt8(),u=f&112;let s=t[u];if(s===void 0)throw new I("Unrecognized type: 0b"+u.toString(2));const h=f&15;let d=h;f&128&&(d=ta(a,h));let g=null,w=null;if(s==="ofs_delta"){const _=ea(a),P=e-_;({object:g,type:s}=await this.readSlice({start:P}))}if(s==="ref_delta"){const _=a.slice(20).toString("hex");({object:g,type:s}=await this.read({oid:_}))}const v=i.slice(a.tell());if(w=Buffer.from(await Wn(v)),w.byteLength!==d)throw new I(`Packfile told us object would have length ${d} but it had length ${w.byteLength}`);return g&&(w=Buffer.from(qn(w,g))),this.readDepth>3&&(this.offsetCache[e]={type:s,object:w}),{type:s,format:"content",object:w}}}class ce extends ie{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=ce.code,this.data={value:e}}}ce.code="InvalidOidError";class $e extends ie{constructor(e,t,i,a){super(`Object ${e} ${a?`at ${a}`:""}was anticipated to be a ${i} but it is a ${t}.`),this.code=this.name=$e.code,this.data={oid:e,actual:t,expected:i,filepath:a}}}$e.code="ObjectTypeError";function ra(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}const H=2**32;function rr(r,e,t,i){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=i.valueOf());const a=Math.floor(t/1e3),f=(t-a*1e3)*1e6;return[a,f]}function nr(r){const[e,t]=rr(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[i,a]=rr(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%H,ctimeNanoseconds:t%H,mtimeSeconds:i%H,mtimeNanoseconds:a%H,dev:r.dev%H,ino:r.ino%H,mode:ra(r.mode%H),uid:r.uid%H,gid:r.gid%H,size:r.size>-1?r.size%H:0}}function na(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095}}function ia(r){const e=r.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}class J{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||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 t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return J.fromBuffer(e);if(e===null)return new J(null);throw new I("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new I("Index file is empty (.git/index)");const t=new J,i=new z(e),a=i.toString("utf8",4);if(a!=="DIRC")throw new I(`Invalid dircache magic file number: ${a}`);const f=await Ie(e.slice(0,-20)),u=e.slice(-20).toString("hex");if(u!==f)throw new I(`Invalid checksum in GitIndex buffer: expected ${u} but saw ${f}`);const s=i.readUInt32BE();if(s!==2)throw new I(`Unsupported dircache version: ${s}`);const h=i.readUInt32BE();let d=0;for(;!i.eof()&&d<h;){const y={};y.ctimeSeconds=i.readUInt32BE(),y.ctimeNanoseconds=i.readUInt32BE(),y.mtimeSeconds=i.readUInt32BE(),y.mtimeNanoseconds=i.readUInt32BE(),y.dev=i.readUInt32BE(),y.ino=i.readUInt32BE(),y.mode=i.readUInt32BE(),y.uid=i.readUInt32BE(),y.gid=i.readUInt32BE(),y.size=i.readUInt32BE(),y.oid=i.slice(20).toString("hex");const g=i.readUInt16BE();y.flags=na(g);const w=e.indexOf(0,i.tell()+1)-i.tell();if(w<1)throw new I(`Got a path length of: ${w}`);if(y.path=i.toString("utf8",w),y.path.includes("..\\")||y.path.includes("../"))throw new he(y.path);let v=8-(i.tell()-12)%8;for(v===0&&(v=8);v--;){const _=i.readUInt8();if(_!==0)throw new I(`Expected 1-8 null characters but got '${_}' after ${y.path}`);if(i.eof())throw new I("Unexpected end of file")}y.stages=[],t._addEntry(y),d++}return t}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(yr)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(t=>t):e)}*[Symbol.iterator](){for(const e of this.entries)yield e}insert({filepath:e,stats:t,oid:i,stage:a=0}){t||(t={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),t=nr(t);const f=Buffer.from(e),u={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:a,nameLength:f.length<4095?f.length:4095},stages:[]};this._addEntry(u),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(const t of this._entries.keys())t.startsWith(e+"/")&&this._entries.delete(t);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(`
|
|
50
|
-
`)}static async _entryToBuffer(
|
|
51
|
-
`),
|
|
52
|
-
`),
|
|
53
|
-
`),
|
|
54
|
-
`),
|
|
55
|
-
`),
|
|
56
|
-
`),
|
|
57
|
-
`),
|
|
58
|
-
`),
|
|
59
|
-
`),
|
|
60
|
-
`),
|
|
61
|
-
`)])),
|
|
62
|
-
`)),
|
|
63
|
-
`)])),
|
|
64
|
-
`:`${
|
|
65
|
-
`,
|
|
49
|
+
*/(function(n){var t=$t,e=ye,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=s,n.SlowBuffer=I,n.INSPECT_MAX_BYTES=50;var o=2147483647;n.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=c(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{var u=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(u,i),u.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function f(u){if(u>o)throw new RangeError('The value "'+u+'" is invalid for option "size"');var i=new Uint8Array(u);return Object.setPrototypeOf(i,s.prototype),i}function s(u,i,a){if(typeof u=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(u)}return h(u,i,a)}s.poolSize=8192;function h(u,i,a){if(typeof u=="string")return b(u,i);if(ArrayBuffer.isView(u))return _(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);if(q(u,ArrayBuffer)||u&&q(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(q(u,SharedArrayBuffer)||u&&q(u.buffer,SharedArrayBuffer)))return U(u,i,a);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var l=u.valueOf&&u.valueOf();if(l!=null&&l!==u)return s.from(l,i,a);var p=B(u);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return s.from(u[Symbol.toPrimitive]("string"),i,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u)}s.from=function(u,i,a){return h(u,i,a)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function y(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function d(u,i,a){return y(u),u<=0?f(u):i!==void 0?typeof a=="string"?f(u).fill(i,a):f(u).fill(i):f(u)}s.alloc=function(u,i,a){return d(u,i,a)};function w(u){return y(u),f(u<0?0:x(u)|0)}s.allocUnsafe=function(u){return w(u)},s.allocUnsafeSlow=function(u){return w(u)};function b(u,i){if((typeof i!="string"||i==="")&&(i="utf8"),!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);var a=E(u,i)|0,l=f(a),p=l.write(u,i);return p!==a&&(l=l.slice(0,p)),l}function v(u){for(var i=u.length<0?0:x(u.length)|0,a=f(i),l=0;l<i;l+=1)a[l]=u[l]&255;return a}function _(u){if(q(u,Uint8Array)){var i=new Uint8Array(u);return U(i.buffer,i.byteOffset,i.byteLength)}return v(u)}function U(u,i,a){if(i<0||u.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(u.byteLength<i+(a||0))throw new RangeError('"length" is outside of buffer bounds');var l;return i===void 0&&a===void 0?l=new Uint8Array(u):a===void 0?l=new Uint8Array(u,i):l=new Uint8Array(u,i,a),Object.setPrototypeOf(l,s.prototype),l}function B(u){if(s.isBuffer(u)){var i=x(u.length)|0,a=f(i);return a.length===0||u.copy(a,0,0,i),a}if(u.length!==void 0)return typeof u.length!="number"||Rt(u.length)?f(0):v(u);if(u.type==="Buffer"&&Array.isArray(u.data))return v(u.data)}function x(u){if(u>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return u|0}function I(u){return+u!=u&&(u=0),s.alloc(+u)}s.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==s.prototype},s.compare=function(i,a){if(q(i,Uint8Array)&&(i=s.from(i,i.offset,i.byteLength)),q(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),!s.isBuffer(i)||!s.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===a)return 0;for(var l=i.length,p=a.length,g=0,m=Math.min(l,p);g<m;++g)if(i[g]!==a[g]){l=i[g],p=a[g];break}return l<p?-1:p<l?1:0},s.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(i,a){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return s.alloc(0);var l;if(a===void 0)for(a=0,l=0;l<i.length;++l)a+=i[l].length;var p=s.allocUnsafe(a),g=0;for(l=0;l<i.length;++l){var m=i[l];if(q(m,Uint8Array))g+m.length>p.length?s.from(m).copy(p,g):Uint8Array.prototype.set.call(p,m,g);else if(s.isBuffer(m))m.copy(p,g);else throw new TypeError('"list" argument must be an Array of Buffers');g+=m.length}return p};function E(u,i){if(s.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||q(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);var a=u.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&a===0)return 0;for(var p=!1;;)switch(i){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return Ot(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return Ie(u).length;default:if(p)return l?-1:Ot(u).length;i=(""+i).toLowerCase(),p=!0}}s.byteLength=E;function P(u,i,a){var l=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,i>>>=0,a<=i))return"";for(u||(u="utf8");;)switch(u){case"hex":return Zr(this,i,a);case"utf8":case"utf-8":return xe(this,i,a);case"ascii":return Xr(this,i,a);case"latin1":case"binary":return Kr(this,i,a);case"base64":return Jr(this,i,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qr(this,i,a);default:if(l)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),l=!0}}s.prototype._isBuffer=!0;function j(u,i,a){var l=u[i];u[i]=u[a],u[a]=l}s.prototype.swap16=function(){var i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var a=0;a<i;a+=2)j(this,a,a+1);return this},s.prototype.swap32=function(){var i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var a=0;a<i;a+=4)j(this,a,a+3),j(this,a+1,a+2);return this},s.prototype.swap64=function(){var i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var a=0;a<i;a+=8)j(this,a,a+7),j(this,a+1,a+6),j(this,a+2,a+5),j(this,a+3,a+4);return this},s.prototype.toString=function(){var i=this.length;return i===0?"":arguments.length===0?xe(this,0,i):P.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(i){if(!s.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:s.compare(this,i)===0},s.prototype.inspect=function(){var i="",a=n.INSPECT_MAX_BYTES;return i=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(i+=" ... "),"<Buffer "+i+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(i,a,l,p,g){if(q(i,Uint8Array)&&(i=s.from(i,i.offset,i.byteLength)),!s.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(a===void 0&&(a=0),l===void 0&&(l=i?i.length:0),p===void 0&&(p=0),g===void 0&&(g=this.length),a<0||l>i.length||p<0||g>this.length)throw new RangeError("out of range index");if(p>=g&&a>=l)return 0;if(p>=g)return-1;if(a>=l)return 1;if(a>>>=0,l>>>=0,p>>>=0,g>>>=0,this===i)return 0;for(var m=g-p,S=l-a,$=Math.min(m,S),k=this.slice(p,g),C=i.slice(a,l),T=0;T<$;++T)if(k[T]!==C[T]){m=k[T],S=C[T];break}return m<S?-1:S<m?1:0};function ve(u,i,a,l,p){if(u.length===0)return-1;if(typeof a=="string"?(l=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,Rt(a)&&(a=p?0:u.length-1),a<0&&(a=u.length+a),a>=u.length){if(p)return-1;a=u.length-1}else if(a<0)if(p)a=0;else return-1;if(typeof i=="string"&&(i=s.from(i,l)),s.isBuffer(i))return i.length===0?-1:Ee(u,i,a,l,p);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(u,i,a):Uint8Array.prototype.lastIndexOf.call(u,i,a):Ee(u,[i],a,l,p);throw new TypeError("val must be string, number or Buffer")}function Ee(u,i,a,l,p){var g=1,m=u.length,S=i.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(u.length<2||i.length<2)return-1;g=2,m/=2,S/=2,a/=2}function $(_e,$e){return g===1?_e[$e]:_e.readUInt16BE($e*g)}var k;if(p){var C=-1;for(k=a;k<m;k++)if($(u,k)===$(i,C===-1?0:k-C)){if(C===-1&&(C=k),k-C+1===S)return C*g}else C!==-1&&(k-=k-C),C=-1}else for(a+S>m&&(a=m-S),k=a;k>=0;k--){for(var T=!0,vt=0;vt<S;vt++)if($(u,k+vt)!==$(i,vt)){T=!1;break}if(T)return k}return-1}s.prototype.includes=function(i,a,l){return this.indexOf(i,a,l)!==-1},s.prototype.indexOf=function(i,a,l){return ve(this,i,a,l,!0)},s.prototype.lastIndexOf=function(i,a,l){return ve(this,i,a,l,!1)};function qr(u,i,a,l){a=Number(a)||0;var p=u.length-a;l?(l=Number(l),l>p&&(l=p)):l=p;var g=i.length;l>g/2&&(l=g/2);for(var m=0;m<l;++m){var S=parseInt(i.substr(m*2,2),16);if(Rt(S))return m;u[a+m]=S}return m}function Hr(u,i,a,l){return bt(Ot(i,u.length-a),u,a,l)}function zr(u,i,a,l){return bt(rn(i),u,a,l)}function Wr(u,i,a,l){return bt(Ie(i),u,a,l)}function Vr(u,i,a,l){return bt(nn(i,u.length-a),u,a,l)}s.prototype.write=function(i,a,l,p){if(a===void 0)p="utf8",l=this.length,a=0;else if(l===void 0&&typeof a=="string")p=a,l=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var g=this.length-a;if((l===void 0||l>g)&&(l=g),i.length>0&&(l<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var m=!1;;)switch(p){case"hex":return qr(this,i,a,l);case"utf8":case"utf-8":return Hr(this,i,a,l);case"ascii":case"latin1":case"binary":return zr(this,i,a,l);case"base64":return Wr(this,i,a,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vr(this,i,a,l);default:if(m)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),m=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Jr(u,i,a){return i===0&&a===u.length?t.fromByteArray(u):t.fromByteArray(u.slice(i,a))}function xe(u,i,a){a=Math.min(u.length,a);for(var l=[],p=i;p<a;){var g=u[p],m=null,S=g>239?4:g>223?3:g>191?2:1;if(p+S<=a){var $,k,C,T;switch(S){case 1:g<128&&(m=g);break;case 2:$=u[p+1],($&192)===128&&(T=(g&31)<<6|$&63,T>127&&(m=T));break;case 3:$=u[p+1],k=u[p+2],($&192)===128&&(k&192)===128&&(T=(g&15)<<12|($&63)<<6|k&63,T>2047&&(T<55296||T>57343)&&(m=T));break;case 4:$=u[p+1],k=u[p+2],C=u[p+3],($&192)===128&&(k&192)===128&&(C&192)===128&&(T=(g&15)<<18|($&63)<<12|(k&63)<<6|C&63,T>65535&&T<1114112&&(m=T))}}m===null?(m=65533,S=1):m>65535&&(m-=65536,l.push(m>>>10&1023|55296),m=56320|m&1023),l.push(m),p+=S}return Yr(l)}var Ae=4096;function Yr(u){var i=u.length;if(i<=Ae)return String.fromCharCode.apply(String,u);for(var a="",l=0;l<i;)a+=String.fromCharCode.apply(String,u.slice(l,l+=Ae));return a}function Xr(u,i,a){var l="";a=Math.min(u.length,a);for(var p=i;p<a;++p)l+=String.fromCharCode(u[p]&127);return l}function Kr(u,i,a){var l="";a=Math.min(u.length,a);for(var p=i;p<a;++p)l+=String.fromCharCode(u[p]);return l}function Zr(u,i,a){var l=u.length;(!i||i<0)&&(i=0),(!a||a<0||a>l)&&(a=l);for(var p="",g=i;g<a;++g)p+=on[u[g]];return p}function Qr(u,i,a){for(var l=u.slice(i,a),p="",g=0;g<l.length-1;g+=2)p+=String.fromCharCode(l[g]+l[g+1]*256);return p}s.prototype.slice=function(i,a){var l=this.length;i=~~i,a=a===void 0?l:~~a,i<0?(i+=l,i<0&&(i=0)):i>l&&(i=l),a<0?(a+=l,a<0&&(a=0)):a>l&&(a=l),a<i&&(a=i);var p=this.subarray(i,a);return Object.setPrototypeOf(p,s.prototype),p};function O(u,i,a){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+i>a)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(i,a,l){i=i>>>0,a=a>>>0,l||O(i,a,this.length);for(var p=this[i],g=1,m=0;++m<a&&(g*=256);)p+=this[i+m]*g;return p},s.prototype.readUintBE=s.prototype.readUIntBE=function(i,a,l){i=i>>>0,a=a>>>0,l||O(i,a,this.length);for(var p=this[i+--a],g=1;a>0&&(g*=256);)p+=this[i+--a]*g;return p},s.prototype.readUint8=s.prototype.readUInt8=function(i,a){return i=i>>>0,a||O(i,1,this.length),this[i]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(i,a){return i=i>>>0,a||O(i,2,this.length),this[i]|this[i+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(i,a){return i=i>>>0,a||O(i,2,this.length),this[i]<<8|this[i+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(i,a){return i=i>>>0,a||O(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(i,a){return i=i>>>0,a||O(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},s.prototype.readIntLE=function(i,a,l){i=i>>>0,a=a>>>0,l||O(i,a,this.length);for(var p=this[i],g=1,m=0;++m<a&&(g*=256);)p+=this[i+m]*g;return g*=128,p>=g&&(p-=Math.pow(2,8*a)),p},s.prototype.readIntBE=function(i,a,l){i=i>>>0,a=a>>>0,l||O(i,a,this.length);for(var p=a,g=1,m=this[i+--p];p>0&&(g*=256);)m+=this[i+--p]*g;return g*=128,m>=g&&(m-=Math.pow(2,8*a)),m},s.prototype.readInt8=function(i,a){return i=i>>>0,a||O(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},s.prototype.readInt16LE=function(i,a){i=i>>>0,a||O(i,2,this.length);var l=this[i]|this[i+1]<<8;return l&32768?l|4294901760:l},s.prototype.readInt16BE=function(i,a){i=i>>>0,a||O(i,2,this.length);var l=this[i+1]|this[i]<<8;return l&32768?l|4294901760:l},s.prototype.readInt32LE=function(i,a){return i=i>>>0,a||O(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},s.prototype.readInt32BE=function(i,a){return i=i>>>0,a||O(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},s.prototype.readFloatLE=function(i,a){return i=i>>>0,a||O(i,4,this.length),e.read(this,i,!0,23,4)},s.prototype.readFloatBE=function(i,a){return i=i>>>0,a||O(i,4,this.length),e.read(this,i,!1,23,4)},s.prototype.readDoubleLE=function(i,a){return i=i>>>0,a||O(i,8,this.length),e.read(this,i,!0,52,8)},s.prototype.readDoubleBE=function(i,a){return i=i>>>0,a||O(i,8,this.length),e.read(this,i,!1,52,8)};function N(u,i,a,l,p,g){if(!s.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>p||i<g)throw new RangeError('"value" argument is out of bounds');if(a+l>u.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(i,a,l,p){if(i=+i,a=a>>>0,l=l>>>0,!p){var g=Math.pow(2,8*l)-1;N(this,i,a,l,g,0)}var m=1,S=0;for(this[a]=i&255;++S<l&&(m*=256);)this[a+S]=i/m&255;return a+l},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(i,a,l,p){if(i=+i,a=a>>>0,l=l>>>0,!p){var g=Math.pow(2,8*l)-1;N(this,i,a,l,g,0)}var m=l-1,S=1;for(this[a+m]=i&255;--m>=0&&(S*=256);)this[a+m]=i/S&255;return a+l},s.prototype.writeUint8=s.prototype.writeUInt8=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,1,255,0),this[a]=i&255,a+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,2,65535,0),this[a]=i&255,this[a+1]=i>>>8,a+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,2,65535,0),this[a]=i>>>8,this[a+1]=i&255,a+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,4,4294967295,0),this[a+3]=i>>>24,this[a+2]=i>>>16,this[a+1]=i>>>8,this[a]=i&255,a+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,4,4294967295,0),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4},s.prototype.writeIntLE=function(i,a,l,p){if(i=+i,a=a>>>0,!p){var g=Math.pow(2,8*l-1);N(this,i,a,l,g-1,-g)}var m=0,S=1,$=0;for(this[a]=i&255;++m<l&&(S*=256);)i<0&&$===0&&this[a+m-1]!==0&&($=1),this[a+m]=(i/S>>0)-$&255;return a+l},s.prototype.writeIntBE=function(i,a,l,p){if(i=+i,a=a>>>0,!p){var g=Math.pow(2,8*l-1);N(this,i,a,l,g-1,-g)}var m=l-1,S=1,$=0;for(this[a+m]=i&255;--m>=0&&(S*=256);)i<0&&$===0&&this[a+m+1]!==0&&($=1),this[a+m]=(i/S>>0)-$&255;return a+l},s.prototype.writeInt8=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,1,127,-128),i<0&&(i=255+i+1),this[a]=i&255,a+1},s.prototype.writeInt16LE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,2,32767,-32768),this[a]=i&255,this[a+1]=i>>>8,a+2},s.prototype.writeInt16BE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,2,32767,-32768),this[a]=i>>>8,this[a+1]=i&255,a+2},s.prototype.writeInt32LE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,4,2147483647,-2147483648),this[a]=i&255,this[a+1]=i>>>8,this[a+2]=i>>>16,this[a+3]=i>>>24,a+4},s.prototype.writeInt32BE=function(i,a,l){return i=+i,a=a>>>0,l||N(this,i,a,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[a]=i>>>24,this[a+1]=i>>>16,this[a+2]=i>>>8,this[a+3]=i&255,a+4};function Be(u,i,a,l,p,g){if(a+l>u.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function Se(u,i,a,l,p){return i=+i,a=a>>>0,p||Be(u,i,a,4),e.write(u,i,a,l,23,4),a+4}s.prototype.writeFloatLE=function(i,a,l){return Se(this,i,a,!0,l)},s.prototype.writeFloatBE=function(i,a,l){return Se(this,i,a,!1,l)};function Fe(u,i,a,l,p){return i=+i,a=a>>>0,p||Be(u,i,a,8),e.write(u,i,a,l,52,8),a+8}s.prototype.writeDoubleLE=function(i,a,l){return Fe(this,i,a,!0,l)},s.prototype.writeDoubleBE=function(i,a,l){return Fe(this,i,a,!1,l)},s.prototype.copy=function(i,a,l,p){if(!s.isBuffer(i))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),a>=i.length&&(a=i.length),a||(a=0),p>0&&p<l&&(p=l),p===l||i.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),i.length-a<p-l&&(p=i.length-a+l);var g=p-l;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(a,l,p):Uint8Array.prototype.set.call(i,this.subarray(l,p),a),g},s.prototype.fill=function(i,a,l,p){if(typeof i=="string"){if(typeof a=="string"?(p=a,a=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!s.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(i.length===1){var g=i.charCodeAt(0);(p==="utf8"&&g<128||p==="latin1")&&(i=g)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(a<0||this.length<a||this.length<l)throw new RangeError("Out of range index");if(l<=a)return this;a=a>>>0,l=l===void 0?this.length:l>>>0,i||(i=0);var m;if(typeof i=="number")for(m=a;m<l;++m)this[m]=i;else{var S=s.isBuffer(i)?i:s.from(i,p),$=S.length;if($===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(m=0;m<l-a;++m)this[m+a]=S[m%$]}return this};var tn=/[^+/0-9A-Za-z-_]/g;function en(u){if(u=u.split("=")[0],u=u.trim().replace(tn,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}function Ot(u,i){i=i||1/0;for(var a,l=u.length,p=null,g=[],m=0;m<l;++m){if(a=u.charCodeAt(m),a>55295&&a<57344){if(!p){if(a>56319){(i-=3)>-1&&g.push(239,191,189);continue}else if(m+1===l){(i-=3)>-1&&g.push(239,191,189);continue}p=a;continue}if(a<56320){(i-=3)>-1&&g.push(239,191,189),p=a;continue}a=(p-55296<<10|a-56320)+65536}else p&&(i-=3)>-1&&g.push(239,191,189);if(p=null,a<128){if((i-=1)<0)break;g.push(a)}else if(a<2048){if((i-=2)<0)break;g.push(a>>6|192,a&63|128)}else if(a<65536){if((i-=3)<0)break;g.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((i-=4)<0)break;g.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return g}function rn(u){for(var i=[],a=0;a<u.length;++a)i.push(u.charCodeAt(a)&255);return i}function nn(u,i){for(var a,l,p,g=[],m=0;m<u.length&&!((i-=2)<0);++m)a=u.charCodeAt(m),l=a>>8,p=a%256,g.push(p),g.push(l);return g}function Ie(u){return t.toByteArray(en(u))}function bt(u,i,a,l){for(var p=0;p<l&&!(p+a>=i.length||p>=u.length);++p)i[p+a]=u[p];return p}function q(u,i){return u instanceof i||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===i.name}function Rt(u){return u!==u}var on=function(){for(var u="0123456789abcdef",i=new Array(256),a=0;a<16;++a)for(var l=a*16,p=0;p<16;++p)i[l+p]=u[a]+u[p];return i}()})(de);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(n,t){var e=de,r=e.Buffer;function o(f,s){for(var h in f)s[h]=f[h]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?n.exports=e:(o(e,t),t.Buffer=c);function c(f,s,h){return r(f,s,h)}c.prototype=Object.create(r.prototype),o(r,c),c.from=function(f,s,h){if(typeof f=="number")throw new TypeError("Argument must not be a number");return r(f,s,h)},c.alloc=function(f,s,h){if(typeof f!="number")throw new TypeError("Argument must be a number");var y=r(f);return s!==void 0?typeof h=="string"?y.fill(s,h):y.fill(s):y.fill(0),y},c.allocUnsafe=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return r(f)},c.allocUnsafeSlow=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(f)}})(ue,ue.exports);var we=ue.exports,oi={}.toString,ai=Array.isArray||function(n){return oi.call(n)=="[object Array]"},pt=TypeError,vr=Object,si=Error,ci=EvalError,fi=RangeError,ui=ReferenceError,Er=SyntaxError,li=URIError,hi=Math.abs,pi=Math.floor,di=Math.max,yi=Math.min,wi=Math.pow,gi=Math.round,mi=Number.isNaN||function(t){return t!==t},bi=mi,vi=function(t){return bi(t)||t===0?t:t<0?-1:1},Ei=Object.getOwnPropertyDescriptor,Et=Ei;if(Et)try{Et([],"length")}catch{Et=null}var dt=Et,xt=Object.defineProperty||!1;if(xt)try{xt({},"a",{value:1})}catch{xt=!1}var Ut=xt,Ct,De;function xr(){return De||(De=1,Ct=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;t[e]=o;for(var c in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var f=Object.getOwnPropertySymbols(t);if(f.length!==1||f[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(t,e);if(s.value!==o||s.enumerable!==!0)return!1}return!0}),Ct}var Nt,je;function xi(){if(je)return Nt;je=1;var n=typeof Symbol<"u"&&Symbol,t=xr();return Nt=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Nt}var Mt,Ce;function Ar(){return Ce||(Ce=1,Mt=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Mt}var Lt,Ne;function Br(){if(Ne)return Lt;Ne=1;var n=vr;return Lt=n.getPrototypeOf||null,Lt}var Ai="Function.prototype.bind called on incompatible ",Bi=Object.prototype.toString,Si=Math.max,Fi="[object Function]",Me=function(t,e){for(var r=[],o=0;o<t.length;o+=1)r[o]=t[o];for(var c=0;c<e.length;c+=1)r[c+t.length]=e[c];return r},Ii=function(t,e){for(var r=[],o=e,c=0;o<t.length;o+=1,c+=1)r[c]=t[o];return r},_i=function(n,t){for(var e="",r=0;r<n.length;r+=1)e+=n[r],r+1<n.length&&(e+=t);return e},$i=function(t){var e=this;if(typeof e!="function"||Bi.apply(e)!==Fi)throw new TypeError(Ai+e);for(var r=Ii(arguments,1),o,c=function(){if(this instanceof o){var d=e.apply(this,Me(r,arguments));return Object(d)===d?d:this}return e.apply(t,Me(r,arguments))},f=Si(0,e.length-r.length),s=[],h=0;h<f;h++)s[h]="$"+h;if(o=Function("binder","return function ("+_i(s,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function(){};y.prototype=e.prototype,o.prototype=new y,y.prototype=null}return o},Ui=$i,yt=Function.prototype.bind||Ui,ge=Function.prototype.call,me=Function.prototype.apply,Pi=typeof Reflect<"u"&&Reflect&&Reflect.apply,ki=yt,Ti=me,Oi=ge,Ri=Pi,Sr=Ri||ki.call(Oi,Ti),Di=yt,ji=pt,Ci=ge,Ni=Sr,be=function(t){if(t.length<1||typeof t[0]!="function")throw new ji("a function is required");return Ni(Di,Ci,t)},Gt,Le;function Mi(){if(Le)return Gt;Le=1;var n=be,t=dt,e;try{e=[].__proto__===Array.prototype}catch(f){if(!f||typeof f!="object"||!("code"in f)||f.code!=="ERR_PROTO_ACCESS")throw f}var r=!!e&&t&&t(Object.prototype,"__proto__"),o=Object,c=o.getPrototypeOf;return Gt=r&&typeof r.get=="function"?n([r.get]):typeof c=="function"?function(s){return c(s==null?s:o(s))}:!1,Gt}var qt,Ge;function Fr(){if(Ge)return qt;Ge=1;var n=Ar(),t=Br(),e=Mi();return qt=n?function(o){return n(o)}:t?function(o){if(!o||typeof o!="object"&&typeof o!="function")throw new TypeError("getProto: not an object");return t(o)}:e?function(o){return e(o)}:null,qt}var Ht,qe;function Li(){if(qe)return Ht;qe=1;var n=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=yt;return Ht=e.call(n,t),Ht}var A,Gi=vr,qi=si,Hi=ci,zi=fi,Wi=ui,nt=Er,et=pt,Vi=li,Ji=hi,Yi=pi,Xi=di,Ki=yi,Zi=wi,Qi=gi,to=vi,Ir=Function,zt=function(n){try{return Ir('"use strict"; return ('+n+").constructor;")()}catch{}},ct=dt,eo=Ut,Wt=function(){throw new et},ro=ct?function(){try{return arguments.callee,Wt}catch{try{return ct(arguments,"callee").get}catch{return Wt}}}():Wt,Q=xi()(),R=Fr(),no=Br(),io=Ar(),_r=me,wt=ge,tt={},oo=typeof Uint8Array>"u"||!R?A:R(Uint8Array),Y={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?A:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?A:ArrayBuffer,"%ArrayIteratorPrototype%":Q&&R?R([][Symbol.iterator]()):A,"%AsyncFromSyncIteratorPrototype%":A,"%AsyncFunction%":tt,"%AsyncGenerator%":tt,"%AsyncGeneratorFunction%":tt,"%AsyncIteratorPrototype%":tt,"%Atomics%":typeof Atomics>"u"?A:Atomics,"%BigInt%":typeof BigInt>"u"?A:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?A:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?A:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?A:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":qi,"%eval%":eval,"%EvalError%":Hi,"%Float16Array%":typeof Float16Array>"u"?A:Float16Array,"%Float32Array%":typeof Float32Array>"u"?A:Float32Array,"%Float64Array%":typeof Float64Array>"u"?A:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?A:FinalizationRegistry,"%Function%":Ir,"%GeneratorFunction%":tt,"%Int8Array%":typeof Int8Array>"u"?A:Int8Array,"%Int16Array%":typeof Int16Array>"u"?A:Int16Array,"%Int32Array%":typeof Int32Array>"u"?A:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Q&&R?R(R([][Symbol.iterator]())):A,"%JSON%":typeof JSON=="object"?JSON:A,"%Map%":typeof Map>"u"?A:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Q||!R?A:R(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Gi,"%Object.getOwnPropertyDescriptor%":ct,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?A:Promise,"%Proxy%":typeof Proxy>"u"?A:Proxy,"%RangeError%":zi,"%ReferenceError%":Wi,"%Reflect%":typeof Reflect>"u"?A:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?A:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Q||!R?A:R(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?A:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Q&&R?R(""[Symbol.iterator]()):A,"%Symbol%":Q?Symbol:A,"%SyntaxError%":nt,"%ThrowTypeError%":ro,"%TypedArray%":oo,"%TypeError%":et,"%Uint8Array%":typeof Uint8Array>"u"?A:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?A:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?A:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?A:Uint32Array,"%URIError%":Vi,"%WeakMap%":typeof WeakMap>"u"?A:WeakMap,"%WeakRef%":typeof WeakRef>"u"?A:WeakRef,"%WeakSet%":typeof WeakSet>"u"?A:WeakSet,"%Function.prototype.call%":wt,"%Function.prototype.apply%":_r,"%Object.defineProperty%":eo,"%Object.getPrototypeOf%":no,"%Math.abs%":Ji,"%Math.floor%":Yi,"%Math.max%":Xi,"%Math.min%":Ki,"%Math.pow%":Zi,"%Math.round%":Qi,"%Math.sign%":to,"%Reflect.getPrototypeOf%":io};if(R)try{null.error}catch(n){var ao=R(R(n));Y["%Error.prototype%"]=ao}var so=function n(t){var e;if(t==="%AsyncFunction%")e=zt("async function () {}");else if(t==="%GeneratorFunction%")e=zt("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=zt("async function* () {}");else if(t==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=n("%AsyncGenerator%");o&&R&&(e=R(o.prototype))}return Y[t]=e,e},He={__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"]},gt=yt,Bt=Li(),co=gt.call(wt,Array.prototype.concat),fo=gt.call(_r,Array.prototype.splice),ze=gt.call(wt,String.prototype.replace),St=gt.call(wt,String.prototype.slice),uo=gt.call(wt,RegExp.prototype.exec),lo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ho=/\\(\\)?/g,po=function(t){var e=St(t,0,1),r=St(t,-1);if(e==="%"&&r!=="%")throw new nt("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new nt("invalid intrinsic syntax, expected opening `%`");var o=[];return ze(t,lo,function(c,f,s,h){o[o.length]=s?ze(h,ho,"$1"):f||c}),o},yo=function(t,e){var r=t,o;if(Bt(He,r)&&(o=He[r],r="%"+o[0]+"%"),Bt(Y,r)){var c=Y[r];if(c===tt&&(c=so(r)),typeof c>"u"&&!e)throw new et("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:r,value:c}}throw new nt("intrinsic "+t+" does not exist!")},$r=function(t,e){if(typeof t!="string"||t.length===0)throw new et("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new et('"allowMissing" argument must be a boolean');if(uo(/^%?[^%]*%?$/,t)===null)throw new nt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=po(t),o=r.length>0?r[0]:"",c=yo("%"+o+"%",e),f=c.name,s=c.value,h=!1,y=c.alias;y&&(o=y[0],fo(r,co([0,1],y)));for(var d=1,w=!0;d<r.length;d+=1){var b=r[d],v=St(b,0,1),_=St(b,-1);if((v==='"'||v==="'"||v==="`"||_==='"'||_==="'"||_==="`")&&v!==_)throw new nt("property names with quotes must have matching quotes");if((b==="constructor"||!w)&&(h=!0),o+="."+b,f="%"+o+"%",Bt(Y,f))s=Y[f];else if(s!=null){if(!(b in s)){if(!e)throw new et("base intrinsic for "+t+" exists, but the property is not available.");return}if(ct&&d+1>=r.length){var U=ct(s,b);w=!!U,w&&"get"in U&&!("originalValue"in U.get)?s=U.get:s=s[b]}else w=Bt(s,b),s=s[b];w&&!h&&(Y[f]=s)}}return s},Ur=$r,Pr=be,wo=Pr([Ur("%String.prototype.indexOf%")]),kr=function(t,e){var r=Ur(t,!!e);return typeof r=="function"&&wo(t,".prototype.")>-1?Pr([r]):r},Vt,We;function go(){if(We)return Vt;We=1;var n=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,e,r;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},t(function(){throw 42},null,e)}catch(I){I!==r&&(t=null)}else t=null;var o=/^\s*class\b/,c=function(E){try{var P=n.call(E);return o.test(P)}catch{return!1}},f=function(E){try{return c(E)?!1:(n.call(E),!0)}catch{return!1}},s=Object.prototype.toString,h="[object Object]",y="[object Function]",d="[object GeneratorFunction]",w="[object HTMLAllCollection]",b="[object HTML document.all class]",v="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,U=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var x=document.all;s.call(x)===s.call(document.all)&&(B=function(E){if((U||!E)&&(typeof E>"u"||typeof E=="object"))try{var P=s.call(E);return(P===w||P===b||P===v||P===h)&&E("")==null}catch{}return!1})}return Vt=t?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{t(E,null,e)}catch(P){if(P!==r)return!1}return!c(E)&&f(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(_)return f(E);if(c(E))return!1;var P=s.call(E);return P!==y&&P!==d&&!/^\[object HTML/.test(P)?!1:f(E)},Vt}var Jt,Ve;function mo(){if(Ve)return Jt;Ve=1;var n=go(),t=Object.prototype.toString,e=Object.prototype.hasOwnProperty,r=function(h,y,d){for(var w=0,b=h.length;w<b;w++)e.call(h,w)&&(d==null?y(h[w],w,h):y.call(d,h[w],w,h))},o=function(h,y,d){for(var w=0,b=h.length;w<b;w++)d==null?y(h.charAt(w),w,h):y.call(d,h.charAt(w),w,h)},c=function(h,y,d){for(var w in h)e.call(h,w)&&(d==null?y(h[w],w,h):y.call(d,h[w],w,h))};function f(s){return t.call(s)==="[object Array]"}return Jt=function(h,y,d){if(!n(y))throw new TypeError("iterator must be a function");var w;arguments.length>=3&&(w=d),f(h)?r(h,y,w):typeof h=="string"?o(h,y,w):c(h,y,w)},Jt}var Yt,Je;function bo(){return Je||(Je=1,Yt=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Yt}var Xt,Ye;function vo(){if(Ye)return Xt;Ye=1;var n=bo(),t=typeof globalThis>"u"?mr:globalThis;return Xt=function(){for(var r=[],o=0;o<n.length;o++)typeof t[n[o]]=="function"&&(r[r.length]=n[o]);return r},Xt}var Kt={exports:{}},Zt,Xe;function Eo(){if(Xe)return Zt;Xe=1;var n=Ut,t=Er,e=pt,r=dt;return Zt=function(c,f,s){if(!c||typeof c!="object"&&typeof c!="function")throw new e("`obj` must be an object or a function`");if(typeof f!="string"&&typeof f!="symbol")throw new e("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new e("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new e("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new e("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new e("`loose`, if provided, must be a boolean");var h=arguments.length>3?arguments[3]:null,y=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,w=arguments.length>6?arguments[6]:!1,b=!!r&&r(c,f);if(n)n(c,f,{configurable:d===null&&b?b.configurable:!d,enumerable:h===null&&b?b.enumerable:!h,value:s,writable:y===null&&b?b.writable:!y});else if(w||!h&&!y&&!d)c[f]=s;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Zt}var Qt,Ke;function xo(){if(Ke)return Qt;Ke=1;var n=Ut,t=function(){return!!n};return t.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],"length",{value:1}).length!==1}catch{return!0}},Qt=t,Qt}var te,Ze;function Ao(){if(Ze)return te;Ze=1;var n=$r,t=Eo(),e=xo()(),r=dt,o=pt,c=n("%Math.floor%");return te=function(s,h){if(typeof s!="function")throw new o("`fn` is not a function");if(typeof h!="number"||h<0||h>4294967295||c(h)!==h)throw new o("`length` must be a positive 32-bit integer");var y=arguments.length>2&&!!arguments[2],d=!0,w=!0;if("length"in s&&r){var b=r(s,"length");b&&!b.configurable&&(d=!1),b&&!b.writable&&(w=!1)}return(d||w||!y)&&(e?t(s,"length",h,!0,!0):t(s,"length",h)),s},te}var ee,Qe;function Bo(){if(Qe)return ee;Qe=1;var n=yt,t=me,e=Sr;return ee=function(){return e(n,t,arguments)},ee}var tr;function So(){return tr||(tr=1,function(n){var t=Ao(),e=Ut,r=be,o=Bo();n.exports=function(f){var s=r(arguments),h=f.length-(arguments.length-1);return t(s,1+(h>0?h:0),!0)},e?e(n.exports,"apply",{value:o}):n.exports.apply=o}(Kt)),Kt.exports}var re,er;function Fo(){if(er)return re;er=1;var n=xr();return re=function(){return n()&&!!Symbol.toStringTag},re}var ne,rr;function Io(){if(rr)return ne;rr=1;var n=mo(),t=vo(),e=So(),r=kr,o=dt,c=Fr(),f=r("Object.prototype.toString"),s=Fo()(),h=typeof globalThis>"u"?mr:globalThis,y=t(),d=r("String.prototype.slice"),w=r("Array.prototype.indexOf",!0)||function(B,x){for(var I=0;I<B.length;I+=1)if(B[I]===x)return I;return-1},b={__proto__:null};s&&o&&c?n(y,function(U){var B=new h[U];if(Symbol.toStringTag in B&&c){var x=c(B),I=o(x,Symbol.toStringTag);if(!I&&x){var E=c(x);I=o(E,Symbol.toStringTag)}b["$"+U]=e(I.get)}}):n(y,function(U){var B=new h[U],x=B.slice||B.set;x&&(b["$"+U]=e(x))});var v=function(B){var x=!1;return n(b,function(I,E){if(!x)try{"$"+I(B)===E&&(x=d(E,1))}catch{}}),x},_=function(B){var x=!1;return n(b,function(I,E){if(!x)try{I(B),x=d(E,1)}catch{}}),x};return ne=function(B){if(!B||typeof B!="object")return!1;if(!s){var x=d(f(B),8,-1);return w(y,x)>-1?x:x!=="Object"?!1:_(B)}return o?v(B):null},ne}var ie,nr;function _o(){if(nr)return ie;nr=1;var n=Io();return ie=function(e){return!!n(e)},ie}var $o=pt,Uo=kr,Po=Uo("TypedArray.prototype.buffer",!0),ko=_o(),To=Po||function(t){if(!ko(t))throw new $o("Not a Typed Array");return t.buffer},G=we.Buffer,Oo=ai,Ro=To,Do=ArrayBuffer.isView||function(t){try{return Ro(t),!0}catch{return!1}},jo=typeof Uint8Array<"u",Tr=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Co=Tr&&(G.prototype instanceof Uint8Array||G.TYPED_ARRAY_SUPPORT),No=function(t,e){if(G.isBuffer(t))return t.constructor&&!("isBuffer"in t)?G.from(t):t;if(typeof t=="string")return G.from(t,e);if(Tr&&Do(t)){if(t.byteLength===0)return G.alloc(0);if(Co){var r=G.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}var o=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),c=G.from(o);if(c.length===t.byteLength)return c}if(jo&&t instanceof Uint8Array)return G.from(t);var f=Oo(t);if(f)for(var s=0;s<t.length;s+=1){var h=t[s];if(typeof h!="number"||h<0||h>255||~~h!==h)throw new RangeError("Array items must be numbers in the range 0-255.")}if(f||G.isBuffer(t)&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t))return G.from(t);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},Mo=we.Buffer,Lo=No;function Pt(n,t){this._block=Mo.alloc(n),this._finalSize=t,this._blockSize=n,this._len=0}Pt.prototype.update=function(n,t){n=Lo(n,t||"utf8");for(var e=this._block,r=this._blockSize,o=n.length,c=this._len,f=0;f<o;){for(var s=c%r,h=Math.min(o-f,r-s),y=0;y<h;y++)e[s+y]=n[f+y];c+=h,f+=h,c%r===0&&this._update(e)}return this._len+=o,this};Pt.prototype.digest=function(n){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=this._len*8;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var r=(e&4294967295)>>>0,o=(e-r)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var c=this._hash();return n?c.toString(n):c};Pt.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Go=Pt,qo=Xn,Or=Go,Ho=we.Buffer,zo=[1518500249,1859775393,-1894007588,-899497514],Wo=new Array(80);function mt(){this.init(),this._w=Wo,Or.call(this,64,56)}qo(mt,Or);mt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Vo(n){return n<<1|n>>>31}function Jo(n){return n<<5|n>>>27}function Yo(n){return n<<30|n>>>2}function Xo(n,t,e,r){return n===0?t&e|~t&r:n===2?t&e|t&r|e&r:t^e^r}mt.prototype._update=function(n){for(var t=this._w,e=this._a|0,r=this._b|0,o=this._c|0,c=this._d|0,f=this._e|0,s=0;s<16;++s)t[s]=n.readInt32BE(s*4);for(;s<80;++s)t[s]=Vo(t[s-3]^t[s-8]^t[s-14]^t[s-16]);for(var h=0;h<80;++h){var y=~~(h/20),d=Jo(e)+Xo(y,r,o,c)+f+t[h]+zo[y]|0;f=c,c=o,o=Yo(r),r=e,e=d}this._a=e+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=c+this._d|0,this._e=f+this._e|0};mt.prototype._hash=function(){var n=Ho.allocUnsafe(20);return n.writeInt32BE(this._a|0,0),n.writeInt32BE(this._b|0,4),n.writeInt32BE(this._c|0,8),n.writeInt32BE(this._d|0,12),n.writeInt32BE(this._e|0,16),n};var Ko=mt;const Zo=Yn(Ko);function Qo(n){let t="";for(const e of new Uint8Array(n))e<16&&(t+="0"),t+=e.toString(16);return t}let oe=null;async function Ft(n){return oe===null&&(oe=await ea()),oe?Rr(n):ta(n)}function ta(n){return new Zo().update(n).digest("hex")}async function Rr(n){const t=await crypto.subtle.digest("SHA-1",n);return Qo(t)}async function ea(){try{if(await Rr(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function ra(n){const t=[];let e=0,r=0;do{e=n.readUInt8();const o=e&127;t.push(o),r=e&128}while(r);return t.reduce((o,c)=>o+1<<7|c,-1)}function na(n,t){let e=t,r=4,o=null;do o=n.readUInt8(),e|=(o&127)<<r,r+=7;while(o&128);return e}class it{constructor(t){Object.assign(this,t),this.offsetCache={}}static async fromIdx({idx:t,getExternalRefDelta:e}){const r=new z(t);if(r.slice(4).toString("hex")!=="ff744f63")return;const c=r.readUInt32BE();if(c!==2)throw new F(`Unable to read version ${c} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2048*1024*1024)throw new F("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");r.seek(r.tell()+4*255);const f=r.readUInt32BE(),s=[];for(let d=0;d<f;d++){const w=r.slice(20).toString("hex");s[d]=w}r.seek(r.tell()+4*f);const h=new Map;for(let d=0;d<f;d++)h.set(s[d],r.readUInt32BE());const y=r.slice(20).toString("hex");return new it({hashes:s,crcs:{},offsets:h,packfileSha:y,getExternalRefDelta:e})}static async fromPack({pack:t,getExternalRefDelta:e,onProgress:r}){const o={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},c={},f=t.slice(-20).toString("hex"),s=[],h={},y=new Map;let d=null,w=null;await Wn([t],async({data:B,type:x,reference:I,offset:E,num:P})=>{d===null&&(d=P);const j=Math.floor((d-P)*100/d);j!==w&&r&&await r({phase:"Receiving objects",loaded:d-P,total:d}),w=j,x=o[x],["commit","tree","blob","tag"].includes(x)?c[E]={type:x,offset:E}:x==="ofs-delta"?c[E]={type:x,offset:E}:x==="ref-delta"&&(c[E]={type:x,offset:E})});const b=Object.keys(c).map(Number);for(const[B,x]of b.entries()){const I=B+1===b.length?t.byteLength-20:b[B+1],E=c[x],P=pn.buf(t.slice(x,I))>>>0;E.end=I,E.crc=P}const v=new it({pack:Promise.resolve(t),packfileSha:f,crcs:h,hashes:s,offsets:y,getExternalRefDelta:e});w=null;let _=0;const U=[0,0,0,0,0,0,0,0,0,0,0,0];for(let B in c){B=Number(B);const x=Math.floor(_*100/d);x!==w&&r&&await r({phase:"Resolving deltas",loaded:_,total:d}),_++,w=x;const I=c[B];if(!I.oid)try{v.readDepth=0,v.externalReadDepth=0;const{type:E,object:P}=await v.readSlice({start:B});U[v.readDepth]+=1;const j=await Ft(Hn.wrap({type:E,object:P}));I.oid=j,s.push(j),y.set(j,B),h[j]=I.crc}catch{continue}}return s.sort(),v}async toBuffer(){const t=[],e=(y,d)=>{t.push(Buffer.from(y,d))};e("ff744f63","hex"),e("00000002","hex");const r=new z(Buffer.alloc(256*4));for(let y=0;y<256;y++){let d=0;for(const w of this.hashes)parseInt(w.slice(0,2),16)<=y&&d++;r.writeUInt32BE(d)}t.push(r.buffer);for(const y of this.hashes)e(y,"hex");const o=new z(Buffer.alloc(this.hashes.length*4));for(const y of this.hashes)o.writeUInt32BE(this.crcs[y]);t.push(o.buffer);const c=new z(Buffer.alloc(this.hashes.length*4));for(const y of this.hashes)c.writeUInt32BE(this.offsets.get(y));t.push(c.buffer),e(this.packfileSha,"hex");const f=Buffer.concat(t),s=await Ft(f),h=Buffer.alloc(20);return h.write(s,"hex"),Buffer.concat([f,h])}async load({pack:t}){this.pack=t}async unload(){this.pack=null}async read({oid:t}){if(!this.offsets.get(t)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(t);throw new F(`Could not read object ${t} from packfile`)}const e=this.offsets.get(t);return this.readSlice({start:e})}async readSlice({start:t}){if(this.offsetCache[t])return Object.assign({},this.offsetCache[t]);this.readDepth++;const e={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new F("Tried to read from a GitPackIndex with no packfile loaded into memory");const r=(await this.pack).slice(t),o=new z(r),c=o.readUInt8(),f=c&112;let s=e[f];if(s===void 0)throw new F("Unrecognized type: 0b"+f.toString(2));const h=c&15;let y=h;c&128&&(y=na(o,h));let w=null,b=null;if(s==="ofs_delta"){const _=ra(o),U=t-_;({object:w,type:s}=await this.readSlice({start:U}))}if(s==="ref_delta"){const _=o.slice(20).toString("hex");({object:w,type:s}=await this.read({oid:_}))}const v=r.slice(o.tell());if(b=Buffer.from(await Jn(v)),b.byteLength!==y)throw new F(`Packfile told us object would have length ${y} but it had length ${b.byteLength}`);return w&&(b=Buffer.from(zn(b,w))),this.readDepth>3&&(this.offsetCache[t]={type:s,object:b}),{type:s,format:"content",object:b}}}class ft extends ot{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=ft.code,this.data={value:t}}}ft.code="InvalidOidError";class kt extends ot{constructor(t,e,r,o){super(`Object ${t} ${o?`at ${o}`:""}was anticipated to be a ${r} but it is a ${e}.`),this.code=this.name=kt.code,this.data={oid:t,actual:e,expected:r,filepath:o}}}kt.code="ObjectTypeError";function ia(n){let t=n>0?n>>12:0;t!==4&&t!==8&&t!==10&&t!==14&&(t=8);let e=n&511;return e&73?e=493:e=420,t!==8&&(e=0),(t<<12)+e}const H=2**32;function ir(n,t,e,r){if(n!==void 0&&t!==void 0)return[n,t];e===void 0&&(e=r.valueOf());const o=Math.floor(e/1e3),c=(e-o*1e3)*1e6;return[o,c]}function or(n){const[t,e]=ir(n.ctimeSeconds,n.ctimeNanoseconds,n.ctimeMs,n.ctime),[r,o]=ir(n.mtimeSeconds,n.mtimeNanoseconds,n.mtimeMs,n.mtime);return{ctimeSeconds:t%H,ctimeNanoseconds:e%H,mtimeSeconds:r%H,mtimeNanoseconds:o%H,dev:n.dev%H,ino:n.ino%H,mode:ia(n.mode%H),uid:n.uid%H,gid:n.gid%H,size:n.size>-1?n.size%H:0}}function oa(n){return{assumeValid:!!(n&32768),extended:!!(n&16384),stage:(n&12288)>>12,nameLength:n&4095}}function aa(n){const t=n.flags;return t.extended=!1,t.nameLength=Math.min(Buffer.from(n.path).length,4095),(t.assumeValid?32768:0)+(t.extended?16384:0)+((t.stage&3)<<12)+(t.nameLength&4095)}class J{constructor(t,e){this._dirty=!1,this._unmergedPaths=e||new Set,this._entries=t||new Map}_addEntry(t){if(t.flags.stage===0)t.stages=[t],this._entries.set(t.path,t),this._unmergedPaths.delete(t.path);else{let e=this._entries.get(t.path);e||(this._entries.set(t.path,t),e=t),e.stages[t.flags.stage]=t,this._unmergedPaths.add(t.path)}}static async from(t){if(Buffer.isBuffer(t))return J.fromBuffer(t);if(t===null)return new J(null);throw new F("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(t.length===0)throw new F("Index file is empty (.git/index)");const e=new J,r=new z(t),o=r.toString("utf8",4);if(o!=="DIRC")throw new F(`Invalid dircache magic file number: ${o}`);const c=await Ft(t.slice(0,-20)),f=t.slice(-20).toString("hex");if(f!==c)throw new F(`Invalid checksum in GitIndex buffer: expected ${f} but saw ${c}`);const s=r.readUInt32BE();if(s!==2)throw new F(`Unsupported dircache version: ${s}`);const h=r.readUInt32BE();let y=0;for(;!r.eof()&&y<h;){const d={};d.ctimeSeconds=r.readUInt32BE(),d.ctimeNanoseconds=r.readUInt32BE(),d.mtimeSeconds=r.readUInt32BE(),d.mtimeNanoseconds=r.readUInt32BE(),d.dev=r.readUInt32BE(),d.ino=r.readUInt32BE(),d.mode=r.readUInt32BE(),d.uid=r.readUInt32BE(),d.gid=r.readUInt32BE(),d.size=r.readUInt32BE(),d.oid=r.slice(20).toString("hex");const w=r.readUInt16BE();d.flags=oa(w);const b=t.indexOf(0,r.tell()+1)-r.tell();if(b<1)throw new F(`Got a path length of: ${b}`);if(d.path=r.toString("utf8",b),d.path.includes("..\\")||d.path.includes("../"))throw new ht(d.path);let v=8-(r.tell()-12)%8;for(v===0&&(v=8);v--;){const _=r.readUInt8();if(_!==0)throw new F(`Expected 1-8 null characters but got '${_}' after ${d.path}`);if(r.eof())throw new F("Unexpected end of file")}d.stages=[],e._addEntry(d),y++}return e}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(wr)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(t=>t.stages.length>1?t.stages.filter(e=>e):t)}*[Symbol.iterator](){for(const t of this.entries)yield t}insert({filepath:t,stats:e,oid:r,stage:o=0}){e||(e={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),e=or(e);const c=Buffer.from(t),f={ctimeSeconds:e.ctimeSeconds,ctimeNanoseconds:e.ctimeNanoseconds,mtimeSeconds:e.mtimeSeconds,mtimeNanoseconds:e.mtimeNanoseconds,dev:e.dev,ino:e.ino,mode:e.mode||33188,uid:e.uid,gid:e.gid,size:e.size,path:t,oid:r,flags:{assumeValid:!1,extended:!1,stage:o,nameLength:c.length<4095?c.length:4095},stages:[]};this._addEntry(f),this._dirty=!0}delete({filepath:t}){if(this._entries.has(t))this._entries.delete(t);else for(const e of this._entries.keys())e.startsWith(t+"/")&&this._entries.delete(e);this._unmergedPaths.has(t)&&this._unmergedPaths.delete(t),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:t}){return this._entries.has(t)}render(){return this.entries.map(t=>`${t.mode.toString(8)} ${t.oid} ${t.path}`).join(`
|
|
50
|
+
`)}static async _entryToBuffer(t){const e=Buffer.from(t.path),r=Math.ceil((62+e.length+1)/8)*8,o=Buffer.alloc(r),c=new z(o),f=or(t);return c.writeUInt32BE(f.ctimeSeconds),c.writeUInt32BE(f.ctimeNanoseconds),c.writeUInt32BE(f.mtimeSeconds),c.writeUInt32BE(f.mtimeNanoseconds),c.writeUInt32BE(f.dev),c.writeUInt32BE(f.ino),c.writeUInt32BE(f.mode),c.writeUInt32BE(f.uid),c.writeUInt32BE(f.gid),c.writeUInt32BE(f.size),c.write(t.oid,20,"hex"),c.writeUInt16BE(aa(t)),c.write(t.path,e.length,"utf8"),o}async toObject(){const t=Buffer.alloc(12),e=new z(t);e.write("DIRC",4,"utf8"),e.writeUInt32BE(2),e.writeUInt32BE(this.entriesFlat.length);let r=[];for(const s of this.entries)if(r.push(J._entryToBuffer(s)),s.stages.length>1)for(const h of s.stages)h&&h!==s&&r.push(J._entryToBuffer(h));r=await Promise.all(r);const o=Buffer.concat(r),c=Buffer.concat([t,o]),f=await Ft(c);return Buffer.concat([c,Buffer.from(f,"hex")])}}async function Dr(n,t){const e=pr(n);for(;;){const{value:r,done:o}=await e.next();if(r&&await t(r),o)break}e.return&&e.return()}async function ut(n){let t=0;const e=[];await Dr(n,c=>{e.push(c),t+=c.byteLength});const r=new Uint8Array(t);let o=0;for(const c of e)r.set(c,o),o+=c.byteLength;return r}class ae{constructor(){this._queue=[]}write(t){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){const e=this._waiting;this._waiting=null,e({value:t})}else this._queue.push(t)}end(){if(this._ended=!0,this._waiting){const t=this._waiting;this._waiting=null,t({done:!0})}}destroy(t){this.error=t,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(t=>{this._waiting=t})}}class sa{static demux(t){const e=D.streamReader(t),r=new ae,o=new ae,c=new ae,f=async function(){const s=await e();if(s===null)return f();if(s===!0){r.end(),c.end(),t.error?o.destroy(t.error):o.end();return}switch(s[0]){case 1:{o.write(s.slice(1));break}case 2:{c.write(s.slice(1));break}case 3:{const h=s.slice(1);c.write(h),r.end(),c.end(),o.destroy(new Error(h.toString("utf8")));return}default:r.write(s)}f()};return f(),{packetlines:r,packfile:o,progress:c}}}async function jr(n){const{packetlines:t,packfile:e,progress:r}=sa.demux(n),o=[],c=[],f=[];let s=!1,h=!1;return new Promise((y,d)=>{Dr(t,w=>{const b=w.toString("utf8").trim();if(b.startsWith("shallow")){const v=b.slice(-41).trim();v.length!==40&&d(new ft(v)),o.push(v)}else if(b.startsWith("unshallow")){const v=b.slice(-41).trim();v.length!==40&&d(new ft(v)),c.push(v)}else if(b.startsWith("ACK")){const[,v,_]=b.split(" ");f.push({oid:v,status:_}),_||(h=!0)}else b.startsWith("NAK")?(s=!0,h=!0):(h=!0,s=!0);h&&(n.error?d(n.error):y({shallows:o,unshallows:c,acks:f,nak:s,packfile:e,progress:r}))}).finally(()=>{h||(n.error?d(n.error):y({shallows:o,unshallows:c,acks:f,nak:s,packfile:e,progress:r}))})})}typeof globalThis.Buffer>"u"&&(globalThis.Buffer=de.Buffer);class Tt extends Error{constructor(t,e){super(`Authentication required to access private repository: ${t}`),this.name="GitAuthenticationError",this.repoUrl=t,this.status=e}}async function ca(n,t,e,r){const o=(r==null?void 0:r.additionalHeaders)||{},c=await Mr(n,t,o),f=await da(c.idx,t,e),s=e.map(v=>f[v].oid),h=s.length>0?await ya(n,s,o):null,y={};if(await Promise.all(e.map(async v=>{h&&(y[v]=await Lr(h.idx,f[v].oid))})),!(r!=null&&r.withObjects))return{files:y};const d=[],w=await c.idx.toBuffer();if(d.push({name:`pack-${c.idx.packfileSha}`,pack:c.packfile,index:lt(w),promisor:c.promisor}),h){const v=await h.idx.toBuffer();d.push({name:`pack-${h.idx.packfileSha}`,pack:h.packfile,index:lt(v),promisor:h.promisor})}const b={};for(const v of e)b[v]=f[v].oid;return{files:y,packfiles:d,objects:[...await ar(c),...await ar(h)],fileOids:b}}const fa=/^[0-9a-f]{40}$/i;async function ua(n,t,e={}){const r=await Mr(n,t,e),o=await pa(r.idx,t);return o!=null&&o.object?Cr(o):[]}async function la(n,t,e={}){const r=await ha(n,t);if(r.resolvedOid)return r.resolvedOid;const o=await le(n,r.refname,e);if(!o)throw new Error(`Git ref "${r.refname}" not found at ${n}`);return o}function Cr(n){return n.object.map(t=>{if(t.type==="blob")return{name:t.path,type:"file"};if(t.type==="tree"&&t.object)return{name:t.path,type:"folder",children:Cr(t)}}).filter(t=>!!(t!=null&&t.name))}async function Nr(n,t,e={}){const r=Buffer.from(await ut([D.encode(`command=ls-refs
|
|
51
|
+
`),D.encode(`agent=git/2.37.3
|
|
52
|
+
`),D.encode(`object-format=sha1
|
|
53
|
+
`),D.delim(),D.encode(`peel
|
|
54
|
+
`),D.encode(`ref-prefix ${t}
|
|
55
|
+
`),D.flush()])),o=await fetch(n+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${r.length}`,"Git-Protocol":"version=2",...e},body:r});if(!o.ok)throw o.status===401||o.status===403?new Tt(n,o.status):new Error(`Failed to fetch git refs from ${n}: ${o.status} ${o.statusText}`);const c={};for await(const f of wa(o)){const s=f.indexOf(" "),h=f.slice(0,s),d=f.slice(s+1,f.length-1).split(" ")[0];c[d]=h}return c}async function ha(n,t){switch(t.type??"infer"){case"commit":return{kind:"commit",refname:t.value,resolvedOid:t.value};case"branch":return{kind:"refname",refname:`refs/heads/${t.value.trim()}`};case"tag":return{kind:"refname",refname:`refs/tags/${t.value.trim()}`};case"refname":return{kind:"refname",refname:t.value.trim()};case"infer":{const r=t.value.trim();if(r===""||r==="HEAD")return{kind:"refname",refname:"HEAD"};if(r.startsWith("refs/"))return{kind:"refname",refname:r};if(fa.test(r))return{kind:"commit",refname:r,resolvedOid:r};const o=`refs/heads/${r}`,c=await le(n,o);if(c)return{kind:"refname",refname:o,resolvedOid:c};const f=`refs/tags/${r}`,s=await le(n,f);if(s)return{kind:"refname",refname:f,resolvedOid:s};throw new Error(`Git ref "${t.value}" not found at ${n}`)}default:throw new Error(`Invalid ref type: ${t.type}`)}}async function le(n,t,e){const r=await Nr(n,t,e),o=[t,`${t}^{}`];for(const c of o){const f=c.trim();if(f in r)return r[f]}return null}async function Mr(n,t,e){const r=Buffer.from(await ut([D.encode(`want ${t} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3 filter
|
|
56
|
+
`),D.encode(`filter blob:none
|
|
57
|
+
`),D.encode(`shallow ${t}
|
|
58
|
+
`),D.encode(`deepen 1
|
|
59
|
+
`),D.flush(),D.encode(`done
|
|
60
|
+
`),D.encode(`done
|
|
61
|
+
`)])),o=await fetch(n+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${r.length}`,...e},body:r});if(!o.ok)throw o.status===401||o.status===403?new Tt(n,o.status):new Error(`Failed to fetch git objects from ${n}: ${o.status} ${o.statusText}`);const c=Gr(o.body),f=await jr(c),s=Buffer.from(await ut(f.packfile)),h=await it.fromPack({pack:s}),y=h.read;return h.read=async function({oid:d,...w}){const b=await y.call(this,{oid:d,...w});return b.oid=d,b},{idx:h,packfile:lt(s),promisor:!0}}async function pa(n,t){const e=await n.read({oid:t});X(e);const r=await n.read({oid:e.object.tree}),o=[r];for(;o.length>0;){const c=o.pop(),f=await n.read({oid:c.oid});if(X(f),c.object=f.object,f.type==="tree")for(const s of f.object)s.type==="tree"&&o.push(s)}return r}async function ar(n){if(!n)return[];const t=[],e=new Set;for(const r of n.idx.hashes??[]){if(e.has(r))continue;const o=n.idx.offsets.get(r);if(o===void 0)continue;const{type:c,object:f}=await n.idx.readSlice({start:o});c==="ofs_delta"||c==="ref_delta"||f&&(e.add(r),t.push({oid:r,type:c,body:lt(f)}))}return t}async function da(n,t,e){const r=await n.read({oid:t});X(r);const o=await n.read({oid:r.object.tree});X(o);const c={};for(const f of e){let s=o;const h=f.split("/");for(const y of h){if(s.type!=="tree")throw new Error(`Path not found in the repo: ${f}`);let d=!1;for(const w of s.object)if(w.path===y){try{s=await n.read({oid:w.oid}),X(s)}catch{s=w}d=!0;break}if(!d)throw new Error(`Path not found in the repo: ${f}`)}c[f]=s}return c}async function ya(n,t,e){const r=Buffer.from(await ut([...t.map(y=>D.encode(`want ${y} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3
|
|
62
|
+
`)),D.flush(),D.encode(`done
|
|
63
|
+
`)])),o=await fetch(n+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${r.length}`,...e},body:r});if(!o.ok)throw o.status===401||o.status===403?new Tt(n,o.status):new Error(`Failed to fetch git objects from ${n}: ${o.status} ${o.statusText}`);const c=Gr(o.body),f=await jr(c),s=Buffer.from(await ut(f.packfile));return s.byteLength===0?{idx:await it.fromPack({pack:s}),packfile:new Uint8Array,promisor:!1}:{idx:await it.fromPack({pack:s}),packfile:lt(s),promisor:!1}}async function Lr(n,t){const e=await n.read({oid:t});if(X(e),e.type==="blob")return e.object;const r={};for(const{path:o,oid:c,type:f}of e.object)if(f==="blob"){const s=await n.read({oid:c});X(s),r[o]=s.object}else f==="tree"&&(r[o]=await Lr(n,c));return r}function X(n){if(n.object instanceof Buffer)switch(n.type){case"commit":n.object=M.from(n.object).parse();break;case"tree":n.object=pe.from(n.object).entries();break;case"blob":n.object=new Uint8Array(n.object),n.format="content";break;case"tag":n.object=st.from(n.object).parse();break;default:throw new kt(n.oid,n.type,"blob|commit|tag|tree")}}async function*wa(n){const t=await n.text();let e=0;for(;e<=t.length;){const r=parseInt(t.substring(e,e+4),16);if(r===0)break;yield t.substring(e+4,e+r),e+=r}}function Gr(n){if(n[Symbol.asyncIterator])return n;const t=n.getReader();return{next(){return t.read()},return(){return t.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}function lt(n){return n instanceof Uint8Array,Uint8Array.from(n)}const ga=he.deflate,ma=/^[0-9a-f]{40}$/i;async function ba(n){const t={},e=new TextEncoder;return await Promise.all(n.map(async({oid:r,type:o,body:c})=>{if(!r||c.length===0)return;const f=e.encode(`${o} ${c.length}\0`),s=new Uint8Array(f.length+c.length);s.set(f,0),s.set(c,f.length);const h=await ga(s),y=r.slice(0,2),d=r.slice(2);t[`.git/objects/${y}/${d}`]=h})),t}function va(n,t,e){const r=(n==null?void 0:n.trim())??"";let o=null;switch(t){case"branch":r&&(o=`refs/heads/${r}`);break;case"refname":o=r||null;break;case"tag":r.startsWith("refs/")?o=r:r&&(o=`refs/tags/${r}`);break;case"commit":o=null;break;default:r.startsWith("refs/")?o=r:ma.test(r)?o=null:r&&r!=="HEAD"&&(o=`refs/heads/${r}`);break}const c=o?`ref: ${o}
|
|
64
|
+
`:`${e}
|
|
65
|
+
`,f=o&&o.startsWith("refs/heads/")?o:void 0,s=f==null?void 0:f.slice(11),h=o&&o.startsWith("refs/tags/")?o:void 0,y=h==null?void 0:h.slice(10);return{headContent:c,branchName:s,branchRef:f,tagName:y}}function Ea(n,{branchName:t,partialCloneFilter:e}){const o=["[core]",` repositoryformatversion = ${e?1:0}`," filemode = true"," bare = false"," logallrefupdates = true"," ignorecase = true"," precomposeunicode = true",'[remote "origin"]',` url = ${n}`," fetch = +refs/heads/*:refs/remotes/origin/*"," fetch = +refs/tags/*:refs/tags/*"];return e&&(o.push(" promisor = true"),o.push(` partialclonefilter = ${e}`),o.push("[extensions]"),o.push(" partialclone = origin")),t&&o.push(`[branch "${t}"]`," remote = origin",` merge = refs/heads/${t}`),o.join(`
|
|
66
66
|
`)+`
|
|
67
|
-
`}async function
|
|
68
|
-
`,s[".git/shallow"]=`${
|
|
67
|
+
`}async function xa({repoUrl:n,commitHash:t,ref:e,refType:r,objects:o,fileOids:c,pathPrefix:f}){const s={},h=va(e,r,t);s[".git/HEAD"]=h.headContent,s[".git/config"]=Ea(n,{branchName:h.branchName}),s[".git/description"]=`WordPress Playground clone
|
|
68
|
+
`,s[".git/shallow"]=`${t}
|
|
69
69
|
`,s[".git/refs/heads/.gitkeep"]="",s[".git/refs/tags/.gitkeep"]="",s[".git/refs/remotes/.gitkeep"]="",h.branchRef&&h.branchName&&(s[".git/logs/HEAD"]=`ref: ${h.branchRef}
|
|
70
|
-
`,s[`.git/${h.branchRef}`]=`${
|
|
71
|
-
`,s[`.git/refs/remotes/origin/${h.branchName}`]=`${
|
|
70
|
+
`,s[`.git/${h.branchRef}`]=`${t}
|
|
71
|
+
`,s[`.git/refs/remotes/origin/${h.branchName}`]=`${t}
|
|
72
72
|
`,s[".git/refs/remotes/origin/HEAD"]=`ref: refs/remotes/origin/${h.branchName}
|
|
73
|
-
`),h.tagName&&(s[`.git/refs/tags/${h.tagName}`]=`${
|
|
74
|
-
`),Object.assign(s,await ma(a));const d=new J;for(const[g,w]of Object.entries(f)){const v=g.substring(u.length).replace(/^\/+/,"");d.insert({filepath:v,oid:w,stats:{ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:33188,uid:0,gid:0,size:0}})}const y=await d.toObject();return s[".git/index"]=Uint8Array.from(y),s}function Ea(r,e){e=te.normalizePath(e);const t=["",".","/"].includes(e);let i=r;if(t)e="";else{const u=e.split("/");for(const s of u){const h=i==null?void 0:i.find(d=>d.name===s);if((h==null?void 0:h.type)==="folder")i=h.children;else return h?[h.name]:[]}}const a=[],f=[{tree:i,path:e}];for(;f.length>0;){const{tree:u,path:s}=f.pop();for(const h of u){const d=`${s}${s?"/":""}${h.name}`;h.type==="folder"?f.push({tree:h.children,path:d}):a.push(d)}}return a}function xa(r,e){return r.startsWith(e)?r.substring(e.length):r}class Aa{constructor(e){this.fileTree=e}async read(e){let t=this.getEntryAtPath(e);if(typeof t=="string")t=new TextEncoder().encode(t);else if(!(t instanceof Uint8Array))throw new Error(`Unsupported content type: ${typeof t}`);const i=new ReadableStream({start(a){a.enqueue(t),a.close()}});return new se.StreamedFile(i,e,{filesize:t.byteLength})}getEntryAtPath(e){let t=e.replace(/^\//,""),i=this.fileTree;for(;t;){if(i[t])return i[t];const a=t.split("/"),f=a.shift();if(!f||!i[f])break;i=i[f],t=a.join("/")}throw new Error(`File not found at ${e}`)}}class Fe{constructor(e){this.entries=new Map,this.zipReader=e}static fromStream(e){const t=new oe.ZipReader(new oe.BlobReader(new se.StreamedFile(e,"archive.zip")));return new Fe(t)}static fromArrayBuffer(e){const t=new oe.ZipReader(new oe.BlobReader(new Blob([e])));return new Fe(t)}async read(e){const t=await this.getEntry(e),i=await t.getData(new oe.BlobWriter);return new se.StreamedFile(i.stream(),e,{filesize:t.uncompressedSize})}async getEntry(e){const i=(await this.getEntries()).get(e.replace(/^\//,""));if(!i)throw new Error(`File ${e} not found in the zip.`);return i}async getEntries(){if(this.entries.size===0){const e=await this.zipReader.getEntries();for(const t of e)this.entries.set(t.filename,t)}return this.entries}}class Ba{constructor(e){if(!e.length)throw new Error("OverlayFilesystem requires at least one filesystem");this.filesystems=e}async read(e){const t=[];for(const a of this.filesystems)try{return await a.read(e)}catch(f){t.push(f instanceof Error?f:new Error(String(f)))}const i=t.map(a=>a.message).join("; ");throw new Error(`Failed to read ${e} from any filesystem: ${i}`,{cause:t})}}class Sa{constructor(e){if(this.baseUrl="",this.options=e,this.isDataUrl=e.baseUrl.startsWith("data:"),this.isDataUrl)return;const t=new URL("./",e.baseUrl);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("Unsupported protocol: "+t.protocol+". Only HTTP and HTTPS are supported.");this.baseUrl=t.origin+t.pathname}async read(e){if(this.isDataUrl)throw new Error("FetchFilesystem cannot fetch files from data URLs");e=te.normalizePath(e);const t=e.replace(/^\//,""),i=new URL(t,this.baseUrl).toString();if(!i.startsWith(this.baseUrl))throw new Error(`Refused to read a file outside of the base URL: ${i}`);const a=this.options.corsProxy?`${this.options.corsProxy}${encodeURIComponent(i)}`:i,f=await fetch(a);if(!f.ok)throw new Error(`Failed to fetch file at ${e}: ${f.statusText}`);const u=f.headers.get("content-length")?parseInt(f.headers.get("content-length"),10):void 0;return new se.StreamedFile(f.body,e,{filesize:u})}}class Ia{constructor(e){this.root=e}async ensureNodeModules(){if(!this.fs||!this.path){try{this.fs=await import("fs"),this.path=await import("path")}catch{this.fs=require("fs"),this.path=require("path")}this.root=this.path.resolve(this.root)+this.path.sep}}async read(e){if(await this.ensureNodeModules(),e=this.path.resolve(this.root,this.path.normalize(e.replace(/^\//,""))),!e.startsWith(this.root))throw new Error(`Refused to read a file outside of the root directory: ${e}`);return new Promise((t,i)=>{const a=this.path.resolve(e),f=this.fs.createReadStream(a);f.on("error",u=>{i(new Error(`Failed to read file at ${e}: ${u.message}`))}),this.fs.stat(a,(u,s)=>{u?i(new Error(`Failed to read file at ${e}: ${u.message}`)):t(new se.StreamedFile(Fa(f),e,{filesize:s.size}))})})}}function Fa(r){return new ReadableStream({start(t){r.on("data",i=>t.enqueue(i)),r.on("end",()=>t.close())}})}exports.FetchFilesystem=Sa;exports.InMemoryFilesystem=Aa;exports.NodeJsFilesystem=Ia;exports.OverlayFilesystem=Ba;exports.ZipFilesystem=Fe;exports.changeset=Sn;exports.clearContentsFromMountDevice=_n;exports.createClient=hn;exports.createCommit=En;exports.createDotGitDirectory=va;exports.createOrUpdateBranch=bn;exports.createTree=xn;exports.createTreeNode=ot;exports.createTreeNodes=ar;exports.deleteFile=fr;exports.directoryHandleFromMountDevice=cr;exports.directoryHandleToOpfsPath=Fn;exports.filesListToObject=pn;exports.fork=vn;exports.getArtifact=mn;exports.getFilesFromDirectory=or;exports.iterateFiles=Bn;exports.listDescendantFiles=Ea;exports.listGitFiles=fa;exports.listGitRefs=Cr;exports.mayPush=wn;exports.opfsPathToDirectoryHandle=ur;exports.removePathPrefix=xa;exports.resolveCommitHash=ca;exports.sparseCheckout=aa;
|
|
73
|
+
`),h.tagName&&(s[`.git/refs/tags/${h.tagName}`]=`${t}
|
|
74
|
+
`),Object.assign(s,await ba(o));const y=new J;for(const[w,b]of Object.entries(c)){const v=w.substring(f.length).replace(/^\/+/,"");y.insert({filepath:v,oid:b,stats:{ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:33188,uid:0,gid:0,size:0}})}const d=await y.toObject();return s[".git/index"]=Uint8Array.from(d),s}function Aa(n,t){t=rt.normalizePath(t);const e=["",".","/"].includes(t);let r=n;if(e)t="";else{const f=t.split("/");for(const s of f){const h=r==null?void 0:r.find(y=>y.name===s);if((h==null?void 0:h.type)==="folder")r=h.children;else return h?[h.name]:[]}}const o=[],c=[{tree:r,path:t}];for(;c.length>0;){const{tree:f,path:s}=c.pop();for(const h of f){const y=`${s}${s?"/":""}${h.name}`;h.type==="folder"?c.push({tree:h.children,path:y}):o.push(y)}}return o}function Ba(n,t){return n.startsWith(t)?n.substring(t.length):n}async function Sa(n,t){await t.clear();const e=async r=>{const o=await n.listFiles(r);for(const c of o){const f=r==="/"?`/${c}`:`${r}/${c}`;if(await n.isDir(f))await t.mkdir(f),await e(f);else{const s=await n.read(f),h=new Uint8Array(await s.arrayBuffer());await t.writeFile(f,h)}}};await e("/")}class Fa extends EventTarget{constructor(t){super(),this.encoder=new TextEncoder,this.decoder=new TextDecoder,this.backend=t}async isDir(t){return this.backend.isDir(t)}async fileExists(t){return this.backend.fileExists(t)}async read(t){return this.backend.read(t)}async readFileAsText(t){const r=await(await this.read(t)).arrayBuffer();return this.decoder.decode(r)}async listFiles(t){return this.backend.listFiles(t)}async writeFile(t,e){const r=typeof e=="string"?this.encoder.encode(e):e;await this.backend.writeFile(t,r),this.dispatchEvent(new Event("change"))}async mkdir(t,e){await this.backend.mkdir(t,(e==null?void 0:e.recursive)??!1),this.dispatchEvent(new Event("change"))}async rmdir(t,e){await this.backend.rmdir(t,(e==null?void 0:e.recursive)??!1),this.dispatchEvent(new Event("change"))}async mv(t,e){t!==e&&(await this.backend.mv(t,e),this.dispatchEvent(new Event("change")))}async unlink(t){await this.backend.unlink(t),this.dispatchEvent(new Event("change"))}async clear(){await this.backend.clear(),this.dispatchEvent(new Event("change"))}}class Ia{constructor(t){this.fileTree=t}async read(t){let e=this.getEntryAtPath(t);if(typeof e=="string")e=new TextEncoder().encode(e);else if(!(e instanceof Uint8Array))throw new Error(`Unsupported content type: ${typeof e}`);const r=new ReadableStream({start(o){o.enqueue(e),o.close()}});return new K.StreamedFile(r,t,{filesize:e.byteLength})}getEntryAtPath(t){let e=t.replace(/^\//,""),r=this.fileTree;for(;e;){if(r[e])return r[e];const o=e.split("/"),c=o.shift();if(!c||!r[c])break;r=r[c],e=o.join("/")}throw new Error(`File not found at ${t}`)}}class It{constructor(t){this.entries=new Map,this.zipReader=t}static fromStream(t){const e=new at.ZipReader(new at.BlobReader(new K.StreamedFile(t,"archive.zip")));return new It(e)}static fromArrayBuffer(t){const e=new at.ZipReader(new at.BlobReader(new Blob([t])));return new It(e)}async read(t){const e=await this.getEntry(t),r=await e.getData(new at.BlobWriter);return new K.StreamedFile(r.stream(),t,{filesize:e.uncompressedSize})}async getEntry(t){const r=(await this.getEntries()).get(t.replace(/^\//,""));if(!r)throw new Error(`File ${t} not found in the zip.`);return r}async getEntries(){if(this.entries.size===0){const t=await this.zipReader.getEntries();for(const e of t)this.entries.set(e.filename,e)}return this.entries}}class _a{constructor(t){if(!t.length)throw new Error("OverlayFilesystem requires at least one filesystem");this.filesystems=t}async read(t){const e=[];for(const o of this.filesystems)try{return await o.read(t)}catch(c){e.push(c instanceof Error?c:new Error(String(c)))}const r=e.map(o=>o.message).join("; ");throw new Error(`Failed to read ${t} from any filesystem: ${r}`,{cause:e})}}class $a{constructor(t){if(this.baseUrl="",this.options=t,this.isDataUrl=t.baseUrl.startsWith("data:"),this.isDataUrl)return;const e=new URL("./",t.baseUrl);if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error("Unsupported protocol: "+e.protocol+". Only HTTP and HTTPS are supported.");this.baseUrl=e.origin+e.pathname}async read(t){if(this.isDataUrl)throw new Error("FetchFilesystem cannot fetch files from data URLs");t=rt.normalizePath(t);const e=t.replace(/^\//,""),r=new URL(e,this.baseUrl).toString();if(!r.startsWith(this.baseUrl))throw new Error(`Refused to read a file outside of the base URL: ${r}`);const o=this.options.corsProxy?`${this.options.corsProxy}${encodeURIComponent(r)}`:r,c=await fetch(o);if(!c.ok)throw new Error(`Failed to fetch file at ${t}: ${c.statusText}`);const f=c.headers.get("content-length")?parseInt(c.headers.get("content-length"),10):void 0;return new K.StreamedFile(c.body,t,{filesize:f})}}class Ua{constructor(t){this.root=t}async ensureNodeModules(){if(!this.fs||!this.path){try{this.fs=await import("fs"),this.path=await import("path")}catch{this.fs=require("fs"),this.path=require("path")}this.root=this.path.resolve(this.root)+this.path.sep}}async read(t){if(await this.ensureNodeModules(),t=this.path.resolve(this.root,this.path.normalize(t.replace(/^\//,""))),!t.startsWith(this.root))throw new Error(`Refused to read a file outside of the root directory: ${t}`);return new Promise((e,r)=>{const o=this.path.resolve(t),c=this.fs.createReadStream(o);c.on("error",f=>{r(new Error(`Failed to read file at ${t}: ${f.message}`))}),this.fs.stat(o,(f,s)=>{f?r(new Error(`Failed to read file at ${t}: ${f.message}`)):e(new K.StreamedFile(Pa(c),t,{filesize:s.size}))})})}}function Pa(n){return new ReadableStream({start(e){n.on("data",r=>e.enqueue(r)),n.on("end",()=>e.close())}})}class _t{constructor(t){this.opfsRoot=t}static fromDirectoryHandle(t){return new _t(t)}static async fromPath(t,e=!1){if(typeof navigator>"u")throw new Error("OPFS not available: navigator is undefined");if(!navigator.storage||!navigator.storage.getDirectory)throw new Error("OPFS not available: storage API not supported");let r=await navigator.storage.getDirectory();const o=t.split("/").filter(Boolean);for(const c of o)r=await r.getDirectoryHandle(c,{create:e});return new _t(r)}async clear(){for await(const[t]of this.opfsRoot.entries())try{await this.opfsRoot.removeEntry(t,{recursive:!0})}catch{}}async read(t){const e=await this.readFileAsBuffer(t),r=new ReadableStream({start(o){o.enqueue(e),o.close()}});return new K.StreamedFile(r,t,{filesize:e.byteLength})}async isDir(t){if(t==="/")return!0;try{const e=t.split("/").filter(Boolean);let r=this.opfsRoot;for(const o of e)r=await r.getDirectoryHandle(o);return!0}catch{return!1}}async fileExists(t){const e=t.split("/").filter(Boolean);if(e.length===0)return!0;const r=e.pop();try{let o=this.opfsRoot;for(const c of e)o=await o.getDirectoryHandle(c);try{return await o.getFileHandle(r),!0}catch{return await o.getDirectoryHandle(r),!0}}catch{return!1}}async listFiles(t){let e=this.opfsRoot;if(t!=="/"){const o=t.split("/").filter(Boolean);for(const c of o)e=await e.getDirectoryHandle(c)}const r=[];for await(const[o]of e.entries())r.push(o);return r}async writeFile(t,e){const r=t.split("/").filter(Boolean),o=r.pop();if(!o)throw new Error(`Invalid file path: ${t}`);let c=this.opfsRoot;for(const h of r)c=await c.getDirectoryHandle(h);const s=await(await c.getFileHandle(o,{create:!0})).createWritable();await s.write(e),await s.close()}async mkdir(t,e=!1){const r=t.split("/").filter(Boolean);let o=this.opfsRoot;for(let c=0;c<r.length;c++){const f=r[c],s=c===r.length-1;o=await o.getDirectoryHandle(f,{create:e||s})}}async rmdir(t,e){const r=t.split("/").filter(Boolean),o=r.pop();if(!o)return;let c=this.opfsRoot;for(const f of r)c=await c.getDirectoryHandle(f);await c.removeEntry(o,{recursive:e})}async mv(t,e){if(await this.isDir(t))await this.copyDir(t,e),await this.rmdir(t,!0);else{const o=await this.readFileAsBuffer(t);await this.writeFile(e,o),await this.unlink(t)}}async unlink(t){const e=t.split("/").filter(Boolean),r=e.pop();if(!r)return;let o=this.opfsRoot;for(const c of e)o=await o.getDirectoryHandle(c);try{await o.removeEntry(r)}catch{}}async readFileAsBuffer(t){const e=t.split("/").filter(Boolean),r=e.pop();if(!r)throw new Error(`Invalid file path: ${t}`);let o=this.opfsRoot;for(const s of e)o=await o.getDirectoryHandle(s);const f=await(await o.getFileHandle(r)).getFile();return new Uint8Array(await f.arrayBuffer())}async copyDir(t,e){await this.mkdir(e);const r=await this.listFiles(t);for(const o of r){const c=t==="/"?`/${o}`:`${t}/${o}`,f=e==="/"?`/${o}`:`${e}/${o}`;if(await this.isDir(c))await this.copyDir(c,f);else{const s=await this.readFileAsBuffer(c);await this.writeFile(f,s)}}}}class ka{constructor(t={}){this.root={type:"dir",children:{}};for(const[e,r]of Object.entries(t))this.writeFileSync(e,r)}async read(t){const r=this.getFile(t).content,o=new ReadableStream({start(c){c.enqueue(r),c.close()}});return new K.StreamedFile(o,t,{filesize:r.byteLength})}async isDir(t){const e=this.getNode(t);return!!e&&e.type==="dir"}async fileExists(t){return!!this.getNode(t)}async listFiles(t){const e=this.getNode(t);return!e||e.type!=="dir"?[]:Object.keys(e.children)}async writeFile(t,e){this.writeFileSync(t,e)}async mkdir(t,e=!1){if(t==="/")return;const{parent:r,name:o}=e?this.getOrCreateParent(t):this.getParent(t);r.children[o]||(r.children[o]={type:"dir",children:{}})}async rmdir(t,e){const{parent:r,name:o}=this.getParent(t),c=r.children[o];if(!(!c||c.type!=="dir")){if(!e&&Object.keys(c.children).length>0)throw new Error("Directory not empty");delete r.children[o]}}async mv(t,e){const{parent:r,name:o}=this.getParent(t),c=r.children[o];if(!c)throw new Error(`Source not found: ${t}`);const{parent:f,name:s}=this.getParent(e);f.children[s]=c,delete r.children[o]}async unlink(t){const{parent:e,name:r}=this.getParent(t),o=e.children[r];o&&o.type==="file"&&delete e.children[r]}async clear(){this.root={type:"dir",children:{}}}writeFileSync(t,e){const{parent:r,name:o}=this.getParent(t);r.children[o]={type:"file",content:new Uint8Array(e)}}getNode(t){if(t==="/")return this.root;const e=t.split("/").filter(Boolean);let r=this.root;for(const o of e){if(r.type!=="dir")return;const c=r.children[o];if(!c)return;r=c}return r}getDir(t){const e=this.getNode(t);if(!e||e.type!=="dir")throw new Error(`Directory not found: ${t}`);return e}getFile(t){const e=this.getNode(t);if(!e||e.type!=="file")throw new Error(`File not found: ${t}`);return e}getParent(t){const e=t.split("/").filter(Boolean),r=e.pop();if(!r)throw new Error(`Invalid path: ${t}`);const o=e.length?`/${e.join("/")}`:"/",c=this.getNode(o);if(!c||c.type!=="dir")throw new Error(`Parent directory not found: ${o}`);return{parent:c,name:r}}getOrCreateParent(t){const e=t.split("/").filter(Boolean),r=e.pop();if(!r)throw new Error(`Invalid path: ${t}`);const o=e.length?`/${e.join("/")}`:"/";return{parent:this.ensureDir(o),name:r}}ensureDir(t){if(t==="/")return this.root;const e=t.split("/").filter(Boolean);let r=this.root;for(const o of e){const c=r.children[o];if(!c){const f={type:"dir",children:{}};r.children[o]=f,r=f;continue}if(c.type!=="dir")throw new Error(`Path segment "${o}" is not a directory in ${t}`);r=c}return r}}exports.EventedFilesystem=Fa;exports.FetchFilesystem=$a;exports.GitAuthenticationError=Tt;exports.InMemoryFilesystem=Ia;exports.InMemoryFilesystemBackend=ka;exports.NodeJsFilesystem=Ua;exports.OpfsFilesystemBackend=_t;exports.OverlayFilesystem=_a;exports.ZipFilesystem=It;exports.changeset=In;exports.clearContentsFromMountDevice=Un;exports.copyFilesystem=Sa;exports.createClient=dn;exports.createCommit=An;exports.createDotGitDirectory=xa;exports.createOrUpdateBranch=En;exports.createTree=Bn;exports.createTreeNode=se;exports.createTreeNodes=cr;exports.deleteFile=ur;exports.directoryHandleFromMountDevice=lr;exports.directoryHandleToOpfsPath=$n;exports.filesListToObject=yn;exports.fork=xn;exports.getArtifact=bn;exports.getFilesFromDirectory=sr;exports.iterateFiles=Fn;exports.listDescendantFiles=Aa;exports.listGitFiles=ua;exports.listGitRefs=Nr;exports.mayPush=vn;exports.opfsPathToDirectoryHandle=hr;exports.removePathPrefix=Ba;exports.resolveCommitHash=la;exports.sparseCheckout=ca;
|
|
75
75
|
//# sourceMappingURL=index.cjs.map
|