vbapm 0.6.14 → 0.7.0

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.
Files changed (72) hide show
  1. package/README.md +46 -0
  2. package/addins/build/vbapm.xlam +0 -0
  3. package/lib/_commonjsHelpers-Bjf42z7h.js +1 -0
  4. package/lib/actions/add-source.d.ts +11 -0
  5. package/lib/add-source-_Z4tr2ea.js +17 -0
  6. package/lib/bin/vbapm-add.d.ts +2 -0
  7. package/lib/build-project-CIZanDh1.js +3 -0
  8. package/lib/build-target-B03OPzeI.js +9 -0
  9. package/lib/crc32-Cc3OMFYk.js +1 -0
  10. package/lib/create-project-CTAlegO8.js +10 -0
  11. package/lib/debug.js +1 -1
  12. package/lib/errors.d.ts +4 -0
  13. package/lib/export-project-DdTYRyAw.js +4 -0
  14. package/lib/export-target-CEupP86g.js +4 -0
  15. package/lib/{get-target-e760a439.js → get-target-Ba_ZoGUl.js} +1 -1
  16. package/lib/index-BlteXxjY.js +1 -0
  17. package/lib/index-CB6KQLC7.js +13 -0
  18. package/lib/index-CEojr58e.js +2 -0
  19. package/lib/index-Cwtynogk.js +54 -0
  20. package/lib/index-DSgWshzu.js +2 -0
  21. package/lib/index-_8uEunjn.js +6 -0
  22. package/lib/index-mBZsirl0.js +14 -0
  23. package/lib/index.d.ts +1 -0
  24. package/lib/index.js +1 -1
  25. package/lib/init-project-BY-a8CIk.js +15 -0
  26. package/lib/installer-C0iBwEpK.js +9 -0
  27. package/lib/{load-from-project-acf7400a.js → load-from-project-wNJg8fme.js} +1 -1
  28. package/lib/once-fkpTAKD3.js +1 -0
  29. package/lib/one_ini_bg.wasm +0 -0
  30. package/lib/project-DFh-2QTw.js +20 -0
  31. package/lib/run-macro-Ck_8Iku3.js +1 -0
  32. package/lib/sat-solver-CqS8Vf6C.js +1 -0
  33. package/lib/string_decoder-CW-j4E6X.js +1 -0
  34. package/lib/test-project-CM-XUOdH.js +1 -0
  35. package/lib/tmp-C7yJT4iq.js +8 -0
  36. package/lib/toml-patch-r8oqFm0h.js +3 -0
  37. package/lib/transform-target-DJmqMjY0.js +2 -0
  38. package/lib/vbapm-add-QPN5uEGK.js +16 -0
  39. package/lib/vbapm-build-BKtQ6OeP.js +9 -0
  40. package/lib/vbapm-export-4H_qDinP.js +7 -0
  41. package/lib/{vbapm-init-5c8eb026.js → vbapm-init-BMY4x_xq.js} +2 -2
  42. package/lib/vbapm-new-DLW9SdvJ.js +17 -0
  43. package/lib/vbapm-run-DzRxAhlD.js +10 -0
  44. package/lib/{vbapm-test-a7b30592.js → vbapm-test-DInh0MDC.js} +1 -1
  45. package/lib/vbapm-version-3Xv7JjGv.js +8 -0
  46. package/lib/vbapm.js +11 -10
  47. package/package.json +124 -137
  48. package/lib/_commonjsHelpers-553b27b3.js +0 -1
  49. package/lib/build-project-eb8454f0.js +0 -3
  50. package/lib/build-target-dbcc69c7.js +0 -9
  51. package/lib/create-project-3154aace.js +0 -10
  52. package/lib/export-project-bc13c1ae.js +0 -4
  53. package/lib/export-target-5d28d188.js +0 -4
  54. package/lib/index-4ce3d28b.js +0 -6
  55. package/lib/index-72c1a91d.js +0 -3
  56. package/lib/index-c5b5f6d1.js +0 -2
  57. package/lib/index-ddd39b65.js +0 -5
  58. package/lib/init-project-ceecd718.js +0 -15
  59. package/lib/installer-dbc2c34a.js +0 -21
  60. package/lib/once-5205b917.js +0 -1
  61. package/lib/project-43370ed3.js +0 -29
  62. package/lib/run-macro-4f1375ca.js +0 -1
  63. package/lib/sat-solver-f9155891.js +0 -1
  64. package/lib/test-project-669dfcfb.js +0 -1
  65. package/lib/tmp-14f9d850.js +0 -9
  66. package/lib/toml-patch.es-6bd2145d.js +0 -3
  67. package/lib/vbapm-build-8ff58485.js +0 -9
  68. package/lib/vbapm-export-96798f4f.js +0 -7
  69. package/lib/vbapm-new-cd174cbb.js +0 -17
  70. package/lib/vbapm-run-2f17fb22.js +0 -10
  71. package/lib/vbapm-version-c5f3d55a.js +0 -8
  72. package/lib/workbook-xml-a61269f4.js +0 -2
