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