@@ -0,0 +1,2 @@
1
+ "use strict";var e,t,r,o,n,s,a,u,c=require("./_commonjsHelpers-Bjf42z7h.js"),i=require("stream"),d=require("zlib"),l=require("http"),h=require("https"),f=require("./once-fkpTAKD3.js"),p=require("querystring"),m=require("url");function y(){if(o)return r;o=1;const e=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];return r=(t,r)=>{if(r._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");const o=new Set(Object.keys(t).concat(e)),n={};for(const e of o)e in r||(n[e]={get(){const r=t[e];return"function"==typeof r?r.bind(t):r},set(r){t[e]=r},enumerable:!0,configurable:!1});return Object.defineProperties(r,n),t.once("aborted",()=>{r.destroy(),r.emit("aborted")}),t.once("close",()=>{t.complete&&r.readable?r.once("end",()=>{r.emit("close")}):r.emit("close")}),r}}function b(){if(s)return n;s=1;const{Transform:e,PassThrough:t}=i,r=d,o=y();return n=n=>{const s=(n.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(s))return n;const a="br"===s;if(a&&"function"!=typeof r.createBrotliDecompress)return n.destroy(new Error("Brotli is not supported on Node.js < 12")),n;let u=!0;const c=new e({transform(e,t,r){u=!1,r(null,e)},flush(e){e()}}),i=new t({autoDestroy:!1,destroy(e,t){n.destroy(),t(e)}}),d=a?r.createBrotliDecompress():r.createUnzip();return d.once("error",e=>{!u||n.readable?i.destroy(e):i.end()}),o(n,i),n.pipe(c).pipe(d).pipe(i),i}}
2
+ /*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var g=function(){if(u)return a;u=1,a=g;const r=t?e:(t=1,e=function(e,t){var r=[];e.on("data",function(e){r.push(e)}),e.once("end",function(){t&&t(null,Buffer.concat(r)),t=null}),e.once("error",function(e){t&&t(e),t=null})}),o=b(),n=l,s=h,c=f.requireOnce(),i=p,d=m,y=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function g(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=c(t),e.url){const{hostname:t,port:r,protocol:o,auth:n,path:s}=d.parse(e.url);delete e.url,t||r||o||n?Object.assign(e,{hostname:t,port:r,protocol:o,auth:n,path:s}):e.path=s}const r={"accept-encoding":"gzip, deflate"};let a;e.headers&&Object.keys(e.headers).forEach(t=>r[t.toLowerCase()]=e.headers[t]),e.headers=r,e.body?a=e.json&&!y(e.body)?JSON.stringify(e.body):e.body:e.form&&(a="string"==typeof e.form?e.form:i.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),a&&(e.method||(e.method="POST"),y(a)||(e.headers["content-length"]=Buffer.byteLength(a)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const u=e.hostname,l=("https:"===e.protocol?s:n).request(e,r=>{if(!1!==e.followRedirects&&r.statusCode>=300&&r.statusCode<400&&r.headers.location){e.url=r.headers.location,delete e.headers.host,r.resume();const o=d.parse(e.url).hostname;return null!==o&&o!==u&&(delete e.headers.cookie,delete e.headers.authorization),"POST"===e.method&&[301,302].includes(r.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0===e.maxRedirects--?t(new Error("too many redirects")):g(e,t)}const n="function"==typeof o&&"HEAD"!==e.method;t(null,n?o(r):r)});return l.on("timeout",()=>{l.abort(),t(new Error("Request timed out"))}),l.on("error",t),y(a)?a.on("error",t).pipe(l):l.end(a),l}return g.concat=(e,t)=>g(e,(o,n)=>{if(o)return t(o);r(n,(r,o)=>{if(r)return t(r);if(e.json)try{o=JSON.parse(o.toString())}catch(r){return t(r,n,o)}t(null,n,o)})}),["get","post","put","patch","head","delete"].forEach(e=>{g[e]=(t,r)=>("string"==typeof t&&(t={url:t}),g(Object.assign({method:e.toUpperCase()},t),r))}),a}(),w=c.getDefaultExportFromCjs(g);function j(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:function(e){let t=[e];return{next:()=>Promise.resolve({done:0===t.length,value:t.pop()}),return:()=>(t=[],{}),[Symbol.asyncIterator](){return this}}}(e)}async function v(e,t){const r=j(e);for(;;){const{value:e,done:o}=await r.next();if(e&&await t(e),o)break}r.return&&r.return()}async function q({onProgress:e,url:t,method:r="GET",headers:o={},agent:n,body:s}){return s&&Array.isArray(s)?s=Buffer.from(await async function(e){let t=0;const r=[];await v(e,e=>{r.push(e),t+=e.byteLength});const o=new Uint8Array(t);let n=0;for(const e of r)o.set(e,n),n+=e.byteLength;return o}(s)):s&&(s=function(e){const{PassThrough:t}=require("readable-stream"),r=new t;return setTimeout(async()=>{await v(e,e=>r.write(e)),r.end()},1),r}(s)),new Promise((e,a)=>{w({url:t,method:r,headers:o,agent:n,body:s},(t,r)=>{if(t)return a(t);try{const t=function(e){const t=Object.getOwnPropertyDescriptor(e,Symbol.asyncIterator);if(t&&t.enumerable)return e;let r=!1;const o=[];let n={};return e.on("data",e=>{o.push(e),n.resolve&&(n.resolve({value:o.shift(),done:!1}),n={})}),e.on("error",e=>{n.reject&&(n.reject(e),n={})}),e.on("end",()=>{r=!0,n.resolve&&(n.resolve({done:!0}),n={})}),{next:()=>new Promise((e,t)=>0===o.length&&r?e({done:!0}):o.length>0?e({value:o.shift(),done:!1}):void(0!==o.length||r||(n={resolve:e,reject:t}))),return(){e.removeAllListeners(),e.destroy&&e.destroy()},[Symbol.asyncIterator](){return this}}}(r);e({url:r.url,method:r.method,statusCode:r.statusCode,statusMessage:r.statusMessage,body:t,headers:r.headers})}catch(e){a(e)}})})}var S={request:q};exports.default=S,exports.request=q;
@@ -0,0 +1,6 @@
1
+ "use strict";var t=require("./_commonjsHelpers-Bjf42z7h.js"),e=require("./index-CEojr58e.js"),i=require("./index-BlteXxjY.js"),r=require("./crc32-Cc3OMFYk.js"),a=require("./installer-C0iBwEpK.js");function n(t,e){return e.forEach(function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach(function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}})}),Object.freeze(t)}var s,o,c,f,d,h,l,u,g={};function w(){if(o)return s;o=1;var t=function(e){if(e=e||{},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if("undefined"==typeof process||void 0===process.domain)throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||t.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||t.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||t.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=t.DEFAULT_MAX_PENDING};return t.DEFAULT_TIMEOUT=0,t.DEFAULT_MAX_OCCUPATION_TIME=0,t.DEFAULT_MAX_EXECUTION_TIME=0,t.DEFAULT_MAX_PENDING=1e3,t.prototype.acquire=function(t,e,i,r){if(Array.isArray(t))return this._acquireBatch(t,e,i,r);if("function"!=typeof e)throw new Error("You must pass a function to execute");var a=null,n=null,s=null;"function"!=typeof i&&(r=i,i=null,s=new this.Promise(function(t,e){a=t,n=e})),r=r||{};var o=!1,c=null,f=null,d=null,h=this,l=function(e,r,c){f&&(clearTimeout(f),f=null),d&&(clearTimeout(d),d=null),e&&(h.queues[t]&&0===h.queues[t].length&&delete h.queues[t],h.domainReentrant&&delete h.domains[t]),o||(s?r?n(r):a(c):"function"==typeof i&&i(r,c),o=!0),e&&h.queues[t]&&h.queues[t].length>0&&h.queues[t].shift()()},u=function(i){if(o)return l(i);c&&(clearTimeout(c),c=null),h.domainReentrant&&i&&(h.domains[t]=process.domain);var a=r.maxExecutionTime||h.maxExecutionTime;if(a&&(d=setTimeout(function(){h.queues[t]&&l(i,new Error("Maximum execution time is exceeded "+t))},a)),1===e.length){var n=!1;try{e(function(t,e){n||(n=!0,l(i,t,e))})}catch(t){n||(n=!0,l(i,t))}}else h._promiseTry(function(){return e()}).then(function(t){l(i,void 0,t)},function(t){l(i,t)})};h.domainReentrant&&process.domain&&(u=process.domain.bind(u));var g=r.maxPending||h.maxPending;if(h.queues[t])if(h.domainReentrant&&process.domain&&process.domain===h.domains[t])u(!1);else if(h.queues[t].length>=g)l(!1,new Error("Too many pending tasks in queue "+t));else{var w=function(){u(!0)};r.skipQueue?h.queues[t].unshift(w):h.queues[t].push(w);var p=r.timeout||h.timeout;p&&(c=setTimeout(function(){c=null,l(!1,new Error("async-lock timed out in queue "+t))},p))}else h.queues[t]=[],u(!0);var m=r.maxOccupationTime||h.maxOccupationTime;return m&&(f=setTimeout(function(){h.queues[t]&&l(!1,new Error("Maximum occupation time is exceeded in queue "+t))},m)),s||void 0},t.prototype._acquireBatch=function(t,e,i,r){"function"!=typeof i&&(r=i,i=null);var a=this,n=t.reduceRight(function(t,e){return function(t,e){return function(i){a.acquire(t,e,i,r)}}(e,t)},e);if("function"!=typeof i)return new this.Promise(function(t,e){1===n.length?n(function(i,r){i?e(i):t(r)}):t(n())});n(i)},t.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},t.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(t){return this.Promise.reject(t)}},s=t}function p(){if(u)return l;u=1;var t=e.requireInherits(),r=function(){if(h)return d;h=1;var t=e.requireSafeBuffer().Buffer,r=i.requireToBuffer();function a(e,i){this._block=t.alloc(e),this._finalSize=i,this._blockSize=e,this._len=0}return a.prototype.update=function(t,e){t=r(t,e||"utf8");for(var i=this._block,a=this._blockSize,n=t.length,s=this._len,o=0;o<n;){for(var c=s%a,f=Math.min(n-o,a-c),d=0;d<f;d++)i[c+d]=t[o+d];o+=f,(s+=f)%a===0&&this._update(i)}return this._len+=n,this},a.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var i=8*this._len;if(i<=4294967295)this._block.writeUInt32BE(i,this._blockSize-4);else{var r=(4294967295&i)>>>0,a=(i-r)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var n=this._hash();return t?n.toString(t):n},a.prototype._update=function(){throw new Error("_update must be implemented by subclass")},d=a}(),a=e.requireSafeBuffer().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function o(){this.init(),this._w=s,r.call(this,64,56)}function c(t){return t<<1|t>>>31}function f(t){return t<<5|t>>>27}function g(t){return t<<30|t>>>2}function w(t,e,i,r){return 0===t?e&i|~e&r:2===t?e&i|e&r|i&r:e^i^r}return t(o,r),o.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},o.prototype._update=function(t){for(var e=this._w,i=0|this._a,r=0|this._b,a=0|this._c,s=0|this._d,o=0|this._e,d=0;d<16;++d)e[d]=t.readInt32BE(4*d);for(;d<80;++d)e[d]=c(e[d-3]^e[d-8]^e[d-14]^e[d-16]);for(var h=0;h<80;++h){var l=~~(h/20),u=f(i)+w(l,r,a,s)+o+e[h]+n[l]|0;o=s,s=a,a=g(r),r=i,i=u}this._a=i+this._a|0,this._b=r+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0},o.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},l=o}var m,y={};function b(){return m||(m=1,function(t){var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var a in r)i(r,a)&&(t[a]=r[a])}}return t},t.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,i,r,a){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),a);else for(var n=0;n<r;n++)t[a+n]=e[i+n]},flattenChunks:function(t){var e,i,r,a,n,s;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(s=new Uint8Array(r),a=0,e=0,i=t.length;e<i;e++)n=t[e],s.set(n,a),a+=n.length;return s}},a={arraySet:function(t,e,i,r,a){for(var n=0;n<r;n++)t[a+n]=e[i+n]},flattenChunks:function(t){return[].concat.apply([],t)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,a))},t.setTyped(e)}(y)),y}var _,v,x,k,E,$,S,B,A={},R={},P={};function j(){if(_)return P;_=1;var t=b();function e(t){for(var e=t.length;--e>=0;)t[e]=0}var i=256,r=286,a=30,n=15,s=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],o=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],d=new Array(576);e(d);var h=new Array(60);e(h);var l=new Array(512);e(l);var u=new Array(256);e(u);var g=new Array(29);e(g);var w,p,m,y=new Array(a);function v(t,e,i,r,a){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=a,this.has_stree=t&&t.length}function x(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function k(t){return t<256?l[t]:l[256+(t>>>7)]}function E(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function $(t,e,i){t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,E(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)}function S(t,e,i){$(t,i[2*e],i[2*e+1])}function B(t,e){var i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1}function A(t,e,i){var r,a,s=new Array(16),o=0;for(r=1;r<=n;r++)s[r]=o=o+i[r-1]<<1;for(a=0;a<=e;a++){var c=t[2*a+1];0!==c&&(t[2*a]=B(s[c]++,c))}}function R(t){var e;for(e=0;e<r;e++)t.dyn_ltree[2*e]=0;for(e=0;e<a;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function j(t){t.bi_valid>8?E(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function O(t,e,i,r){var a=2*e,n=2*i;return t[a]<t[n]||t[a]===t[n]&&r[e]<=r[i]}function I(t,e,i){for(var r=t.heap[i],a=i<<1;a<=t.heap_len&&(a<t.heap_len&&O(e,t.heap[a+1],t.heap[a],t.depth)&&a++,!O(e,r,t.heap[a],t.depth));)t.heap[i]=t.heap[a],i=a,a<<=1;t.heap[i]=r}function C(t,e,r){var a,n,c,f,d=0;if(0!==t.last_lit)do{a=t.pending_buf[t.d_buf+2*d]<<8|t.pending_buf[t.d_buf+2*d+1],n=t.pending_buf[t.l_buf+d],d++,0===a?S(t,n,e):(S(t,(c=u[n])+i+1,e),0!==(f=s[c])&&$(t,n-=g[c],f),S(t,c=k(--a),r),0!==(f=o[c])&&$(t,a-=y[c],f))}while(d<t.last_lit);S(t,256,e)}function z(t,e){var i,r,a,s=e.dyn_tree,o=e.stat_desc.static_tree,c=e.stat_desc.has_stree,f=e.stat_desc.elems,d=-1;for(t.heap_len=0,t.heap_max=573,i=0;i<f;i++)0!==s[2*i]?(t.heap[++t.heap_len]=d=i,t.depth[i]=0):s[2*i+1]=0;for(;t.heap_len<2;)s[2*(a=t.heap[++t.heap_len]=d<2?++d:0)]=1,t.depth[a]=0,t.opt_len--,c&&(t.static_len-=o[2*a+1]);for(e.max_code=d,i=t.heap_len>>1;i>=1;i--)I(t,s,i);a=f;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],I(t,s,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,s[2*a]=s[2*i]+s[2*r],t.depth[a]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,s[2*i+1]=s[2*r+1]=a,t.heap[1]=a++,I(t,s,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,a,s,o,c,f=e.dyn_tree,d=e.max_code,h=e.stat_desc.static_tree,l=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,g=e.stat_desc.extra_base,w=e.stat_desc.max_length,p=0;for(s=0;s<=n;s++)t.bl_count[s]=0;for(f[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)(s=f[2*f[2*(r=t.heap[i])+1]+1]+1)>w&&(s=w,p++),f[2*r+1]=s,r>d||(t.bl_count[s]++,o=0,r>=g&&(o=u[r-g]),c=f[2*r],t.opt_len+=c*(s+o),l&&(t.static_len+=c*(h[2*r+1]+o)));if(0!==p){do{for(s=w-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[w]--,p-=2}while(p>0);for(s=w;0!==s;s--)for(r=t.bl_count[s];0!==r;)(a=t.heap[--i])>d||(f[2*a+1]!==s&&(t.opt_len+=(s-f[2*a+1])*f[2*a],f[2*a+1]=s),r--)}}(t,e),A(s,d,t.bl_count)}function D(t,e,i){var r,a,n=-1,s=e[1],o=0,c=7,f=4;for(0===s&&(c=138,f=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)a=s,s=e[2*(r+1)+1],++o<c&&a===s||(o<f?t.bl_tree[2*a]+=o:0!==a?(a!==n&&t.bl_tree[2*a]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,n=a,0===s?(c=138,f=3):a===s?(c=6,f=3):(c=7,f=4))}function T(t,e,i){var r,a,n=-1,s=e[1],o=0,c=7,f=4;for(0===s&&(c=138,f=3),r=0;r<=i;r++)if(a=s,s=e[2*(r+1)+1],!(++o<c&&a===s)){if(o<f)do{S(t,a,t.bl_tree)}while(0!==--o);else 0!==a?(a!==n&&(S(t,a,t.bl_tree),o--),S(t,16,t.bl_tree),$(t,o-3,2)):o<=10?(S(t,17,t.bl_tree),$(t,o-3,3)):(S(t,18,t.bl_tree),$(t,o-11,7));o=0,n=a,0===s?(c=138,f=3):a===s?(c=6,f=3):(c=7,f=4)}}e(y);var U=!1;function N(e,i,r,a){$(e,0+(a?1:0),3),function(e,i,r){j(e),E(e,r),E(e,~r),t.arraySet(e.pending_buf,e.window,i,r,e.pending),e.pending+=r}(e,i,r)}return P._tr_init=function(t){U||(!function(){var t,e,i,f,b,_=new Array(16);for(i=0,f=0;f<28;f++)for(g[f]=i,t=0;t<1<<s[f];t++)u[i++]=f;for(u[i-1]=f,b=0,f=0;f<16;f++)for(y[f]=b,t=0;t<1<<o[f];t++)l[b++]=f;for(b>>=7;f<a;f++)for(y[f]=b<<7,t=0;t<1<<o[f]-7;t++)l[256+b++]=f;for(e=0;e<=n;e++)_[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,_[8]++;for(;t<=255;)d[2*t+1]=9,t++,_[9]++;for(;t<=279;)d[2*t+1]=7,t++,_[7]++;for(;t<=287;)d[2*t+1]=8,t++,_[8]++;for(A(d,287,_),t=0;t<a;t++)h[2*t+1]=5,h[2*t]=B(t,5);w=new v(d,s,257,r,n),p=new v(h,o,0,a,n),m=new v(new Array(0),c,0,19,7)}(),U=!0),t.l_desc=new x(t.dyn_ltree,w),t.d_desc=new x(t.dyn_dtree,p),t.bl_desc=new x(t.bl_tree,m),t.bi_buf=0,t.bi_valid=0,R(t)},P._tr_stored_block=N,P._tr_flush_block=function(t,e,r,a){var n,s,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<i;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),z(t,t.l_desc),z(t,t.d_desc),o=function(t){var e;for(D(t,t.dyn_ltree,t.l_desc.max_code),D(t,t.dyn_dtree,t.d_desc.max_code),z(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*f[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==e?N(t,e,r,a):4===t.strategy||s===n?($(t,2+(a?1:0),3),C(t,d,h)):($(t,4+(a?1:0),3),function(t,e,i,r){var a;for($(t,e-257,5),$(t,i-1,5),$(t,r-4,4),a=0;a<r;a++)$(t,t.bl_tree[2*f[a]+1],3);T(t,t.dyn_ltree,e-1),T(t,t.dyn_dtree,i-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),C(t,t.dyn_ltree,t.dyn_dtree)),R(t),a&&j(t)},P._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(u[r]+i+1)]++,t.dyn_dtree[2*k(e)]++),t.last_lit===t.lit_bufsize-1},P._tr_align=function(t){$(t,2,3),S(t,256,d),function(t){16===t.bi_valid?(E(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)},P}function O(){if(x)return v;return x=1,v=function(t,e,i,r){for(var a=65535&t,n=t>>>16&65535,s=0;0!==i;){i-=s=i>2e3?2e3:i;do{n=n+(a=a+e[r++]|0)|0}while(--s);a%=65521,n%=65521}return a|n<<16}}function I(){if(E)return k;E=1;var t=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();return k=function(e,i,r,a){var n=t,s=a+r;e^=-1;for(var o=a;o<s;o++)e=e>>>8^n[255&(e^i[o])];return-1^e}}function C(){return S?$:(S=1,$={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"})}function z(){if(B)return R;B=1;var t,e=b(),i=j(),r=O(),a=I(),n=C(),s=-2,o=258,c=262,f=103,d=113,h=666;function l(t,e){return t.msg=n[e],e}function u(t){return(t<<1)-(t>4?9:0)}function g(t){for(var e=t.length;--e>=0;)t[e]=0}function w(t){var i=t.state,r=i.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(e.arraySet(t.output,i.pending_buf,i.pending_out,r,t.next_out),t.next_out+=r,i.pending_out+=r,t.total_out+=r,t.avail_out-=r,i.pending-=r,0===i.pending&&(i.pending_out=0))}function p(t,e){i._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,w(t.strm)}function m(t,e){t.pending_buf[t.pending++]=e}function y(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function _(t,i,n,s){var o=t.avail_in;return o>s&&(o=s),0===o?0:(t.avail_in-=o,e.arraySet(i,t.input,t.next_in,o,n),1===t.state.wrap?t.adler=r(t.adler,i,o,n):2===t.state.wrap&&(t.adler=a(t.adler,i,o,n)),t.next_in+=o,t.total_in+=o,o)}function v(t,e){var i,r,a=t.max_chain_length,n=t.strstart,s=t.prev_length,f=t.nice_match,d=t.strstart>t.w_size-c?t.strstart-(t.w_size-c):0,h=t.window,l=t.w_mask,u=t.prev,g=t.strstart+o,w=h[n+s-1],p=h[n+s];t.prev_length>=t.good_match&&(a>>=2),f>t.lookahead&&(f=t.lookahead);do{if(h[(i=e)+s]===p&&h[i+s-1]===w&&h[i]===h[n]&&h[++i]===h[n+1]){n+=2,i++;do{}while(h[++n]===h[++i]&&h[++n]===h[++i]&&h[++n]===h[++i]&&h[++n]===h[++i]&&h[++n]===h[++i]&&h[++n]===h[++i]&&h[++n]===h[++i]&&h[++n]===h[++i]&&n<g);if(r=o-(g-n),n=g-o,r>s){if(t.match_start=e,s=r,r>=f)break;w=h[n+s-1],p=h[n+s]}}}while((e=u[e&l])>d&&0!==--a);return s<=t.lookahead?s:t.lookahead}function x(t){var i,r,a,n,s,o=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=o+(o-c)){e.arraySet(t.window,t.window,o,o,0),t.match_start-=o,t.strstart-=o,t.block_start-=o,i=r=t.hash_size;do{a=t.head[--i],t.head[i]=a>=o?a-o:0}while(--r);i=r=o;do{a=t.prev[--i],t.prev[i]=a>=o?a-o:0}while(--r);n+=o}if(0===t.strm.avail_in)break;if(r=_(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+3-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<c&&0!==t.strm.avail_in)}function k(t,e){for(var r,a;;){if(t.lookahead<c){if(x(t),t.lookahead<c&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-c&&(t.match_length=v(t,r)),t.match_length>=3)if(a=i._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else a=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(a&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}function E(t,e){for(var r,a,n;;){if(t.lookahead<c){if(x(t),t.lookahead<c&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-c&&(t.match_length=v(t,r),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,a=i._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,a&&(p(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((a=i._tr_tally(t,0,t.window[t.strstart-1]))&&p(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(a=i._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}function $(t,e,i,r,a){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=a}function S(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new e.Buf16(1146),this.dyn_dtree=new e.Buf16(122),this.bl_tree=new e.Buf16(78),g(this.dyn_ltree),g(this.dyn_dtree),g(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new e.Buf16(16),this.heap=new e.Buf16(573),g(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new e.Buf16(573),g(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function A(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:d,t.adler=2===e.wrap?0:1,e.last_flush=0,i._tr_init(e),0):l(t,s)}function P(e){var i,r=A(e);return 0===r&&((i=e.state).window_size=2*i.w_size,g(i.head),i.max_lazy_match=t[i.level].max_lazy,i.good_match=t[i.level].good_length,i.nice_match=t[i.level].nice_length,i.max_chain_length=t[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),r}function z(t,i,r,a,n,o){if(!t)return s;var c=1;if(-1===i&&(i=6),a<0?(c=0,a=-a):a>15&&(c=2,a-=16),n<1||n>9||8!==r||a<8||a>15||i<0||i>9||o<0||o>4)return l(t,s);8===a&&(a=9);var f=new S;return t.state=f,f.strm=t,f.wrap=c,f.gzhead=null,f.w_bits=a,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=n+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+3-1)/3),f.window=new e.Buf8(2*f.w_size),f.head=new e.Buf16(f.hash_size),f.prev=new e.Buf16(f.w_size),f.lit_bufsize=1<<n+6,f.pending_buf_size=4*f.lit_bufsize,f.pending_buf=new e.Buf8(f.pending_buf_size),f.d_buf=1*f.lit_bufsize,f.l_buf=3*f.lit_bufsize,f.level=i,f.strategy=o,f.method=r,P(t)}return t=[new $(0,0,0,0,function(t,e){var i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(x(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,p(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-c&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(p(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(p(t,!1),t.strm.avail_out),1)}),new $(4,4,8,4,k),new $(4,5,16,8,k),new $(4,6,32,32,k),new $(4,4,16,16,E),new $(8,16,32,32,E),new $(8,16,128,128,E),new $(8,32,128,256,E),new $(32,128,258,1024,E),new $(32,258,258,4096,E)],R.deflateInit=function(t,e){return z(t,e,8,15,8,0)},R.deflateInit2=z,R.deflateReset=P,R.deflateResetKeep=A,R.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?s:(t.state.gzhead=e,0):s},R.deflate=function(e,r){var n,c,b,_;if(!e||!e.state||r>5||r<0)return e?l(e,s):s;if(c=e.state,!e.output||!e.input&&0!==e.avail_in||c.status===h&&4!==r)return l(e,0===e.avail_out?-5:s);if(c.strm=e,n=c.last_flush,c.last_flush=r,42===c.status)if(2===c.wrap)e.adler=0,m(c,31),m(c,139),m(c,8),c.gzhead?(m(c,(c.gzhead.text?1:0)+(c.gzhead.hcrc?2:0)+(c.gzhead.extra?4:0)+(c.gzhead.name?8:0)+(c.gzhead.comment?16:0)),m(c,255&c.gzhead.time),m(c,c.gzhead.time>>8&255),m(c,c.gzhead.time>>16&255),m(c,c.gzhead.time>>24&255),m(c,9===c.level?2:c.strategy>=2||c.level<2?4:0),m(c,255&c.gzhead.os),c.gzhead.extra&&c.gzhead.extra.length&&(m(c,255&c.gzhead.extra.length),m(c,c.gzhead.extra.length>>8&255)),c.gzhead.hcrc&&(e.adler=a(e.adler,c.pending_buf,c.pending,0)),c.gzindex=0,c.status=69):(m(c,0),m(c,0),m(c,0),m(c,0),m(c,0),m(c,9===c.level?2:c.strategy>=2||c.level<2?4:0),m(c,3),c.status=d);else{var v=8+(c.w_bits-8<<4)<<8;v|=(c.strategy>=2||c.level<2?0:c.level<6?1:6===c.level?2:3)<<6,0!==c.strstart&&(v|=32),v+=31-v%31,c.status=d,y(c,v),0!==c.strstart&&(y(c,e.adler>>>16),y(c,65535&e.adler)),e.adler=1}if(69===c.status)if(c.gzhead.extra){for(b=c.pending;c.gzindex<(65535&c.gzhead.extra.length)&&(c.pending!==c.pending_buf_size||(c.gzhead.hcrc&&c.pending>b&&(e.adler=a(e.adler,c.pending_buf,c.pending-b,b)),w(e),b=c.pending,c.pending!==c.pending_buf_size));)m(c,255&c.gzhead.extra[c.gzindex]),c.gzindex++;c.gzhead.hcrc&&c.pending>b&&(e.adler=a(e.adler,c.pending_buf,c.pending-b,b)),c.gzindex===c.gzhead.extra.length&&(c.gzindex=0,c.status=73)}else c.status=73;if(73===c.status)if(c.gzhead.name){b=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>b&&(e.adler=a(e.adler,c.pending_buf,c.pending-b,b)),w(e),b=c.pending,c.pending===c.pending_buf_size)){_=1;break}_=c.gzindex<c.gzhead.name.length?255&c.gzhead.name.charCodeAt(c.gzindex++):0,m(c,_)}while(0!==_);c.gzhead.hcrc&&c.pending>b&&(e.adler=a(e.adler,c.pending_buf,c.pending-b,b)),0===_&&(c.gzindex=0,c.status=91)}else c.status=91;if(91===c.status)if(c.gzhead.comment){b=c.pending;do{if(c.pending===c.pending_buf_size&&(c.gzhead.hcrc&&c.pending>b&&(e.adler=a(e.adler,c.pending_buf,c.pending-b,b)),w(e),b=c.pending,c.pending===c.pending_buf_size)){_=1;break}_=c.gzindex<c.gzhead.comment.length?255&c.gzhead.comment.charCodeAt(c.gzindex++):0,m(c,_)}while(0!==_);c.gzhead.hcrc&&c.pending>b&&(e.adler=a(e.adler,c.pending_buf,c.pending-b,b)),0===_&&(c.status=f)}else c.status=f;if(c.status===f&&(c.gzhead.hcrc?(c.pending+2>c.pending_buf_size&&w(e),c.pending+2<=c.pending_buf_size&&(m(c,255&e.adler),m(c,e.adler>>8&255),e.adler=0,c.status=d)):c.status=d),0!==c.pending){if(w(e),0===e.avail_out)return c.last_flush=-1,0}else if(0===e.avail_in&&u(r)<=u(n)&&4!==r)return l(e,-5);if(c.status===h&&0!==e.avail_in)return l(e,-5);if(0!==e.avail_in||0!==c.lookahead||0!==r&&c.status!==h){var k=2===c.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(x(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}(c,r):3===c.strategy?function(t,e){for(var r,a,n,s,c=t.window;;){if(t.lookahead<=o){if(x(t),t.lookahead<=o&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(a=c[n=t.strstart-1])===c[++n]&&a===c[++n]&&a===c[++n]){s=t.strstart+o;do{}while(a===c[++n]&&a===c[++n]&&a===c[++n]&&a===c[++n]&&a===c[++n]&&a===c[++n]&&a===c[++n]&&a===c[++n]&&n<s);t.match_length=o-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=i._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}(c,r):t[c.level].func(c,r);if(3!==k&&4!==k||(c.status=h),1===k||3===k)return 0===e.avail_out&&(c.last_flush=-1),0;if(2===k&&(1===r?i._tr_align(c):5!==r&&(i._tr_stored_block(c,0,0,!1),3===r&&(g(c.head),0===c.lookahead&&(c.strstart=0,c.block_start=0,c.insert=0))),w(e),0===e.avail_out))return c.last_flush=-1,0}return 4!==r?0:c.wrap<=0?1:(2===c.wrap?(m(c,255&e.adler),m(c,e.adler>>8&255),m(c,e.adler>>16&255),m(c,e.adler>>24&255),m(c,255&e.total_in),m(c,e.total_in>>8&255),m(c,e.total_in>>16&255),m(c,e.total_in>>24&255)):(y(c,e.adler>>>16),y(c,65535&e.adler)),w(e),c.wrap>0&&(c.wrap=-c.wrap),0!==c.pending?0:1)},R.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&e!==f&&e!==d&&e!==h?l(t,s):(t.state=null,e===d?l(t,-3):0):s},R.deflateSetDictionary=function(t,i){var a,n,o,c,f,d,h,l,u=i.length;if(!t||!t.state)return s;if(2===(c=(a=t.state).wrap)||1===c&&42!==a.status||a.lookahead)return s;for(1===c&&(t.adler=r(t.adler,i,u,0)),a.wrap=0,u>=a.w_size&&(0===c&&(g(a.head),a.strstart=0,a.block_start=0,a.insert=0),l=new e.Buf8(a.w_size),e.arraySet(l,i,u-a.w_size,a.w_size,0),i=l,u=a.w_size),f=t.avail_in,d=t.next_in,h=t.input,t.avail_in=u,t.next_in=0,t.input=i,x(a);a.lookahead>=3;){n=a.strstart,o=a.lookahead-2;do{a.ins_h=(a.ins_h<<a.hash_shift^a.window[n+3-1])&a.hash_mask,a.prev[n&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=n,n++}while(--o);a.strstart=n,a.lookahead=2,x(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=2,a.match_available=0,t.next_in=d,t.input=h,t.avail_in=f,a.wrap=c,0},R.deflateInfo="pako deflate (from Nodeca project)",R}var D,T,U,N,M={};function F(){if(D)return M;D=1;var t=b(),e=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch(t){e=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){i=!1}for(var r=new t.Buf8(256),a=0;a<256;a++)r[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function n(r,a){if(a<65534&&(r.subarray&&i||!r.subarray&&e))return String.fromCharCode.apply(null,t.shrinkBuf(r,a));for(var n="",s=0;s<a;s++)n+=String.fromCharCode(r[s]);return n}return r[254]=r[254]=1,M.string2buf=function(e){var i,r,a,n,s,o=e.length,c=0;for(n=0;n<o;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<o&&56320==(64512&(a=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(a-56320),n++),c+=r<128?1:r<2048?2:r<65536?3:4;for(i=new t.Buf8(c),s=0,n=0;s<c;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<o&&56320==(64512&(a=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(a-56320),n++),r<128?i[s++]=r:r<2048?(i[s++]=192|r>>>6,i[s++]=128|63&r):r<65536?(i[s++]=224|r>>>12,i[s++]=128|r>>>6&63,i[s++]=128|63&r):(i[s++]=240|r>>>18,i[s++]=128|r>>>12&63,i[s++]=128|r>>>6&63,i[s++]=128|63&r);return i},M.buf2binstring=function(t){return n(t,t.length)},M.binstring2buf=function(e){for(var i=new t.Buf8(e.length),r=0,a=i.length;r<a;r++)i[r]=e.charCodeAt(r);return i},M.buf2string=function(t,e){var i,a,s,o,c=e||t.length,f=new Array(2*c);for(a=0,i=0;i<c;)if((s=t[i++])<128)f[a++]=s;else if((o=r[s])>4)f[a++]=65533,i+=o-1;else{for(s&=2===o?31:3===o?15:7;o>1&&i<c;)s=s<<6|63&t[i++],o--;o>1?f[a++]=65533:s<65536?f[a++]=s:(s-=65536,f[a++]=55296|s>>10&1023,f[a++]=56320|1023&s)}return n(f,a)},M.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+r[t[i]]>e?i:e},M}function H(){if(U)return T;return U=1,T=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}var q,L,W,Z,G,K,V,X,Y,J,Q,tt,et,it,rt,at,nt,st,ot,ct,ft,dt={},ht={};function lt(){if(G)return ht;G=1;var t=b(),e=O(),i=I(),r=L?q:(L=1,q=function(t,e){var i,r,a,n,s,o,c,f,d,h,l,u,g,w,p,m,y,b,_,v,x,k,E,$,S;i=t.state,r=t.next_in,$=t.input,a=r+(t.avail_in-5),n=t.next_out,S=t.output,s=n-(e-t.avail_out),o=n+(t.avail_out-257),c=i.dmax,f=i.wsize,d=i.whave,h=i.wnext,l=i.window,u=i.hold,g=i.bits,w=i.lencode,p=i.distcode,m=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{g<15&&(u+=$[r++]<<g,g+=8,u+=$[r++]<<g,g+=8),b=w[u&m];e:for(;;){if(u>>>=_=b>>>24,g-=_,0==(_=b>>>16&255))S[n++]=65535&b;else{if(!(16&_)){if(64&_){if(32&_){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}b=w[(65535&b)+(u&(1<<_)-1)];continue e}for(v=65535&b,(_&=15)&&(g<_&&(u+=$[r++]<<g,g+=8),v+=u&(1<<_)-1,u>>>=_,g-=_),g<15&&(u+=$[r++]<<g,g+=8,u+=$[r++]<<g,g+=8),b=p[u&y];;){if(u>>>=_=b>>>24,g-=_,16&(_=b>>>16&255)){if(x=65535&b,g<(_&=15)&&(u+=$[r++]<<g,(g+=8)<_&&(u+=$[r++]<<g,g+=8)),(x+=u&(1<<_)-1)>c){t.msg="invalid distance too far back",i.mode=30;break t}if(u>>>=_,g-=_,x>(_=n-s)){if((_=x-_)>d&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(k=0,E=l,0===h){if(k+=f-_,_<v){v-=_;do{S[n++]=l[k++]}while(--_);k=n-x,E=S}}else if(h<_){if(k+=f+h-_,(_-=h)<v){v-=_;do{S[n++]=l[k++]}while(--_);if(k=0,h<v){v-=_=h;do{S[n++]=l[k++]}while(--_);k=n-x,E=S}}}else if(k+=h-_,_<v){v-=_;do{S[n++]=l[k++]}while(--_);k=n-x,E=S}for(;v>2;)S[n++]=E[k++],S[n++]=E[k++],S[n++]=E[k++],v-=3;v&&(S[n++]=E[k++],v>1&&(S[n++]=E[k++]))}else{k=n-x;do{S[n++]=S[k++],S[n++]=S[k++],S[n++]=S[k++],v-=3}while(v>2);v&&(S[n++]=S[k++],v>1&&(S[n++]=S[k++]))}break}if(64&_){t.msg="invalid distance code",i.mode=30;break t}b=p[(65535&b)+(u&(1<<_)-1)]}}break}}while(r<a&&n<o);r-=v=g>>3,u&=(1<<(g-=v<<3))-1,t.next_in=r,t.next_out=n,t.avail_in=r<a?a-r+5:5-(r-a),t.avail_out=n<o?o-n+257:257-(n-o),i.hold=u,i.bits=g}),a=function(){if(Z)return W;Z=1;var t=b(),e=15,i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],r=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];return W=function(s,o,c,f,d,h,l,u){var g,w,p,m,y,b,_,v,x,k=u.bits,E=0,$=0,S=0,B=0,A=0,R=0,P=0,j=0,O=0,I=0,C=null,z=0,D=new t.Buf16(16),T=new t.Buf16(16),U=null,N=0;for(E=0;E<=e;E++)D[E]=0;for($=0;$<f;$++)D[o[c+$]]++;for(A=k,B=e;B>=1&&0===D[B];B--);if(A>B&&(A=B),0===B)return d[h++]=20971520,d[h++]=20971520,u.bits=1,0;for(S=1;S<B&&0===D[S];S++);for(A<S&&(A=S),j=1,E=1;E<=e;E++)if(j<<=1,(j-=D[E])<0)return-1;if(j>0&&(0===s||1!==B))return-1;for(T[1]=0,E=1;E<e;E++)T[E+1]=T[E]+D[E];for($=0;$<f;$++)0!==o[c+$]&&(l[T[o[c+$]]++]=$);if(0===s?(C=U=l,b=19):1===s?(C=i,z-=257,U=r,N-=257,b=256):(C=a,U=n,b=-1),I=0,$=0,E=S,y=h,R=A,P=0,p=-1,m=(O=1<<A)-1,1===s&&O>852||2===s&&O>592)return 1;for(;;){_=E-P,l[$]<b?(v=0,x=l[$]):l[$]>b?(v=U[N+l[$]],x=C[z+l[$]]):(v=96,x=0),g=1<<E-P,S=w=1<<R;do{d[y+(I>>P)+(w-=g)]=_<<24|v<<16|x}while(0!==w);for(g=1<<E-1;I&g;)g>>=1;if(0!==g?(I&=g-1,I+=g):I=0,$++,0===--D[E]){if(E===B)break;E=o[c+l[$]]}if(E>A&&(I&m)!==p){for(0===P&&(P=A),y+=S,j=1<<(R=E-P);R+P<B&&!((j-=D[R+P])<=0);)R++,j<<=1;if(O+=1<<R,1===s&&O>852||2===s&&O>592)return 1;d[p=I&m]=A<<24|R<<16|y-h}}return 0!==I&&(d[y+I]=E-P<<24|64<<16),u.bits=A,0}}(),n=-2,s=12,o=30;function c(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function f(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var i;return e&&e.state?(i=e.state,e.total_in=e.total_out=i.total=0,e.msg="",i.wrap&&(e.adler=1&i.wrap),i.mode=1,i.last=0,i.havedict=0,i.dmax=32768,i.head=null,i.hold=0,i.bits=0,i.lencode=i.lendyn=new t.Buf32(852),i.distcode=i.distdyn=new t.Buf32(592),i.sane=1,i.back=-1,0):n}function h(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,d(t)):n}function l(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?n:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,h(t))):n}function u(t,e){var i,r;return t?(r=new f,t.state=r,r.window=null,0!==(i=l(t,e))&&(t.state=null),i):n}var g,w,p=!0;function m(e){if(p){var i;for(g=new t.Buf32(512),w=new t.Buf32(32),i=0;i<144;)e.lens[i++]=8;for(;i<256;)e.lens[i++]=9;for(;i<280;)e.lens[i++]=7;for(;i<288;)e.lens[i++]=8;for(a(1,e.lens,0,288,g,0,e.work,{bits:9}),i=0;i<32;)e.lens[i++]=5;a(2,e.lens,0,32,w,0,e.work,{bits:5}),p=!1}e.lencode=g,e.lenbits=9,e.distcode=w,e.distbits=5}function y(e,i,r,a){var n,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new t.Buf8(s.wsize)),a>=s.wsize?(t.arraySet(s.window,i,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((n=s.wsize-s.wnext)>a&&(n=a),t.arraySet(s.window,i,r-a,n,s.wnext),(a-=n)?(t.arraySet(s.window,i,r-a,a,0),s.wnext=a,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}return ht.inflateReset=h,ht.inflateReset2=l,ht.inflateResetKeep=d,ht.inflateInit=function(t){return u(t,15)},ht.inflateInit2=u,ht.inflate=function(f,d){var h,l,u,g,w,p,b,_,v,x,k,E,$,S,B,A,R,P,j,O,I,C,z,D,T=0,U=new t.Buf8(4),N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!f||!f.state||!f.output||!f.input&&0!==f.avail_in)return n;(h=f.state).mode===s&&(h.mode=13),w=f.next_out,u=f.output,b=f.avail_out,g=f.next_in,l=f.input,p=f.avail_in,_=h.hold,v=h.bits,x=p,k=b,C=0;t:for(;;)switch(h.mode){case 1:if(0===h.wrap){h.mode=13;break}for(;v<16;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(2&h.wrap&&35615===_){h.check=0,U[0]=255&_,U[1]=_>>>8&255,h.check=i(h.check,U,2,0),_=0,v=0,h.mode=2;break}if(h.flags=0,h.head&&(h.head.done=!1),!(1&h.wrap)||(((255&_)<<8)+(_>>8))%31){f.msg="incorrect header check",h.mode=o;break}if(8!=(15&_)){f.msg="unknown compression method",h.mode=o;break}if(v-=4,I=8+(15&(_>>>=4)),0===h.wbits)h.wbits=I;else if(I>h.wbits){f.msg="invalid window size",h.mode=o;break}h.dmax=1<<I,f.adler=h.check=1,h.mode=512&_?10:s,_=0,v=0;break;case 2:for(;v<16;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(h.flags=_,8!=(255&h.flags)){f.msg="unknown compression method",h.mode=o;break}if(57344&h.flags){f.msg="unknown header flags set",h.mode=o;break}h.head&&(h.head.text=_>>8&1),512&h.flags&&(U[0]=255&_,U[1]=_>>>8&255,h.check=i(h.check,U,2,0)),_=0,v=0,h.mode=3;case 3:for(;v<32;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}h.head&&(h.head.time=_),512&h.flags&&(U[0]=255&_,U[1]=_>>>8&255,U[2]=_>>>16&255,U[3]=_>>>24&255,h.check=i(h.check,U,4,0)),_=0,v=0,h.mode=4;case 4:for(;v<16;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}h.head&&(h.head.xflags=255&_,h.head.os=_>>8),512&h.flags&&(U[0]=255&_,U[1]=_>>>8&255,h.check=i(h.check,U,2,0)),_=0,v=0,h.mode=5;case 5:if(1024&h.flags){for(;v<16;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}h.length=_,h.head&&(h.head.extra_len=_),512&h.flags&&(U[0]=255&_,U[1]=_>>>8&255,h.check=i(h.check,U,2,0)),_=0,v=0}else h.head&&(h.head.extra=null);h.mode=6;case 6:if(1024&h.flags&&((E=h.length)>p&&(E=p),E&&(h.head&&(I=h.head.extra_len-h.length,h.head.extra||(h.head.extra=new Array(h.head.extra_len)),t.arraySet(h.head.extra,l,g,E,I)),512&h.flags&&(h.check=i(h.check,l,E,g)),p-=E,g+=E,h.length-=E),h.length))break t;h.length=0,h.mode=7;case 7:if(2048&h.flags){if(0===p)break t;E=0;do{I=l[g+E++],h.head&&I&&h.length<65536&&(h.head.name+=String.fromCharCode(I))}while(I&&E<p);if(512&h.flags&&(h.check=i(h.check,l,E,g)),p-=E,g+=E,I)break t}else h.head&&(h.head.name=null);h.length=0,h.mode=8;case 8:if(4096&h.flags){if(0===p)break t;E=0;do{I=l[g+E++],h.head&&I&&h.length<65536&&(h.head.comment+=String.fromCharCode(I))}while(I&&E<p);if(512&h.flags&&(h.check=i(h.check,l,E,g)),p-=E,g+=E,I)break t}else h.head&&(h.head.comment=null);h.mode=9;case 9:if(512&h.flags){for(;v<16;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(_!==(65535&h.check)){f.msg="header crc mismatch",h.mode=o;break}_=0,v=0}h.head&&(h.head.hcrc=h.flags>>9&1,h.head.done=!0),f.adler=h.check=0,h.mode=s;break;case 10:for(;v<32;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}f.adler=h.check=c(_),_=0,v=0,h.mode=11;case 11:if(0===h.havedict)return f.next_out=w,f.avail_out=b,f.next_in=g,f.avail_in=p,h.hold=_,h.bits=v,2;f.adler=h.check=1,h.mode=s;case s:if(5===d||6===d)break t;case 13:if(h.last){_>>>=7&v,v-=7&v,h.mode=27;break}for(;v<3;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}switch(h.last=1&_,v-=1,3&(_>>>=1)){case 0:h.mode=14;break;case 1:if(m(h),h.mode=20,6===d){_>>>=2,v-=2;break t}break;case 2:h.mode=17;break;case 3:f.msg="invalid block type",h.mode=o}_>>>=2,v-=2;break;case 14:for(_>>>=7&v,v-=7&v;v<32;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if((65535&_)!=(_>>>16^65535)){f.msg="invalid stored block lengths",h.mode=o;break}if(h.length=65535&_,_=0,v=0,h.mode=15,6===d)break t;case 15:h.mode=16;case 16:if(E=h.length){if(E>p&&(E=p),E>b&&(E=b),0===E)break t;t.arraySet(u,l,g,E,w),p-=E,g+=E,b-=E,w+=E,h.length-=E;break}h.mode=s;break;case 17:for(;v<14;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(h.nlen=257+(31&_),_>>>=5,v-=5,h.ndist=1+(31&_),_>>>=5,v-=5,h.ncode=4+(15&_),_>>>=4,v-=4,h.nlen>286||h.ndist>30){f.msg="too many length or distance symbols",h.mode=o;break}h.have=0,h.mode=18;case 18:for(;h.have<h.ncode;){for(;v<3;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}h.lens[N[h.have++]]=7&_,_>>>=3,v-=3}for(;h.have<19;)h.lens[N[h.have++]]=0;if(h.lencode=h.lendyn,h.lenbits=7,z={bits:h.lenbits},C=a(0,h.lens,0,19,h.lencode,0,h.work,z),h.lenbits=z.bits,C){f.msg="invalid code lengths set",h.mode=o;break}h.have=0,h.mode=19;case 19:for(;h.have<h.nlen+h.ndist;){for(;A=(T=h.lencode[_&(1<<h.lenbits)-1])>>>16&255,R=65535&T,!((B=T>>>24)<=v);){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(R<16)_>>>=B,v-=B,h.lens[h.have++]=R;else{if(16===R){for(D=B+2;v<D;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(_>>>=B,v-=B,0===h.have){f.msg="invalid bit length repeat",h.mode=o;break}I=h.lens[h.have-1],E=3+(3&_),_>>>=2,v-=2}else if(17===R){for(D=B+3;v<D;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}v-=B,I=0,E=3+(7&(_>>>=B)),_>>>=3,v-=3}else{for(D=B+7;v<D;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}v-=B,I=0,E=11+(127&(_>>>=B)),_>>>=7,v-=7}if(h.have+E>h.nlen+h.ndist){f.msg="invalid bit length repeat",h.mode=o;break}for(;E--;)h.lens[h.have++]=I}}if(h.mode===o)break;if(0===h.lens[256]){f.msg="invalid code -- missing end-of-block",h.mode=o;break}if(h.lenbits=9,z={bits:h.lenbits},C=a(1,h.lens,0,h.nlen,h.lencode,0,h.work,z),h.lenbits=z.bits,C){f.msg="invalid literal/lengths set",h.mode=o;break}if(h.distbits=6,h.distcode=h.distdyn,z={bits:h.distbits},C=a(2,h.lens,h.nlen,h.ndist,h.distcode,0,h.work,z),h.distbits=z.bits,C){f.msg="invalid distances set",h.mode=o;break}if(h.mode=20,6===d)break t;case 20:h.mode=21;case 21:if(p>=6&&b>=258){f.next_out=w,f.avail_out=b,f.next_in=g,f.avail_in=p,h.hold=_,h.bits=v,r(f,k),w=f.next_out,u=f.output,b=f.avail_out,g=f.next_in,l=f.input,p=f.avail_in,_=h.hold,v=h.bits,h.mode===s&&(h.back=-1);break}for(h.back=0;A=(T=h.lencode[_&(1<<h.lenbits)-1])>>>16&255,R=65535&T,!((B=T>>>24)<=v);){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(A&&!(240&A)){for(P=B,j=A,O=R;A=(T=h.lencode[O+((_&(1<<P+j)-1)>>P)])>>>16&255,R=65535&T,!(P+(B=T>>>24)<=v);){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}_>>>=P,v-=P,h.back+=P}if(_>>>=B,v-=B,h.back+=B,h.length=R,0===A){h.mode=26;break}if(32&A){h.back=-1,h.mode=s;break}if(64&A){f.msg="invalid literal/length code",h.mode=o;break}h.extra=15&A,h.mode=22;case 22:if(h.extra){for(D=h.extra;v<D;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}h.length+=_&(1<<h.extra)-1,_>>>=h.extra,v-=h.extra,h.back+=h.extra}h.was=h.length,h.mode=23;case 23:for(;A=(T=h.distcode[_&(1<<h.distbits)-1])>>>16&255,R=65535&T,!((B=T>>>24)<=v);){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(!(240&A)){for(P=B,j=A,O=R;A=(T=h.distcode[O+((_&(1<<P+j)-1)>>P)])>>>16&255,R=65535&T,!(P+(B=T>>>24)<=v);){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}_>>>=P,v-=P,h.back+=P}if(_>>>=B,v-=B,h.back+=B,64&A){f.msg="invalid distance code",h.mode=o;break}h.offset=R,h.extra=15&A,h.mode=24;case 24:if(h.extra){for(D=h.extra;v<D;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}h.offset+=_&(1<<h.extra)-1,_>>>=h.extra,v-=h.extra,h.back+=h.extra}if(h.offset>h.dmax){f.msg="invalid distance too far back",h.mode=o;break}h.mode=25;case 25:if(0===b)break t;if(E=k-b,h.offset>E){if((E=h.offset-E)>h.whave&&h.sane){f.msg="invalid distance too far back",h.mode=o;break}E>h.wnext?(E-=h.wnext,$=h.wsize-E):$=h.wnext-E,E>h.length&&(E=h.length),S=h.window}else S=u,$=w-h.offset,E=h.length;E>b&&(E=b),b-=E,h.length-=E;do{u[w++]=S[$++]}while(--E);0===h.length&&(h.mode=21);break;case 26:if(0===b)break t;u[w++]=h.length,b--,h.mode=21;break;case 27:if(h.wrap){for(;v<32;){if(0===p)break t;p--,_|=l[g++]<<v,v+=8}if(k-=b,f.total_out+=k,h.total+=k,k&&(f.adler=h.check=h.flags?i(h.check,u,k,w-k):e(h.check,u,k,w-k)),k=b,(h.flags?_:c(_))!==h.check){f.msg="incorrect data check",h.mode=o;break}_=0,v=0}h.mode=28;case 28:if(h.wrap&&h.flags){for(;v<32;){if(0===p)break t;p--,_+=l[g++]<<v,v+=8}if(_!==(4294967295&h.total)){f.msg="incorrect length check",h.mode=o;break}_=0,v=0}h.mode=29;case 29:C=1;break t;case o:C=-3;break t;case 31:return-4;default:return n}return f.next_out=w,f.avail_out=b,f.next_in=g,f.avail_in=p,h.hold=_,h.bits=v,(h.wsize||k!==f.avail_out&&h.mode<o&&(h.mode<27||4!==d))&&y(f,f.output,f.next_out,k-f.avail_out),x-=f.avail_in,k-=f.avail_out,f.total_in+=x,f.total_out+=k,h.total+=k,h.wrap&&k&&(f.adler=h.check=h.flags?i(h.check,u,k,f.next_out-k):e(h.check,u,k,f.next_out-k)),f.data_type=h.bits+(h.last?64:0)+(h.mode===s?128:0)+(20===h.mode||15===h.mode?256:0),(0===x&&0===k||4===d)&&0===C&&(C=-5),C},ht.inflateEnd=function(t){if(!t||!t.state)return n;var e=t.state;return e.window&&(e.window=null),t.state=null,0},ht.inflateGetHeader=function(t,e){var i;return t&&t.state&&2&(i=t.state).wrap?(i.head=e,e.done=!1,0):n},ht.inflateSetDictionary=function(t,i){var r,a=i.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?n:11===r.mode&&e(1,i,a,0)!==r.check?-3:y(t,i,a,a)?(r.mode=31,-4):(r.havedict=1,0):n},ht.inflateInfo="pako inflate (from Nodeca project)",ht}function ut(){return V?K:(V=1,K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8})}function gt(){if(J)return dt;J=1;var t=lt(),e=b(),i=F(),r=ut(),a=C(),n=H(),s=Y?X:(Y=1,X=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}),o=Object.prototype.toString;function c(f){if(!(this instanceof c))return new c(f);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},f||{});var d=this.options;d.raw&&d.windowBits>=0&&d.windowBits<16&&(d.windowBits=-d.windowBits,0===d.windowBits&&(d.windowBits=-15)),!(d.windowBits>=0&&d.windowBits<16)||f&&f.windowBits||(d.windowBits+=32),d.windowBits>15&&d.windowBits<48&&(15&d.windowBits||(d.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0;var h=t.inflateInit2(this.strm,d.windowBits);if(h!==r.Z_OK)throw new Error(a[h]);if(this.header=new s,t.inflateGetHeader(this.strm,this.header),d.dictionary&&("string"==typeof d.dictionary?d.dictionary=i.string2buf(d.dictionary):"[object ArrayBuffer]"===o.call(d.dictionary)&&(d.dictionary=new Uint8Array(d.dictionary)),d.raw&&(h=t.inflateSetDictionary(this.strm,d.dictionary))!==r.Z_OK))throw new Error(a[h])}function f(t,e){var i=new c(e);if(i.push(t,!0),i.err)throw i.msg||a[i.err];return i.result}return c.prototype.push=function(a,n){var s,c,f,d,h,l=this.strm,u=this.options.chunkSize,g=this.options.dictionary,w=!1;if(this.ended)return!1;c=n===~~n?n:!0===n?r.Z_FINISH:r.Z_NO_FLUSH,"string"==typeof a?l.input=i.binstring2buf(a):"[object ArrayBuffer]"===o.call(a)?l.input=new Uint8Array(a):l.input=a,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new e.Buf8(u),l.next_out=0,l.avail_out=u),(s=t.inflate(l,r.Z_NO_FLUSH))===r.Z_NEED_DICT&&g&&(s=t.inflateSetDictionary(this.strm,g)),s===r.Z_BUF_ERROR&&!0===w&&(s=r.Z_OK,w=!1),s!==r.Z_STREAM_END&&s!==r.Z_OK)return this.onEnd(s),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&s!==r.Z_STREAM_END&&(0!==l.avail_in||c!==r.Z_FINISH&&c!==r.Z_SYNC_FLUSH)||("string"===this.options.to?(f=i.utf8border(l.output,l.next_out),d=l.next_out-f,h=i.buf2string(l.output,f),l.next_out=d,l.avail_out=u-d,d&&e.arraySet(l.output,l.output,f,d,0),this.onData(h)):this.onData(e.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(w=!0)}while((l.avail_in>0||0===l.avail_out)&&s!==r.Z_STREAM_END);return s===r.Z_STREAM_END&&(c=r.Z_FINISH),c===r.Z_FINISH?(s=t.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===r.Z_OK):c!==r.Z_SYNC_FLUSH||(this.onEnd(r.Z_OK),l.avail_out=0,!0)},c.prototype.onData=function(t){this.chunks.push(t)},c.prototype.onEnd=function(t){t===r.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},dt.Inflate=c,dt.inflate=f,dt.inflateRaw=function(t,e){return(e=e||{}).raw=!0,f(t,e)},dt.ungzip=f,dt}function wt(){if(tt)return Q;tt=1;var t=b().assign,e=function(){if(N)return A;N=1;var t=z(),e=b(),i=F(),r=C(),a=H(),n=Object.prototype.toString;function s(o){if(!(this instanceof s))return new s(o);this.options=e.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},o||{});var c=this.options;c.raw&&c.windowBits>0?c.windowBits=-c.windowBits:c.gzip&&c.windowBits>0&&c.windowBits<16&&(c.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var f=t.deflateInit2(this.strm,c.level,c.method,c.windowBits,c.memLevel,c.strategy);if(0!==f)throw new Error(r[f]);if(c.header&&t.deflateSetHeader(this.strm,c.header),c.dictionary){var d;if(d="string"==typeof c.dictionary?i.string2buf(c.dictionary):"[object ArrayBuffer]"===n.call(c.dictionary)?new Uint8Array(c.dictionary):c.dictionary,0!==(f=t.deflateSetDictionary(this.strm,d)))throw new Error(r[f]);this._dict_set=!0}}function o(t,e){var i=new s(e);if(i.push(t,!0),i.err)throw i.msg||r[i.err];return i.result}return s.prototype.push=function(r,a){var s,o,c=this.strm,f=this.options.chunkSize;if(this.ended)return!1;o=a===~~a?a:!0===a?4:0,"string"==typeof r?c.input=i.string2buf(r):"[object ArrayBuffer]"===n.call(r)?c.input=new Uint8Array(r):c.input=r,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new e.Buf8(f),c.next_out=0,c.avail_out=f),1!==(s=t.deflate(c,o))&&0!==s)return this.onEnd(s),this.ended=!0,!1;0!==c.avail_out&&(0!==c.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(i.buf2binstring(e.shrinkBuf(c.output,c.next_out))):this.onData(e.shrinkBuf(c.output,c.next_out)))}while((c.avail_in>0||0===c.avail_out)&&1!==s);return 4===o?(s=t.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,0===s):2!==o||(this.onEnd(0),c.avail_out=0,!0)},s.prototype.onData=function(t){this.chunks.push(t)},s.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},A.Deflate=s,A.deflate=o,A.deflateRaw=function(t,e){return(e=e||{}).raw=!0,o(t,e)},A.gzip=function(t,e){return(e=e||{}).gzip=!0,o(t,e)},A}(),i={};return t(i,e,gt(),ut()),Q=i}function pt(){if(it)return et;function t(t){return Array.isArray(t)?t:[t]}it=1;const e=/^\s+$/,i=/^\\!/,r=/^\\#/,a=/\r?\n/g,n=/^\.*\/|^\.+$/,s="undefined"!=typeof Symbol?Symbol.for("node-ignore"):"node-ignore",o=/([0-z])-([0-z])/g,c=[[/\\?\s+$/,t=>0===t.indexOf("\\")?" ":""],[/\\\s/g,()=>" "],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,i)=>e+6<i.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)\\\*(?=.+)/g,(t,e)=>`${e}[^\\/]*`],[/\\\\\\(?=[$.|*+(){^])/g,()=>"\\"],[/\\\\/g,()=>"\\"],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,i,r,a)=>"\\"===e?`\\[${i}${(t=>{const{length:e}=t;return t.slice(0,e-e%2)})(r)}${a}`:"]"===a&&r.length%2==0?`[${(t=>t.replace(o,(t,e,i)=>e.charCodeAt(0)<=i.charCodeAt(0)?t:""))(i)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],f=Object.create(null),d=t=>"string"==typeof t;class h{constructor(t,e,i,r){this.origin=t,this.pattern=e,this.negative=i,this.regex=r}}const l=(t,e)=>{const a=t;let n=!1;0===t.indexOf("!")&&(n=!0,t=t.substr(1));const s=((t,e,i)=>{const r=f[t];if(r)return r;const a=c.reduce((e,i)=>e.replace(i[0],i[1].bind(t)),t);return f[t]=i?new RegExp(a,"i"):new RegExp(a)})(t=t.replace(i,"!").replace(r,"#"),0,e);return new h(a,t,n,s)},u=(t,e)=>{throw new e(t)},g=(t,e,i)=>{if(!d(t))return i(`path must be a string, but got \`${e}\``,TypeError);if(!t)return i("path must not be empty",TypeError);if(g.isNotRelative(t)){return i(`path should be a ${"`path.relative()`d"} string, but got "${e}"`,RangeError)}return!0},w=t=>n.test(t);g.isNotRelative=w,g.convert=t=>t;class p{constructor({ignorecase:t=!0}={}){var e,i,r;this._rules=[],this._ignorecase=t,e=this,i=s,r=!0,Object.defineProperty(e,i,{value:r}),this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[s])return this._rules=this._rules.concat(t._rules),void(this._added=!0);if((t=>t&&d(t)&&!e.test(t)&&0!==t.indexOf("#"))(t)){const e=l(t,this._ignorecase);this._added=!0,this._rules.push(e)}}add(e){return this._added=!1,t(d(e)?(t=>t.split(a))(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,e){let i=!1,r=!1;return this._rules.forEach(a=>{const{negative:n}=a;if(r===n&&i!==r||n&&!i&&!r&&!e)return;a.regex.test(t)&&(i=!n,r=n)}),{ignored:i,unignored:r}}_test(t,e,i,r){const a=t&&g.convert(t);return g(a,t,u),this._t(a,e,i,r)}_t(t,e,i,r){if(t in e)return e[t];if(r||(r=t.split("/")),r.pop(),!r.length)return e[t]=this._testOne(t,i);const a=this._t(r.join("/")+"/",e,i,r);return e[t]=a.ignored?a:this._testOne(t,i)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(e){return t(e).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}}const m=t=>new p(t),y=()=>!1;if(m.isPathValid=t=>g(t&&g.convert(t),t,y),m.default=m,et=m,"undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const t=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");g.convert=t;const e=/^[a-z]:\//i;g.isNotRelative=t=>e.test(t)||w(t)}return et}function mt(){return st?nt:(st=1,nt=function(t,e){var i,r,a=t,n=e,s=a.length,o=n.length,c=!1,f=null,d=s+1,h=[],l=[],u=[],g="",w=function(t,e,i){return{x:t,y:e,k:i}},p=function(t,e){return{elem:t,t:e}},m=function(t,e,i){var r,c,f;for(r=e>i?h[t-1+d]:h[t+1+d],c=(f=Math.max(e,i))-t;c<s&&f<o&&a[c]===n[f];)++c,++f;return h[t+d]=l.length,l[l.length]=new w(c,f,r),f};return s>=o&&(i=a,r=s,a=n,n=i,s=o,o=r,c=!0,d=s+1),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return f},getlcs:function(){return g},getses:function(){return u},compose:function(){var t,e,i,r,y,b,_,v;for(t=o-s,e=s+o+3,i={},_=0;_<e;++_)i[_]=-1,h[_]=-1;r=-1;do{for(v=-++r;v<=t-1;++v)i[v+d]=m(v,i[v-1+d]+1,i[v+1+d]);for(v=t+r;v>=t+1;--v)i[v+d]=m(v,i[v-1+d]+1,i[v+1+d]);i[t+d]=m(t,i[t-1+d]+1,i[t+1+d])}while(i[t+d]!==o);for(f=t+2*r,y=h[t+d],b=[];-1!==y;)b[b.length]=new w(l[y].x,l[y].y,null),y=l[y].k;!function(t){var e,i,r;for(e=i=0,r=t.length-1;r>=0;--r)for(;e<t[r].x||i<t[r].y;)t[r].y-t[r].x>i-e?(u[u.length]=new p(n[i],c?-1:1),++i):t[r].y-t[r].x<i-e?(u[u.length]=new p(a[e],c?1:-1),++e):(u[u.length]=new p(a[e],0),g+=a[e],++e,++i)}(b)}}})}function yt(){if(ct)return ot;ct=1;var t=mt();function e(e,i){for(var r=[],a=e.length,n=i.length,s=function(e,i){var r=new t(e,i);r.compose();for(var a,n,s=r.getses(),o=e.length-1,c=i.length-1,f=s.length-1;f>=0;--f)s[f].t===r.SES_COMMON?(n?(n.chain={file1index:o,file2index:c,chain:null},n=n.chain):n=a={file1index:o,file2index:c,chain:null},o--,c--):s[f].t===r.SES_DELETE?o--:s[f].t===r.SES_ADD&&c--;var d={file1index:-1,file2index:-1,chain:null};return n?(n.chain=d,a):d}(e,i);null!==s;s=s.chain){var o=a-s.file1index-1,c=n-s.file2index-1;a=s.file1index,n=s.file2index,(o||c)&&r.push({file1:[a+1,o],file2:[n+1,c]})}return r.reverse(),r}return ot=function(t,i,r){var a=[],n=[t,i,r],s=function(t,i,r){var a,n=e(i,t),s=e(i,r),o=[];function c(t,e){o.push([t.file1[0],e,t.file1[1],t.file2[0],t.file2[1]])}for(a=0;a<n.length;a++)c(n[a],0);for(a=0;a<s.length;a++)c(s[a],2);o.sort(function(t,e){return t[0]-e[0]});var f=[],d=0;function h(t){t>d&&(f.push([1,d,t-d]),d=t)}for(var l=0;l<o.length;l++){for(var u=l,g=o[l],w=g[0],p=w+g[2];l<o.length-1;){var m=o[l+1],y=m[0];if(y>p)break;p=Math.max(p,y+m[2]),l++}if(h(w),u==l)g[4]>0&&f.push([g[1],g[3],g[4]]);else{var b={0:[t.length,-1,i.length,-1],2:[r.length,-1,i.length,-1]};for(a=u;a<=l;a++){var _=b[(g=o[a])[1]],v=g[0],x=v+g[2],k=g[3],E=k+g[4];_[0]=Math.min(k,_[0]),_[1]=Math.max(E,_[1]),_[2]=Math.min(v,_[2]),_[3]=Math.max(x,_[3])}var $=b[0][0]+(w-b[0][2]),S=b[0][1]+(p-b[0][3]),B=b[2][0]+(w-b[2][2]),A=b[2][1]+(p-b[2][3]);f.push([-1,$,S-$,w,p-w,B,A-B])}d=p}return h(i.length),f}(t,i,r),o=[];function c(){o.length&&a.push({ok:o}),o=[]}function f(t){for(var e=0;e<t.length;e++)o.push(t[e])}function d(e){if(e[2]!=e[6])return!0;for(var i=e[1],a=e[5],n=0;n<e[2];n++)if(t[n+i]!=r[n+a])return!0;return!1}for(var h=0;h<s.length;h++){var l=s[h],u=l[0];-1==u?d(l)?(c(),a.push({conflict:{a:t.slice(l[1],l[1]+l[2]),aIndex:l[1],o:i.slice(l[3],l[3]+l[4]),oIndex:l[3],b:r.slice(l[5],l[5]+l[6]),bIndex:l[5]}})):f(n[0].slice(l[1],l[1]+l[2])):f(n[u].slice(l[1],l[1]+l[2]))}return c(),a}}function bt(){if(ft)return g;function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}ft=1,Object.defineProperty(g,"__esModule",{value:!0});var e=t(f?c:(f=1,c=w())),i=t(p()),n=t(r.requireCrc32()),s=t(wt()),o=t(a.requirePify()),d=t(pt()),h=t(function(){if(at)return rt;function t(t,e,i){return e=e instanceof RegExp?e:new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),t.replace(e,i)}return at=1,rt={clean:function(e){if("string"!=typeof e)throw new Error("Expected a string, received: "+e);return e=t(e,"./","/"),e=t(e,"..","."),e=t(e," ","-"),e=t(e,/^[~^:?*\\\-]/g,""),e=t(e,/[~^:?*\\]/g,"-"),e=t(e,/[~^:?*\\\-]$/g,""),e=t(e,"@{","-"),e=t(e,/\.$/g,""),e=t(e,/\/$/g,""),t(e,/\.lock$/g,"")}}}()),l=t(yt());class u 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 u(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 m extends u{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=m.code,this.data={filepaths:t}}}m.code="UnmergedPathsError";class y extends u{constructor(t){super(`An internal error caused this command to fail.\n\nIf you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.\n\nPlease file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${t}`),this.code=this.name=y.code,this.data={message:t}}}y.code="InternalError";class b extends u{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=b.code,this.data={filepath:t}}}b.code="UnsafeFilepathError";class _{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 i=this.buffer.toString(t,this._start,this._start+e);return this._start+=e,i}write(t,e,i){const r=this.buffer.write(t,this._start,e,i);return this._start+=e,r}copy(t,e,i){const r=t.copy(this.buffer,this._start,e,i);return this._start+=r,r}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 v(t,e){return-(t<e)||+(t>e)}function x(t,e){return v(t.path,e.path)}function k(t){let e=t>0?t>>12:0;4!==e&&8!==e&&10!==e&&14!==e&&(e=8);let i=511&t;return i=73&i?493:420,8!==e&&(i=0),(e<<12)+i}const E=2**32;function $(t,e,i,r){if(void 0!==t&&void 0!==e)return[t,e];void 0===i&&(i=r.valueOf());const a=Math.floor(i/1e3);return[a,1e6*(i-1e3*a)]}function S(t){const[e,i]=$(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[r,a]=$(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%E,ctimeNanoseconds:i%E,mtimeSeconds:r%E,mtimeNanoseconds:a%E,dev:t.dev%E,ino:t.ino%E,mode:k(t.mode%E),uid:t.uid%E,gid:t.gid%E,size:t.size>-1?t.size%E:0}}let B=null;async function A(t){return null===B&&(B=await async function(){try{return"da39a3ee5e6b4b0d3255bfef95601890afd80709"===await R(new Uint8Array([]))}catch(t){}return!1}()),B?R(t):function(t){return(new i).update(t).digest("hex")}(t)}async function R(t){return function(t){let e="";for(const i of new Uint8Array(t))i<16&&(e+="0"),e+=i.toString(16);return e}(await crypto.subtle.digest("SHA-1",t))}function P(t){return{assumeValid:Boolean(32768&t),extended:Boolean(16384&t),stage:(12288&t)>>12,nameLength:4095&t}}class j{constructor(t,e){this._dirty=!1,this._unmergedPaths=e||new Set,this._entries=t||new Map}_addEntry(t){if(0===t.flags.stage)t.stages=[t],this._entries.set(t.path,t),this._unmergedPaths.delete(t.path);else{let e=this._entries.get(t.path);e||(this._entries.set(t.path,t),e=t),e.stages[t.flags.stage]=t,this._unmergedPaths.add(t.path)}}static async from(t){if(Buffer.isBuffer(t))return j.fromBuffer(t);if(null===t)return new j(null);throw new y("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(0===t.length)throw new y("Index file is empty (.git/index)");const e=new j,i=new _(t),r=i.toString("utf8",4);if("DIRC"!==r)throw new y(`Invalid dircache magic file number: ${r}`);const a=await A(t.slice(0,-20)),n=t.slice(-20).toString("hex");if(n!==a)throw new y(`Invalid checksum in GitIndex buffer: expected ${n} but saw ${a}`);const s=i.readUInt32BE();if(2!==s)throw new y(`Unsupported dircache version: ${s}`);const o=i.readUInt32BE();let c=0;for(;!i.eof()&&c<o;){const r={};r.ctimeSeconds=i.readUInt32BE(),r.ctimeNanoseconds=i.readUInt32BE(),r.mtimeSeconds=i.readUInt32BE(),r.mtimeNanoseconds=i.readUInt32BE(),r.dev=i.readUInt32BE(),r.ino=i.readUInt32BE(),r.mode=i.readUInt32BE(),r.uid=i.readUInt32BE(),r.gid=i.readUInt32BE(),r.size=i.readUInt32BE(),r.oid=i.slice(20).toString("hex");const a=i.readUInt16BE();r.flags=P(a);const n=t.indexOf(0,i.tell()+1)-i.tell();if(n<1)throw new y(`Got a path length of: ${n}`);if(r.path=i.toString("utf8",n),r.path.includes("..\\")||r.path.includes("../"))throw new b(r.path);let s=8-(i.tell()-12)%8;for(0===s&&(s=8);s--;){const t=i.readUInt8();if(0!==t)throw new y(`Expected 1-8 null characters but got '${t}' after ${r.path}`);if(i.eof())throw new y("Unexpected end of file")}r.stages=[],e._addEntry(r),c++}return e}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(x)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(t=>t.stages.length>1?t.stages.filter(t=>t):t)}*[Symbol.iterator](){for(const t of this.entries)yield t}insert({filepath:t,stats:e,oid:i,stage:r=0}){e||(e={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),e=S(e);const a=Buffer.from(t),n={ctimeSeconds:e.ctimeSeconds,ctimeNanoseconds:e.ctimeNanoseconds,mtimeSeconds:e.mtimeSeconds,mtimeNanoseconds:e.mtimeNanoseconds,dev:e.dev,ino:e.ino,mode:e.mode||33188,uid:e.uid,gid:e.gid,size:e.size,path:t,oid:i,flags:{assumeValid:!1,extended:!1,stage:r,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(n),this._dirty=!0}delete({filepath:t}){if(this._entries.has(t))this._entries.delete(t);else for(const e of this._entries.keys())e.startsWith(t+"/")&&this._entries.delete(e);this._unmergedPaths.has(t)&&this._unmergedPaths.delete(t),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:t}){return this._entries.has(t)}render(){return this.entries.map(t=>`${t.mode.toString(8)} ${t.oid} ${t.path}`).join("\n")}static async _entryToBuffer(t){const e=Buffer.from(t.path),i=8*Math.ceil((62+e.length+1)/8),r=Buffer.alloc(i),a=new _(r),n=S(t);return a.writeUInt32BE(n.ctimeSeconds),a.writeUInt32BE(n.ctimeNanoseconds),a.writeUInt32BE(n.mtimeSeconds),a.writeUInt32BE(n.mtimeNanoseconds),a.writeUInt32BE(n.dev),a.writeUInt32BE(n.ino),a.writeUInt32BE(n.mode),a.writeUInt32BE(n.uid),a.writeUInt32BE(n.gid),a.writeUInt32BE(n.size),a.write(t.oid,20,"hex"),a.writeUInt16BE(function(t){const e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((3&e.stage)<<12)+(4095&e.nameLength)}(t)),a.write(t.path,e.length,"utf8"),r}async toObject(){const t=Buffer.alloc(12),e=new _(t);e.write("DIRC",4,"utf8"),e.writeUInt32BE(2),e.writeUInt32BE(this.entriesFlat.length);let i=[];for(const t of this.entries)if(i.push(j._entryToBuffer(t)),t.stages.length>1)for(const e of t.stages)e&&e!==t&&i.push(j._entryToBuffer(e));i=await Promise.all(i);const r=Buffer.concat(i),a=Buffer.concat([t,r]),n=await A(a);return Buffer.concat([a,Buffer.from(n,"hex")])}}function O(t,e,i=!0,r=!0){const a=S(t),n=S(e);return i&&a.mode!==n.mode||a.mtimeSeconds!==n.mtimeSeconds||a.ctimeSeconds!==n.ctimeSeconds||a.uid!==n.uid||a.gid!==n.gid||r&&a.ino!==n.ino||a.size!==n.size}let I=null;const C=Symbol("IndexCache");class z{static async acquire({fs:t,gitdir:i,cache:r,allowUnmerged:a=!0},n){r[C]||(r[C]={map:new Map,stats:new Map});const s=`${i}/index`;let o;null===I&&(I=new e({maxPending:1/0}));let c=[];return await I.acquire(s,async()=>{const e=r[C];await async function(t,e,i){const r=i.stats.get(e);if(void 0===r)return!0;if(null===r)return!1;const a=await t.lstat(e);return null!==a&&O(r,a)}(t,s,e)&&await async function(t,e,i){const[r,a]=await Promise.all([t.lstat(e),t.read(e)]),n=await j.from(a);i.map.set(e,n),i.stats.set(e,r)}(t,s,e);const i=e.map.get(s);if(c=i.unmergedPaths,c.length&&!a)throw new m(c);if(o=await n(i),i._dirty){const r=await i.toObject();await t.write(s,r),e.stats.set(s,await t.lstat(s)),i._dirty=!1}}),o}}function D(t){const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function T(t){const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return-1===e?".":0===e?"/":t.slice(0,e)}function U(t){const e=new Map,i=function(t){if(!e.has(t)){const r={type:"tree",fullpath:t,basename:D(t),metadata:{},children:[]};e.set(t,r),r.parent=i(T(t)),r.parent&&r.parent!==r&&r.parent.children.push(r)}return e.get(t)},r=function(t,r){if(!e.has(t)){const a={type:"blob",fullpath:t,basename:D(t),metadata:r,parent:i(T(t)),children:[]};a.parent&&a.parent.children.push(a),e.set(t,a)}return e.get(t)};i(".");for(const e of t)r(e.path,e);return e}class N{constructor({fs:t,gitdir:e,cache:i}){this.treePromise=z.acquire({fs:t,gitdir:e,cache:i},async function(t){return U(t.entries)});const r=this;this.ConstructEntry=class{constructor(t){this._fullpath=t,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return r.type(this)}async mode(){return r.mode(this)}async stat(){return r.stat(this)}async content(){return r.content(this)}async oid(){return r.oid(this)}}}async readdir(t){const e=t._fullpath,i=(await this.treePromise).get(e);if(!i)return null;if("blob"===i.type)return null;if("tree"!==i.type)throw new Error(`ENOTDIR: not a directory, scandir '${e}'`);const r=i.children.map(t=>t.fullpath);return r.sort(v),r}async type(t){return!1===t._type&&await t.stat(),t._type}async mode(t){return!1===t._mode&&await t.stat(),t._mode}async stat(t){if(!1===t._stat){const e=(await this.treePromise).get(t._fullpath);if(!e)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);const i="tree"===e.type?{}:S(e.metadata);t._type="tree"===e.type?"tree":function(t){switch(t){case 16384:return"tree";case 33188:case 33261:case 40960:return"blob";case 57344:return"commit"}throw new y(`Unexpected GitTree entry mode: ${t.toString(8)}`)}(i.mode),t._mode=i.mode,"tree"===e.type?t._stat=void 0:t._stat=i}return t._stat}async content(t){}async oid(t){if(!1===t._oid){const e=(await this.treePromise).get(t._fullpath);t._oid=e.metadata.oid}return t._oid}}const M=Symbol("GitWalkSymbol");function F(){const t=Object.create(null);return Object.defineProperty(t,M,{value:function({fs:t,gitdir:e,cache:i}){return new N({fs:t,gitdir:e,cache:i})}}),Object.freeze(t),t}class H extends u{constructor(t){super(`Could not find ${t}.`),this.code=this.name=H.code,this.data={what:t}}}H.code="NotFoundError";class q extends u{constructor(t,e,i,r){super(`Object ${t} ${r?`at ${r}`:""}was anticipated to be a ${i} but it is a ${e}.`),this.code=this.name=q.code,this.data={oid:t,actual:e,expected:i,filepath:r}}}q.code="ObjectTypeError";class L extends u{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=L.code,this.data={value:t}}}L.code="InvalidOidError";class W extends u{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:\n[remote "${t}"]\n\tfetch = +refs/heads/*:refs/remotes/origin/*\n`),this.code=this.name=W.code,this.data={remote:t}}}W.code="NoRefspecError";class Z{constructor(t){if(this.refs=new Map,this.parsedConfig=[],t){let e=null;this.parsedConfig=t.trim().split("\n").map(t=>{if(/^\s*#/.test(t))return{line:t,comment:!0};const i=t.indexOf(" ");if(t.startsWith("^")){const i=t.slice(1);return this.refs.set(e+"^{}",i),{line:t,ref:e,peeled:i}}{const r=t.slice(0,i);return e=t.slice(i+1),this.refs.set(e,r),{line:t,ref:e,oid:r}}})}return this}static from(t){return new Z(t)}delete(t){this.parsedConfig=this.parsedConfig.filter(e=>e.ref!==t),this.refs.delete(t)}toString(){return this.parsedConfig.map(({line:t})=>t).join("\n")+"\n"}}class G{constructor({remotePath:t,localPath:e,force:i,matchPrefix:r}){Object.assign(this,{remotePath:t,localPath:e,force:i,matchPrefix:r})}static from(t){const[e,i,r,a,n]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),s="+"===e,o="*"===r;if(o!==("*"===n))throw new y("Invalid refspec");return new G({remotePath:i,localPath:a,force:s,matchPrefix:o})}translate(t){if(this.matchPrefix){if(t.startsWith(this.remotePath))return this.localPath+t.replace(this.remotePath,"")}else if(t===this.remotePath)return this.localPath;return null}reverseTranslate(t){if(this.matchPrefix){if(t.startsWith(this.localPath))return this.remotePath+t.replace(this.localPath,"")}else if(t===this.localPath)return this.remotePath;return null}}class K{constructor(t=[]){this.rules=t}static from(t){const e=[];for(const i of t)e.push(G.from(i));return new K(e)}add(t){const e=G.from(t);this.rules.push(e)}translate(t){const e=[];for(const i of this.rules)for(const r of t){const t=i.translate(r);t&&e.push([r,t])}return e}translateOne(t){let e=null;for(const i of this.rules){const r=i.translate(t);r&&(e=r)}return e}localNamespaces(){return this.rules.filter(t=>t.matchPrefix).map(t=>t.localPath.replace(/\/$/,""))}}function V(t,e){const i=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),a=-(i<r)||+(i>r);return 0===a?t.endsWith("^{}")?1:-1:a}
2
+ /*!
3
+ * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
4
+ * SPDX-License-Identifier: LGPL-3.0-or-later
5
+ * Copyright (c) James Prevett and other ZenFS contributors.
6
+ */function X(...t){if(0===t.length)return".";let e;for(let i=0;i<t.length;++i){const r=t[i];r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":function(t){if(!t.length)return".";const e="/"===t[0],i="/"===t.at(-1);return(t=function(t,e){let i="",r=0,a=-1,n=0,s="\0";for(let o=0;o<=t.length;++o){if(o<t.length)s=t[o];else{if("/"===s)break;s="/"}if("/"===s){if(a===o-1||1===n);else if(2===n){if(i.length<2||2!==r||"."!==i.at(-1)||"."!==i.at(-2)){if(i.length>2){const t=i.lastIndexOf("/");-1===t?(i="",r=0):(i=i.slice(0,t),r=i.length-1-i.lastIndexOf("/")),a=o,n=0;continue}if(0!==i.length){i="",r=0,a=o,n=0;continue}}e&&(i+=i.length>0?"/..":"..",r=2)}else i.length>0?i+="/"+t.slice(a+1,o):i=t.slice(a+1,o),r=o-a-1;a=o,n=0}else"."===s&&-1!==n?++n:n=-1}return i}(t,!e)).length?(i&&(t+="/"),e?`/${t}`:t):e?"/":i?"./":"."}(e)}const Y=t=>{if("boolean"==typeof t)return t;if("true"===(t=t.trim().toLowerCase())||"yes"===t||"on"===t)return!0;if("false"===t||"no"===t||"off"===t)return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},J={core:{filemode:Y,bare:Y,logallrefupdates:Y,symlinks:Y,ignorecase:Y,bigFileThreshold:t=>{if("number"==typeof t)return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1048576),t.endsWith("g")&&(e*=1073741824),e}}},Q=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,tt=/^[A-Za-z0-9-.]+$/,et=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,it=/^[A-Za-z][A-Za-z-]*$/,nt=/^(.*?)( *[#;].*)$/,st=t=>{const e=nt.exec(t);if(null==e)return t;const[i,r]=e.slice(1);return ot(i)&&ot(r)?`${i}${r}`:i},ot=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!=0,ct=t=>t.split("").reduce((t,e,i,r)=>{const a='"'===e&&"\\"!==r[i-1],n="\\"===e&&'"'===r[i+1];return a||n?t:t+e},""),dt=t=>null!=t?t.toLowerCase():null,ht=(t,e,i)=>[dt(t),e,dt(i)].filter(t=>null!=t).join("."),lt=t=>{const e=t.split("."),i=e.shift(),r=e.pop(),a=e.length?e.join("."):void 0;return{section:i,subsection:a,name:r,path:ht(i,a,r),sectionPath:ht(i,a,null),isSection:!!i}};class ut{constructor(t){let e=null,i=null;this.parsedConfig=t?t.split("\n").map(t=>{let r=null,a=null;const n=t.trim(),s=(t=>{const e=Q.exec(t);if(null!=e){const[t,i]=e.slice(1);return[t,i]}return null})(n),o=null!=s;if(o)[e,i]=s;else{const t=(t=>{const e=et.exec(t);if(null!=e){const[t,i="true"]=e.slice(1),r=st(i);return[t,ct(r)]}return null})(n);null!=t&&([r,a]=t)}const c=ht(e,i,r);return{line:t,isSection:o,section:e,subsection:i,name:r,value:a,path:c}}):[]}static from(t){return new ut(t)}async get(t,e=!1){const i=lt(t).path,r=this.parsedConfig.filter(t=>t.path===i).map(({section:t,name:e,value:i})=>{const r=J[t]&&J[t][e];return r?r(i):i});return e?r:r.pop()}async getall(t){return this.get(t,!0)}async getSubsections(t){return this.parsedConfig.filter(e=>e.isSection&&e.section===t).map(t=>t.subsection)}async deleteSection(t,e){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===t&&i.subsection===e))}async append(t,e){return this.set(t,e,!0)}async set(t,e,i=!1){const{section:r,subsection:a,name:n,path:s,sectionPath:o,isSection:c}=lt(t),f=(d=this.parsedConfig,h=t=>t.path===s,d.reduce((t,e,i)=>h(e)?i:t,-1));var d,h;if(null==e)-1!==f&&this.parsedConfig.splice(f,1);else if(-1!==f){const t=this.parsedConfig[f],r=Object.assign({},t,{name:n,value:e,modified:!0});i?this.parsedConfig.splice(f+1,0,r):this.parsedConfig[f]=r}else{const t=this.parsedConfig.findIndex(t=>t.path===o),i={section:r,subsection:a,name:n,value:e,modified:!0,path:s};if(tt.test(r)&&it.test(n))if(t>=0)this.parsedConfig.splice(t+1,0,i);else{const t={isSection:c,section:r,subsection:a,modified:!0,path:o};this.parsedConfig.push(t,i)}}}toString(){return this.parsedConfig.map(({line:t,section:e,subsection:i,name:r,value:a,modified:n=!1})=>n?null!=r&&null!=a?"string"==typeof a&&/[#;]/.test(a)?`\t${r} = "${a}"`:`\t${r} = ${a}`:null!=i?`[${e} "${i}"]`:`[${e}]`:t).join("\n")}}class gt{static async get({fs:t,gitdir:e}){const i=await t.read(`${e}/config`,{encoding:"utf8"});return ut.from(i)}static async save({fs:t,gitdir:e,config:i}){await t.write(`${e}/config`,i.toString(),{encoding:"utf8"})}}const mt=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],bt=["config","description","index","shallow","commondir"];let _t;async function vt(t,i){return void 0===_t&&(_t=new e),_t.acquire(t,i)}class xt{static async updateRemoteRefs({fs:t,gitdir:e,remote:i,refs:r,symrefs:a,tags:n,refspecs:s,prune:o=!1,pruneTags:c=!1}){for(const t of r.values())if(!t.match(/[0-9a-f]{40}/))throw new L(t);const f=await gt.get({fs:t,gitdir:e});if(!s){if(0===(s=await f.getall(`remote.${i}.fetch`)).length)throw new W(i);s.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}const d=K.from(s),h=new Map;if(c){const i=await xt.listRefs({fs:t,gitdir:e,filepath:"refs/tags"});await xt.deleteRefs({fs:t,gitdir:e,refs:i.map(t=>`refs/tags/${t}`)})}if(n)for(const i of r.keys())if(i.startsWith("refs/tags")&&!i.endsWith("^{}")&&!await xt.exists({fs:t,gitdir:e,ref:i})){const t=r.get(i);h.set(i,t)}const l=d.translate([...r.keys()]);for(const[t,e]of l){const i=r.get(t);h.set(e,i)}const u=d.translate([...a.keys()]);for(const[t,e]of u){const i=a.get(t),r=d.translateOne(i);r&&h.set(e,`ref: ${r}`)}const g=[];if(o){for(const i of d.localNamespaces()){const r=(await xt.listRefs({fs:t,gitdir:e,filepath:i})).map(t=>`${i}/${t}`);for(const t of r)h.has(t)||g.push(t)}g.length>0&&await xt.deleteRefs({fs:t,gitdir:e,refs:g})}for(const[i,r]of h)await vt(i,async()=>t.write(X(e,i),`${r.trim()}\n`,"utf8"));return{pruned:g}}static async writeRef({fs:t,gitdir:e,ref:i,value:r}){if(!r.match(/[0-9a-f]{40}/))throw new L(r);await vt(i,async()=>t.write(X(e,i),`${r.trim()}\n`,"utf8"))}static async writeSymbolicRef({fs:t,gitdir:e,ref:i,value:r}){await vt(i,async()=>t.write(X(e,i),`ref: ${r.trim()}\n`,"utf8"))}static async deleteRef({fs:t,gitdir:e,ref:i}){return xt.deleteRefs({fs:t,gitdir:e,refs:[i]})}static async deleteRefs({fs:t,gitdir:e,refs:i}){await Promise.all(i.map(i=>t.rm(X(e,i))));let r=await vt("packed-refs",async()=>t.read(`${e}/packed-refs`,{encoding:"utf8"}));const a=Z.from(r),n=a.refs.size;for(const t of i)a.refs.has(t)&&a.delete(t);a.refs.size<n&&(r=a.toString(),await vt("packed-refs",async()=>t.write(`${e}/packed-refs`,r,{encoding:"utf8"})))}static async resolve({fs:t,gitdir:e,ref:i,depth:r}){if(void 0!==r&&-1===--r)return i;if(i.startsWith("ref: "))return i=i.slice(5),xt.resolve({fs:t,gitdir:e,ref:i,depth:r});if(40===i.length&&/[0-9a-f]{40}/.test(i))return i;const a=await xt.packedRefs({fs:t,gitdir:e}),n=mt(i).filter(t=>!bt.includes(t));for(const i of n){const n=await vt(i,async()=>await t.read(`${e}/${i}`,{encoding:"utf8"})||a.get(i));if(n)return xt.resolve({fs:t,gitdir:e,ref:n.trim(),depth:r})}throw new H(i)}static async exists({fs:t,gitdir:e,ref:i}){try{return await xt.expand({fs:t,gitdir:e,ref:i}),!0}catch(t){return!1}}static async expand({fs:t,gitdir:e,ref:i}){if(40===i.length&&/[0-9a-f]{40}/.test(i))return i;const r=await xt.packedRefs({fs:t,gitdir:e}),a=mt(i);for(const i of a){if(await vt(i,async()=>t.exists(`${e}/${i}`)))return i;if(r.has(i))return i}throw new H(i)}static async expandAgainstMap({ref:t,map:e}){const i=mt(t);for(const t of i)if(await e.has(t))return t;throw new H(t)}static resolveAgainstMap({ref:t,fullref:e=t,depth:i,map:r}){if(void 0!==i&&-1===--i)return{fullref:e,oid:t};if(t.startsWith("ref: "))return t=t.slice(5),xt.resolveAgainstMap({ref:t,fullref:e,depth:i,map:r});if(40===t.length&&/[0-9a-f]{40}/.test(t))return{fullref:e,oid:t};const a=mt(t);for(const t of a){const e=r.get(t);if(e)return xt.resolveAgainstMap({ref:e.trim(),fullref:t,depth:i,map:r})}throw new H(t)}static async packedRefs({fs:t,gitdir:e}){const i=await vt("packed-refs",async()=>t.read(`${e}/packed-refs`,{encoding:"utf8"}));return Z.from(i).refs}static async listRefs({fs:t,gitdir:e,filepath:i}){const r=xt.packedRefs({fs:t,gitdir:e});let a=null;try{a=await t.readdirDeep(`${e}/${i}`),a=a.map(t=>t.replace(`${e}/${i}/`,""))}catch(t){a=[]}for(let t of(await r).keys())t.startsWith(i)&&(t=t.replace(i+"/",""),a.includes(t)||a.push(t));return a.sort(V),a}static async listBranches({fs:t,gitdir:e,remote:i}){return i?xt.listRefs({fs:t,gitdir:e,filepath:`refs/remotes/${i}`}):xt.listRefs({fs:t,gitdir:e,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:e}){return(await xt.listRefs({fs:t,gitdir:e,filepath:"refs/tags"})).filter(t=>!t.endsWith("^{}"))}}function kt(t,e){return v(Et(t),Et(e))}function Et(t){return"040000"===t.mode?t.path+"/":t.path}function $t(t){switch(t){case"040000":return"tree";case"100644":case"100755":case"120000":return"blob";case"160000":return"commit"}throw new y(`Unexpected GitTree entry mode: ${t}`)}function St(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=function(t){if("number"==typeof t&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new y(`Could not understand file mode: ${t}`)}(t.mode),t.type||(t.type=$t(t.mode)),t}class Bt{constructor(t){if(Buffer.isBuffer(t))this._entries=function(t){const e=[];let i=0;for(;i<t.length;){const r=t.indexOf(32,i);if(-1===r)throw new y(`GitTree: Error parsing buffer at byte location ${i}: Could not find the next space character.`);const a=t.indexOf(0,i);if(-1===a)throw new y(`GitTree: Error parsing buffer at byte location ${i}: Could not find the next null character.`);let n=t.slice(i,r).toString("utf8");"40000"===n&&(n="040000");const s=$t(n),o=t.slice(r+1,a).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new b(o);const c=t.slice(a+1,a+21).toString("hex");i=a+21,e.push({mode:n,path:o,oid:c,type:s})}return e}(t);else{if(!Array.isArray(t))throw new y("invalid type passed to GitTree constructor");this._entries=t.map(St)}this._entries.sort(x)}static from(t){return new Bt(t)}render(){return this._entries.map(t=>`${t.mode} ${t.type} ${t.oid} ${t.path}`).join("\n")}toObject(){const t=[...this._entries];return t.sort(kt),Buffer.concat(t.map(t=>{const e=Buffer.from(t.mode.replace(/^0/,"")),i=Buffer.from(" "),r=Buffer.from(t.path,"utf8"),a=Buffer.from([0]),n=Buffer.from(t.oid,"hex");return Buffer.concat([e,i,r,a,n])}))}entries(){return this._entries}*[Symbol.iterator](){for(const t of this._entries)yield t}}class At{static wrap({type:t,object:e}){const i=`${t} ${e.length}\0`,r=i.length,a=r+e.length,n=new Uint8Array(a);for(let t=0;t<r;t++)n[t]=i.charCodeAt(t);return n.set(e,r),n}static unwrap(t){const e=t.indexOf(32),i=t.indexOf(0),r=t.slice(0,e).toString("utf8"),a=t.slice(e+1,i).toString("utf8"),n=t.length-(i+1);if(parseInt(a)!==n)throw new y(`Length mismatch: expected ${a} bytes but got ${n} instead.`);return{type:r,object:Buffer.from(t.slice(i+1))}}}async function Rt({fs:t,gitdir:e,oid:i}){const r=`objects/${i.slice(0,2)}/${i.slice(2)}`,a=await t.read(`${e}/${r}`);return a?{object:a,format:"deflated",source:r}:null}function Pt(t){let e=0,i=0,r=null;do{r=t.readUInt8(),e|=(127&r)<<i,i+=7}while(128&r);return e}function jt(t,e,i){let r=0,a=0;for(;i--;)1&e&&(r|=t.readUInt8()<<a),e>>=1,a+=8;return r}function Ot(t,e){const i=t.readUInt8();if(128&i){const r=jt(t,15&i,4);let a=jt(t,(112&i)>>4,3);return 0===a&&(a=65536),e.slice(r,r+a)}return t.slice(i)}function It(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:function(t){let e=[t];return{next:()=>Promise.resolve({done:0===e.length,value:e.pop()}),return:()=>(e=[],{}),[Symbol.asyncIterator](){return this}}}(t)}class Ct{constructor(t){if("undefined"==typeof Buffer)throw new Error("Missing Buffer dependency");this.stream=It(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>zt(e);){const t=await this._next();if(this._ended)break;e.push(t)}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 zt(t){return t.reduce((t,e)=>t+e.length,0)}async function Dt(t){let e=await t.byte();const i=e>>4&7;let r,a,n=15&e;if(128&e){let i=4;do{e=await t.byte(),n|=(127&e)<<i,i+=7}while(128&e)}if(6===i){let i=0;r=0;const n=[];do{e=await t.byte(),r|=(127&e)<<i,i+=7,n.push(e)}while(128&e);a=Buffer.from(n)}if(7===i){a=await t.read(20)}return{type:i,length:n,ofs:r,reference:a}}async function Tt(t){return s.inflate(t)}class Ut{constructor(t){Object.assign(this,t),this.offsetCache={}}static async fromIdx({idx:t,getExternalRefDelta:e}){const i=new _(t);if("ff744f63"!==i.slice(4).toString("hex"))return;const r=i.readUInt32BE();if(2!==r)throw new y(`Unable to read version ${r} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2147483648)throw new y("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+1020);const a=i.readUInt32BE(),n=[];for(let t=0;t<a;t++){const e=i.slice(20).toString("hex");n[t]=e}i.seek(i.tell()+4*a);const s=new Map;for(let t=0;t<a;t++)s.set(n[t],i.readUInt32BE());const o=i.slice(20).toString("hex");return new Ut({hashes:n,crcs:{},offsets:s,packfileSha:o,getExternalRefDelta:e})}static async fromPack({pack:t,getExternalRefDelta:e,onProgress:i}){const r={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},a={},o=t.slice(-20).toString("hex"),c=[],f={},d=new Map;let h=null,l=null;await async function(t,e){const i=new Ct(t);let r=await i.read(4);if(r=r.toString("utf8"),"PACK"!==r)throw new y(`Invalid PACK header '${r}'`);let a=await i.read(4);if(a=a.readUInt32BE(0),2!==a)throw new y(`Invalid packfile version: ${a}`);let n=await i.read(4);if(n=n.readUInt32BE(0),!(n<1))for(;!i.eof()&&n--;){const t=i.tell(),{type:r,length:a,ofs:o,reference:c}=await Dt(i),f=new s.Inflate;for(;!f.result;){const s=await i.chunk();if(!s)break;if(f.push(s,!1),f.err)throw new y(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==a)throw new y("Inflated object size is different from that stated in packfile.");await i.undo(),await i.read(s.length-f.strm.avail_in);const d=i.tell();await e({data:f.result,type:r,num:n,offset:t,end:d,reference:c,ofs:o})}}}}([t],async({data:t,type:e,reference:n,offset:s,num:o})=>{null===h&&(h=o);const c=Math.floor(100*(h-o)/h);c!==l&&i&&await i({phase:"Receiving objects",loaded:h-o,total:h}),l=c,(["commit","tree","blob","tag"].includes(e=r[e])||"ofs-delta"===e||"ref-delta"===e)&&(a[s]={type:e,offset:s})});const u=Object.keys(a).map(Number);for(const[e,i]of u.entries()){const r=e+1===u.length?t.byteLength-20:u[e+1],s=a[i],o=n.buf(t.slice(i,r))>>>0;s.end=r,s.crc=o}const g=new Ut({pack:Promise.resolve(t),packfileSha:o,crcs:f,hashes:c,offsets:d,getExternalRefDelta:e});l=null;let w=0;const p=[0,0,0,0,0,0,0,0,0,0,0,0];for(let t in a){t=Number(t);const e=Math.floor(100*w/h);e!==l&&i&&await i({phase:"Resolving deltas",loaded:w,total:h}),w++,l=e;const r=a[t];if(!r.oid)try{g.readDepth=0,g.externalReadDepth=0;const{type:e,object:i}=await g.readSlice({start:t});p[g.readDepth]+=1;const a=await A(At.wrap({type:e,object:i}));r.oid=a,c.push(a),d.set(a,t),f[a]=r.crc}catch(t){continue}}return c.sort(),g}async toBuffer(){const t=[],e=(e,i)=>{t.push(Buffer.from(e,i))};e("ff744f63","hex"),e("00000002","hex");const i=new _(Buffer.alloc(1024));for(let t=0;t<256;t++){let e=0;for(const i of this.hashes)parseInt(i.slice(0,2),16)<=t&&e++;i.writeUInt32BE(e)}t.push(i.buffer);for(const t of this.hashes)e(t,"hex");const r=new _(Buffer.alloc(4*this.hashes.length));for(const t of this.hashes)r.writeUInt32BE(this.crcs[t]);t.push(r.buffer);const a=new _(Buffer.alloc(4*this.hashes.length));for(const t of this.hashes)a.writeUInt32BE(this.offsets.get(t));t.push(a.buffer),e(this.packfileSha,"hex");const n=Buffer.concat(t),s=await A(n),o=Buffer.alloc(20);return o.write(s,"hex"),Buffer.concat([n,o])}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 y(`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=await this.pack;if(!e)throw new y("Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.");const i=e.slice(t),r=new _(i),a=r.readUInt8(),n=112&a;let s={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"}[n];if(void 0===s)throw new y("Unrecognized type: 0b"+n.toString(2));const o=15&a;let c=o;128&a&&(c=function(t,e){let i=e,r=4,a=null;do{a=t.readUInt8(),i|=(127&a)<<r,r+=7}while(128&a);return i}(r,o));let f=null,d=null;if("ofs_delta"===s){const e=function(t){const e=[];let i=0,r=0;do{i=t.readUInt8();const a=127&i;e.push(a),r=128&i}while(r);return e.reduce((t,e)=>t+1<<7|e,-1)}(r),i=t-e;({object:f,type:s}=await this.readSlice({start:i}))}if("ref_delta"===s){const t=r.slice(20).toString("hex");({object:f,type:s}=await this.read({oid:t}))}const h=i.slice(r.tell());if(d=Buffer.from(await Tt(h)),d.byteLength!==c)throw new y(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return f&&(d=Buffer.from(function(t,e){const i=new _(t),r=Pt(i);if(r!==e.byteLength)throw new y(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);const a=Pt(i);let n;const s=Ot(i,e);if(s.byteLength===a)n=s;else{n=Buffer.alloc(a);const t=new _(n);for(t.copy(s);!i.eof();)t.copy(Ot(i,e));const r=t.tell();if(a!==r)throw new y(`applyDelta expected target buffer to be ${a} bytes but the resulting buffer was ${r} bytes`)}return n}(d,f))),this.readDepth>3&&(this.offsetCache[t]={type:s,object:d}),{type:s,format:"content",object:d}}}const Nt=Symbol("PackfileCache");function Mt({fs:t,cache:e,filename:i,getExternalRefDelta:r,emitter:a,emitterPrefix:n}){e[Nt]||(e[Nt]=new Map);let s=e[Nt].get(i);return s||(s=async function({fs:t,filename:e,getExternalRefDelta:i,emitter:r,emitterPrefix:a}){const n=await t.read(e);return Ut.fromIdx({idx:n,getExternalRefDelta:i})}({fs:t,filename:i,getExternalRefDelta:r,emitter:a,emitterPrefix:n}),e[Nt].set(i,s)),s}async function Ft({fs:t,cache:e,gitdir:i,oid:r,format:a="content"}){const n=r=>Ft({fs:t,cache:e,gitdir:i,oid:r});let s;if("4b825dc642cb6eb9a060e54bf8d69288fbee4904"===r&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await Rt({fs:t,gitdir:i,oid:r})),!s){if(s=await async function({fs:t,cache:e,gitdir:i,oid:r,format:a="content",getExternalRefDelta:n}){let s=await t.readdir(X(i,"objects/pack"));s=s.filter(t=>t.endsWith(".idx"));for(const a of s){const s=`${i}/objects/pack/${a}`,o=await Mt({fs:t,cache:e,filename:s,getExternalRefDelta:n});if(o.error)throw new y(o.error);if(o.offsets.has(r)){const e=s.replace(/idx$/,"pack");o.pack||(o.pack=t.read(e));const i=await o.pack;if(!i)throw o.pack=null,new y(`Could not read packfile at ${e}. The file may be missing, corrupted, or too large to read into memory.`);if(!o._checksumVerified){const t=o.packfileSha,e=i.subarray(-20),r=Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("");if(r!==t)throw new y(`Packfile trailer mismatch: expected ${t}, got ${r}. The packfile may be corrupted.`);const a=i.subarray(0,-20),n=await A(a);if(n!==t)throw new y(`Packfile payload corrupted: calculated ${n} but expected ${t}. The packfile may have been tampered with.`);o._checksumVerified=!0}const c=await o.read({oid:r,getExternalRefDelta:n});return c.format="content",c.source=`objects/pack/${a.replace(/idx$/,"pack")}`,c}}return null}({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:n}),!s)throw new H(r);return s}if("deflated"===a)return s;if("deflated"===s.format&&(s.object=Buffer.from(await Tt(s.object)),s.format="wrapped"),"wrapped"===a)return s;const o=await A(s.object);if(o!==r)throw new y(`SHA check failed! Expected ${r}, computed ${o}`);const{object:c,type:f}=At.unwrap(s.object);if(s.type=f,s.object=c,s.format="content","content"===a)return s;throw new y(`invalid requested format "${a}"`)}class Ht extends u{constructor(t,e,i=!0){super(`Failed to create ${t} at ${e} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${t}.)`:""}`),this.code=this.name=Ht.code,this.data={noun:t,where:e,canForce:i}}}Ht.code="AlreadyExistsError";class qt extends u{constructor(t,e,i){super(`Found multiple ${t} matching "${e}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=qt.code,this.data={nouns:t,short:e,matches:i}}}qt.code="AmbiguousError";class Lt extends u{constructor(t){super(`Your local changes to the following files would be overwritten by checkout: ${t.join(", ")}`),this.code=this.name=Lt.code,this.data={filepaths:t}}}Lt.code="CheckoutConflictError";class Wt extends u{constructor(t,e){super(`Cannot cherry-pick merge commit ${t}. Merge commits have ${e} parents and require specifying which parent to use as the base.`),this.code=this.name=Wt.code,this.data={oid:t,parentCount:e}}}Wt.code="CherryPickMergeCommitError";class Zt extends u{constructor(t){super(`Cannot cherry-pick root commit ${t}. Root commits have no parents.`),this.code=this.name=Zt.code,this.data={oid:t}}}Zt.code="CherryPickRootCommitError";class Gt extends u{constructor(t,e){super(`Failed to checkout "${t}" because commit ${e} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=Gt.code,this.data={ref:t,oid:e}}}Gt.code="CommitNotFetchedError";class Kt extends u{constructor(){super("Empty response from git server."),this.code=this.name=Kt.code,this.data={}}}Kt.code="EmptyServerResponseError";class Vt extends u{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=Vt.code,this.data={}}}Vt.code="FastForwardError";class Xt extends u{constructor(t,e){super(`One or more branches were not updated: ${t}`),this.code=this.name=Xt.code,this.data={prettyDetails:t,result:e}}}Xt.code="GitPushError";class Yt extends u{constructor(t,e,i){super(`HTTP Error: ${t} ${e}`),this.code=this.name=Yt.code,this.data={statusCode:t,statusMessage:e,response:i}}}Yt.code="HttpError";class Jt extends u{constructor(t){let e="invalid filepath";"leading-slash"===t||"trailing-slash"===t?e='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':"directory"===t&&(e='"filepath" should not be a directory.'),super(e),this.code=this.name=Jt.code,this.data={reason:t}}}Jt.code="InvalidFilepathError";class Qt extends u{constructor(t,e){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${e}".)`),this.code=this.name=Qt.code,this.data={ref:t,suggestion:e}}}Qt.code="InvalidRefNameError";class te extends u{constructor(t){super(`Maximum search depth of ${t} exceeded.`),this.code=this.name=te.code,this.data={depth:t}}}te.code="MaxDepthError";class ee extends u{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=ee.code,this.data={}}}ee.code="MergeNotSupportedError";class ie extends u{constructor(t,e,i,r){super(`Automatic merge failed with one or more merge conflicts in the following files: ${t.toString()}. Fix conflicts then commit the result.`),this.code=this.name=ie.code,this.data={filepaths:t,bothModified:e,deleteByUs:i,deleteByTheirs:r}}}ie.code="MergeConflictError";class re extends u{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=re.code,this.data={role:t}}}re.code="MissingNameError";class ae extends u{constructor(t){super(`The function requires a "${t}" parameter but none was provided.`),this.code=this.name=ae.code,this.data={parameter:t}}}ae.code="MissingParameterError";class ne extends u{constructor(t){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=ne.code,this.data={errors:t},this.errors=t}}ne.code="MultipleGitError";class se extends u{constructor(t,e){super(`Expected "${t}" but received "${e}".`),this.code=this.name=se.code,this.data={expected:t,actual:e}}}se.code="ParseError";class oe extends u{constructor(t){let e="";"not-fast-forward"===t?e=" because it was not a simple fast-forward":"tag-exists"===t&&(e=" because tag already exists"),super(`Push rejected${e}. Use "force: true" to override.`),this.code=this.name=oe.code,this.data={reason:t}}}oe.code="PushRejectedError";class ce extends u{constructor(t,e){super(`Remote does not support the "${t}" so the "${e}" parameter cannot be used.`),this.code=this.name=ce.code,this.data={capability:t,parameter:e}}}ce.code="RemoteCapabilityError";class fe extends u{constructor(t,e){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${t}`),this.code=this.name=fe.code,this.data={preview:t,response:e}}}fe.code="SmartHttpError";class de extends u{constructor(t,e,i){super(`Git remote "${t}" uses an unrecognized transport protocol: "${e}"`),this.code=this.name=de.code,this.data={url:t,transport:e,suggestion:i}}}de.code="UnknownTransportError";class he extends u{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=he.code,this.data={url:t}}}he.code="UrlParseError";class le extends u{constructor(){super("The operation was canceled."),this.code=this.name=le.code,this.data={}}}le.code="UserCanceledError";class ue extends u{constructor(t){super(`Could not merge index: Entry for '${t}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=ue.code,this.data={filepath:t}}}ue.code="IndexResetError";class ge extends u{constructor(t){super(`"${t}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=ge.code,this.data={ref:t}}}ge.code="NoCommitError";var we=Object.freeze({__proto__:null,AlreadyExistsError:Ht,AmbiguousError:qt,CheckoutConflictError:Lt,CherryPickMergeCommitError:Wt,CherryPickRootCommitError:Zt,CommitNotFetchedError:Gt,EmptyServerResponseError:Kt,FastForwardError:Vt,GitPushError:Xt,HttpError:Yt,InternalError:y,InvalidFilepathError:Jt,InvalidOidError:L,InvalidRefNameError:Qt,MaxDepthError:te,MergeNotSupportedError:ee,MergeConflictError:ie,MissingNameError:re,MissingParameterError:ae,MultipleGitError:ne,NoRefspecError:W,NotFoundError:H,ObjectTypeError:q,ParseError:se,PushRejectedError:oe,RemoteCapabilityError:ce,SmartHttpError:fe,UnknownTransportError:de,UnsafeFilepathError:b,UrlParseError:he,UserCanceledError:le,UnmergedPathsError:m,IndexResetError:ue,NoCommitError:ge});function pe({name:t,email:e,timestamp:i,timezoneOffset:r}){return`${t} <${e}> ${i} ${r=function(t){const e=function(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}((i=t,0===i?i:-i));var i;t=Math.abs(t);const r=Math.floor(t/60);t-=60*r;let a=String(r),n=String(t);a.length<2&&(a="0"+a);n.length<2&&(n="0"+n);return(-1===e?"-":"+")+a+n}(r)}`}function me(t){return t=(t=(t=t.replace(/\r/g,"")).replace(/^\n+/,"")).replace(/\n+$/,"")+"\n"}function ye(t){const[,e,i,r,a]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:i,timestamp:Number(r),timezoneOffset:be(a)}}function be(t){let[,e,i,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=("+"===e?1:-1)*(60*Number(i)+Number(r)),0===(a=r)?a:-a;var a}class _e{constructor(t){if("string"==typeof t)this._tag=t;else if(Buffer.isBuffer(t))this._tag=t.toString("utf8");else{if("object"!=typeof t)throw new y("invalid type passed to GitAnnotatedTag constructor");this._tag=_e.render(t)}}static from(t){return new _e(t)}static render(t){return`object ${t.object}\ntype ${t.type}\ntag ${t.tag}\ntagger ${pe(t.tagger)}\n\n${t.message}\n${t.gpgsig?t.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf("\n\n"))}message(){const t=this.withoutSignature();return t.slice(t.indexOf("\n\n")+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){const t=this.justHeaders().split("\n"),e=[];for(const i of t)" "===i[0]?e[e.length-1]+="\n"+i.slice(1):e.push(i);const i={};for(const t of e){const e=t.slice(0,t.indexOf(" ")),r=t.slice(t.indexOf(" ")+1);Array.isArray(i[e])?i[e].push(r):i[e]=r}return i.tagger&&(i.tagger=ye(i.tagger)),i.committer&&(i.committer=ye(i.committer)),i}withoutSignature(){const t=me(this._tag);return-1===t.indexOf("\n-----BEGIN PGP SIGNATURE-----")?t:t.slice(0,t.lastIndexOf("\n-----BEGIN PGP SIGNATURE-----"))}gpgsig(){if(-1===this._tag.indexOf("\n-----BEGIN PGP SIGNATURE-----"))return;return me(this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27))}payload(){return this.withoutSignature()+"\n"}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(t,e,i){const r=t.payload();let{signature:a}=await e({payload:r,secretKey:i});a=me(a);const n=r+a;return _e.from(n)}}function ve(t){return t.trim().split("\n").map(t=>" "+t).join("\n")+"\n"}class xe{constructor(t){if("string"==typeof t)this._commit=t;else if(Buffer.isBuffer(t))this._commit=t.toString("utf8");else{if("object"!=typeof t)throw new y("invalid type passed to GitCommit constructor");this._commit=xe.render(t)}}static fromPayloadSignature({payload:t,signature:e}){const i=xe.justHeaders(t),r=xe.justMessage(t),a=me(i+"\ngpgsig"+ve(e)+"\n"+r);return new xe(a)}static from(t){return new xe(t)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return xe.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(t){return me(t.slice(t.indexOf("\n\n")+2))}static justHeaders(t){return t.slice(0,t.indexOf("\n\n"))}parseHeaders(){const t=xe.justHeaders(this._commit).split("\n"),e=[];for(const i of t)" "===i[0]?e[e.length-1]+="\n"+i.slice(1):e.push(i);const i={parent:[]};for(const t of e){const e=t.slice(0,t.indexOf(" ")),r=t.slice(t.indexOf(" ")+1);Array.isArray(i[e])?i[e].push(r):i[e]=r}return i.author&&(i.author=ye(i.author)),i.committer&&(i.committer=ye(i.committer)),i}static renderHeaders(t){let e="";if(t.tree?e+=`tree ${t.tree}\n`:e+="tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n",t.parent){if(void 0===t.parent.length)throw new y("commit 'parent' property should be an array");for(const i of t.parent)e+=`parent ${i}\n`}e+=`author ${pe(t.author)}\n`;return e+=`committer ${pe(t.committer||t.author)}\n`,t.gpgsig&&(e+="gpgsig"+ve(t.gpgsig)),e}static render(t){return xe.renderHeaders(t)+"\n"+me(t.message)}render(){return this._commit}withoutSignature(){const t=me(this._commit);if(-1===t.indexOf("\ngpgsig"))return t;return me(t.slice(0,t.indexOf("\ngpgsig"))+"\n"+t.slice(t.indexOf("-----END PGP SIGNATURE-----\n")+28))}isolateSignature(){const t=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return t.split("\n").map(t=>t.replace(/^ /,"")).join("\n")}static async sign(t,e,i){const r=t.withoutSignature(),a=xe.justMessage(t._commit);let{signature:n}=await e({payload:r,secretKey:i});n=me(n);const s=xe.justHeaders(t._commit)+"\ngpgsig"+ve(n)+"\n"+a;return xe.from(s)}}async function ke({fs:t,cache:e,gitdir:i,oid:r}){if("4b825dc642cb6eb9a060e54bf8d69288fbee4904"===r)return{tree:Bt.from([]),oid:r};const{type:a,object:n}=await Ft({fs:t,cache:e,gitdir:i,oid:r});if("tag"===a)return ke({fs:t,cache:e,gitdir:i,oid:r=_e.from(n).parse().object});if("commit"===a)return ke({fs:t,cache:e,gitdir:i,oid:r=xe.from(n).parse().tree});if("tree"!==a)throw new q(r,a,"tree");return{tree:Bt.from(n),oid:r}}class Ee{constructor({fs:t,gitdir:e,ref:i,cache:r}){this.fs=t,this.cache=r,this.gitdir=e,this.mapPromise=(async()=>{const r=new Map;let a;try{a=await xt.resolve({fs:t,gitdir:e,ref:i})}catch(t){t instanceof H&&(a="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}const n=await ke({fs:t,cache:this.cache,gitdir:e,oid:a});return n.type="tree",n.mode="40000",r.set(".",n),r})();const a=this;this.ConstructEntry=class{constructor(t){this._fullpath=t,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){const e=t._fullpath,{fs:i,cache:r,gitdir:a}=this,n=await this.mapPromise,s=n.get(e);if(!s)throw new Error(`No obj for ${e}`);const o=s.oid;if(!o)throw new Error(`No oid for obj ${JSON.stringify(s)}`);if("tree"!==s.type)return null;const{type:c,object:f}=await Ft({fs:i,cache:r,gitdir:a,oid:o});if(c!==s.type)throw new q(o,c,s.type);const d=Bt.from(f);for(const t of d)n.set(X(e,t.path),t);return d.entries().map(t=>X(e,t.path))}async type(t){if(!1===t._type){const e=await this.mapPromise,{type:i}=e.get(t._fullpath);t._type=i}return t._type}async mode(t){if(!1===t._mode){const e=await this.mapPromise,{mode:i}=e.get(t._fullpath);t._mode=k(parseInt(i,8))}return t._mode}async stat(t){}async content(t){if(!1===t._content){const e=await this.mapPromise,{fs:i,cache:r,gitdir:a}=this,n=e.get(t._fullpath).oid,{type:s,object:o}=await Ft({fs:i,cache:r,gitdir:a,oid:n});t._content="blob"!==s?void 0:new Uint8Array(o)}return t._content}async oid(t){if(!1===t._oid){const e=(await this.mapPromise).get(t._fullpath);t._oid=e.oid}return t._oid}}function $e({ref:t="HEAD"}={}){const e=Object.create(null);return Object.defineProperty(e,M,{value:function({fs:e,gitdir:i,cache:r}){return new Ee({fs:e,gitdir:i,ref:t,cache:r})}}),Object.freeze(e),e}class Se{constructor({fs:t,dir:e,gitdir:i,cache:r}){this.fs=t,this.cache=r,this.dir=e,this.gitdir=i,this.config=null;const a=this;this.ConstructEntry=class{constructor(t){this._fullpath=t,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){const e=t._fullpath,{fs:i,dir:r}=this,a=await i.readdir(X(r,e));return null===a?null:a.map(t=>X(e,t))}async type(t){return!1===t._type&&await t.stat(),t._type}async mode(t){return!1===t._mode&&await t.stat(),t._mode}async stat(t){if(!1===t._stat){const{fs:e,dir:i}=this;let r=await e.lstat(`${i}/${t._fullpath}`);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let a=r.isDirectory()?"tree":"blob";"blob"!==a||r.isFile()||r.isSymbolicLink()||(a="special"),t._type=a,r=S(r),t._mode=r.mode,-1===r.size&&t._actualSize&&(r.size=t._actualSize),t._stat=r}return t._stat}async content(t){if(!1===t._content){const{fs:e,dir:i,gitdir:r}=this;if("tree"===await t.type())t._content=void 0;else{let a;if(await t.mode()>>12==10)a=await e.readlink(`${i}/${t._fullpath}`);else{const n=await this._getGitConfig(e,r),s=await n.get("core.autocrlf");a=await e.read(`${i}/${t._fullpath}`,{autocrlf:s})}t._actualSize=a.length,t._stat&&-1===t._stat.size&&(t._stat.size=t._actualSize),t._content=new Uint8Array(a)}}return t._content}async oid(t){if(!1===t._oid){const e=this,{fs:i,gitdir:r,cache:a}=this;let n;await z.acquire({fs:i,gitdir:r,cache:a},async function(a){const s=a.entriesMap.get(t._fullpath),o=await t.stat(),c=await e._getGitConfig(i,r),f=await c.get("core.filemode"),d="undefined"==typeof process||!("win32"===process.platform);if(!s||O(o,s,f,d)){const e=await t.content();void 0===e?n=void 0:(n=await A(At.wrap({type:"blob",object:e})),!s||n!==s.oid||f&&o.mode!==s.mode||!O(o,s,f,d)||a.insert({filepath:t._fullpath,stats:o,oid:n}))}else n=s.oid}),t._oid=n}return t._oid}async _getGitConfig(t,e){return this.config||(this.config=await gt.get({fs:t,gitdir:e})),this.config}}function Be(){const t=Object.create(null);return Object.defineProperty(t,M,{value:function({fs:t,dir:e,gitdir:i,cache:r}){return new Se({fs:t,dir:e,gitdir:i,cache:r})}}),Object.freeze(t),t}const Ae=void 0===Array.prototype.flat?t=>t.reduce((t,e)=>t.concat(e),[]):t=>t.flat();class Re{constructor(){this.value=null}consider(t){null!=t&&(null===this.value||t<this.value)&&(this.value=t)}reset(){this.value=null}}function*Pe(t){const e=new Re;let i;const r=[],a=t.length;for(let i=0;i<a;i++)r[i]=t[i].next().value,void 0!==r[i]&&e.consider(r[i]);if(null!==e.value)for(;;){const n=[];i=e.value,e.reset();for(let s=0;s<a;s++)void 0!==r[s]&&r[s]===i?(n[s]=r[s],r[s]=t[s].next().value):n[s]=null,void 0!==r[s]&&e.consider(r[s]);if(yield n,null===e.value)return}}async function je({fs:t,cache:e,dir:i,gitdir:r,trees:a,map:n=async(t,e)=>e,reduce:s=async(t,e)=>{const i=Ae(e);return void 0!==t&&i.unshift(t),i},iterate:o=(t,e)=>Promise.all([...e].map(t))}){const c=a.map(a=>a[M]({fs:t,dir:i,gitdir:r,cache:e})),f=new Array(c.length).fill("."),d=function(t,e){const i=e-t;return Array.from({length:i},(e,i)=>t+i)}(0,c.length),h=async t=>{const{entries:e,children:i}=await(async t=>{d.forEach(e=>{const i=t[e];t[e]=i&&new c[e].ConstructEntry(i)});const e=(await Promise.all(d.map(e=>{const i=t[e];return i?c[e].readdir(i):[]}))).map(t=>(null===t?[]:t)[Symbol.iterator]());return{entries:t,children:Pe(e)}})(t),r=e.find(t=>t&&t._fullpath)._fullpath,a=await n(r,e);if(null!==a){let t=await o(h,i);return t=t.filter(t=>void 0!==t),s(a,t)}};return h(f)}async function Oe(t,e){const i=await t.readdir(e);null==i?await t.rm(e):i.length?await Promise.all(i.map(i=>{const r=X(e,i);return t.lstat(r).then(e=>{if(e)return e.isDirectory()?Oe(t,r):t.rm(r)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function Ie(t){return"function"==typeof t}function Ce(t){return function(t){return t&&"object"==typeof t}(e=(t=>{try{return t.readFile().catch(t=>t)}catch(t){return t}})(t))&&Ie(e.then)&&Ie(e.catch);var e}const ze=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function De(t,e){if(Ce(e))for(const i of ze)t[`_${i}`]=e[i].bind(e);else for(const i of ze)t[`_${i}`]=o(e[i].bind(e));Ce(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Oe.bind(null,t)):(e.cp&&(t._cp=o(e.cp.bind(e))),e.rm?t._rm=o(e.rm.bind(e)):e.rmdir.length>2?t._rm=o(e.rmdir.bind(e)):t._rm=Oe.bind(null,t))}class Te{constructor(t){if(void 0!==t._original_unwrapped_fs)return t;const e=Object.getOwnPropertyDescriptor(t,"promises");e&&e.enumerable?De(this,t.promises):De(this,t),this._original_unwrapped_fs=t}async exists(t,e={}){try{return await this._stat(t),!0}catch(t){if("ENOENT"===t.code||"ENOTDIR"===t.code||(t.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',t),t}}async read(t,e={}){try{let i=await this._readFile(t,e);if("true"===e.autocrlf)try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,"\n"),i=(new TextEncoder).encode(i)}catch(t){}return"string"!=typeof i&&(i=Buffer.from(i)),i}catch(t){return null}}async write(t,e,i={}){try{await this._writeFile(t,e,i)}catch(r){await this.mkdir(T(t)),await this._writeFile(t,e,i)}}async mkdir(t,e=!1){try{await this._mkdir(t)}catch(i){if(null===i)return;if("EEXIST"===i.code)return;if(e)throw i;if("ENOENT"===i.code){const e=T(t);if("."===e||"/"===e||e===t)throw i;await this.mkdir(e),await this.mkdir(t,!0)}}}async rm(t){try{await this._unlink(t)}catch(t){if("ENOENT"!==t.code)throw t}}async rmdir(t,e){try{e&&e.recursive?await this._rm(t,e):await this._rmdir(t)}catch(t){if("ENOENT"!==t.code)throw t}}async readdir(t){try{const e=await this._readdir(t);return e.sort(v),e}catch(t){return"ENOTDIR"===t.code?null:[]}}async readdirDeep(t){const e=await this._readdir(t);return(await Promise.all(e.map(async e=>{const i=t+"/"+e;return(await this._stat(i)).isDirectory()?this.readdirDeep(i):i}))).reduce((t,e)=>t.concat(e),[])}async lstat(t){try{return await this._lstat(t)}catch(t){if("ENOENT"===t.code||(t.code||"").includes("ENS"))return null;throw t}}async readlink(t,e={encoding:"buffer"}){try{const i=await this._readlink(t,e);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(t){if("ENOENT"===t.code||(t.code||"").includes("ENS"))return null;throw t}}async writelink(t,e){return this._symlink(e.toString("utf8"),t)}}function Ue(t,e){if(void 0===e)throw new ae(t)}async function Ne({fsp:t,dotgit:e}){Ue("fsp",t),Ue("dotgit",e);const i=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return i.isDirectory()?e:i.isFile()?t._readFile(e,"utf8").then(t=>t.trimRight().substr(8)).then(t=>{if((i=t).startsWith("/")||/^[a-zA-Z]:[\\/]/.test(i))return t;var i;return X(T(e),t)}):e}async function Me(t,e){return!(!t&&!e)&&(!(!t||e)||(!(t||!e)||("tree"!==await t.type()||"tree"!==await e.type())&&(await t.type()!==await e.type()||await t.mode()!==await e.mode()||await t.oid()!==await e.oid())))}async function Fe({fs:t,dir:e,gitdir:i=X(e,".git"),commit:r="HEAD",cache:a={}}){try{Ue("fs",t),Ue("dir",e),Ue("gitdir",i);const n=new Te(t),s=[$e({ref:r}),Be(),F()];let o=[];const c=await Ne({fsp:n,dotgit:i});await z.acquire({fs:n,gitdir:c,cache:a},async function(t){o=t.unmergedPaths});const f=await je({fs:n,cache:a,dir:e,gitdir:c,trees:s,map:async function(t,[e,i,r]){const a=!await Me(i,r),n=o.includes(t),s=!await Me(r,e);if(a||n)return e?{path:t,mode:await e.mode(),oid:await e.oid(),type:await e.type(),content:await e.content()}:void 0;if(s)return!1;throw new ue(t)}});await z.acquire({fs:n,gitdir:c,cache:a},async function(t){for(const i of f)if(!1!==i)if(i){if("blob"===i.type){const r=(new TextDecoder).decode(i.content);await n.write(`${e}/${i.path}`,r,{mode:i.mode}),t.insert({filepath:i.path,oid:i.oid,stage:0})}}else await n.rmdir(`${e}/${i.path}`,{recursive:!0}),t.delete({filepath:i.path})})}catch(t){throw t.caller="git.abortMerge",t}}class He{static async isIgnored({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r}){if(".git"===D(r))return!0;if("."===r)return!1;let a="";const n=X(i,"info","exclude");await t.exists(n)&&(a=await t.read(n,"utf8"));const s=[{gitignore:X(e,".gitignore"),filepath:r}],o=r.split("/").filter(Boolean);for(let t=1;t<o.length;t++){const i=o.slice(0,t).join("/"),r=o.slice(t).join("/");s.push({gitignore:X(e,i,".gitignore"),filepath:r})}let c=!1;for(const e of s){let i;try{i=await t.read(e.gitignore,"utf8")}catch(t){if("NOENT"===t.code)continue}const r=d().add(a);r.add(i);const n=T(e.filepath);if("."!==n&&r.ignores(n))return!0;c=c?!r.test(e.filepath).unignored:r.test(e.filepath).ignored}return c}}let qe=null;async function Le(t){return null===qe&&(qe=function(){try{new CompressionStream("deflate").writable.close();return new Blob([]).stream().cancel(),!0}catch(t){return!1}}()),qe?async function(t){const e=new CompressionStream("deflate"),i=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(i).arrayBuffer())}(t):s.deflate(t)}async function We({fs:t,gitdir:e,type:i,object:r,format:a="content",oid:n,dryRun:s=!1}){return"deflated"!==a&&("wrapped"!==a&&(r=At.wrap({type:i,object:r})),n=await A(r),r=Buffer.from(await Le(r))),s||await async function({fs:t,gitdir:e,object:i,format:r,oid:a}){const n=`${e}/objects/${a.slice(0,2)}/${a.slice(2)}`;await t.exists(n)||await t.write(n,i)}({fs:t,gitdir:e,object:r,format:"deflated",oid:n}),n}function Ze(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function Ge({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r,cache:a={},force:n=!1,parallel:s=!0}){try{Ue("fs",t),Ue("dir",e),Ue("gitdir",i),Ue("filepath",r);const o=new Te(t),c=await Ne({fsp:o,dotgit:i});await z.acquire({fs:o,gitdir:c,cache:a},async t=>{const i=await gt.get({fs:o,gitdir:c}),a=await i.get("core.autocrlf");return Ke({dir:e,gitdir:c,fs:o,filepath:r,index:t,force:n,parallel:s,autocrlf:a})})}catch(t){throw t.caller="git.add",t}}async function Ke({dir:t,gitdir:e,fs:i,filepath:r,index:a,force:n,parallel:s,autocrlf:o}){const c=(r=Array.isArray(r)?r:[r]).map(async r=>{if(!n){if(await He.isIgnored({fs:i,dir:t,gitdir:e,filepath:r}))return}const c=await i.lstat(X(t,r));if(!c)throw new H(r);if(c.isDirectory()){const c=await i.readdir(X(t,r));if(s){const f=c.map(c=>Ke({dir:t,gitdir:e,fs:i,filepath:[X(r,c)],index:a,force:n,parallel:s,autocrlf:o}));await Promise.all(f)}else for(const f of c)await Ke({dir:t,gitdir:e,fs:i,filepath:[X(r,f)],index:a,force:n,parallel:s,autocrlf:o})}else{const n=c.isSymbolicLink()?await i.readlink(X(t,r)).then(Ze):await i.read(X(t,r),{autocrlf:o});if(null===n)throw new H(r);const s=await We({fs:i,gitdir:e,type:"blob",object:n});a.insert({filepath:r,stats:c,oid:s})}}),f=await Promise.allSettled(c),d=f.filter(t=>"rejected"===t.status).map(t=>t.reason);if(d.length>1)throw new ne(d);if(1===d.length)throw d[0];return f.filter(t=>"fulfilled"===t.status&&t.value).map(t=>t.value)}async function Ve({fs:t,gitdir:e,path:i}){return(await gt.get({fs:t,gitdir:e})).get(i)}function Xe(t,...e){for(const i of e)if(i)for(const e of Object.keys(i)){const r=i[e];void 0!==r&&(t[e]=r)}return t}async function Ye({fs:t,gitdir:e,author:i,commit:r}){const a=Math.floor(Date.now()/1e3),n=Xe({},{name:await Ve({fs:t,gitdir:e,path:"user.name"}),email:await Ve({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(1e3*a).getTimezoneOffset()},r?r.author:void 0,i);if(void 0!==n.name)return n}async function Je({fs:t,gitdir:e,author:i,committer:r,commit:a}){const n=Math.floor(Date.now()/1e3),s=Xe({},{name:await Ve({fs:t,gitdir:e,path:"user.name"}),email:await Ve({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(1e3*n).getTimezoneOffset()},a?a.committer:void 0,i,r);if(void 0!==s.name)return s}async function Qe({fs:t,cache:e,gitdir:i,oid:r}){const{type:a,object:n}=await Ft({fs:t,cache:e,gitdir:i,oid:r});if("tag"===a)return Qe({fs:t,cache:e,gitdir:i,oid:r=_e.from(n).parse().object});if("commit"!==a)throw new q(r,a,"commit");return{commit:xe.from(n),oid:r}}async function ti({fs:t,cache:e,gitdir:i,oid:r}){const{commit:a,oid:n}=await Qe({fs:t,cache:e,gitdir:i,oid:r});return{oid:n,commit:a.parse(),payload:a.withoutSignature()}}async function ei({fs:t,cache:e,onSign:i,gitdir:r,message:a,author:n,committer:s,signingKey:o,amend:c=!1,dryRun:f=!1,noUpdateBranch:d=!1,ref:h,parent:l,tree:u}){let g,w,p=!1,m=!1;if(!h){const e=await t.read(`${r}/HEAD`,{encoding:"utf8"});m=!e.startsWith("ref:"),h=await xt.resolve({fs:t,gitdir:r,ref:"HEAD",depth:2})}try{g=await xt.resolve({fs:t,gitdir:r,ref:h}),w=await ti({fs:t,gitdir:r,oid:g,cache:{}})}catch{p=!0}if(c&&p)throw new ge(h);const y=c?await Ye({fs:t,gitdir:r,author:n,commit:w.commit}):await Ye({fs:t,gitdir:r,author:n});if(!y)throw new re("author");const b=c?await Je({fs:t,gitdir:r,author:y,committer:s,commit:w.commit}):await Je({fs:t,gitdir:r,author:y,committer:s});if(!b)throw new re("committer");return z.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async function(e){const n=U(e.entries).get(".");if(u||(u=await ii({fs:t,gitdir:r,inode:n,dryRun:f})),l=l?await Promise.all(l.map(e=>xt.resolve({fs:t,gitdir:r,ref:e}))):c?w.commit.parent:g?[g]:[],!a){if(!c)throw new ae("message");a=w.commit.message}let s=xe.from({tree:u,parent:l,author:y,committer:b,message:a});o&&(s=await xe.sign(s,i,o));const p=await We({fs:t,gitdir:r,type:"commit",object:s.toObject(),dryRun:f});return d||f||await xt.writeRef({fs:t,gitdir:r,ref:m?"HEAD":h,value:p}),p})}async function ii({fs:t,gitdir:e,inode:i,dryRun:r}){const a=i.children;for(const i of a)"tree"===i.type&&(i.metadata.mode="040000",i.metadata.oid=await ii({fs:t,gitdir:e,inode:i,dryRun:r}));const n=a.map(t=>({mode:t.metadata.mode,path:t.basename,oid:t.metadata.oid,type:t.type})),s=Bt.from(n);return await We({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:r})}async function ri({fs:t,cache:e,gitdir:i,oid:r,filepath:a}){if(a.startsWith("/"))throw new Jt("leading-slash");if(a.endsWith("/"))throw new Jt("trailing-slash");const n=r,s=await ke({fs:t,cache:e,gitdir:i,oid:r}),o=s.tree;if(""===a)r=s.oid;else{const s=a.split("/");r=await ai({fs:t,cache:e,gitdir:i,tree:o,pathArray:s,oid:n,filepath:a})}return r}async function ai({fs:t,cache:e,gitdir:i,tree:r,pathArray:a,oid:n,filepath:s}){const o=a.shift();for(const c of r)if(c.path===o){if(0===a.length)return c.oid;{const{type:o,object:f}=await Ft({fs:t,cache:e,gitdir:i,oid:c.oid});if("tree"!==o)throw new q(n,o,"tree",s);return ai({fs:t,cache:e,gitdir:i,tree:r=Bt.from(f),pathArray:a,oid:n,filepath:s})}}throw new H(`file or directory found at "${n}:${s}"`)}async function ni({fs:t,cache:e,gitdir:i,oid:r,filepath:a}){void 0!==a&&(r=await ri({fs:t,cache:e,gitdir:i,oid:r,filepath:a}));const{tree:n,oid:s}=await ke({fs:t,cache:e,gitdir:i,oid:r});return{oid:s,tree:n.entries()}}async function si({fs:t,gitdir:e,tree:i}){const r=Bt.from(i).toObject();return await We({fs:t,gitdir:e,type:"tree",object:r,format:"content"})}async function oi({fs:t,onSign:e,dir:i,gitdir:r=X(i,".git"),ref:a="refs/notes/commits",oid:n,note:s,force:o,author:c,committer:f,signingKey:d,cache:h={}}){try{Ue("fs",t),Ue("gitdir",r),Ue("oid",n),Ue("note",s),d&&Ue("onSign",e);const i=new Te(t),l=await Ye({fs:i,gitdir:r,author:c});if(!l)throw new re("author");const u=await Je({fs:i,gitdir:r,author:l,committer:f});if(!u)throw new re("committer");const g=await Ne({fsp:i,dotgit:r});return await async function({fs:t,cache:e,onSign:i,gitdir:r,ref:a,oid:n,note:s,force:o,author:c,committer:f,signingKey:d}){let h;try{h=await xt.resolve({gitdir:r,fs:t,ref:a})}catch(t){if(!(t instanceof H))throw t}let l=(await ni({fs:t,cache:e,gitdir:r,oid:h||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)l=l.filter(t=>t.path!==n);else for(const t of l)if(t.path===n)throw new Ht("note",n);"string"==typeof s&&(s=Buffer.from(s,"utf8"));const u=await We({fs:t,gitdir:r,type:"blob",object:s,format:"content"});l.push({mode:"100644",path:n,oid:u,type:"blob"});const g=await si({fs:t,gitdir:r,tree:l});return await ei({fs:t,cache:e,onSign:i,gitdir:r,ref:a,tree:g,parent:h&&[h],message:"Note added by 'isomorphic-git addNote'\n",author:c,committer:f,signingKey:d})}({fs:i,cache:h,onSign:e,gitdir:g,ref:a,oid:n,note:s,force:o,author:l,committer:u,signingKey:d})}catch(t){throw t.caller="git.addNote",t}}const ci=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function fi(t,e){if("string"!=typeof t)throw new TypeError("Reference name must be a string");return!ci.test(t)&&!0}async function di({fs:t,gitdir:e,remote:i,url:r,force:a}){if(!fi(i))throw new Qt(i,h.clean(i));const n=await gt.get({fs:t,gitdir:e});if(!a){if((await n.getSubsections("remote")).includes(i)&&r!==await n.get(`remote.${i}.url`))throw new Ht("remote",i)}await n.set(`remote.${i}.url`,r),await n.set(`remote.${i}.fetch`,`+refs/heads/*:refs/remotes/${i}/*`),await gt.save({fs:t,gitdir:e,config:n})}async function hi({fs:t,dir:e,gitdir:i=X(e,".git"),remote:r,url:a,force:n=!1}){try{Ue("fs",t),Ue("gitdir",i),Ue("remote",r),Ue("url",a);const e=new Te(t),s=await Ne({fsp:e,dotgit:i});return await di({fs:e,gitdir:s,remote:r,url:a,force:n})}catch(t){throw t.caller="git.addRemote",t}}async function li({fs:t,onSign:e,dir:i,gitdir:r=X(i,".git"),ref:a,tagger:n,message:s=a,gpgsig:o,object:c,signingKey:f,force:d=!1,cache:h={}}){try{Ue("fs",t),Ue("gitdir",r),Ue("ref",a),f&&Ue("onSign",e);const i=new Te(t),l=await Ne({fsp:i,dotgit:r}),u=await Ye({fs:i,gitdir:l,author:n});if(!u)throw new re("tagger");return await async function({fs:t,cache:e,onSign:i,gitdir:r,ref:a,tagger:n,message:s=a,gpgsig:o,object:c,signingKey:f,force:d=!1}){if(a=a.startsWith("refs/tags/")?a:`refs/tags/${a}`,!d&&await xt.exists({fs:t,gitdir:r,ref:a}))throw new Ht("tag",a);const h=await xt.resolve({fs:t,gitdir:r,ref:c||"HEAD"}),{type:l}=await Ft({fs:t,cache:e,gitdir:r,oid:h});let u=_e.from({object:h,type:l,tag:a.replace("refs/tags/",""),tagger:n,message:s,gpgsig:o});f&&(u=await _e.sign(u,i,f));const g=await We({fs:t,gitdir:r,type:"tag",object:u.toObject()});await xt.writeRef({fs:t,gitdir:r,ref:a,value:g})}({fs:i,cache:h,onSign:e,gitdir:l,ref:a,tagger:u,message:s,gpgsig:o,object:c,signingKey:f,force:d})}catch(t){throw t.caller="git.annotatedTag",t}}async function ui({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r,object:a,checkout:n=!1,force:s=!1}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r);const e=new Te(t),o=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e,ref:i,object:r,checkout:a=!1,force:n=!1}){if(!fi(i))throw new Qt(i,h.clean(i));const s=`refs/heads/${i}`;if(!n&&await xt.exists({fs:t,gitdir:e,ref:s}))throw new Ht("branch",i,!1);let o;try{o=await xt.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch(t){}o&&await xt.writeRef({fs:t,gitdir:e,ref:s,value:o}),a&&await xt.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}({fs:e,gitdir:o,ref:r,object:a,checkout:n,force:s})}catch(t){throw t.caller="git.branch",t}}const gi=(t,e)=>"."===t||null==e||0===e.length||"."===e||(e.length>=t.length?e.startsWith(t):t.startsWith(e));async function wi({fs:t,cache:e,onProgress:i,onPostCheckout:r,dir:a,gitdir:n,remote:s,ref:o,filepaths:c,noCheckout:f,noUpdateHead:d,dryRun:h,force:l,track:u=!0,nonBlocking:g=!1,batchSize:w=100}){let p,m;if(r)try{p=await xt.resolve({fs:t,gitdir:n,ref:"HEAD"})}catch(t){p="0000000000000000000000000000000000000000"}try{m=await xt.resolve({fs:t,gitdir:n,ref:o})}catch(e){if("HEAD"===o)throw e;const i=`${s}/${o}`;if(m=await xt.resolve({fs:t,gitdir:n,ref:i}),u){const e=await gt.get({fs:t,gitdir:n});await e.set(`branch.${o}.remote`,s),await e.set(`branch.${o}.merge`,`refs/heads/${o}`),await gt.save({fs:t,gitdir:n,config:e})}await xt.writeRef({fs:t,gitdir:n,ref:`refs/heads/${o}`,value:m})}if(!f){let s;try{s=await async function({fs:t,cache:e,onProgress:i,dir:r,gitdir:a,ref:n,force:s,filepaths:o}){let c=0;return je({fs:t,cache:e,dir:r,gitdir:a,trees:[$e({ref:n}),Be(),F()],map:async function(t,[e,r,a]){if("."===t)return;if(o&&!o.some(e=>gi(t,e)))return null;i&&await i({phase:"Analyzing workdir",loaded:++c});switch([!!a,!!e,!!r].map(Number).join("")){case"000":return;case"001":return s&&o&&o.includes(t)?["delete",t]:void 0;case"010":switch(await e.type()){case"tree":return["mkdir",t];case"blob":return["create",t,await e.oid(),await e.mode()];case"commit":return["mkdir-index",t,await e.oid(),await e.mode()];default:return["error",`new entry Unhandled type ${await e.type()}`]}case"011":switch(`${await e.type()}-${await r.type()}`){case"tree-tree":case"commit-tree":return;case"tree-blob":case"blob-tree":case"commit-blob":return["conflict",t];case"blob-blob":return await e.oid()!==await r.oid()?s?["update",t,await e.oid(),await e.mode(),await e.mode()!==await r.mode()]:["conflict",t]:await e.mode()!==await r.mode()?s?["update",t,await e.oid(),await e.mode(),!0]:["conflict",t]:["create-index",t,await e.oid(),await e.mode()];default:return["error",`new entry Unhandled type ${e.type}`]}case"100":return["delete-index",t];case"101":switch(await a.type()){case"tree":case"commit":return["rmdir-index",t];case"blob":return await a.oid()!==await r.oid()?s?["delete",t]:["conflict",t]:["delete",t];default:return["error",`delete entry Unhandled type ${await a.type()}`]}case"110":case"111":switch(`${await a.type()}-${await e.type()}`){case"tree-tree":return;case"blob-blob":if(await a.oid()===await e.oid()&&await a.mode()===await e.mode()&&!s)return;if(r){if(await r.oid()!==await a.oid()&&await r.oid()!==await e.oid())return s?["update",t,await e.oid(),await e.mode(),await e.mode()!==await r.mode()]:["conflict",t]}else if(s)return["update",t,await e.oid(),await e.mode(),await e.mode()!==await a.mode()];return await e.mode()!==await a.mode()?["update",t,await e.oid(),await e.mode(),!0]:await e.oid()!==await a.oid()?["update",t,await e.oid(),await e.mode(),!1]:void 0;case"tree-blob":return["update-dir-to-blob",t,await e.oid()];case"blob-tree":return["update-blob-to-tree",t];case"commit-commit":return["mkdir-index",t,await e.oid(),await e.mode()];default:return["error",`update entry Unhandled type ${await a.type()}-${await e.type()}`]}}},reduce:async function(t,e){return e=Ae(e),t?t&&"rmdir"===t[0]?(e.push(t),e):(e.unshift(t),e):e}})}({fs:t,cache:e,onProgress:i,dir:a,gitdir:n,ref:o,force:l,filepaths:c})}catch(t){throw t instanceof H&&t.data.what===m?new Gt(o,m):t}const f=s.filter(([t])=>"conflict"===t).map(([t,e])=>e);if(f.length>0)throw new Lt(f);const d=s.filter(([t])=>"error"===t).map(([t,e])=>e);if(d.length>0)throw new y(d.join(", "));if(h)return void(r&&await r({previousHead:p,newHead:m,type:null!=c&&c.length>0?"file":"branch"}));let u=0;const b=s.length;if(await z.acquire({fs:t,gitdir:n,cache:e},async function(e){await Promise.all(s.filter(([t])=>"delete"===t||"delete-index"===t).map(async function([r,n]){const s=`${a}/${n}`;"delete"===r&&await t.rm(s),e.delete({filepath:n}),i&&await i({phase:"Updating workdir",loaded:++u,total:b})}))}),await z.acquire({fs:t,gitdir:n,cache:e},async function(e){for(const[r,n]of s)if("rmdir"===r||"rmdir-index"===r){const s=`${a}/${n}`;try{"rmdir"===r&&await t.rmdir(s),e.delete({filepath:n}),i&&await i({phase:"Updating workdir",loaded:++u,total:b})}catch(t){if("ENOTEMPTY"!==t.code)throw t;console.log(`Did not delete ${n} because directory is not empty`)}}}),await Promise.all(s.filter(([t])=>"mkdir"===t||"mkdir-index"===t).map(async function([e,r]){const n=`${a}/${r}`;await t.mkdir(n),i&&await i({phase:"Updating workdir",loaded:++u,total:b})})),g){const r=s.filter(([t])=>"create"===t||"create-index"===t||"update"===t||"mkdir-index"===t),o=await pi("Update Working Dir",r.map(([i,r,s,o,c])=>()=>async function({fs:t,cache:e,gitdir:i,dir:r},[a,n,s,o,c]){const f=`${r}/${n}`;if("create-index"!==a&&"mkdir-index"!==a){const{object:r}=await Ft({fs:t,cache:e,gitdir:i,oid:s});if(c&&await t.rm(f),33188===o)await t.write(f,r);else if(33261===o)await t.write(f,r,{mode:511});else{if(40960!==o)throw new y(`Invalid mode 0o${o.toString(8)} detected in blob ${s}`);await t.writelink(f,r)}}const d=await t.lstat(f);33261===o&&(d.mode=493);"mkdir-index"===a&&(d.mode=57344);return[n,s,d]}({fs:t,cache:e,gitdir:n,dir:a},[i,r,s,o,c])),i,w);await z.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!0},async function(t){await pi("Update Index",o.map(([e,i,r])=>()=>async function({index:t,fullpath:e,stats:i,oid:r}){try{t.insert({filepath:e,stats:i,oid:r})}catch(t){console.warn(`Error inserting ${e} into index:`,t)}}({index:t,fullpath:e,oid:i,stats:r})),i,w)})}else await z.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!0},async function(r){await Promise.all(s.filter(([t])=>"create"===t||"create-index"===t||"update"===t||"mkdir-index"===t).map(async function([s,o,c,f,d]){const h=`${a}/${o}`;try{if("create-index"!==s&&"mkdir-index"!==s){const{object:i}=await Ft({fs:t,cache:e,gitdir:n,oid:c});if(d&&await t.rm(h),33188===f)await t.write(h,i);else if(33261===f)await t.write(h,i,{mode:511});else{if(40960!==f)throw new y(`Invalid mode 0o${f.toString(8)} detected in blob ${c}`);await t.writelink(h,i)}}const a=await t.lstat(h);33261===f&&(a.mode=493),"mkdir-index"===s&&(a.mode=57344),r.insert({filepath:o,stats:a,oid:c}),i&&await i({phase:"Updating workdir",loaded:++u,total:b})}catch(t){console.log(t)}}))});r&&await r({previousHead:p,newHead:m,type:null!=c&&c.length>0?"file":"branch"})}if(!d){const e=await xt.expand({fs:t,gitdir:n,ref:o});e.startsWith("refs/heads")?await xt.writeSymbolicRef({fs:t,gitdir:n,ref:"HEAD",value:e}):await xt.writeRef({fs:t,gitdir:n,ref:"HEAD",value:m})}}async function pi(t,e,i,r){const a=[];try{for(let t=0;t<e.length;t+=r){const n=e.slice(t,t+r).map(t=>t());(await Promise.allSettled(n)).forEach(t=>{"fulfilled"===t.status&&a.push(t.value)}),i&&await i({phase:"Updating workdir",loaded:t+n.length,total:e.length})}return a}catch(e){console.error(`Error during ${t}: ${e}`)}return a}async function mi({fs:t,onProgress:e,onPostCheckout:i,dir:r,gitdir:a=X(r,".git"),remote:n="origin",ref:s,filepaths:o,noCheckout:c=!1,noUpdateHead:f=void 0===s,dryRun:d=!1,force:h=!1,track:l=!0,cache:u={},nonBlocking:g=!1,batchSize:w=100}){try{Ue("fs",t),Ue("dir",r),Ue("gitdir",a);const p=s||"HEAD",m=new Te(t),y=await Ne({fsp:m,dotgit:a});return await wi({fs:m,cache:u,onProgress:e,onPostCheckout:i,dir:r,gitdir:y,remote:n,ref:p,filepaths:o,noCheckout:c,noUpdateHead:f,dryRun:d,force:h,track:l,nonBlocking:g,batchSize:w})}catch(t){throw t.caller="git.checkout",t}}const yi=/^.*(\r?\n|$)/gm;function bi({branches:t,contents:e}){const i=t[1],r=t[2],a=e[0],n=e[1],s=e[2],o=n.match(yi),c=a.match(yi),f=s.match(yi),d=l(o,c,f);let h="",u=!0;for(const t of d)t.ok&&(h+=t.ok.join("")),t.conflict&&(u=!1,h+=`${"<".repeat(7)} ${i}\n`,h+=t.conflict.a.join(""),h+=`${"=".repeat(7)}\n`,h+=t.conflict.b.join(""),h+=`${">".repeat(7)} ${r}\n`);return{cleanMerge:u,mergedText:h}}async function _i({fs:t,cache:e,dir:i,gitdir:r=X(i,".git"),index:a,ourOid:n,baseOid:s,theirOid:o,ourName:c="ours",baseName:f="base",theirName:d="theirs",dryRun:h=!1,abortOnConflict:l=!0,mergeDriver:u}){const g=$e({ref:n}),w=$e({ref:s}),p=$e({ref:o}),m=[],y=[],b=[],_=[],v=await je({fs:t,cache:e,dir:i,gitdir:r,trees:[g,w,p],map:async function(e,[i,n,s]){const o=D(e);switch(`${await Me(i,n)}-${await Me(s,n)}`){case"false-false":return{mode:await n.mode(),path:o,oid:await n.oid(),type:await n.type()};case"false-true":return s||"tree"!==await i.type()?s?{mode:await s.mode(),path:o,oid:await s.oid(),type:await s.type()}:void 0:{mode:await i.mode(),path:o,oid:await i.oid(),type:await i.type()};case"true-false":return i||"tree"!==await s.type()?i?{mode:await i.mode(),path:o,oid:await i.oid(),type:await i.type()}:void 0:{mode:await s.mode(),path:o,oid:await s.oid(),type:await s.type()};case"true-true":if(i&&s&&"tree"===await i.type()&&"tree"===await s.type())return{mode:await i.mode(),path:o,oid:await i.oid(),type:"tree"};if(i&&s&&"blob"===await i.type()&&"blob"===await s.type())return async function({fs:t,gitdir:e,path:i,ours:r,base:a,theirs:n,ourName:s,theirName:o,baseName:c,dryRun:f,mergeDriver:d=bi}){const h="blob";let l="100755",u="",g="";a&&"blob"===await a.type()&&(l=await a.mode(),u=await a.oid(),g=Buffer.from(await a.content()).toString("utf8"));const w=l===await r.mode()?await n.mode():await r.mode();if(await r.oid()===await n.oid())return{cleanMerge:!0,mergeResult:{mode:w,path:i,oid:await r.oid(),type:h}};if(await r.oid()===u)return{cleanMerge:!0,mergeResult:{mode:w,path:i,oid:await n.oid(),type:h}};if(await n.oid()===u)return{cleanMerge:!0,mergeResult:{mode:w,path:i,oid:await r.oid(),type:h}};const p=Buffer.from(await r.content()).toString("utf8"),m=Buffer.from(await n.content()).toString("utf8"),{mergedText:y,cleanMerge:b}=await d({branches:[c,s,o],contents:[g,p,m],path:i}),_=await We({fs:t,gitdir:e,type:"blob",object:Buffer.from(y,"utf8"),dryRun:f});return{cleanMerge:b,mergeResult:{mode:w,path:i,oid:_,type:h}}}({fs:t,gitdir:r,path:o,ours:i,base:n,theirs:s,ourName:c,baseName:f,theirName:d,mergeDriver:u}).then(async t=>{if(t.cleanMerge)l||a.insert({filepath:e,oid:t.mergeResult.oid,stage:0});else if(m.push(e),y.push(e),!l){let t="";n&&"blob"===await n.type()&&(t=await n.oid());const r=await i.oid(),o=await s.oid();a.delete({filepath:e}),t&&a.insert({filepath:e,oid:t,stage:1}),a.insert({filepath:e,oid:r,stage:2}),a.insert({filepath:e,oid:o,stage:3})}return t.mergeResult});if(n&&!i&&s&&"blob"===await n.type()&&"blob"===await s.type()){if(m.push(e),b.push(e),!l){const t=await n.oid(),i=await s.oid();a.delete({filepath:e}),a.insert({filepath:e,oid:t,stage:1}),a.insert({filepath:e,oid:i,stage:3})}return{mode:await s.mode(),oid:await s.oid(),type:"blob",path:o}}if(n&&i&&!s&&"blob"===await n.type()&&"blob"===await i.type()){if(m.push(e),_.push(e),!l){const t=await n.oid(),r=await i.oid();a.delete({filepath:e}),a.insert({filepath:e,oid:t,stage:1}),a.insert({filepath:e,oid:r,stage:2})}return{mode:await i.mode(),oid:await i.oid(),type:"blob",path:o}}if(n&&!i&&!s&&("blob"===await n.type()||"tree"===await n.type()))return;throw new ee}},reduce:0===m.length||i&&!l?async(e,i)=>{const a=i.filter(Boolean);if(e&&(!e||"tree"!==e.type||0!==a.length||"."===e.path)){if(a.length>0||"."===e.path&&0===a.length){const i=new Bt(a).toObject(),n=await We({fs:t,gitdir:r,type:"tree",object:i,dryRun:h});e.oid=n}return e}}:void 0});return 0!==m.length?(i&&!l&&await je({fs:t,cache:e,dir:i,gitdir:r,trees:[$e({ref:v.oid})],map:async function(e,[r]){const a=`${i}/${e}`;if("blob"===await r.type()){const e=await r.mode(),i=(new TextDecoder).decode(await r.content());await t.write(a,i,{mode:e})}return!0}}),new ie(m,y,b,_)):v.oid}const vi={stage:F,workdir:Be};let xi;async function ki(t,i){return void 0===xi&&(xi=new e),xi.acquire(t,i)}async function Ei({fs:t,dir:e,gitdir:i,entries:r}){return Promise.all(r.map(async function r(a){if("tree"===a.type){if(!a.oid){const e=await Promise.all(a.children.map(r));a.oid=await si({fs:t,gitdir:i,tree:e}),a.mode=16384}}else"blob"===a.type&&(a.oid=await async function(t,e,i,r,a=null){const n=X(i,r),s=await t.lstat(n);if(!s)throw new H(n);if(s.isDirectory())throw new y(`${n}: file expected, but found directory`);const o=a?await Rt({fs:t,gitdir:e,oid:a}):void 0;let c=o?a:void 0;return o||await ki({fs:t,gitdir:e,currentFilepath:n},async()=>{const i=s.isSymbolicLink()?await t.readlink(n).then(Ze):await t.read(n);if(null===i)throw new H(n);c=await We({fs:t,gitdir:e,type:"blob",object:i})}),c}(t,i,e,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}))}async function $i({fs:t,dir:e,gitdir:i,treePair:r}){const a="stage"===r[1],n=r.map(t=>"string"==typeof t?vi[t]():t),s=[],o=await je({fs:t,cache:{},dir:e,gitdir:i,trees:n,map:async(r,[a,n])=>{if("."!==r&&!await He.isIgnored({fs:t,dir:e,gitdir:i,filepath:r}))return n?((!a||await a.oid()!==await n.oid()&&void 0!==await n.oid())&&s.push([a,n]),{mode:await n.mode(),path:r,oid:await n.oid(),type:await n.type()}):void 0},reduce:async(t,e)=>(e=e.filter(Boolean),t?(t.children=e,t):e.length>0?e:void 0),iterate:async(i,r)=>{const n=[];for(const i of r){const[r,o]=i;a?o&&(await t.exists(`${e}/${o.toString()}`)?n.push(i):s.push([null,o])):r&&(o?n.push(i):s.push([r,null]))}return n.length?Promise.all(n.map(i)):[]}});if(0===s.length||0===o.length)return null;const c=(await Ei({fs:t,dir:e,gitdir:i,entries:o})).filter(Boolean).map(t=>({mode:t.mode,path:t.path,oid:t.oid,type:t.type}));return si({fs:t,gitdir:i,tree:c})}async function Si({fs:t,dir:e,gitdir:i,stashCommit:r,parentCommit:a,wasStaged:n}){const s=[],o=[],c=await je({fs:t,cache:{},dir:e,gitdir:i,trees:[$e({ref:a}),$e({ref:r})],map:async(r,[a,c])=>{if("."===r||await He.isIgnored({fs:t,dir:e,gitdir:i,filepath:r}))return;const f=c?await c.type():await a.type();if("tree"!==f&&"blob"!==f)return;if(!c&&a){const t="tree"===f?"rmdir":"rm";return"tree"===f&&s.push(r),"blob"===f&&n&&o.push({filepath:r,oid:await a.oid()}),{method:t,filepath:r}}const d=await c.oid();return a&&await a.oid()===d?void 0:"tree"===f?{method:"mkdir",filepath:r}:(n&&o.push({filepath:r,oid:d,stats:await t.lstat(X(e,r))}),{method:"write",filepath:r,oid:d})}});await ki({fs:t,gitdir:i,dirRemoved:s,ops:c},async()=>{for(const r of c){const a=X(e,r.filepath);switch(r.method){case"rmdir":await t.rmdir(a);break;case"mkdir":await t.mkdir(a);break;case"rm":await t.rm(a);break;case"write":if(!s.some(t=>a.startsWith(t))){const{object:e}=await Ft({fs:t,cache:{},gitdir:i,oid:r.oid});await t.exists(a)&&await t.rm(a),await t.write(a,e)}}}}),await z.acquire({fs:t,gitdir:i,cache:{}},async t=>{o.forEach(({filepath:e,stats:i,oid:r})=>{t.insert({filepath:e,stats:i,oid:r})})})}async function Bi({fs:t,cache:e,dir:i,gitdir:r,oid:a,dryRun:n=!1,noUpdateBranch:s=!1,abortOnConflict:o=!0,committer:c,mergeDriver:f}){const{commit:d,oid:h}=await ti({fs:t,cache:e,gitdir:r,oid:a});if(d.parent.length>1)throw new Wt(h,d.parent.length);if(0===d.parent.length)throw new Zt(h);const l=await xt.resolve({fs:t,gitdir:r,ref:"HEAD"}),{commit:u}=await ti({fs:t,cache:e,gitdir:r,oid:l}),g=d.parent[0],{commit:w}=await ti({fs:t,cache:e,gitdir:r,oid:g}),p=await z.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async a=>_i({fs:t,cache:e,dir:i,gitdir:r,index:a,ourOid:u.tree,baseOid:w.tree,theirOid:d.tree,ourName:"HEAD",baseName:`parent of ${h.slice(0,7)}`,theirName:h.slice(0,7),dryRun:n,abortOnConflict:o,mergeDriver:f}));if(p instanceof ie)throw p;const m=await ei({fs:t,cache:e,gitdir:r,message:d.message,tree:p,parent:[l],author:d.author,committer:c,dryRun:n,noUpdateBranch:s});return!i||n||s||await Si({fs:t,dir:i,gitdir:r,stashCommit:m,parentCommit:l,wasStaged:!0}),m}async function Ai({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,cache:a={},committer:n,dryRun:s=!1,noUpdateBranch:o=!1,abortOnConflict:c=!0,mergeDriver:f}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r);const d=new Te(t),h=await Ne({fsp:d,dotgit:i}),{commit:l}=await ti({fs:d,cache:a,gitdir:h,oid:r});if(l.parent&&l.parent.length>1)return await Bi({fs:d,cache:a,dir:e,gitdir:h,oid:r,dryRun:s,noUpdateBranch:o,abortOnConflict:c,committer:void 0,mergeDriver:f});const u=await Je({fs:d,gitdir:h,committer:n});if(!u)throw new re("committer");return await Bi({fs:d,cache:a,dir:e,gitdir:h,oid:r,dryRun:s,noUpdateBranch:o,abortOnConflict:c,committer:u,mergeDriver:f})}catch(t){throw t.caller="git.cherryPick",t}}const Ri=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function Pi(t){const e=Ri.exec(t);return e?"remotes/"===e[1]&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function ji({fs:t,gitdir:e,fullname:i=!1,test:r=!1}){const a=await xt.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(r)try{await xt.resolve({fs:t,gitdir:e,ref:a})}catch(t){return}if(a.startsWith("refs/"))return i?a:Pi(a)}function Oi({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function Ii(t,e){const i=It(t);for(;;){const{value:t,done:r}=await i.next();if(t&&await e(t),r)break}i.return&&i.return()}async function Ci(t){let e=0;const i=[];await Ii(t,t=>{i.push(t),e+=t.byteLength});const r=new Uint8Array(e);let a=0;for(const t of i)r.set(t,a),a+=t.byteLength;return r}function zi(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(null==e)return{url:t,auth:{}};e=e[1];const[i,r]=e.split(":");return{url:t=t.replace(`${e}@`,""),auth:{username:i,password:r}}}function Di(t,e){const i=e.toString(16);return"0".repeat(t-i.length)+i}class Ti{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(t){"string"==typeof t&&(t=Buffer.from(t));const e=Di(4,t.length+4);return Buffer.concat([Buffer.from(e,"utf8"),t])}static streamReader(t){const e=new Ct(t);return async function(){try{let t=await e.read(4);if(null==t)return!0;if(t=parseInt(t.toString("utf8"),16),0===t)return null;if(1===t)return null;const i=await e.read(t-4);return null==i||i}catch(e){return t.error=e,!0}}}}async function Ui(t){const e={};let i;for(;i=await t(),!0!==i;){if(null===i)continue;i=i.toString("utf8").replace(/\n$/,"");const t=i.indexOf("=");if(t>-1){const r=i.slice(0,t),a=i.slice(t+1);e[r]=a}else e[i]=!0}return{protocolVersion:2,capabilities2:e}}async function Ni(t,{service:e}){const i=new Set,r=new Map,a=new Map,n=Ti.streamReader(t);let s=await n();for(;null===s;)s=await n();if(!0===s)throw new Kt;if(s.includes("version 2"))return Ui(n);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new se(`# service=${e}\\n`,s.toString("utf8"));let o=await n();for(;null===o;)o=await n();if(!0===o)return{capabilities:i,refs:r,symrefs:a};if(o=o.toString("utf8"),o.includes("version 2"))return Ui(n);const[c,f]=Mi(o,"\0","\\x00");if(f.split(" ").map(t=>i.add(t)),"0000000000000000000000000000000000000000 capabilities^{}"!==c){const[t,e]=Mi(c," "," ");for(r.set(e,t);;){const t=await n();if(!0===t)break;if(null!==t){const[e,i]=Mi(t.toString("utf8")," "," ");r.set(i,e)}}}for(const t of i)if(t.startsWith("symref=")){const e=t.match(/symref=([^:]+):(.*)/);3===e.length&&a.set(e[1],e[2])}return{protocolVersion:1,capabilities:i,refs:r,symrefs:a}}function Mi(t,e,i){const r=t.trim().split(e);if(2!==r.length)throw new se(`Two strings separated by '${i}'`,t.toString("utf8"));return r}const Fi=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,Hi=(t,e)=>{(e.username||e.password)&&(t.Authorization=Oi(e)),e.headers&&Object.assign(t,e.headers)},qi=async t=>{try{const e=Buffer.from(await Ci(t.body)),i=e.toString("utf8");return{preview:i.length<256?i:i.slice(0,256)+"...",response:i,data:e}}catch(t){return{}}};class Li{static async capabilities(){return["discover","connect"]}static async discover({http:t,onProgress:e,onAuth:i,onAuthSuccess:r,onAuthFailure:a,corsProxy:n,service:s,url:o,headers:c,protocolVersion:f}){let{url:d,auth:h}=zi(o);const l=n?Fi(n,d):d;let u,g;(h.username||h.password)&&(c.Authorization=Oi(h)),2===f&&(c["Git-Protocol"]="version=2");let w=!1;do{if(u=await t.request({onProgress:e,method:"GET",url:`${l}/info/refs?service=${s}`,headers:c}),g=!1,401===u.statusCode||203===u.statusCode){const t=w?a:i;if(t){if(h=await t(d,{...h,headers:{...c}}),h&&h.cancel)throw new le;h&&(Hi(c,h),w=!0,g=!0)}}else 200===u.statusCode&&w&&r&&await r(d,h)}while(g);if(200!==u.statusCode){const{response:t}=await qi(u);throw new Yt(u.statusCode,u.statusMessage,t)}if(u.headers["content-type"]===`application/x-${s}-advertisement`){const t=await Ni(u.body,{service:s});return t.auth=h,t}{const{preview:t,response:e,data:i}=await qi(u);try{const t=await Ni([i],{service:s});return t.auth=h,t}catch(i){throw new fe(t,e)}}}static async connect({http:t,onProgress:e,corsProxy:i,service:r,url:a,auth:n,body:s,headers:o}){const c=zi(a);c&&(a=c.url),i&&(a=Fi(i,a)),o["content-type"]=`application/x-${r}-request`,o.accept=`application/x-${r}-result`,Hi(o,n);const f=await t.request({onProgress:e,method:"POST",url:`${a}/${r}`,body:s,headers:o});if(200!==f.statusCode){const{response:t}=qi(f);throw new Yt(f.statusCode,f.statusMessage,t)}return f}}class Wi{static getRemoteHelperFor({url:t}){const e=new Map;e.set("http",Li),e.set("https",Li);const i=function({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};const e=t.match(/(\w+)(:\/\/|::)(.*)/);if(null===e)return;if("://"===e[2])return{transport:e[1],address:e[0]};if("::"===e[2])return{transport:e[1],address:e[3]}}({url:t});if(!i)throw new he(t);if(e.has(i.transport))return e.get(i.transport);throw new de(t,i.transport,"ssh"===i.transport?function(t){return(t=t.replace(/^git@([^:]+):/,"https://$1/")).replace(/^ssh:\/\//,"https://")}(t):void 0)}}let Zi=null;class Gi{static async read({fs:t,gitdir:i}){null===Zi&&(Zi=new e);const r=X(i,"shallow"),a=new Set;return await Zi.acquire(r,async function(){const e=await t.read(r,{encoding:"utf8"});return null===e||""===e.trim()?a:void e.trim().split("\n").map(t=>a.add(t))}),a}static async write({fs:t,gitdir:i,oids:r}){null===Zi&&(Zi=new e);const a=X(i,"shallow");if(r.size>0){const e=[...r].join("\n")+"\n";await Zi.acquire(a,async function(){await t.write(a,e,{encoding:"utf8"})})}else await Zi.acquire(a,async function(){await t.rm(a)})}}async function Ki({fs:t,cache:e,gitdir:i,oid:r,format:a="content"}){const n=r=>Ft({fs:t,cache:e,gitdir:i,oid:r});let s=await async function({fs:t,gitdir:e,oid:i}){const r=`objects/${i.slice(0,2)}/${i.slice(2)}`;return t.exists(`${e}/${r}`)}({fs:t,gitdir:i,oid:r});return s||(s=await async function({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:a}){let n=await t.readdir(X(i,"objects/pack"));n=n.filter(t=>t.endsWith(".idx"));for(const s of n){const n=`${i}/objects/pack/${s}`,o=await Mt({fs:t,cache:e,filename:n,getExternalRefDelta:a});if(o.error)throw new y(o.error);if(o.offsets.has(r))return!0}return!1}({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:n})),s}function Vi(t,e){const i=t.map(t=>t.split("=",1)[0]);return e.filter(t=>{const e=t.split("=",1)[0];return i.includes(e)})}const Xi="1.37.4",Yi="git/isomorphic-git@1.37.4";class Ji{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})}}function Qi(t){const e=t.indexOf("\r"),i=t.indexOf("\n");return-1===e&&-1===i?-1:-1===e?i+1:-1===i?e+1:i===e+1?i+1:Math.min(e,i)+1}function tr(t){const e=new Ji;let i="";return(async()=>{await Ii(t,t=>{for(t=t.toString("utf8"),i+=t;;){const t=Qi(i);if(-1===t)break;e.write(i.slice(0,t)),i=i.slice(t)}}),i.length>0&&e.write(i),e.end()})(),e}class er{static demux(t){const e=Ti.streamReader(t),i=new Ji,r=new Ji,a=new Ji,n=async function(){const s=await e();if(null===s)return n();if(!0===s)return i.end(),a.end(),void(t.error?r.destroy(t.error):r.end());switch(s[0]){case 1:r.write(s.slice(1));break;case 2:a.write(s.slice(1));break;case 3:{const t=s.slice(1);return a.write(t),i.end(),a.end(),void r.destroy(new Error(t.toString("utf8")))}default:i.write(s)}n()};return n(),{packetlines:i,packfile:r,progress:a}}}async function ir({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:f,remoteRef:d,remote:h,url:l,corsProxy:u,depth:g=null,since:w=null,exclude:p=[],relative:m=!1,tags:y=!1,singleBranch:b=!1,headers:_={},prune:v=!1,pruneTags:x=!1}){const k=f||await ji({fs:t,gitdir:c,test:!0}),E=await gt.get({fs:t,gitdir:c}),$=h||k&&await E.get(`branch.${k}.remote`)||"origin",S=l||await E.get(`remote.${$}.url`);if(void 0===S)throw new ae("remote OR url");const B=d||k&&await E.get(`branch.${k}.merge`)||f||"HEAD";void 0===u&&(u=await E.get("http.corsProxy"));const A=Wi.getRemoteHelperFor({url:S}),R=await A.discover({http:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,corsProxy:u,service:"git-upload-pack",url:S,headers:_,protocolVersion:1}),P=R.auth,j=R.refs;if(0===j.size)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(null!==g&&!R.capabilities.has("shallow"))throw new ce("shallow","depth");if(null!==w&&!R.capabilities.has("deepen-since"))throw new ce("deepen-since","since");if(p.length>0&&!R.capabilities.has("deepen-not"))throw new ce("deepen-not","exclude");if(!0===m&&!R.capabilities.has("deepen-relative"))throw new ce("deepen-relative","relative");const{oid:O,fullref:I}=xt.resolveAgainstMap({ref:B,map:j});for(const t of j.keys())t===I||"HEAD"===t||t.startsWith("refs/heads/")||y&&t.startsWith("refs/tags/")||j.delete(t);const C=Vi([...R.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Yi}`]);m&&C.push("deepen-relative");const z=b?[O]:j.values(),D=b?[k]:await xt.listRefs({fs:t,gitdir:c,filepath:"refs"});let T=[];for(let i of D)try{i=await xt.expand({fs:t,gitdir:c,ref:i});const r=await xt.resolve({fs:t,gitdir:c,ref:i});await Ki({fs:t,cache:e,gitdir:c,oid:r})&&T.push(r)}catch(t){}T=[...new Set(T)];const U=await Gi.read({fs:t,gitdir:c}),N=function({capabilities:t=[],wants:e=[],haves:i=[],shallows:r=[],depth:a=null,since:n=null,exclude:s=[]}){const o=[];e=[...new Set(e)];let c=` ${t.join(" ")}`;for(const t of e)o.push(Ti.encode(`want ${t}${c}\n`)),c="";for(const t of r)o.push(Ti.encode(`shallow ${t}\n`));null!==a&&o.push(Ti.encode(`deepen ${a}\n`)),null!==n&&o.push(Ti.encode(`deepen-since ${Math.floor(n.valueOf()/1e3)}\n`));for(const t of s)o.push(Ti.encode(`deepen-not ${t}\n`));o.push(Ti.flush());for(const t of i)o.push(Ti.encode(`have ${t}\n`));return o.push(Ti.encode("done\n")),o}({capabilities:C,wants:z,haves:T,shallows:R.capabilities.has("shallow")?[...U]:[],depth:g,since:w,exclude:p}),M=Buffer.from(await Ci(N)),F=await A.connect({http:i,onProgress:r,corsProxy:u,service:"git-upload-pack",url:S,auth:P,body:[M],headers:_}),H=await async function(t){const{packetlines:e,packfile:i,progress:r}=er.demux(t),a=[],n=[],s=[];let o=!1,c=!1;return new Promise((f,d)=>{Ii(e,e=>{const h=e.toString("utf8").trim();if(h.startsWith("shallow")){const t=h.slice(-41).trim();40!==t.length&&d(new L(t)),a.push(t)}else if(h.startsWith("unshallow")){const t=h.slice(-41).trim();40!==t.length&&d(new L(t)),n.push(t)}else if(h.startsWith("ACK")){const[,t,e]=h.split(" ");s.push({oid:t,status:e}),e||(c=!0)}else h.startsWith("NAK")?(o=!0,c=!0):(c=!0,o=!0);c&&(t.error?d(t.error):f({shallows:a,unshallows:n,acks:s,nak:o,packfile:i,progress:r}))}).finally(()=>{c||(t.error?d(t.error):f({shallows:a,unshallows:n,acks:s,nak:o,packfile:i,progress:r}))})})}(F.body);F.headers&&(H.headers=F.headers);for(const i of H.shallows)if(!U.has(i))try{const{object:r}=await Ft({fs:t,cache:e,gitdir:c,oid:i}),a=new xe(r),n=await Promise.all(a.headers().parent.map(i=>Ki({fs:t,cache:e,gitdir:c,oid:i})));0===n.length||n.every(t=>t)||U.add(i)}catch(t){U.add(i)}for(const t of H.unshallows)U.delete(t);if(await Gi.write({fs:t,gitdir:c,oids:U}),b){const e=new Map([[I,O]]),i=new Map;let r=10,a=I;for(;r--;){const t=R.symrefs.get(a);if(void 0===t)break;i.set(a,t),a=t}const n=j.get(a);n&&e.set(a,n);const{pruned:s}=await xt.updateRemoteRefs({fs:t,gitdir:c,remote:$,refs:e,symrefs:i,tags:y,prune:v});v&&(H.pruned=s)}else{const{pruned:e}=await xt.updateRemoteRefs({fs:t,gitdir:c,remote:$,refs:j,symrefs:R.symrefs,tags:y,prune:v,pruneTags:x});v&&(H.pruned=e)}if(H.HEAD=R.symrefs.get("HEAD"),void 0===H.HEAD){const{oid:t}=xt.resolveAgainstMap({ref:"HEAD",map:j});for(const[e,i]of j.entries())if("HEAD"!==e&&i===t){H.HEAD=e;break}}const q=I.startsWith("refs/tags")?"tag":"branch";if(H.FETCH_HEAD={oid:O,description:`${q} '${Pi(I)}' of ${S}`},r||a){Ii(tr(H.progress),async t=>{if(a&&await a(t),r){const e=t.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);e&&await r({phase:e[1].trim(),loaded:parseInt(e[2],10),total:parseInt(e[3],10)})}})}const W=Buffer.from(await Ci(H.packfile));if(F.body.error)throw F.body.error;const Z=W.slice(-20).toString("hex"),G={defaultBranch:H.HEAD,fetchHead:H.FETCH_HEAD.oid,fetchHeadDescription:H.FETCH_HEAD.description};if(H.headers&&(G.headers=H.headers),v&&(G.pruned=H.pruned),""!==Z&&"5041434b0000000200000000"!==W.slice(0,12).toString("hex")){G.packfile=`objects/pack/pack-${Z}.pack`;const i=X(c,G.packfile);await t.write(i,W);const a=i=>Ft({fs:t,cache:e,gitdir:c,oid:i}),n=await Ut.fromPack({pack:W,getExternalRefDelta:a,onProgress:r});await t.write(i.replace(/\.pack$/,".idx"),await n.toBuffer())}return G}async function rr({fs:t,bare:e=!1,dir:i,gitdir:r=(e?i:X(i,".git")),defaultBranch:a="master"}){if(await t.exists(r+"/config"))return;let n=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];n=n.map(t=>r+"/"+t);for(const e of n)await t.mkdir(e);await t.write(r+"/config",`[core]\n\trepositoryformatversion = 0\n\tfilemode = false\n\tbare = ${e}\n`+(e?"":"\tlogallrefupdates = true\n")+"\tsymlinks = false\n\tignorecase = true\n"),await t.write(r+"/HEAD",`ref: refs/heads/${a}\n`)}async function ar({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPostCheckout:o,dir:c,gitdir:f=X(c,".git"),url:d,corsProxy:h,ref:l,remote:u="origin",depth:g,since:w,exclude:p=[],relative:m=!1,singleBranch:y=!1,noCheckout:b=!1,noTags:_=!1,headers:v={},cache:x={},nonBlocking:k=!1,batchSize:E=100}){try{Ue("fs",t),Ue("http",e),Ue("gitdir",f),b||Ue("dir",c),Ue("url",d);const $=new Te(t),S=await Ne({fsp:$,dotgit:f});return await async function({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:c,dir:f,gitdir:d,url:h,corsProxy:l,ref:u,remote:g,depth:w,since:p,exclude:m,relative:y,singleBranch:b,noCheckout:_,noTags:v,headers:x,nonBlocking:k,batchSize:E=100}){try{if(await rr({fs:t,gitdir:d}),await di({fs:t,gitdir:d,remote:g,url:h,force:!1}),l){const e=await gt.get({fs:t,gitdir:d});await e.set("http.corsProxy",l),await gt.save({fs:t,gitdir:d,config:e})}const{defaultBranch:$,fetchHead:S}=await ir({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:d,ref:u,remote:g,corsProxy:l,depth:w,since:p,exclude:m,relative:y,singleBranch:b,headers:x,tags:!v});if(null===S)return;u=(u=u||$).replace("refs/heads/",""),await wi({fs:t,cache:e,onProgress:r,onPostCheckout:c,dir:f,gitdir:d,ref:u,remote:g,noCheckout:_,nonBlocking:k,batchSize:E})}catch(e){throw await t.rmdir(d,{recursive:!0,maxRetries:10}).catch(()=>{}),e}}({fs:$,cache:x,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPostCheckout:o,dir:c,gitdir:S,url:d,corsProxy:h,ref:l,remote:u,depth:g,since:w,exclude:p,relative:m,singleBranch:y,noCheckout:b,noTags:_,headers:v,nonBlocking:k,batchSize:E})}catch(t){throw t.caller="git.clone",t}}async function nr({fs:t,onSign:e,dir:i,gitdir:r=X(i,".git"),message:a,author:n,committer:s,signingKey:o,amend:c=!1,dryRun:f=!1,noUpdateBranch:d=!1,ref:h,parent:l,tree:u,cache:g={}}){try{Ue("fs",t),c||Ue("message",a),o&&Ue("onSign",e);const i=new Te(t),w=await Ne({fsp:i,dotgit:r});return await ei({fs:i,cache:g,onSign:e,gitdir:w,message:a,author:n,committer:s,signingKey:o,amend:c,dryRun:f,noUpdateBranch:d,ref:h,parent:l,tree:u})}catch(t){throw t.caller="git.commit",t}}async function sr({fs:t,dir:e,gitdir:i=X(e,".git"),fullname:r=!1,test:a=!1}){try{Ue("fs",t),Ue("gitdir",i);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await ji({fs:e,gitdir:n,fullname:r,test:a})}catch(t){throw t.caller="git.currentBranch",t}}async function or({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r}){try{Ue("fs",t),Ue("ref",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e,ref:i}){if(i=i.startsWith("refs/heads/")?i:`refs/heads/${i}`,!await xt.exists({fs:t,gitdir:e,ref:i}))throw new H(i);const r=await xt.expand({fs:t,gitdir:e,ref:i});if(r===await ji({fs:t,gitdir:e,fullname:!0})){const i=await xt.resolve({fs:t,gitdir:e,ref:r});await xt.writeRef({fs:t,gitdir:e,ref:"HEAD",value:i})}await xt.deleteRef({fs:t,gitdir:e,ref:r});const a=Pi(i),n=await gt.get({fs:t,gitdir:e});await n.deleteSection("branch",a),await gt.save({fs:t,gitdir:e,config:n})}({fs:e,gitdir:a,ref:r})}catch(t){throw t.caller="git.deleteBranch",t}}async function cr({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r}){try{Ue("fs",t),Ue("ref",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});await xt.deleteRef({fs:e,gitdir:a,ref:r})}catch(t){throw t.caller="git.deleteRef",t}}async function fr({fs:t,dir:e,gitdir:i=X(e,".git"),remote:r}){try{Ue("fs",t),Ue("remote",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e,remote:i}){const r=await gt.get({fs:t,gitdir:e});await r.deleteSection("remote",i),await gt.save({fs:t,gitdir:e,config:r})}({fs:e,gitdir:a,remote:r})}catch(t){throw t.caller="git.deleteRemote",t}}async function dr({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r}){try{Ue("fs",t),Ue("ref",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e,ref:i}){i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,await xt.deleteRef({fs:t,gitdir:e,ref:i})}({fs:e,gitdir:a,ref:r})}catch(t){throw t.caller="git.deleteTag",t}}async function hr({fs:t,cache:e,gitdir:i,oid:r}){const a=await async function({fs:t,gitdir:e,oid:i}){const r=i.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map(t=>`${r}${t}`).filter(t=>t.startsWith(i))}({fs:t,gitdir:i,oid:r}),n=await async function({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:a}){const n=[];let s=await t.readdir(X(i,"objects/pack"));s=s.filter(t=>t.endsWith(".idx"));for(const o of s){const s=`${i}/objects/pack/${o}`,c=await Mt({fs:t,cache:e,filename:s,getExternalRefDelta:a});if(c.error)throw new y(c.error);for(const t of c.offsets.keys())t.startsWith(r)&&n.push(t)}return n}({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:r=>Ft({fs:t,cache:e,gitdir:i,oid:r})});for(const t of n)-1===a.indexOf(t)&&a.push(t);if(1===a.length)return a[0];if(a.length>1)throw new qt("oids",r,a);throw new H(`an object matching "${r}"`)}async function lr({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,cache:a={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await hr({fs:e,cache:a,gitdir:n,oid:r})}catch(t){throw t.caller="git.expandOid",t}}async function ur({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await xt.expand({fs:e,gitdir:a,ref:r})}catch(t){throw t.caller="git.expandRef",t}}async function gr({fs:t,cache:e,gitdir:i,oids:r}){const a={},n=r.length;let s=r.map((t,e)=>({index:e,oid:t}));for(;s.length;){const r=new Set;for(const{oid:t,index:e}of s)a[t]||(a[t]=new Set),a[t].add(e),a[t].size===n&&r.add(t);if(r.size>0)return[...r];const o=new Map;for(const{oid:r,index:n}of s)try{const{object:s}=await Ft({fs:t,cache:e,gitdir:i,oid:r}),c=xe.from(s),{parent:f}=c.parseHeaders();for(const t of f)a[t]&&a[t].has(n)||o.set(t+":"+n,{oid:t,index:n})}catch(t){}s=Array.from(o.values())}return[]}async function wr({fs:t,cache:e,dir:i,gitdir:r,ours:a,theirs:n,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:c=!1,noUpdateBranch:f=!1,abortOnConflict:d=!0,message:h,author:l,committer:u,signingKey:g,onSign:w,mergeDriver:p,allowUnrelatedHistories:m=!1}){void 0===a&&(a=await ji({fs:t,gitdir:r,fullname:!0})),a=await xt.expand({fs:t,gitdir:r,ref:a}),n=await xt.expand({fs:t,gitdir:r,ref:n});const y=await xt.resolve({fs:t,gitdir:r,ref:a}),b=await xt.resolve({fs:t,gitdir:r,ref:n}),_=await gr({fs:t,cache:e,gitdir:r,oids:[y,b]});if(1!==_.length){if(0!==_.length||!m)throw new ee;_.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904")}const v=_[0];if(v===b)return{oid:y,alreadyMerged:!0};if(s&&v===y)return c||f||await xt.writeRef({fs:t,gitdir:r,ref:a,value:b}),{oid:b,fastForward:!0};{if(o)throw new Vt;const s=await z.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async s=>_i({fs:t,cache:e,dir:i,gitdir:r,index:s,ourOid:y,theirOid:b,baseOid:v,ourName:Pi(a),baseName:"base",theirName:Pi(n),dryRun:c,abortOnConflict:d,mergeDriver:p}));if(s instanceof ie)throw s;h||(h=`Merge branch '${Pi(n)}' into ${Pi(a)}`);return{oid:await ei({fs:t,cache:e,gitdir:r,message:h,ref:a,tree:s,parent:[y,b],author:l,committer:u,signingKey:g,onSign:w,dryRun:c,noUpdateBranch:f}),tree:s,mergeCommit:!0}}}async function pr({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:c,gitdir:f,ref:d,url:h,remote:l,remoteRef:u,prune:g,pruneTags:w,fastForward:p,fastForwardOnly:m,corsProxy:y,singleBranch:b,headers:_,author:v,committer:x,signingKey:k}){try{if(!d){const e=await ji({fs:t,gitdir:f});if(!e)throw new ae("ref");d=e}const{fetchHead:E,fetchHeadDescription:$}=await ir({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:f,corsProxy:y,ref:d,url:h,remote:l,remoteRef:u,singleBranch:b,headers:_,prune:g,pruneTags:w});await wr({fs:t,cache:e,gitdir:f,ours:d,theirs:E,fastForward:p,fastForwardOnly:m,message:`Merge ${$}`,author:v,committer:x,signingKey:k,dryRun:!1,noUpdateBranch:!1}),await wi({fs:t,cache:e,onProgress:r,dir:c,gitdir:f,ref:d,remote:l,noCheckout:!1})}catch(t){throw t.caller="git.pull",t}}async function mr({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c=X(o,".git"),ref:f,url:d,remote:h,remoteRef:l,corsProxy:u,singleBranch:g,headers:w={},cache:p={}}){try{Ue("fs",t),Ue("http",e),Ue("gitdir",c);const m={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},y=new Te(t),b=await Ne({fsp:y,dotgit:c});return await pr({fs:y,cache:p,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:b,ref:f,url:d,remote:h,remoteRef:l,fastForwardOnly:!0,corsProxy:u,singleBranch:g,headers:w,author:m,committer:m})}catch(t){throw t.caller="git.fastForward",t}}async function yr({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c=X(o,".git"),ref:f,remote:d,remoteRef:h,url:l,corsProxy:u,depth:g=null,since:w=null,exclude:p=[],relative:m=!1,tags:y=!1,singleBranch:b=!1,headers:_={},prune:v=!1,pruneTags:x=!1,cache:k={}}){try{Ue("fs",t),Ue("http",e),Ue("gitdir",c);const o=new Te(t),E=await Ne({fsp:o,dotgit:c});return await ir({fs:o,cache:k,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,gitdir:E,ref:f,remote:d,remoteRef:h,url:l,corsProxy:u,depth:g,since:w,exclude:p,relative:m,tags:y,singleBranch:b,headers:_,prune:v,pruneTags:x})}catch(t){throw t.caller="git.fetch",t}}async function br({fs:t,dir:e,gitdir:i=X(e,".git"),oids:r,cache:a={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oids",r);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await gr({fs:e,cache:a,gitdir:n,oids:r})}catch(t){throw t.caller="git.findMergeBase",t}}async function _r({fs:t,filepath:e}){if(await t.exists(X(e,".git")))return e;{const i=T(e);if(i===e)throw new H(`git root for ${e}`);return _r({fs:t,filepath:i})}}async function vr({fs:t,filepath:e}){try{return Ue("fs",t),Ue("filepath",e),await _r({fs:new Te(t),filepath:e})}catch(t){throw t.caller="git.findRoot",t}}async function xr({fs:t,dir:e,gitdir:i=X(e,".git"),path:r}){try{Ue("fs",t),Ue("gitdir",i),Ue("path",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await Ve({fs:e,gitdir:a,path:r})}catch(t){throw t.caller="git.getConfig",t}}async function kr({fs:t,dir:e,gitdir:i=X(e,".git"),path:r}){try{Ue("fs",t),Ue("gitdir",i),Ue("path",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e,path:i}){return(await gt.get({fs:t,gitdir:e})).getall(i)}({fs:e,gitdir:a,path:r})}catch(t){throw t.caller="git.getConfigAll",t}}async function Er({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,url:n,headers:s={},forPush:o=!1}){try{Ue("http",t),Ue("url",n);const c=Wi.getRemoteHelperFor({url:n}),f=await c.discover({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,headers:s,protocolVersion:1}),d={capabilities:[...f.capabilities]};for(const[t,e]of f.refs){const i=t.split("/"),r=i.pop();let a=d;for(const t of i)a[t]=a[t]||{},a=a[t];a[r]=e}for(const[t,e]of f.symrefs){const i=t.split("/"),r=i.pop();let a=d;for(const t of i)a[t]=a[t]||{},a=a[t];a[r]=e}return d}catch(t){throw t.caller="git.getRemoteInfo",t}}function $r(t,e,i,r){const a=[];for(const[n,s]of t.refs){if(e&&!n.startsWith(e))continue;if(n.endsWith("^{}")){if(r){const t=n.replace("^{}",""),e=a[a.length-1],i=e.ref===t?e:a.find(e=>e.ref===t);if(void 0===i)throw new Error("I did not expect this to happen");i.peeled=s}continue}const o={ref:n,oid:s};i&&t.symrefs.has(n)&&(o.target=t.symrefs.get(n)),a.push(o)}return a}async function Sr({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,url:n,headers:s={},forPush:o=!1,protocolVersion:c=2}){try{Ue("http",t),Ue("url",n);const f=Wi.getRemoteHelperFor({url:n}),d=await f.discover({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,headers:s,protocolVersion:c});if(2===d.protocolVersion)return{protocolVersion:d.protocolVersion,capabilities:d.capabilities2};const h={};for(const t of d.capabilities){const[e,i]=t.split("=");h[e]=i||!0}return{protocolVersion:1,capabilities:h,refs:$r(d,void 0,!0,!0)}}catch(t){throw t.caller="git.getRemoteInfo2",t}}async function Br({object:t}){try{Ue("object",t),"string"==typeof t?t=Buffer.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));const e="blob",{oid:i,object:r}=await async function({type:t,object:e,format:i="content",oid:r}){return"deflated"!==i&&("wrapped"!==i&&(e=At.wrap({type:t,object:e})),r=await A(e)),{oid:r,object:e}}({type:e,format:"content",object:t});return{oid:i,type:e,object:r,format:"wrapped"}}catch(t){throw t.caller="git.hashBlob",t}}async function Ar({fs:t,onProgress:e,dir:i,gitdir:r=X(i,".git"),filepath:a,cache:n={}}){try{Ue("fs",t),Ue("dir",i),Ue("gitdir",i),Ue("filepath",a);const s=new Te(t),o=await Ne({fsp:s,dotgit:r});return await async function({fs:t,cache:e,onProgress:i,dir:r,gitdir:a,filepath:n}){try{n=X(r,n);const s=await t.read(n),o=i=>Ft({fs:t,cache:e,gitdir:a,oid:i}),c=await Ut.fromPack({pack:s,getExternalRefDelta:o,onProgress:i});return await t.write(n.replace(/\.pack$/,".idx"),await c.toBuffer()),{oids:[...c.hashes]}}catch(t){throw t.caller="git.indexPack",t}}({fs:s,cache:n,onProgress:e,dir:i,gitdir:o,filepath:a})}catch(t){throw t.caller="git.indexPack",t}}async function Rr({fs:t,bare:e=!1,dir:i,gitdir:r=(e?i:X(i,".git")),defaultBranch:a="master"}){try{Ue("fs",t),Ue("gitdir",r),e||Ue("dir",i);const n=new Te(t),s=await Ne({fsp:n,dotgit:r});return await rr({fs:n,bare:e,dir:i,gitdir:s,defaultBranch:a})}catch(t){throw t.caller="git.init",t}}async function Pr({fs:t,cache:e,gitdir:i,oid:r,ancestor:a,depth:n}){const s=await Gi.read({fs:t,gitdir:i});if(!r)throw new ae("oid");if(!a)throw new ae("ancestor");if(r===a)return!1;const o=[r],c=new Set;let f=0;for(;o.length;){if(f++===n)throw new te(n);const r=o.shift(),{type:d,object:h}=await Ft({fs:t,cache:e,gitdir:i,oid:r});if("commit"!==d)throw new q(r,d,"commit");const l=xe.from(h).parse();for(const t of l.parent)if(t===a)return!0;if(!s.has(r))for(const t of l.parent)c.has(t)||(o.push(t),c.add(t))}return!1}async function jr({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,ancestor:a,depth:n=-1,cache:s={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r),Ue("ancestor",a);const e=new Te(t),o=await Ne({fsp:e,dotgit:i});return await Pr({fs:e,cache:s,gitdir:o,oid:r,ancestor:a,depth:n})}catch(t){throw t.caller="git.isDescendent",t}}async function Or({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r}){try{Ue("fs",t),Ue("dir",e),Ue("gitdir",i),Ue("filepath",r);const a=new Te(t),n=await Ne({fsp:a,dotgit:i});return He.isIgnored({fs:a,dir:e,gitdir:n,filepath:r})}catch(t){throw t.caller="git.isIgnored",t}}async function Ir({fs:t,dir:e,gitdir:i=X(e,".git"),remote:r}){try{Ue("fs",t),Ue("gitdir",i);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return xt.listBranches({fs:e,gitdir:a,remote:r})}catch(t){throw t.caller="git.listBranches",t}}async function Cr({fs:t,gitdir:e,ref:i,cache:r}){if(i){const a=await xt.resolve({gitdir:e,fs:t,ref:i}),n=[];return await zr({fs:t,cache:r,gitdir:e,oid:a,filenames:n,prefix:""}),n}return z.acquire({fs:t,gitdir:e,cache:r},async function(t){return t.entries.map(t=>t.path)})}async function zr({fs:t,cache:e,gitdir:i,oid:r,filenames:a,prefix:n}){const{tree:s}=await ni({fs:t,cache:e,gitdir:i,oid:r});for(const r of s)"tree"===r.type?await zr({fs:t,cache:e,gitdir:i,oid:r.oid,filenames:a,prefix:X(n,r.path)}):a.push(X(n,r.path))}async function Dr({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r,cache:a={}}){try{Ue("fs",t),Ue("gitdir",i);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await Cr({fs:e,cache:a,gitdir:n,ref:r})}catch(t){throw t.caller="git.listFiles",t}}async function Tr({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r="refs/notes/commits",cache:a={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await async function({fs:t,cache:e,gitdir:i,ref:r}){let a;try{a=await xt.resolve({gitdir:i,fs:t,ref:r})}catch(t){if(t instanceof H)return[]}return(await ni({fs:t,cache:e,gitdir:i,oid:a})).tree.map(t=>({target:t.path,note:t.oid}))}({fs:e,cache:a,gitdir:n,ref:r})}catch(t){throw t.caller="git.listNotes",t}}async function Ur({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r}){try{Ue("fs",t),Ue("gitdir",i);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return xt.listRefs({fs:e,gitdir:a,filepath:r})}catch(t){throw t.caller="git.listRefs",t}}async function Nr({fs:t,dir:e,gitdir:i=X(e,".git")}){try{Ue("fs",t),Ue("gitdir",i);const e=new Te(t),r=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e}){const i=await gt.get({fs:t,gitdir:e}),r=await i.getSubsections("remote");return Promise.all(r.map(async t=>({remote:t,url:await i.get(`remote.${t}.url`)})))}({fs:e,gitdir:r})}catch(t){throw t.caller="git.listRemotes",t}}async function Mr({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,url:n,headers:s={},forPush:o=!1,protocolVersion:c=2,prefix:f,symrefs:d,peelTags:h}){try{Ue("http",t),Ue("url",n);const l=await Li.discover({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,headers:s,protocolVersion:c});if(1===l.protocolVersion)return $r(l,f,d,h);const u=await async function({prefix:t,symrefs:e,peelTags:i}){const r=[];return r.push(Ti.encode("command=ls-refs\n")),r.push(Ti.encode(`agent=${Yi}\n`)),(i||e||t)&&r.push(Ti.delim()),i&&r.push(Ti.encode("peel")),e&&r.push(Ti.encode("symrefs")),t&&r.push(Ti.encode(`ref-prefix ${t}`)),r.push(Ti.flush()),r}({prefix:f,symrefs:d,peelTags:h});return async function(t){const e=Ti.streamReader(t),i=[];let r;for(;r=await e(),!0!==r;){if(null===r)continue;r=r.toString("utf8").replace(/\n$/,"");const[t,e,...a]=r.split(" "),n={ref:e,oid:t};for(const t of a){const[e,i]=t.split(":");"symref-target"===e?n.target=i:"peeled"===e&&(n.peeled=i)}i.push(n)}return i}((await Li.connect({http:t,auth:l.auth,headers:s,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,body:u})).body)}catch(t){throw t.caller="git.listServerRefs",t}}async function Fr({fs:t,dir:e,gitdir:i=X(e,".git")}){try{Ue("fs",t),Ue("gitdir",i);const e=new Te(t),r=await Ne({fsp:e,dotgit:i});return xt.listTags({fs:e,gitdir:r})}catch(t){throw t.caller="git.listTags",t}}function Hr(t,e){return t.committer.timestamp-e.committer.timestamp}async function qr({fs:t,cache:e,gitdir:i,oid:r,fileId:a}){if("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"===a)return;const n=r;let s;const o=await ke({fs:t,cache:e,gitdir:i,oid:r}),c=o.tree;return a===o.oid?s=o.path:(s=await Lr({fs:t,cache:e,gitdir:i,tree:c,fileId:a,oid:n}),Array.isArray(s)&&(0===s.length?s=void 0:1===s.length&&(s=s[0]))),s}async function Lr({fs:t,cache:e,gitdir:i,tree:r,fileId:a,oid:n,filepaths:s=[],parentPath:o=""}){const c=r.entries().map(function(r){let c;return r.oid===a?(c=X(o,r.path),s.push(c)):"tree"===r.type&&(c=Ft({fs:t,cache:e,gitdir:i,oid:r.oid}).then(function({object:c}){return Lr({fs:t,cache:e,gitdir:i,tree:Bt.from(c),fileId:a,oid:n,filepaths:s,parentPath:X(o,r.path)})})),c});return await Promise.all(c),s}async function Wr({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r,ref:a="HEAD",depth:n,since:s,force:o,follow:c,cache:f={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",a);const e=new Te(t),d=await Ne({fsp:e,dotgit:i});return await async function({fs:t,cache:e,gitdir:i,filepath:r,ref:a,depth:n,since:s,force:o,follow:c}){const f=void 0===s?void 0:Math.floor(s.valueOf()/1e3),d=[],h=await Gi.read({fs:t,gitdir:i}),l=await xt.resolve({fs:t,gitdir:i,ref:a}),u=[await ti({fs:t,cache:e,gitdir:i,oid:l})];let g,w,p;function m(t){p&&r&&d.push(t)}for(;u.length>0;){const a=u.pop();if(void 0!==f&&a.commit.committer.timestamp<=f)break;if(r){let n;try{n=await ri({fs:t,cache:e,gitdir:i,oid:a.commit.tree,filepath:r}),w&&g!==n&&d.push(w),g=n,w=a,p=!0}catch(n){if(!(n instanceof H))throw n;{let s=c&&g;if(s&&(s=await qr({fs:t,cache:e,gitdir:i,oid:a.commit.tree,fileId:g}),s))if(Array.isArray(s)){if(w){const a=await qr({fs:t,cache:e,gitdir:i,oid:w.commit.tree,fileId:g});if(Array.isArray(a)){if(s=s.filter(t=>-1===a.indexOf(t)),1!==s.length){s=!1,w&&d.push(w);break}s=s[0],r=s,w&&d.push(w)}}}else r=s,w&&d.push(w);if(!s){if(p&&g&&(d.push(w),!o))break;if(!o&&!c)throw n}w=a,p=!1}}}else d.push(a);if(void 0!==n&&d.length===n){m(a);break}if(!h.has(a.oid))for(const r of a.commit.parent){const a=await ti({fs:t,cache:e,gitdir:i,oid:r});u.map(t=>t.oid).includes(a.oid)||u.push(a)}0===u.length&&m(a),u.sort((t,e)=>Hr(t.commit,e.commit))}return d}({fs:e,cache:f,gitdir:d,filepath:r,ref:a,depth:n,since:s,force:o,follow:c})}catch(t){throw t.caller="git.log",t}}async function Zr({fs:t,onSign:e,dir:i,gitdir:r=X(i,".git"),ours:a,theirs:n,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:c=!1,noUpdateBranch:f=!1,abortOnConflict:d=!0,message:h,author:l,committer:u,signingKey:g,cache:w={},mergeDriver:p,allowUnrelatedHistories:m=!1}){try{Ue("fs",t),g&&Ue("onSign",e);const y=new Te(t),b=await Ne({fsp:y,dotgit:r}),_=await Ye({fs:y,gitdir:b,author:l});if(!(_||o&&s))throw new re("author");const v=await Je({fs:y,gitdir:b,author:_,committer:u});if(!(v||o&&s))throw new re("committer");return await wr({fs:y,cache:w,dir:i,gitdir:b,ours:a,theirs:n,fastForward:s,fastForwardOnly:o,dryRun:c,noUpdateBranch:f,abortOnConflict:d,message:h,author:_,committer:v,signingKey:g,onSign:e,mergeDriver:p,allowUnrelatedHistories:m})}catch(t){throw t.caller="git.merge",t}}const Gr={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function Kr({fs:t,cache:e,dir:r,gitdir:a=X(r,".git"),oids:n}){const s=new i,o=[];function c(t,e){const i=Buffer.from(t,e);o.push(i),s.update(i)}async function f({stype:t,object:e}){const i=Gr[t];let r=e.length,a=r>15?128:0;const n=15&r;r>>>=4;let s=(a|i|n).toString(16);for(c(s,"hex");a;)a=r>127?128:0,s=a|127&r,c(Di(2,s),"hex"),r>>>=7;c(Buffer.from(await Le(e)))}c("PACK"),c("00000002","hex"),c(Di(8,n.length),"hex");for(const i of n){const{type:r,object:n}=await Ft({fs:t,cache:e,gitdir:a,oid:i});await f({object:n,stype:r})}const d=s.digest();return o.push(d),o}async function Vr({fs:t,dir:e,gitdir:i=X(e,".git"),oids:r,write:a=!1,cache:n={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oids",r);const e=new Te(t),s=await Ne({fsp:e,dotgit:i});return await async function({fs:t,cache:e,gitdir:i,oids:r,write:a}){const n=await Kr({fs:t,cache:e,gitdir:i,oids:r}),s=Buffer.from(await Ci(n)),o=`pack-${s.slice(-20).toString("hex")}.pack`;return a?(await t.write(X(i,`objects/pack/${o}`),s),{filename:o}):{filename:o,packfile:new Uint8Array(s)}}({fs:e,cache:n,gitdir:s,oids:r,write:a})}catch(t){throw t.caller="git.packObjects",t}}async function Xr({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c=X(o,".git"),ref:f,url:d,remote:h,remoteRef:l,prune:u=!1,pruneTags:g=!1,fastForward:w=!0,fastForwardOnly:p=!1,corsProxy:m,singleBranch:y,headers:b={},author:_,committer:v,signingKey:x,cache:k={}}){try{Ue("fs",t),Ue("gitdir",c);const E=new Te(t),$=await Ne({fsp:E,dotgit:c}),S=await Ye({fs:E,gitdir:$,author:_});if(!S)throw new re("author");const B=await Je({fs:E,gitdir:$,author:S,committer:v});if(!B)throw new re("committer");return await pr({fs:E,cache:k,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:$,ref:f,url:d,remote:h,remoteRef:l,fastForward:w,fastForwardOnly:p,corsProxy:m,singleBranch:y,headers:b,author:S,committer:B,signingKey:x,prune:u,pruneTags:g})}catch(t){throw t.caller="git.pull",t}}async function Yr({fs:t,cache:e,dir:i,gitdir:r=X(i,".git"),oids:a}){const n=new Set;async function s(i){if(n.has(i))return;n.add(i);const{type:a,object:o}=await Ft({fs:t,cache:e,gitdir:r,oid:i});if("tag"===a){const t=_e.from(o).headers().object;await s(t)}else if("commit"===a){const t=xe.from(o).headers().tree;await s(t)}else if("tree"===a){const t=Bt.from(o);for(const e of t)"blob"===e.type&&n.add(e.oid),"tree"===e.type&&await s(e.oid)}}for(const t of a)await s(t);return n}async function Jr({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPrePush:c,gitdir:f,ref:d,remoteRef:h,remote:l,url:u,force:g=!1,delete:w=!1,corsProxy:p,headers:m={}}){const y=d||await ji({fs:t,gitdir:f});if(void 0===y)throw new ae("ref");const b=await gt.get({fs:t,gitdir:f});l=l||await b.get(`branch.${y}.pushRemote`)||await b.get("remote.pushDefault")||await b.get(`branch.${y}.remote`)||"origin";const _=u||await b.get(`remote.${l}.pushurl`)||await b.get(`remote.${l}.url`);if(void 0===_)throw new ae("remote OR url");const v=h||await b.get(`branch.${y}.merge`);if(void 0===_)throw new ae("remoteRef");void 0===p&&(p=await b.get("http.corsProxy"));const x=await xt.expand({fs:t,gitdir:f,ref:y}),k=w?"0000000000000000000000000000000000000000":await xt.resolve({fs:t,gitdir:f,ref:x}),E=Wi.getRemoteHelperFor({url:_}),$=await E.discover({http:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,corsProxy:p,service:"git-receive-pack",url:_,headers:m,protocolVersion:1}),S=$.auth;let B;if(v)try{B=await xt.expandAgainstMap({ref:v,map:$.refs})}catch(t){if(!(t instanceof H))throw t;B=v.startsWith("refs/")?v:`refs/heads/${v}`}else B=x;const A=$.refs.get(B)||"0000000000000000000000000000000000000000";if(c){if(!await c({remote:l,url:_,localRef:{ref:w?"(delete)":x,oid:k},remoteRef:{ref:B,oid:A}}))throw new le}const R=!$.capabilities.has("no-thin");let P=new Set;if(!w){const i=[...$.refs.values()];let r=new Set;if("0000000000000000000000000000000000000000"!==A){const a=await gr({fs:t,cache:e,gitdir:f,oids:[k,A]});for(const t of a)i.push(t);R&&(r=await Yr({fs:t,cache:e,gitdir:f,oids:a}))}if(!i.includes(k)){const r=await async function({fs:t,cache:e,dir:i,gitdir:r=X(i,".git"),start:a,finish:n}){const s=await Gi.read({fs:t,gitdir:r}),o=new Set,c=new Set;for(const e of a)o.add(await xt.resolve({fs:t,gitdir:r,ref:e}));for(const e of n)try{const i=await xt.resolve({fs:t,gitdir:r,ref:e});c.add(i)}catch(t){}const f=new Set;async function d(i){f.add(i);const{type:a,object:n}=await Ft({fs:t,cache:e,gitdir:r,oid:i});if("tag"===a)return d(_e.from(n).headers().object);if("commit"!==a)throw new q(i,a,"commit");if(!s.has(i)){const t=xe.from(n).headers().parent;for(i of t)c.has(i)||f.has(i)||await d(i)}}for(const t of o)await d(t);return f}({fs:t,cache:e,gitdir:f,start:[k],finish:i});P=await Yr({fs:t,cache:e,gitdir:f,oids:r})}if(R){try{const i=await xt.resolve({fs:t,gitdir:f,ref:`refs/remotes/${l}/HEAD`,depth:2}),{oid:a}=await xt.resolveAgainstMap({ref:i.replace(`refs/remotes/${l}/`,""),fullref:i,map:$.refs}),n=[a];for(const i of await Yr({fs:t,cache:e,gitdir:f,oids:n}))r.add(i)}catch(t){}for(const t of r)P.delete(t)}if(k===A&&(g=!0),!g){if(x.startsWith("refs/tags")&&"0000000000000000000000000000000000000000"!==A)throw new oe("tag-exists");if("0000000000000000000000000000000000000000"!==k&&"0000000000000000000000000000000000000000"!==A&&!await Pr({fs:t,cache:e,gitdir:f,oid:k,ancestor:A,depth:-1}))throw new oe("not-fast-forward")}}const j=Vi([...$.capabilities],["report-status","side-band-64k",`agent=${Yi}`]),O=await async function({capabilities:t=[],triplets:e=[]}){const i=[];let r=`\0 ${t.join(" ")}`;for(const t of e)i.push(Ti.encode(`${t.oldoid} ${t.oid} ${t.fullRef}${r}\n`)),r="";return i.push(Ti.flush()),i}({capabilities:j,triplets:[{oldoid:A,oid:k,fullRef:B}]}),I=w?[]:await Kr({fs:t,cache:e,gitdir:f,oids:[...P]}),C=await E.connect({http:i,onProgress:r,corsProxy:p,service:"git-receive-pack",url:_,auth:S,headers:m,body:[...O,...I]}),{packfile:z,progress:D}=await er.demux(C.body);if(a){Ii(tr(D),async t=>{await a(t)})}const T=await async function(t){const e={};let i="";const r=Ti.streamReader(t);let a=await r();for(;!0!==a;)null!==a&&(i+=a.toString("utf8")+"\n"),a=await r();const n=i.toString("utf8").split("\n");if(a=n.shift(),!a.startsWith("unpack "))throw new se('unpack ok" or "unpack [error message]',a);e.ok="unpack ok"===a,e.ok||(e.error=a.slice(7)),e.refs={};for(const t of n){if(""===t.trim())continue;const i=t.slice(0,2),r=t.slice(3);let a=r.indexOf(" ");-1===a&&(a=r.length);const n=r.slice(0,a),s=r.slice(a+1);e.refs[n]={ok:"ok"===i,error:s}}return e}(z);if(C.headers&&(T.headers=C.headers),l&&T.ok&&T.refs[B].ok&&!x.startsWith("refs/tags")){const e=`refs/remotes/${l}/${B.replace("refs/heads","")}`;w?await xt.deleteRef({fs:t,gitdir:f,ref:e}):await xt.writeRef({fs:t,gitdir:f,ref:e,value:k})}if(T.ok&&Object.values(T.refs).every(t=>t.ok))return T;{const t=Object.entries(T.refs).filter(([t,e])=>!e.ok).map(([t,e])=>`\n - ${t}: ${e.error}`).join("");throw new Xt(t,T)}}async function Qr({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPrePush:o,dir:c,gitdir:f=X(c,".git"),ref:d,remoteRef:h,remote:l="origin",url:u,force:g=!1,delete:w=!1,corsProxy:p,headers:m={},cache:y={}}){try{Ue("fs",t),Ue("http",e),Ue("gitdir",f);const c=new Te(t),b=await Ne({fsp:c,dotgit:f});return await Jr({fs:c,cache:y,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPrePush:o,gitdir:b,ref:d,remoteRef:h,remote:l,url:u,force:g,delete:w,corsProxy:p,headers:m})}catch(t){throw t.caller="git.push",t}}async function ta({fs:t,cache:e,gitdir:i,oid:r}){const{type:a,object:n}=await Ft({fs:t,cache:e,gitdir:i,oid:r});if("tag"===a)return ta({fs:t,cache:e,gitdir:i,oid:r=_e.from(n).parse().object});if("blob"!==a)throw new q(r,a,"blob");return{oid:r,blob:new Uint8Array(n)}}async function ea({fs:t,cache:e,gitdir:i,oid:r,filepath:a}){void 0!==a&&(r=await ri({fs:t,cache:e,gitdir:i,oid:r,filepath:a}));return await ta({fs:t,cache:e,gitdir:i,oid:r})}async function ia({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,filepath:a,cache:n={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r);const e=new Te(t),s=await Ne({fsp:e,dotgit:i});return await ea({fs:e,cache:n,gitdir:s,oid:r,filepath:a})}catch(t){throw t.caller="git.readBlob",t}}async function ra({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,cache:a={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await ti({fs:e,cache:a,gitdir:n,oid:r})}catch(t){throw t.caller="git.readCommit",t}}async function aa({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r="refs/notes/commits",oid:a,cache:n={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r),Ue("oid",a);const e=new Te(t),s=await Ne({fsp:e,dotgit:i});return await async function({fs:t,cache:e,gitdir:i,ref:r="refs/notes/commits",oid:a}){const n=await xt.resolve({gitdir:i,fs:t,ref:r}),{blob:s}=await ea({fs:t,cache:e,gitdir:i,oid:n,filepath:a});return s}({fs:e,cache:n,gitdir:s,ref:r,oid:a})}catch(t){throw t.caller="git.readNote",t}}async function na({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,format:a="parsed",filepath:n,encoding:s,cache:o={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r);const e=new Te(t),c=await Ne({fsp:e,dotgit:i});void 0!==n&&(r=await ri({fs:e,cache:o,gitdir:c,oid:r,filepath:n}));const f="parsed"===a?"content":a,d=await Ft({fs:e,cache:o,gitdir:c,oid:r,format:f});if(d.oid=r,"parsed"===a)switch(d.format="parsed",d.type){case"commit":d.object=xe.from(d.object).parse();break;case"tree":d.object=Bt.from(d.object).entries();break;case"blob":s?d.object=d.object.toString(s):(d.object=new Uint8Array(d.object),d.format="content");break;case"tag":d.object=_e.from(d.object).parse();break;default:throw new q(d.oid,d.type,"blob|commit|tag|tree")}else"deflated"!==d.format&&"wrapped"!==d.format||(d.type=d.format);return d}catch(t){throw t.caller="git.readObject",t}}async function sa({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,cache:a={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await async function({fs:t,cache:e,gitdir:i,oid:r}){const{type:a,object:n}=await Ft({fs:t,cache:e,gitdir:i,oid:r,format:"content"});if("tag"!==a)throw new q(r,a,"tag");const s=_e.from(n);return{oid:r,tag:s.parse(),payload:s.payload()}}({fs:e,cache:a,gitdir:n,oid:r})}catch(t){throw t.caller="git.readTag",t}}async function oa({fs:t,dir:e,gitdir:i=X(e,".git"),oid:r,filepath:a,cache:n={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("oid",r);const e=new Te(t),s=await Ne({fsp:e,dotgit:i});return await ni({fs:e,cache:n,gitdir:s,oid:r,filepath:a})}catch(t){throw t.caller="git.readTree",t}}async function ca({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r,cache:a={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("filepath",r);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});await z.acquire({fs:e,gitdir:n,cache:a},async function(t){t.delete({filepath:r})})}catch(t){throw t.caller="git.remove",t}}async function fa({fs:t,onSign:e,dir:i,gitdir:r=X(i,".git"),ref:a="refs/notes/commits",oid:n,author:s,committer:o,signingKey:c,cache:f={}}){try{Ue("fs",t),Ue("gitdir",r),Ue("oid",n);const i=new Te(t),d=await Ne({fsp:i,dotgit:r}),h=await Ye({fs:i,gitdir:d,author:s});if(!h)throw new re("author");const l=await Je({fs:i,gitdir:d,author:h,committer:o});if(!l)throw new re("committer");return await async function({fs:t,cache:e,onSign:i,gitdir:r,ref:a="refs/notes/commits",oid:n,author:s,committer:o,signingKey:c}){let f;try{f=await xt.resolve({gitdir:r,fs:t,ref:a})}catch(t){if(!(t instanceof H))throw t}let d=(await ni({fs:t,cache:e,gitdir:r,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;d=d.filter(t=>t.path!==n);const h=await si({fs:t,gitdir:r,tree:d});return await ei({fs:t,cache:e,onSign:i,gitdir:r,ref:a,tree:h,parent:f&&[f],message:"Note removed by 'isomorphic-git removeNote'\n",author:s,committer:o,signingKey:c})}({fs:i,cache:f,onSign:e,gitdir:d,ref:a,oid:n,author:h,committer:l,signingKey:c})}catch(t){throw t.caller="git.removeNote",t}}async function da({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r,oldref:a,checkout:n=!1}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r),Ue("oldref",a);const e=new Te(t),s=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e,oldref:i,ref:r,checkout:a=!1}){if(!fi(r))throw new Qt(r,h.clean(r));if(!fi(i))throw new Qt(i,h.clean(i));const n=`refs/heads/${i}`,s=`refs/heads/${r}`;if(await xt.exists({fs:t,gitdir:e,ref:s}))throw new Ht("branch",r,!1);const o=await xt.resolve({fs:t,gitdir:e,ref:n,depth:1});await xt.writeRef({fs:t,gitdir:e,ref:s,value:o}),await xt.deleteRef({fs:t,gitdir:e,ref:n});const c=await ji({fs:t,gitdir:e,fullname:!0});(a||c===n)&&await xt.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}({fs:e,gitdir:s,ref:r,oldref:a,checkout:n})}catch(t){throw t.caller="git.renameBranch",t}}async function ha({gitdir:t,type:e,object:i}){return A(At.wrap({type:e,object:i}))}async function la({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r,ref:a,cache:n={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("filepath",r);const s=new Te(t),o=await Ne({fsp:s,dotgit:i});let c,f;try{c=await xt.resolve({fs:s,gitdir:o,ref:a||"HEAD"})}catch(t){if(a)throw t}if(c)try{c=await ri({fs:s,cache:n,gitdir:o,oid:c,filepath:r})}catch(t){c=null}let d={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0};const h=e&&await s.read(X(e,r));h&&(f=await ha({gitdir:o,type:"blob",object:h}),c===f&&(d=await s.lstat(X(e,r)))),await z.acquire({fs:s,gitdir:o,cache:n},async function(t){t.delete({filepath:r}),c&&t.insert({filepath:r,stats:d,oid:c})})}catch(t){throw t.caller="git.reset",t}}async function ua({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r,depth:a}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r);const e=new Te(t),n=await Ne({fsp:e,dotgit:i});return await xt.resolve({fs:e,gitdir:n,ref:r,depth:a})}catch(t){throw t.caller="git.resolveRef",t}}async function ga({fs:t,dir:e,gitdir:i=X(e,".git"),path:r,value:a,append:n=!1}){try{Ue("fs",t),Ue("gitdir",i),Ue("path",r);const e=new Te(t),s=await Ne({fsp:e,dotgit:i}),o=await gt.get({fs:e,gitdir:s});n?await o.append(r,a):await o.set(r,a),await gt.save({fs:e,gitdir:s,config:o})}catch(t){throw t.caller="git.setConfig",t}}async function wa({fs:t,gitdir:e,commit:i}){const r=xe.from(i).toObject();return await We({fs:t,gitdir:e,type:"commit",object:r,format:"content"})}class pa{static get timezoneOffsetForRefLogEntry(){const t=(new Date).getTimezoneOffset(),e=Math.abs(Math.floor(t/60)),i=Math.abs(t%60).toString().padStart(2,"0");return`${t>0?"-":"+"}${e.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(t,e,i){const r=t.name.replace(/\s/g,""),a=Math.floor(Date.now()/1e3),n=pa.timezoneOffsetForRefLogEntry;return`0000000000000000000000000000000000000000 ${e} ${r} ${t.email} ${a} ${n}\t${i}\n`}static getStashReflogEntry(t,e=!1){return t.split("\n").filter(t=>t).reverse().map((t,i)=>e?`stash@{${i}}: ${t.split("\t")[1]}`:t)}}class ma{constructor({fs:t,dir:e,gitdir:i=X(e,".git")}){Object.assign(this,{fs:t,dir:e,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return X(this.gitdir,ma.refStash)}get refLogsStashPath(){return X(this.gitdir,ma.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Ye({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new re("author");return this._author}async getStashSHA(t,e){if(!await this.fs.exists(this.refStashPath))return null;return(e||await this.readStashReflogs({parsed:!1}))[t].split(" ")[1]}async writeStashCommit({message:t,tree:e,parent:i}){return wa({fs:this.fs,gitdir:this.gitdir,commit:{message:t,tree:e,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(t){const e=await this.readStashReflogs({parsed:!1});if(0!==t&&(t<0||t>e.length-1))throw new Qt(`stash@${t}`,"number that is in range of [0, num of stash pushed]");const i=await this.getStashSHA(t,e);return i?ti({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(t){return xt.writeRef({fs:this.fs,gitdir:this.gitdir,ref:ma.refStash,value:t})}async writeStashReflogEntry({stashCommit:t,message:e}){const i=await this.getAuthor(),r=pa.createStashReflogEntry(i,t,e),a=this.refLogsStashPath;await ki({filepath:a,entry:r},async()=>{const t=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,t+r,"utf8")})}async readStashReflogs({parsed:t=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];const e=await this.fs.read(this.refLogsStashPath,"utf8");return pa.getStashReflogEntry(e,t)}}async function ya({fs:t,dir:e,gitdir:i,message:r=""}){const a=new ma({fs:t,dir:e,gitdir:i});await a.getAuthor();const n=await ji({fs:t,gitdir:i,fullname:!1}),s=await xt.resolve({fs:t,gitdir:i,ref:"HEAD"}),o=(await ra({fs:t,dir:e,gitdir:i,oid:s})).commit.message,c=[s];let f=null,d=$e({ref:"HEAD"});const h=await $i({fs:t,dir:e,gitdir:i,treePair:[$e({ref:"HEAD"}),"stage"]});if(h){const t=await a.writeStashCommit({message:`stash-Index: WIP on ${n} - ${(new Date).toISOString()}`,tree:h,parent:c});c.push(t),f=h,d=F()}const l=await $i({fs:t,dir:e,gitdir:i,treePair:[d,"workdir"]});if(l){const t=await a.writeStashCommit({message:`stash-WorkDir: WIP on ${n} - ${(new Date).toISOString()}`,tree:l,parent:[c[c.length-1]]});c.push(t),f=l}if(!f||!h&&!l)throw new H("changes, nothing to stash");const u=(r.trim()||`WIP on ${n}`)+`: ${s.substring(0,7)} ${o}`;return{stashCommit:await a.writeStashCommit({message:u,tree:f,parent:c}),stashMsg:u,branch:n,stashMgr:a}}async function ba({fs:t,dir:e,gitdir:i,message:r=""}){const{stashCommit:a,stashMsg:n,branch:s,stashMgr:o}=await ya({fs:t,dir:e,gitdir:i,message:r});return await o.writeStashRef(a),await o.writeStashReflogEntry({stashCommit:a,message:n}),await mi({fs:t,dir:e,gitdir:i,ref:s,track:!1,force:!0}),a}async function _a({fs:t,dir:e,gitdir:i,message:r=""}){const{stashCommit:a}=await ya({fs:t,dir:e,gitdir:i,message:r});return a}async function va({fs:t,dir:e,gitdir:i,refIdx:r=0}){const a=new ma({fs:t,dir:e,gitdir:i}),n=await a.readStashCommit(r),{parent:s=null}=n.commit?n.commit:{};if(s&&Array.isArray(s))for(let r=0;r<s.length-1;r++){const a=(await ti({fs:t,cache:{},gitdir:i,oid:s[r+1]})).commit.message.startsWith("stash-Index");await Si({fs:t,dir:e,gitdir:i,stashCommit:s[r+1],parentCommit:s[r],wasStaged:a})}}async function xa({fs:t,dir:e,gitdir:i,refIdx:r=0}){const a=new ma({fs:t,dir:e,gitdir:i});if(!(await a.readStashCommit(r)).commit)return;const n=a.refStashPath;await ki(n,async()=>{await t.exists(n)&&await t.rm(n)});const s=await a.readStashReflogs({parsed:!1});if(!s.length)return;s.splice(r,1);const o=a.refLogsStashPath;await ki({reflogEntries:s,stashReflogPath:o,stashMgr:a},async()=>{if(s.length){await t.write(o,s.reverse().join("\n")+"\n","utf8");const e=s[s.length-1].split(" ")[1];await a.writeStashRef(e)}else await t.rm(o)})}async function ka({fs:t,dir:e,gitdir:i}){return new ma({fs:t,dir:e,gitdir:i}).readStashReflogs({parsed:!0})}async function Ea({fs:t,dir:e,gitdir:i}){const r=new ma({fs:t,dir:e,gitdir:i}),a=[r.refStashPath,r.refLogsStashPath];await ki(a,async()=>{await Promise.all(a.map(async e=>{if(await t.exists(e))return t.rm(e)}))})}async function $a({fs:t,dir:e,gitdir:i,refIdx:r=0}){await va({fs:t,dir:e,gitdir:i,refIdx:r}),await xa({fs:t,dir:e,gitdir:i,refIdx:r})}async function Sa({fs:t,dir:e,gitdir:i=X(e,".git"),op:r="push",message:a="",refIdx:n=0}){Ue("fs",t),Ue("dir",e),Ue("gitdir",i),Ue("op",r);const s={push:ba,apply:va,drop:xa,list:ka,clear:Ea,pop:$a,create:_a},o=["apply","drop","pop"];try{const c=new Te(t),f=await Ne({fsp:c,dotgit:i});["refs","logs","logs/refs"].map(t=>X(f,t)).forEach(async t=>{await c.exists(t)||await c.mkdir(t)});const d=s[r];if(d){if(o.includes(r)&&n<0)throw new Qt(`stash@${n}`,"number that is in range of [0, num of stash pushed]");return await d({fs:c,dir:e,gitdir:f,message:a,refIdx:n})}throw new Error(`To be implemented: ${r}`)}catch(t){throw t.caller="git.stash",t}}async function Ba({fs:t,dir:e,gitdir:i=X(e,".git"),filepath:r,cache:a={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("filepath",r);const n=new Te(t),s=await Ne({fsp:n,dotgit:i});if(await He.isIgnored({fs:n,gitdir:s,dir:e,filepath:r}))return"ignored";const o=await async function({fs:t,cache:e,gitdir:i}){let r;try{r=await xt.resolve({fs:t,gitdir:i,ref:"HEAD"})}catch(t){if(t instanceof H)return[]}const{tree:a}=await ni({fs:t,cache:e,gitdir:i,oid:r});return a}({fs:n,cache:a,gitdir:s}),c=await Aa({fs:n,cache:a,gitdir:s,tree:o,path:r}),f=await z.acquire({fs:n,gitdir:s,cache:a},async function(t){for(const e of t)if(e.path===r)return e;return null}),d=await n.lstat(X(e,r)),h=null!==c,l=null!==f,u=null!==d,g=async()=>{if(l&&!O(f,d))return f.oid;{const t=await n.read(X(e,r)),i=await ha({gitdir:s,type:"blob",object:t});return l&&f.oid===i&&-1!==d.size&&z.acquire({fs:n,gitdir:s,cache:a},async function(t){t.insert({filepath:r,stats:d,oid:i})}),i}};if(!h&&!u&&!l)return"absent";if(!h&&!u&&l)return"*absent";if(!h&&u&&!l)return"*added";if(!h&&u&&l){return await g()===f.oid?"added":"*added"}if(h&&!u&&!l)return"deleted";if(h&&!u&&l)return f.oid,"*deleted";if(h&&u&&!l){return await g()===c?"*undeleted":"*undeletemodified"}if(h&&u&&l){const t=await g();return t===c?t===f.oid?"unmodified":"*unmodified":t===f.oid?"modified":"*modified"}}catch(t){throw t.caller="git.status",t}}async function Aa({fs:t,cache:e,gitdir:i,tree:r,path:a}){"string"==typeof a&&(a=a.split("/"));const n=a.shift();for(const s of r)if(s.path===n){if(0===a.length)return s.oid;const{type:r,object:n}=await Ft({fs:t,cache:e,gitdir:i,oid:s.oid});if("tree"===r){return Aa({fs:t,cache:e,gitdir:i,tree:Bt.from(n),path:a})}if("blob"===r)throw new q(s.oid,r,"blob",a.join("/"))}return null}async function Ra({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r="HEAD",filepaths:a=["."],filter:n,cache:s={},ignored:o=!1}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r);const c=new Te(t),f=await Ne({fsp:c,dotgit:i});return await je({fs:c,cache:s,dir:e,gitdir:f,trees:[$e({ref:r}),Be(),F()],map:async function(t,[i,r,s]){if(!i&&!s&&r&&!o){if(await He.isIgnored({fs:c,dir:e,filepath:t}))return null}if(!a.some(e=>gi(t,e)))return null;if(n&&!n(t))return;const[f,d,h]=await Promise.all([i&&i.type(),r&&r.type(),s&&s.type()]),l=[f,d,h].includes("blob");if(("tree"===f||"special"===f)&&!l)return;if("commit"===f)return null;if(("tree"===d||"special"===d)&&!l)return;if("commit"===h)return null;if(("tree"===h||"special"===h)&&!l)return;const u="blob"===f?await i.oid():void 0,g="blob"===h?await s.oid():void 0;let w;"blob"!==f&&"blob"===d&&"blob"!==h?w="42":"blob"===d&&(w=await r.oid());const p=[void 0,u,w,g],m=p.map(t=>p.indexOf(t));return m.shift(),[t,...m]}})}catch(t){throw t.caller="git.statusMatrix",t}}async function Pa({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r,object:a,force:n=!1}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r);const e=new Te(t);if(void 0===r)throw new ae("ref");r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`;const s=await Ne({fsp:e,dotgit:i}),o=await xt.resolve({fs:e,gitdir:s,ref:a||"HEAD"});if(!n&&await xt.exists({fs:e,gitdir:s,ref:r}))throw new Ht("tag",r);await xt.writeRef({fs:e,gitdir:s,ref:r,value:o})}catch(t){throw t.caller="git.tag",t}}async function ja({fs:t,dir:e,gitdir:i=X(e,".git"),cache:r={},filepath:a,oid:n,mode:s,add:o,remove:c,force:f}){try{Ue("fs",t),Ue("gitdir",i),Ue("filepath",a);const d=new Te(t),h=await Ne({fsp:d,dotgit:i});if(c)return await z.acquire({fs:d,gitdir:h,cache:r},async function(t){if(!f){const t=await d.lstat(X(e,a));if(t){if(t.isDirectory())throw new Jt("directory");return}}t.has({filepath:a})&&t.delete({filepath:a})});let l;if(!n){if(l=await d.lstat(X(e,a)),!l)throw new H(`file at "${a}" on disk and "remove" not set`);if(l.isDirectory())throw new Jt("directory")}return await z.acquire({fs:d,gitdir:h,cache:r},async function(t){if(!o&&!t.has({filepath:a}))throw new H(`file at "${a}" in index and "add" not set`);let i;if(n)i={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};else{i=l;const t=i.isSymbolicLink()?await d.readlink(X(e,a)):await d.read(X(e,a));n=await We({fs:d,gitdir:h,type:"blob",format:"content",object:t})}return t.insert({filepath:a,oid:n,stats:i}),n})}catch(t){throw t.caller="git.updateIndex",t}}function Oa(){try{return Xi}catch(t){throw t.caller="git.version",t}}async function Ia({fs:t,dir:e,gitdir:i=X(e,".git"),trees:r,map:a,reduce:n,iterate:s,cache:o={}}){try{Ue("fs",t),Ue("gitdir",i),Ue("trees",r);const c=new Te(t),f=await Ne({fsp:c,dotgit:i});return await je({fs:c,cache:o,dir:e,gitdir:f,trees:r,map:a,reduce:n,iterate:s})}catch(t){throw t.caller="git.walk",t}}async function Ca({fs:t,dir:e,gitdir:i=X(e,".git"),blob:r}){try{Ue("fs",t),Ue("gitdir",i),Ue("blob",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await We({fs:e,gitdir:a,type:"blob",object:r,format:"content"})}catch(t){throw t.caller="git.writeBlob",t}}async function za({fs:t,dir:e,gitdir:i=X(e,".git"),commit:r}){try{Ue("fs",t),Ue("gitdir",i),Ue("commit",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await wa({fs:e,gitdir:a,commit:r})}catch(t){throw t.caller="git.writeCommit",t}}async function Da({fs:t,dir:e,gitdir:i=X(e,".git"),type:r,object:a,format:n="parsed",oid:s,encoding:o}){try{const e=new Te(t),c=await Ne({fsp:e,dotgit:i});if("parsed"===n){switch(r){case"commit":a=xe.from(a).toObject();break;case"tree":a=Bt.from(a).toObject();break;case"blob":a=Buffer.from(a,o);break;case"tag":a=_e.from(a).toObject();break;default:throw new q(s||"",r,"blob|commit|tag|tree")}n="content"}return s=await We({fs:e,gitdir:c,type:r,object:a,oid:s,format:n})}catch(t){throw t.caller="git.writeObject",t}}async function Ta({fs:t,dir:e,gitdir:i=X(e,".git"),ref:r,value:a,force:n=!1,symbolic:s=!1}){try{Ue("fs",t),Ue("gitdir",i),Ue("ref",r),Ue("value",a);const e=new Te(t);if(!fi(r))throw new Qt(r,h.clean(r));const o=await Ne({fsp:e,dotgit:i});if(!n&&await xt.exists({fs:e,gitdir:o,ref:r}))throw new Ht("ref",r);s?await xt.writeSymbolicRef({fs:e,gitdir:o,ref:r,value:a}):(a=await xt.resolve({fs:e,gitdir:o,ref:a}),await xt.writeRef({fs:e,gitdir:o,ref:r,value:a}))}catch(t){throw t.caller="git.writeRef",t}}async function Ua({fs:t,dir:e,gitdir:i=X(e,".git"),tag:r}){try{Ue("fs",t),Ue("gitdir",i),Ue("tag",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await async function({fs:t,gitdir:e,tag:i}){const r=_e.from(i).toObject();return await We({fs:t,gitdir:e,type:"tag",object:r,format:"content"})}({fs:e,gitdir:a,tag:r})}catch(t){throw t.caller="git.writeTag",t}}async function Na({fs:t,dir:e,gitdir:i=X(e,".git"),tree:r}){try{Ue("fs",t),Ue("gitdir",i),Ue("tree",r);const e=new Te(t),a=await Ne({fsp:e,dotgit:i});return await si({fs:e,gitdir:a,tree:r})}catch(t){throw t.caller="git.writeTree",t}}var Ma={Errors:we,STAGE:F,TREE:$e,WORKDIR:Be,add:Ge,abortMerge:Fe,addNote:oi,addRemote:hi,annotatedTag:li,branch:ui,cherryPick:Ai,checkout:mi,clone:ar,commit:nr,getConfig:xr,getConfigAll:kr,setConfig:ga,currentBranch:sr,deleteBranch:or,deleteRef:cr,deleteRemote:fr,deleteTag:dr,expandOid:lr,expandRef:ur,fastForward:mr,fetch:yr,findMergeBase:br,findRoot:vr,getRemoteInfo:Er,getRemoteInfo2:Sr,hashBlob:Br,indexPack:Ar,init:Rr,isDescendent:jr,isIgnored:Or,listBranches:Ir,listFiles:Dr,listNotes:Tr,listRefs:Ur,listRemotes:Nr,listServerRefs:Mr,listTags:Fr,log:Wr,merge:Zr,packObjects:Vr,pull:Xr,push:Qr,readBlob:ia,readCommit:ra,readNote:aa,readObject:na,readTag:sa,readTree:oa,remove:ca,removeNote:fa,renameBranch:da,resetIndex:la,updateIndex:ja,resolveRef:ua,status:Ba,statusMatrix:Ra,tag:Pa,version:Oa,walk:Ia,writeBlob:Ca,writeCommit:za,writeObject:Da,writeRef:Ta,writeTag:Ua,writeTree:Na,stash:Sa};return g.Errors=we,g.STAGE=F,g.TREE=$e,g.WORKDIR=Be,g.abortMerge=Fe,g.add=Ge,g.addNote=oi,g.addRemote=hi,g.annotatedTag=li,g.branch=ui,g.checkout=mi,g.cherryPick=Ai,g.clone=ar,g.commit=nr,g.currentBranch=sr,g.default=Ma,g.deleteBranch=or,g.deleteRef=cr,g.deleteRemote=fr,g.deleteTag=dr,g.expandOid=lr,g.expandRef=ur,g.fastForward=mr,g.fetch=yr,g.findMergeBase=br,g.findRoot=vr,g.getConfig=xr,g.getConfigAll=kr,g.getRemoteInfo=Er,g.getRemoteInfo2=Sr,g.hashBlob=Br,g.indexPack=Ar,g.init=Rr,g.isDescendent=jr,g.isIgnored=Or,g.listBranches=Ir,g.listFiles=Dr,g.listNotes=Tr,g.listRefs=Ur,g.listRemotes=Nr,g.listServerRefs=Mr,g.listTags=Fr,g.log=Wr,g.merge=Zr,g.packObjects=Vr,g.pull=Xr,g.push=Qr,g.readBlob=ia,g.readCommit=ra,g.readNote=aa,g.readObject=na,g.readTag=sa,g.readTree=oa,g.remove=ca,g.removeNote=fa,g.renameBranch=da,g.resetIndex=la,g.resolveRef=ua,g.setConfig=ga,g.stash=Sa,g.status=Ba,g.statusMatrix=Ra,g.tag=Pa,g.updateIndex=ja,g.version=Oa,g.walk=Ia,g.writeBlob=Ca,g.writeCommit=za,g.writeObject=Da,g.writeRef=Ta,g.writeTag=Ua,g.writeTree=Na,g}var _t=bt(),vt=n({__proto__:null,default:t.getDefaultExportFromCjs(_t)},[_t]);exports.index=vt;